diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-09-09 16:51:10 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-09-09 16:51:10 +0000 |
commit | 6b3bcf29f54cee7f91fe9f6d9ebbcb8f0b68ea0b (patch) | |
tree | 2bc015866b14773e21bec53262165a6f5119f732 /clang/lib/Sema/SemaChecking.cpp | |
parent | e6c42ad243b4bdde2c58c5a523fdaa245e371161 (diff) | |
download | bcm5719-llvm-6b3bcf29f54cee7f91fe9f6d9ebbcb8f0b68ea0b.tar.gz bcm5719-llvm-6b3bcf29f54cee7f91fe9f6d9ebbcb8f0b68ea0b.zip |
When type-checking a call to an overloaded, builtin atomic operation,
construct a new DeclRefExpr rather than re-using the existing
DeclRefExpr. Patch by Likai Liu, fixes PR8345.
llvm-svn: 139373
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index b1a87a83dce..68e25e7f4e5 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -614,13 +614,20 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) { TheCall->setArg(i+1, Arg.get()); } - // Switch the DeclRefExpr to refer to the new decl. - DRE->setDecl(NewBuiltinDecl); - DRE->setType(NewBuiltinDecl->getType()); + ASTContext& Context = this->getASTContext(); + + // Create a new DeclRefExpr to refer to the new decl. + DeclRefExpr* NewDRE = DeclRefExpr::Create( + Context, + DRE->getQualifierLoc(), + NewBuiltinDecl, + DRE->getLocation(), + NewBuiltinDecl->getType(), + DRE->getValueKind()); // Set the callee in the CallExpr. // FIXME: This leaks the original parens and implicit casts. - ExprResult PromotedCall = UsualUnaryConversions(DRE); + ExprResult PromotedCall = UsualUnaryConversions(NewDRE); if (PromotedCall.isInvalid()) return ExprError(); TheCall->setCallee(PromotedCall.take()); |