From: Anders Carlsson Date: Thu, 31 Jan 2008 02:13:57 +0000 (+0000) Subject: Make CallExpr::isBuiltinConstantExpr slightly more efficient. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bcba201a1118d7852b8b97187d495ae2a4f49519;p=clang Make CallExpr::isBuiltinConstantExpr slightly more efficient. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46594 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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(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; }