[cfe-commits] r81653 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp test/CodeGen/predefined-expr.c test/CodeGenCXX/predefined-expr.cpp

Daniel Dunbar daniel at zuster.org
Sat Sep 12 16:06:21 PDT 2009


Author: ddunbar
Date: Sat Sep 12 18:06:21 2009
New Revision: 81653

URL: http://llvm.org/viewvc/llvm-project?rev=81653&view=rev
Log:
Don't use the PredefinedExpr string as the global variable name, these don't
make very nice symbols, just use the function name.

Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/test/CodeGen/predefined-expr.c
    cfe/trunk/test/CodeGenCXX/predefined-expr.cpp

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=81653&r1=81652&r2=81653&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Sat Sep 12 18:06:21 2009
@@ -841,11 +841,15 @@
     break;
   }
 
+  llvm::StringRef FnName = CurFn->getName();
+  if (FnName.startswith("\01"))
+    FnName = FnName.substr(1);
+  GlobalVarName += FnName;
+
   std::string FunctionName =
     PredefinedExpr::ComputeName(getContext(), (PredefinedExpr::IdentType)Type,
                                 CurCodeDecl);
 
-  GlobalVarName += FunctionName;
   llvm::Constant *C =
     CGM.GetAddrOfConstantCString(FunctionName, GlobalVarName.c_str());
   return LValue::MakeAddr(C, 0);

Modified: cfe/trunk/test/CodeGen/predefined-expr.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/predefined-expr.c?rev=81653&r1=81652&r2=81653&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/predefined-expr.c (original)
+++ cfe/trunk/test/CodeGen/predefined-expr.c Sat Sep 12 18:06:21 2009
@@ -1,13 +1,13 @@
 // RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
 
 // CHECK: @__func__.plainFunction = private constant [14 x i8] c"plainFunction\00"
-// CHECK: @"__PRETTY_FUNCTION__.void plainFunction()" = private constant [21 x i8] c"void plainFunction()\00"
+// CHECK: @__PRETTY_FUNCTION__.plainFunction = private constant [21 x i8] c"void plainFunction()\00"
 // CHECK: @__func__.externFunction = private constant [15 x i8] c"externFunction\00"
-// CHECK: @"__PRETTY_FUNCTION__.void externFunction()" = private constant [22 x i8] c"void externFunction()\00"
+// CHECK: @__PRETTY_FUNCTION__.externFunction = private constant [22 x i8] c"void externFunction()\00"
 // CHECK: @__func__.privateExternFunction = private constant [22 x i8] c"privateExternFunction\00"
-// CHECK: @"__PRETTY_FUNCTION__.void privateExternFunction()" = private constant [29 x i8] c"void privateExternFunction()\00"
+// CHECK: @__PRETTY_FUNCTION__.privateExternFunction = private constant [29 x i8] c"void privateExternFunction()\00"
 // CHECK: @__func__.staticFunction = private constant [15 x i8] c"staticFunction\00"
-// CHECK: @"__PRETTY_FUNCTION__.void staticFunction()" = private constant [22 x i8] c"void staticFunction()\00"
+// CHECK: @__PRETTY_FUNCTION__.staticFunction = private constant [22 x i8] c"void staticFunction()\00"
 
 #include <stdio.h>
 

Modified: cfe/trunk/test/CodeGenCXX/predefined-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/predefined-expr.cpp?rev=81653&r1=81652&r2=81653&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/predefined-expr.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/predefined-expr.cpp Sat Sep 12 18:06:21 2009
@@ -1,55 +1,55 @@
 // RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
 
-// CHECK: @__func__.externFunction = private constant [15 x i8] c"externFunction\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::externFunction()" = private constant [26 x i8] c"void NS::externFunction()\00"
+// CHECK: private constant [15 x i8] c"externFunction\00"
+// CHECK: private constant [26 x i8] c"void NS::externFunction()\00"
 
-// CHECK: @__func__.classTemplateFunction = private constant [22 x i8] c"classTemplateFunction\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::ClassTemplate<NS::Base *>::classTemplateFunction()" = private constant [60 x i8] c"void NS::ClassTemplate<NS::Base *>::classTemplateFunction()\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::ClassTemplate<int>::classTemplateFunction()" = private constant [53 x i8] c"void NS::ClassTemplate<int>::classTemplateFunction()\00"
+// CHECK: private constant [22 x i8] c"classTemplateFunction\00"
+// CHECK: private constant [60 x i8] c"void NS::ClassTemplate<NS::Base *>::classTemplateFunction()\00"
+// CHECK: private constant [53 x i8] c"void NS::ClassTemplate<int>::classTemplateFunction()\00"
 
-// CHECK: @__func__.functionTemplate1 = private constant [18 x i8] c"functionTemplate1\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::Base::functionTemplate1(NS::Base *)" = private constant [45 x i8] c"void NS::Base::functionTemplate1(NS::Base *)\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::Base::functionTemplate1(int)" = private constant [38 x i8] c"void NS::Base::functionTemplate1(int)\00"
+// CHECK: private constant [18 x i8] c"functionTemplate1\00"
+// CHECK: private constant [45 x i8] c"void NS::Base::functionTemplate1(NS::Base *)\00"
+// CHECK: private constant [38 x i8] c"void NS::Base::functionTemplate1(int)\00"
 
-// CHECK: @"__func__.~Destructor" = private constant [12 x i8] c"~Destructor\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::Destructor::~Destructor()" = private constant [35 x i8] c"void NS::Destructor::~Destructor()\00"
+// CHECK: private constant [12 x i8] c"~Destructor\00"
+// CHECK: private constant [35 x i8] c"void NS::Destructor::~Destructor()\00"
 
-// CHECK: @__func__.Constructor = private constant [12 x i8] c"Constructor\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::Constructor::Constructor(NS::Base *)" = private constant [46 x i8] c"void NS::Constructor::Constructor(NS::Base *)\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::Constructor::Constructor(int)" = private constant [39 x i8] c"void NS::Constructor::Constructor(int)\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::Constructor::Constructor()" = private constant [36 x i8] c"void NS::Constructor::Constructor()\00"
+// CHECK: private constant [12 x i8] c"Constructor\00"
+// CHECK: private constant [46 x i8] c"void NS::Constructor::Constructor(NS::Base *)\00"
+// CHECK: private constant [39 x i8] c"void NS::Constructor::Constructor(int)\00"
+// CHECK: private constant [36 x i8] c"void NS::Constructor::Constructor()\00"
 
-// CHECK: @__func__.virtualFunction = private constant [16 x i8] c"virtualFunction\00"
-// CHECK: @"__PRETTY_FUNCTION__.virtual void NS::Derived::virtualFunction()" = private constant [44 x i8] c"virtual void NS::Derived::virtualFunction()\00"
+// CHECK: private constant [16 x i8] c"virtualFunction\00"
+// CHECK: private constant [44 x i8] c"virtual void NS::Derived::virtualFunction()\00"
 
-// CHECK: @__func__.functionReturingTemplate2 = private constant [26 x i8] c"functionReturingTemplate2\00"
-// CHECK: @"__PRETTY_FUNCTION__.ClassTemplate<NS::Base *> NS::Base::functionReturingTemplate2()" = private constant [64 x i8] c"ClassTemplate<NS::Base *> NS::Base::functionReturingTemplate2()\00"
+// CHECK: private constant [26 x i8] c"functionReturingTemplate2\00"
+// CHECK: private constant [64 x i8] c"ClassTemplate<NS::Base *> NS::Base::functionReturingTemplate2()\00"
 
-// CHECK: @__func__.functionReturingTemplate1 = private constant [26 x i8] c"functionReturingTemplate1\00"
-// CHECK: @"__PRETTY_FUNCTION__.ClassTemplate<int> NS::Base::functionReturingTemplate1()" = private constant [57 x i8] c"ClassTemplate<int> NS::Base::functionReturingTemplate1()\00"
+// CHECK: private constant [26 x i8] c"functionReturingTemplate1\00"
+// CHECK: private constant [57 x i8] c"ClassTemplate<int> NS::Base::functionReturingTemplate1()\00"
 
-// CHECK: @__func__.withTemplateParameter2 = private constant [23 x i8] c"withTemplateParameter2\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::Base::withTemplateParameter2(ClassTemplate<NS::Base *>)" = private constant [65 x i8] c"void NS::Base::withTemplateParameter2(ClassTemplate<NS::Base *>)\00"
+// CHECK: private constant [23 x i8] c"withTemplateParameter2\00"
+// CHECK: private constant [65 x i8] c"void NS::Base::withTemplateParameter2(ClassTemplate<NS::Base *>)\00"
 
-// CHECK: @__func__.withTemplateParameter1 = private constant [23 x i8] c"withTemplateParameter1\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::Base::withTemplateParameter1(ClassTemplate<int>)" = private constant [58 x i8] c"void NS::Base::withTemplateParameter1(ClassTemplate<int>)\00"
+// CHECK: private constant [23 x i8] c"withTemplateParameter1\00"
+// CHECK: private constant [58 x i8] c"void NS::Base::withTemplateParameter1(ClassTemplate<int>)\00"
 
-// CHECK: @__func__.functionReturningClass = private constant [23 x i8] c"functionReturningClass\00"
-// CHECK: @"__PRETTY_FUNCTION__.NS::Base *NS::Base::functionReturningClass()" = private constant [45 x i8] c"NS::Base *NS::Base::functionReturningClass()\00"
+// CHECK: private constant [23 x i8] c"functionReturningClass\00"
+// CHECK: private constant [45 x i8] c"NS::Base *NS::Base::functionReturningClass()\00"
 
-// CHECK: @__func__.functionWithParameters = private constant [23 x i8] c"functionWithParameters\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::Base::functionWithParameters(int, float *, NS::Base *)" = private constant [64 x i8] c"void NS::Base::functionWithParameters(int, float *, NS::Base *)\00"
+// CHECK: private constant [23 x i8] c"functionWithParameters\00"
+// CHECK: private constant [64 x i8] c"void NS::Base::functionWithParameters(int, float *, NS::Base *)\00"
 
-// CHECK: @__func__.variadicFunction = private constant [17 x i8] c"variadicFunction\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::Base::variadicFunction(int, ...)" = private constant [42 x i8] c"void NS::Base::variadicFunction(int, ...)\00"
+// CHECK: private constant [17 x i8] c"variadicFunction\00"
+// CHECK: private constant [42 x i8] c"void NS::Base::variadicFunction(int, ...)\00"
 
-// CHECK: @"__PRETTY_FUNCTION__.virtual void NS::Base::virtualFunction()" = private constant [41 x i8] c"virtual void NS::Base::virtualFunction()\00"
+// CHECK: private constant [41 x i8] c"virtual void NS::Base::virtualFunction()\00"
 
-// CHECK: @__func__.inlineFunction = private constant [15 x i8] c"inlineFunction\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::Base::inlineFunction()" = private constant [32 x i8] c"void NS::Base::inlineFunction()\00"
+// CHECK: private constant [15 x i8] c"inlineFunction\00"
+// CHECK: private constant [32 x i8] c"void NS::Base::inlineFunction()\00"
 
-// CHECK: @__func__.staticFunc = private constant [11 x i8] c"staticFunc\00"
-// CHECK: @"__PRETTY_FUNCTION__.void NS::Base::staticFunc()" = private constant [28 x i8] c"void NS::Base::staticFunc()\00"
+// CHECK: private constant [11 x i8] c"staticFunc\00"
+// CHECK: private constant [28 x i8] c"void NS::Base::staticFunc()\00"
 
 #include <stdio.h>
 





More information about the cfe-commits mailing list