diff options
| author | Anders Carlsson <andersca@mac.com> | 2008-01-31 02:13:57 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2008-01-31 02:13:57 +0000 |
| commit | fbcf676a65ea13d4c7c24e4942b583658d5fbc2b (patch) | |
| tree | 211c22bc58a62f9d8ed8e064d6d552445fcfbb81 /clang | |
| parent | f6e3b3296464a40a7d7eef09a922451c94f1d325 (diff) | |
| download | bcm5719-llvm-fbcf676a65ea13d4c7c24e4942b583658d5fbc2b.tar.gz bcm5719-llvm-fbcf676a65ea13d4c7c24e4942b583658d5fbc2b.zip | |
Make CallExpr::isBuiltinConstantExpr slightly more efficient.
llvm-svn: 46594
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/AST/Expr.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/AST/Expr.cpp b/clang/AST/Expr.cpp index 88c1b236e8e..f02e817f065 100644 --- a/clang/AST/Expr.cpp +++ b/clang/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; } |

