Add protection in case no file is associated to the decl

This commit is contained in:
Danilo Piparo 2014-12-17 18:27:24 +01:00 committed by sftnight
parent 76d6fff7c9
commit 4dd0bb94ea

View File

@ -150,6 +150,7 @@ namespace cling {
}
void ForwardDeclPrinter::prettyPrintAttributes(Decl *D, std::string extra) {
if (D->getSourceRange().isInvalid())
return;
@ -178,6 +179,9 @@ namespace cling {
PLoc = m_SMgr.getPresumedLoc(PLoc.getIncludeLoc());
}
if (PLocs.empty() /* declared in dictionary payload*/)
return;
clang::SourceLocation includeLoc = m_SMgr.getSpellingLoc(PLocs[PLocs.size() - 1].getIncludeLoc());
bool invalid = true;
const char* includeText = m_SMgr.getCharacterData(includeLoc, &invalid);