forked from OSchip/llvm-project
[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:
parent
a73b7df7de
commit
304314d739
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue