[cfe-commits] r60922 - /cfe/trunk/lib/CodeGen/CGExprConstant.cpp

Chris Lattner sabre at nondot.org
Thu Dec 11 21:18:03 PST 2008


Author: lattner
Date: Thu Dec 11 23:18:02 2008
New Revision: 60922

URL: http://llvm.org/viewvc/llvm-project?rev=60922&view=rev
Log:
add codegen support for __func__ and friends, producing the same
output that GCC does.  rdar://6440297

Modified:
    cfe/trunk/lib/CodeGen/CGExprConstant.cpp

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Thu Dec 11 23:18:02 2008
@@ -612,6 +612,16 @@
       }
       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()));





More information about the cfe-commits mailing list