aboutsummaryrefslogtreecommitdiff
path: root/lib
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
commit8d13d221cf7c1657404c611efaadf3ac19d899b3 (patch)
treee689678a618ca5be5bd1d5d0399c5145e89b7c56 /lib
parentc00cb6409307846a9bbcd86d307a1a91aab659d0 (diff)
Fix a goof in my previous patch -- not all of the builtins return a value, some
fixed return types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108657 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaChecking.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index bedea18203..f1e501651e 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/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);
}