[cfe-commits] r152165 - /cfe/trunk/lib/AST/Decl.cpp
Daniel Dunbar
daniel at zuster.org
Tue Mar 6 15:52:38 PST 2012
Author: ddunbar
Date: Tue Mar 6 17:52:37 2012
New Revision: 152165
URL: http://llvm.org/viewvc/llvm-project?rev=152165&view=rev
Log:
[AST] FunctionDecl::getBuiltinID() - Eliminate spurious calls to getASTContext
-- which is very much not free -- in the common case.
Modified:
cfe/trunk/lib/AST/Decl.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=152165&r1=152164&r2=152165&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Tue Mar 6 17:52:37 2012
@@ -1796,11 +1796,14 @@
/// 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;
More information about the cfe-commits
mailing list