summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2010-07-18 20:54:12 +0000
committerChandler Carruth <chandlerc@gmail.com>2010-07-18 20:54:12 +0000
commit3973af797abcd03222027baf26aac2927df154ea (patch)
treeb31c684e62be59b6602a1245fc9598919735eeca /clang/lib/Sema/SemaChecking.cpp
parentf8340deacd3f79b0e3c6bf60fcb8653cf683dd2f (diff)
downloadbcm5719-llvm-3973af797abcd03222027baf26aac2927df154ea.tar.gz
bcm5719-llvm-3973af797abcd03222027baf26aac2927df154ea.zip
Fix a goof in my previous patch -- not all of the builtins return a value, some
fixed return types. llvm-svn: 108657
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index bedea182036..f1e501651e2 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -419,6 +419,10 @@ Sema::SemaBuiltinAtomicOverloaded(OwningExprResult TheCallResult) {
return ExprError();
}
+ // The majority of builtins return a value, but a few have special return
+ // types, so allow them to override appropriately below.
+ QualType ResultType = ValType;
+
// We need to figure out which concrete builtin this maps onto. For example,
// __sync_fetch_and_add with a 2 byte object turns into
// __sync_fetch_and_add_2.
@@ -487,11 +491,13 @@ Sema::SemaBuiltinAtomicOverloaded(OwningExprResult TheCallResult) {
case Builtin::BI__sync_bool_compare_and_swap:
BuiltinIndex = 11;
NumFixed = 2;
+ ResultType = Context.BoolTy;
break;
case Builtin::BI__sync_lock_test_and_set: BuiltinIndex = 12; break;
case Builtin::BI__sync_lock_release:
BuiltinIndex = 13;
NumFixed = 0;
+ ResultType = Context.VoidTy;
break;
}
@@ -558,7 +564,7 @@ Sema::SemaBuiltinAtomicOverloaded(OwningExprResult TheCallResult) {
// Change the result type of the call to match the original value type. This
// is arbitrary, but the codegen for these builtins ins design to handle it
// gracefully.
- TheCall->setType(ValType);
+ TheCall->setType(ResultType);
return move(TheCallResult);
}
OpenPOWER on IntegriCloud