Each annotation came from a single top most file. Walk up the loc chain.
STL contains a lot of forwarding headers. For example map forwards to bits/stl_map. However we still need to annotate the decls that came from stl_map as if they came from map, because semantically we would like to autoload/show hints about map and not some 'interesting' stl implementation. This is why we need to reconstruct the include chain and write out the second includer. The first one is the prompt's input_line_N.
This commit is contained in:
parent
330cdb6086
commit
5194c7811b
@ -150,7 +150,17 @@ namespace cling {
|
||||
}
|
||||
}
|
||||
|
||||
std::string file = m_SMgr.getFilename(m_SMgr.getSpellingLoc(D->getLocStart()));
|
||||
SourceLocation spellingLoc = m_SMgr.getSpellingLoc(D->getLocStart());
|
||||
// Walk up the include chain.
|
||||
PresumedLoc PLoc = m_SMgr.getPresumedLoc(spellingLoc);
|
||||
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());
|
||||
}
|
||||
std::string file = PLocs[PLocs.size() -1].getFilename();
|
||||
// assert ( file.length() != 0 && "Filename Should not be blank");
|
||||
Out() << " __attribute__((annotate(\""
|
||||
<< file;
|
||||
|
Loading…
x
Reference in New Issue
Block a user