[AST] FunctionDecl::getBuiltinID() - Eliminate spurious calls to getASTContext

-- which is very much not free -- in the common case.

llvm-svn: 152165
This commit is contained in:
Daniel Dunbar 2012-03-06 23:52:37 +00:00
parent a73b7df7de
commit 304314d739
1 changed files with 5 additions and 2 deletions

View File

@ -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;