summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2014-11-14 23:55:27 +0000
committerFariborz Jahanian <fjahanian@apple.com>2014-11-14 23:55:27 +0000
commit68e79383619e354988deac99d7c6ac6a75e92b33 (patch)
tree4009033a511ad0160c23a5a2d4df8ec5afea0ab9 /clang/lib/CodeGen/CGExpr.cpp
parentc81307af0f07121f9e9f142078c04aeaae8c5eee (diff)
downloadbcm5719-llvm-68e79383619e354988deac99d7c6ac6a75e92b33.tar.gz
bcm5719-llvm-68e79383619e354988deac99d7c6ac6a75e92b33.zip
This patch fixes couple of bugs for predefined expression
used inside blocks. It fixes a crash in naming code for __func__ etc. when used in a block declared globally. It also brings back old naming convention for predefined expression which was broken. rdar://18961148 llvm-svn: 222065
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 0b8caa1e11a..1a3a61a76dd 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -2081,7 +2081,10 @@ LValue CodeGenFunction::EmitPredefinedLValue(const PredefinedExpr *E) {
StringRef NameItems[] = {
PredefinedExpr::getIdentTypeName(E->getIdentType()), FnName};
std::string GVName = llvm::join(NameItems, NameItems + 2, ".");
-
+ if (CurCodeDecl && isa<BlockDecl>(CurCodeDecl)) {
+ auto C = CGM.GetAddrOfConstantCString(FnName, GVName.c_str(), 1);
+ return MakeAddrLValue(C, E->getType());
+ }
auto C = CGM.GetAddrOfConstantStringFromLiteral(SL, GVName);
return MakeAddrLValue(C, E->getType());
}
OpenPOWER on IntegriCloud