From 3c0e698671afd03f30e7a0d93eea80da2b912bf0 Mon Sep 17 00:00:00 2001 From: Rohan Jacob-Rao Date: Wed, 5 Aug 2015 18:18:13 -0700 Subject: [PATCH] Moved LLVM examples and added licence headers. --- infer/src/llvm/examples/alloca.ll | 5 ----- infer/src/llvm/examples/empty_func.ll | 4 ---- infer/src/llvm/examples/load_func.ll | 5 ----- infer/src/llvm/examples/null_deref.c | 4 ---- infer/src/llvm/examples/ret_var.ll | 4 ---- infer/src/llvm/examples/simple_func.ll | 4 ---- infer/src/llvm/examples/store.ll | 5 ----- infer/tests/codetoanalyze/llvm/alloca.ll | 12 ++++++++++++ infer/tests/codetoanalyze/llvm/load.ll | 12 ++++++++++++ infer/tests/codetoanalyze/llvm/null_deref.c | 13 +++++++++++++ .../codetoanalyze/llvm}/null_deref.ll | 7 +++++++ infer/tests/codetoanalyze/llvm/ret_0.ll | 11 +++++++++++ infer/tests/codetoanalyze/llvm/ret_var.ll | 11 +++++++++++ infer/tests/codetoanalyze/llvm/ret_void.ll | 11 +++++++++++ infer/tests/codetoanalyze/llvm/store.ll | 12 ++++++++++++ 15 files changed, 89 insertions(+), 31 deletions(-) delete mode 100644 infer/src/llvm/examples/alloca.ll delete mode 100644 infer/src/llvm/examples/empty_func.ll delete mode 100644 infer/src/llvm/examples/load_func.ll delete mode 100644 infer/src/llvm/examples/null_deref.c delete mode 100644 infer/src/llvm/examples/ret_var.ll delete mode 100644 infer/src/llvm/examples/simple_func.ll delete mode 100644 infer/src/llvm/examples/store.ll create mode 100644 infer/tests/codetoanalyze/llvm/alloca.ll create mode 100644 infer/tests/codetoanalyze/llvm/load.ll create mode 100644 infer/tests/codetoanalyze/llvm/null_deref.c rename infer/{src/llvm/examples => tests/codetoanalyze/llvm}/null_deref.ll (70%) create mode 100644 infer/tests/codetoanalyze/llvm/ret_0.ll create mode 100644 infer/tests/codetoanalyze/llvm/ret_var.ll create mode 100644 infer/tests/codetoanalyze/llvm/ret_void.ll create mode 100644 infer/tests/codetoanalyze/llvm/store.ll diff --git a/infer/src/llvm/examples/alloca.ll b/infer/src/llvm/examples/alloca.ll deleted file mode 100644 index a80b6f547..000000000 --- a/infer/src/llvm/examples/alloca.ll +++ /dev/null @@ -1,5 +0,0 @@ -; Allocate stack variable using alloca instruction -define i32 @main() { - %a = alloca i32 - ret i32 0 -} diff --git a/infer/src/llvm/examples/empty_func.ll b/infer/src/llvm/examples/empty_func.ll deleted file mode 100644 index 41107c9c3..000000000 --- a/infer/src/llvm/examples/empty_func.ll +++ /dev/null @@ -1,4 +0,0 @@ -; Definition of main function -define void @main() { - ret void -} diff --git a/infer/src/llvm/examples/load_func.ll b/infer/src/llvm/examples/load_func.ll deleted file mode 100644 index bc69f89eb..000000000 --- a/infer/src/llvm/examples/load_func.ll +++ /dev/null @@ -1,5 +0,0 @@ -; Definition of main function -define i32 @main() { - %a = load i32* %b - ret i32 0 -} diff --git a/infer/src/llvm/examples/null_deref.c b/infer/src/llvm/examples/null_deref.c deleted file mode 100644 index 01201b7b1..000000000 --- a/infer/src/llvm/examples/null_deref.c +++ /dev/null @@ -1,4 +0,0 @@ -void foo(void) { - int *p = 0; - *p = 42; -} diff --git a/infer/src/llvm/examples/ret_var.ll b/infer/src/llvm/examples/ret_var.ll deleted file mode 100644 index aca24c0c8..000000000 --- a/infer/src/llvm/examples/ret_var.ll +++ /dev/null @@ -1,4 +0,0 @@ -; Definition of main function -define i32 @main() { - ret i32 %0 -} diff --git a/infer/src/llvm/examples/simple_func.ll b/infer/src/llvm/examples/simple_func.ll deleted file mode 100644 index 39aeede51..000000000 --- a/infer/src/llvm/examples/simple_func.ll +++ /dev/null @@ -1,4 +0,0 @@ -; Definition of main function -define i32 @main() { - ret i32 0 -} diff --git a/infer/src/llvm/examples/store.ll b/infer/src/llvm/examples/store.ll deleted file mode 100644 index 84f52b1c1..000000000 --- a/infer/src/llvm/examples/store.ll +++ /dev/null @@ -1,5 +0,0 @@ -; Function with store instruction -define i32 @main() { - store i32 0, i32* %i - ret i32 0 -} diff --git a/infer/tests/codetoanalyze/llvm/alloca.ll b/infer/tests/codetoanalyze/llvm/alloca.ll new file mode 100644 index 000000000..15e04d7a8 --- /dev/null +++ b/infer/tests/codetoanalyze/llvm/alloca.ll @@ -0,0 +1,12 @@ +; Copyright (c) 2015 - present Facebook, Inc. +; All rights reserved. +; +; This source code is licensed under the BSD style license found in the +; LICENSE file in the root directory of this source tree. An additional grant +; of patent rights can be found in the PATENTS file in the same directory. + +; Allocate stack variable using alloca instruction +define i32 @main() { + %a = alloca i32 + ret i32 0 +} diff --git a/infer/tests/codetoanalyze/llvm/load.ll b/infer/tests/codetoanalyze/llvm/load.ll new file mode 100644 index 000000000..65e6ed90d --- /dev/null +++ b/infer/tests/codetoanalyze/llvm/load.ll @@ -0,0 +1,12 @@ +; Copyright (c) 2015 - present Facebook, Inc. +; All rights reserved. +; +; This source code is licensed under the BSD style license found in the +; LICENSE file in the root directory of this source tree. An additional grant +; of patent rights can be found in the PATENTS file in the same directory. + +; Definition of main function +define i32 @main() { + %a = load i32* %b + ret i32 0 +} diff --git a/infer/tests/codetoanalyze/llvm/null_deref.c b/infer/tests/codetoanalyze/llvm/null_deref.c new file mode 100644 index 000000000..087a103da --- /dev/null +++ b/infer/tests/codetoanalyze/llvm/null_deref.c @@ -0,0 +1,13 @@ +/* +* Copyright (c) 2015 - present Facebook, Inc. +* All rights reserved. +* +* This source code is licensed under the BSD style license found in the +* LICENSE file in the root directory of this source tree. An additional grant +* of patent rights can be found in the PATENTS file in the same directory. +*/ + +void foo(void) { + int *p = 0; + *p = 42; +} diff --git a/infer/src/llvm/examples/null_deref.ll b/infer/tests/codetoanalyze/llvm/null_deref.ll similarity index 70% rename from infer/src/llvm/examples/null_deref.ll rename to infer/tests/codetoanalyze/llvm/null_deref.ll index 52d06ee34..d410e7a09 100644 --- a/infer/src/llvm/examples/null_deref.ll +++ b/infer/tests/codetoanalyze/llvm/null_deref.ll @@ -1,3 +1,10 @@ +; Copyright (c) 2015 - present Facebook, Inc. +; All rights reserved. +; +; This source code is licensed under the BSD style license found in the +; LICENSE file in the root directory of this source tree. An additional grant +; of patent rights can be found in the PATENTS file in the same directory. + ; ModuleID = 'null_deref.c' target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.10.0" diff --git a/infer/tests/codetoanalyze/llvm/ret_0.ll b/infer/tests/codetoanalyze/llvm/ret_0.ll new file mode 100644 index 000000000..ca145708f --- /dev/null +++ b/infer/tests/codetoanalyze/llvm/ret_0.ll @@ -0,0 +1,11 @@ +; Copyright (c) 2015 - present Facebook, Inc. +; All rights reserved. +; +; This source code is licensed under the BSD style license found in the +; LICENSE file in the root directory of this source tree. An additional grant +; of patent rights can be found in the PATENTS file in the same directory. + +; Definition of main function +define i32 @main() { + ret i32 0 +} diff --git a/infer/tests/codetoanalyze/llvm/ret_var.ll b/infer/tests/codetoanalyze/llvm/ret_var.ll new file mode 100644 index 000000000..105275213 --- /dev/null +++ b/infer/tests/codetoanalyze/llvm/ret_var.ll @@ -0,0 +1,11 @@ +; Copyright (c) 2015 - present Facebook, Inc. +; All rights reserved. +; +; This source code is licensed under the BSD style license found in the +; LICENSE file in the root directory of this source tree. An additional grant +; of patent rights can be found in the PATENTS file in the same directory. + +; Definition of main function +define i32 @main() { + ret i32 %0 +} diff --git a/infer/tests/codetoanalyze/llvm/ret_void.ll b/infer/tests/codetoanalyze/llvm/ret_void.ll new file mode 100644 index 000000000..f4031f7a2 --- /dev/null +++ b/infer/tests/codetoanalyze/llvm/ret_void.ll @@ -0,0 +1,11 @@ +; Copyright (c) 2015 - present Facebook, Inc. +; All rights reserved. +; +; This source code is licensed under the BSD style license found in the +; LICENSE file in the root directory of this source tree. An additional grant +; of patent rights can be found in the PATENTS file in the same directory. + +; Definition of main function +define void @main() { + ret void +} diff --git a/infer/tests/codetoanalyze/llvm/store.ll b/infer/tests/codetoanalyze/llvm/store.ll new file mode 100644 index 000000000..dcd70c60a --- /dev/null +++ b/infer/tests/codetoanalyze/llvm/store.ll @@ -0,0 +1,12 @@ +; Copyright (c) 2015 - present Facebook, Inc. +; All rights reserved. +; +; This source code is licensed under the BSD style license found in the +; LICENSE file in the root directory of this source tree. An additional grant +; of patent rights can be found in the PATENTS file in the same directory. + +; Function with store instruction +define i32 @main() { + store i32 0, i32* %i + ret i32 0 +}