Make ParmVarDecl::getDefaultArg() more robust, it now asserts that the argument is not unparsed. Add a new hasDefaultArg() and use it in places where getDefaultArg() was called when the argument was unparsed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72984 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index 19f8958..94daf48 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -326,7 +326,7 @@
   //   const volatile X&, and either there are no other parameters
   //   or else all other parameters have default arguments (8.3.6).
   if ((getNumParams() < 1) ||
-      (getNumParams() > 1 && getParamDecl(1)->getDefaultArg() == 0))
+      (getNumParams() > 1 && !getParamDecl(1)->hasDefaultArg()))
     return false;
 
   const ParmVarDecl *Param = getParamDecl(0);
@@ -363,7 +363,7 @@
   return (getNumParams() == 0 && 
           getType()->getAsFunctionProtoType()->isVariadic()) ||
          (getNumParams() == 1) ||
-         (getNumParams() > 1 && getParamDecl(1)->getDefaultArg() != 0);
+         (getNumParams() > 1 && getParamDecl(1)->hasDefaultArg());
 }
 
 CXXDestructorDecl *