aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2008-01-31 02:13:57 +0000
committerAnders Carlsson <andersca@mac.com>2008-01-31 02:13:57 +0000
commitbcba201a1118d7852b8b97187d495ae2a4f49519 (patch)
treea94d212e4015bfc2e26c026e8f129152ffd2e472
parentc4f8e8b645b8e0e685c089dde0674c6f29a24168 (diff)
Make CallExpr::isBuiltinConstantExpr slightly more efficient.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46594 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--AST/Expr.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/AST/Expr.cpp b/AST/Expr.cpp
index 88c1b236e8..f02e817f06 100644
--- a/AST/Expr.cpp
+++ b/AST/Expr.cpp
@@ -130,9 +130,16 @@ bool CallExpr::isBuiltinConstantExpr() const {
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;
}