Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
Qt Creator 3.6.0-beta1
Description
Has to be fixed in clang.
Index: CIndexInclusionStack.cpp =================================================================== --- CIndexInclusionStack.cpp (revision 246452) +++ CIndexInclusionStack.cpp (working copy) @@ -35,12 +35,28 @@ SmallVector<CXSourceLocation, 10> InclusionStack; unsigned n = SM.local_sloc_entry_size(); + unsigned n2 = 0; + const SrcMgr::SLocEntry &(SourceManager::*Getter)(unsigned, bool*) const; + Getter = &SourceManager::getLocalSLocEntry; + + for (unsigned i = 0 ; i < n ; ++i) { + bool Invalid = false; + const SrcMgr::SLocEntry &SL = (SM.*Getter)(i, &Invalid); + + if (!SL.isFile() || Invalid) + continue; + + const SrcMgr::FileInfo &FI = SL.getFile(); + if (!FI.getContentCache()->OrigEntry) + continue; + + ++n2; + } // In the case where all the SLocEntries are in an external source, traverse // those SLocEntries as well. This is the case where we are looking // at the inclusion stack of an AST/PCH file. - const SrcMgr::SLocEntry &(SourceManager::*Getter)(unsigned, bool*) const; - if (n == 1) { + if (n2 == 1) { Getter = &SourceManager::getLoadedSLocEntry; n = SM.loaded_sloc_entry_size(); } else