diff options
author | Daniel Dunbar <daniel@zuster.org> | 2012-03-06 23:52:37 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2012-03-06 23:52:37 +0000 |
commit | 60d302a707fb35b9acf41bf5495296c4af947045 (patch) | |
tree | 1510023bcf4d40391b4fbabdd2b01013d6305beb /lib/AST/Decl.cpp | |
parent | 8e282c332f8ad51dedf86a185a4dcb78ef93fb51 (diff) |
[AST] FunctionDecl::getBuiltinID() - Eliminate spurious calls to getASTContext
-- which is very much not free -- in the common case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152165 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 03b2794c0e..1942e1e852 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -1796,11 +1796,14 @@ void FunctionDecl::setStorageClass(StorageClass SC) { /// value of type \c Builtin::ID if in the target-independent range /// \c [1,Builtin::First), or a target-specific builtin value. unsigned FunctionDecl::getBuiltinID() const { - ASTContext &Context = getASTContext(); - if (!getIdentifier() || !getIdentifier()->getBuiltinID()) + if (!getIdentifier()) return 0; unsigned BuiltinID = getIdentifier()->getBuiltinID(); + if (!BuiltinID) + return 0; + + ASTContext &Context = getASTContext(); if (!Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID)) return BuiltinID; |