summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2016-12-01 23:41:27 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2016-12-01 23:41:27 +0000
commit5dda1128f17b6a79740d9f549bac4a3db5d45ac2 (patch)
tree289f9603e568037a430aa86065d790bef394d4aa /clang/test
parent734c59d501315192e12d9b6450139f5b02c2f8cb (diff)
downloadbcm5719-llvm-5dda1128f17b6a79740d9f549bac4a3db5d45ac2.tar.gz
bcm5719-llvm-5dda1128f17b6a79740d9f549bac4a3db5d45ac2.zip
[libclang] Add APIs to check the result of an integer expression in CXEvalResult without overflow
Patch by Emilio Cobos Álvarez! See https://reviews.llvm.org/D26788 llvm-svn: 288438
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Index/evaluate-cursor.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/Index/evaluate-cursor.cpp b/clang/test/Index/evaluate-cursor.cpp
index 28a9c368795..39fc9db98a3 100644
--- a/clang/test/Index/evaluate-cursor.cpp
+++ b/clang/test/Index/evaluate-cursor.cpp
@@ -15,6 +15,12 @@ void goo() {
int a = __LINE__;
}
+unsigned long long foo_int = 1ull << 60;
+
+unsigned long long HUGE = 1ull << 63;
+
+long long HUGE_NEG = -(1ll << 35);
+
// RUN: c-index-test -evaluate-cursor-at=%s:4:7 \
// RUN: -evaluate-cursor-at=%s:8:7 \
// RUN: -evaluate-cursor-at=%s:8:11 -std=c++11 %s | FileCheck %s
@@ -28,3 +34,11 @@ void goo() {
// CHECK-MACRO: [function macro]
// CHECK-MACRO: [function macro]
// CHECK-MACRO: [builtin macro]
+
+// RUN: c-index-test -evaluate-cursor-at=%s:18:20 \
+// RUN: -evaluate-cursor-at=%s:20:20 \
+// RUN: -evaluate-cursor-at=%s:22:11 \
+// RUN: -std=c++11 %s | FileCheck -check-prefix=CHECK-LONG %s
+// CHECK-LONG: unsigned, Value: 1152921504606846976
+// CHECK-LONG: unsigned, Value: 9223372036854775808
+// CHECK-LONG: Value: -34359738368
OpenPOWER on IntegriCloud