diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-04-14 14:07:45 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-04-14 14:07:45 +0000 |
commit | 4dddebfef924be24de74b8bdf722a5cff3f3333f (patch) | |
tree | c5b22bf1bfc5c00d760f20bf1bc80e91f3c723d6 /lib/Frontend/HeaderIncludeGen.cpp | |
parent | 5655837683843a526da9d5af1eb0edbed8c0bc94 (diff) |
Fix -H. It was pretty broken.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129514 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/HeaderIncludeGen.cpp')
-rw-r--r-- | lib/Frontend/HeaderIncludeGen.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/Frontend/HeaderIncludeGen.cpp b/lib/Frontend/HeaderIncludeGen.cpp index b77badf77f..51dec967cd 100644 --- a/lib/Frontend/HeaderIncludeGen.cpp +++ b/lib/Frontend/HeaderIncludeGen.cpp @@ -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 += ' '; } |