aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprConstant.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-12-12 05:18:02 +0000
committerChris Lattner <sabre@nondot.org>2008-12-12 05:18:02 +0000
commit35345640442594acbc29445fbde4874a6e4c860a (patch)
tree9f38f4a8a57e350fb2c20fe330b85aa3beafe17a /lib/CodeGen/CGExprConstant.cpp
parentb0da923653601191c4f60bdc284feae376d28cda (diff)
add codegen support for __func__ and friends, producing the same
output that GCC does. rdar://6440297 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60922 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
-rw-r--r--lib/CodeGen/CGExprConstant.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index 52d99dc60e..2166a5c898 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -612,6 +612,16 @@ public:
}
break;
}
+
+ case Expr::PredefinedExprClass: {
+ // __func__/__FUNCTION__ -> "". __PRETTY_FUNCTION__ -> "top level".
+ std::string Str;
+ if (cast<PredefinedExpr>(E)->getIdentType() ==
+ PredefinedExpr::PrettyFunction)
+ Str = "top level";
+
+ return CGM.GetAddrOfConstantCString(Str, ".tmp");
+ }
}
CGM.ErrorUnsupported(E, "constant l-value expression");
llvm::Type *Ty = llvm::PointerType::getUnqual(ConvertType(E->getType()));