r256503 - Avoid crash when dumping LocInfoType.
Serge Pavlov via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 28 09:19:12 PST 2015
Author: sepavloff
Date: Mon Dec 28 11:19:12 2015
New Revision: 256503
URL: http://llvm.org/viewvc/llvm-project?rev=256503&view=rev
Log:
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.
Modified:
cfe/trunk/lib/AST/ASTDumper.cpp
Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=256503&r1=256502&r2=256503&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Mon Dec 28 11:19:12 2015
@@ -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 Ty
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);
More information about the cfe-commits
mailing list