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 +}