forked from OSchip/llvm-project
parent
eb931c6b0e
commit
4e52123d06
|
@ -82,15 +82,18 @@ void HeaderIncludesCallback::FileChanged(SourceLocation Loc,
|
|||
// Adjust the current include depth.
|
||||
if (Reason == PPCallbacks::EnterFile) {
|
||||
++CurrentIncludeDepth;
|
||||
} else {
|
||||
} else if (Reason == PPCallbacks::ExitFile) {
|
||||
if (CurrentIncludeDepth)
|
||||
--CurrentIncludeDepth;
|
||||
|
||||
// We track when we are done with the predefines by watching for the first
|
||||
// place where we drop back to a nesting depth of 0.
|
||||
if (CurrentIncludeDepth == 0 && !HasProcessedPredefines)
|
||||
// place where we drop back to a nesting depth of 1.
|
||||
if (CurrentIncludeDepth == 1 && !HasProcessedPredefines)
|
||||
HasProcessedPredefines = true;
|
||||
}
|
||||
|
||||
return;
|
||||
} else
|
||||
return;
|
||||
|
||||
// Show the header if we are (a) past the predefines, or (b) showing all
|
||||
// headers and in the predefines at a depth past the initial file and command
|
||||
|
@ -107,7 +110,8 @@ void HeaderIncludesCallback::FileChanged(SourceLocation Loc,
|
|||
|
||||
llvm::SmallString<256> Msg;
|
||||
if (ShowDepth) {
|
||||
for (unsigned i = 0; i != CurrentIncludeDepth; ++i)
|
||||
// The main source file is at depth 1, so skip one dot.
|
||||
for (unsigned i = 1; i != CurrentIncludeDepth; ++i)
|
||||
Msg += '.';
|
||||
Msg += ' ';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue