[cfe-commits] r46594 - /cfe/trunk/AST/Expr.cpp
Anders Carlsson
andersca at mac.com
Wed Jan 30 18:13:57 PST 2008
Author: andersca
Date: Wed Jan 30 20:13:57 2008
New Revision: 46594
URL: http://llvm.org/viewvc/llvm-project?rev=46594&view=rev
Log:
Make CallExpr::isBuiltinConstantExpr slightly more efficient.
Modified:
cfe/trunk/AST/Expr.cpp
Modified: cfe/trunk/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Expr.cpp?rev=46594&r1=46593&r2=46594&view=diff
==============================================================================
--- cfe/trunk/AST/Expr.cpp (original)
+++ cfe/trunk/AST/Expr.cpp Wed Jan 30 20:13:57 2008
@@ -130,9 +130,16 @@
if (!DRE)
return false;
- // We have a DeclRefExpr.
- if (strcmp(DRE->getDecl()->getName(),
- "__builtin___CFStringMakeConstantString") == 0)
+ const FunctionDecl *FDecl = dyn_cast<FunctionDecl>(DRE->getDecl());
+ if (!FDecl)
+ return false;
+
+ unsigned builtinID = FDecl->getIdentifier()->getBuiltinID();
+ if (!builtinID)
+ return false;
+
+ // We have a builtin that is a constant expression
+ if (builtinID == Builtin::BI__builtin___CFStringMakeConstantString)
return true;
return false;
}
More information about the cfe-commits
mailing list