Avoid crash when dumping LocInfoType.

LocInfoType is a helper type used internally inside Sema and Parser, it
does not exist in valid AST. LocInfoType uses code value outside the
range of valid Type codes, as a result, dumping such type causes error.
The fix allows correct dumping LocInfoType.

llvm-svn: 256503
This commit is contained in:
Serge Pavlov 2015-12-28 17:19:12 +00:00
parent d0af3b3178
commit a6adc9e790
1 changed files with 10 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include "clang/Basic/Builtins.h"
#include "clang/Basic/Module.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Sema/LocInfoType.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang;
using namespace clang::comments;
@ -655,6 +656,15 @@ void ASTDumper::dumpTypeAsChild(const Type *T) {
OS << "<<<NULL>>>";
return;
}
if (const LocInfoType *LIT = llvm::dyn_cast<LocInfoType>(T)) {
{
ColorScope Color(*this, TypeColor);
OS << "LocInfo Type";
}
dumpPointer(T);
dumpTypeAsChild(LIT->getTypeSourceInfo()->getType());
return;
}
{
ColorScope Color(*this, TypeColor);