[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
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 03b2794..1942e1e 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -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;