summaryrefslogtreecommitdiffstats
path: root/tools/c-index-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
commit21dddd9d6fb6e032413b44629441c2a9dd56239c (patch)
tree0ac050e9f3ceadcfbaa3220e4ad913f88f8ac9d9 /tools/c-index-test
parent5ca7f4286d20192dff833f91865b10be0debd76d (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288438 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/c-index-test')
-rw-r--r--tools/c-index-test/c-index-test.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 2878ba26af..de87351059 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -2462,8 +2462,14 @@ static void display_evaluate_results(CXEvalResult result) {
switch (clang_EvalResult_getKind(result)) {
case CXEval_Int:
{
- int val = clang_EvalResult_getAsInt(result);
- printf("Kind: Int , Value: %d", val);
+ printf("Kind: Int, ");
+ if (clang_EvalResult_isUnsignedInt(result)) {
+ unsigned long long val = clang_EvalResult_getAsUnsigned(result);
+ printf("unsigned, Value: %llu", val);
+ } else {
+ long long val = clang_EvalResult_getAsLongLong(result);
+ printf("Value: %lld", val);
+ }
break;
}
case CXEval_Float: