Revert "Annotate fwd decls with the header containing the decl, not the top-most include."
This reverts commit 125a93e0e3562dac5d5a0429ce49a2b625025c26. It fails in the following case (roottest/root/io/evolution/pragma_read): dictionary for a/b.h which includes a/c.h as #include "c.h" This will add a fwd decl with annotation "c.h", but this header cannot be found. Instead we'd need "a/c.h"...
This commit is contained in:
parent
cfd091955e
commit
714df9c374
@ -170,14 +170,20 @@ namespace cling {
|
||||
}
|
||||
|
||||
SourceLocation spellingLoc = m_SMgr.getSpellingLoc(D->getLocStart());
|
||||
// Get the include location.
|
||||
// Walk up the include chain.
|
||||
PresumedLoc PLoc = m_SMgr.getPresumedLoc(spellingLoc);
|
||||
SourceLocation InclLoc = PLoc.getIncludeLoc();
|
||||
llvm::SmallVector<PresumedLoc, 16> PLocs;
|
||||
while (true) {
|
||||
if (!m_SMgr.getPresumedLoc(PLoc.getIncludeLoc()).isValid())
|
||||
break;
|
||||
PLocs.push_back(PLoc);
|
||||
PLoc = m_SMgr.getPresumedLoc(PLoc.getIncludeLoc());
|
||||
}
|
||||
|
||||
if (!m_SMgr.getPresumedLoc(InclLoc).isValid() /* declared in dictionary payload*/)
|
||||
if (PLocs.empty() /* declared in dictionary payload*/)
|
||||
return;
|
||||
|
||||
clang::SourceLocation includeLoc = m_SMgr.getSpellingLoc(InclLoc);
|
||||
clang::SourceLocation includeLoc = m_SMgr.getSpellingLoc(PLocs[PLocs.size() - 1].getIncludeLoc());
|
||||
bool invalid = true;
|
||||
const char* includeText = m_SMgr.getCharacterData(includeLoc, &invalid);
|
||||
assert(!invalid && "Invalid source data");
|
||||
|
Loading…
x
Reference in New Issue
Block a user