Fix a crash on invalid code.
authorRichard Trieu <rtrieu@google.com>
Fri, 28 Oct 2016 00:15:24 +0000 (00:15 +0000)
committerRichard Trieu <rtrieu@google.com>
Fri, 28 Oct 2016 00:15:24 +0000 (00:15 +0000)
commit42b98e2a824a234c69b46fe26b87906a5eb198d5
treedce319fff7cc0c2bea9ea6778ab1b78c689e3bbe
parented2977fabe45764608ac82d7239a6e08d575a781
Fix a crash on invalid code.

The diagnostic was attempting to access the QualType of a TypeDecl by calling
TypeDecl::getTypeForDecl.  However, the Type pointer stored there is lazily
loaded by functions in ASTContext.  In most cases, the pointer is loaded and
this does not cause a problem.  However, when more that 50 or so unknown types
are seen beforehand, this causes the Type to not be loaded, passing a null
Type to the diagnostics, leading to the crash.  Using
ASTContext::getTypeDeclType will give a proper QualType for all cases.

llvm-svn: 285370
clang/lib/Sema/SemaCXXScopeSpec.cpp
clang/test/SemaCXX/nested-name-spec.cpp