/// \param OutputPath - If non-empty, a path to write the header include
/// information to, instead of writing to stderr.
void AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders = false,
- llvm::StringRef OutputPath = "");
+ llvm::StringRef OutputPath = "",
+ bool ShowDepth = true);
/// CacheTokens - Cache tokens for use with PCH. Note that this requires
/// a seekable stream.
bool HasProcessedPredefines;
bool OwnsOutputFile;
bool ShowAllHeaders;
+ bool ShowDepth;
public:
HeaderIncludesCallback(const Preprocessor *PP, bool ShowAllHeaders_,
- llvm::raw_ostream *OutputFile_, bool OwnsOutputFile_)
+ llvm::raw_ostream *OutputFile_, bool OwnsOutputFile_,
+ bool ShowDepth_)
: SM(PP->getSourceManager()), OutputFile(OutputFile_),
CurrentIncludeDepth(0), HasProcessedPredefines(false),
- OwnsOutputFile(OwnsOutputFile_), ShowAllHeaders(ShowAllHeaders_) {}
+ OwnsOutputFile(OwnsOutputFile_), ShowAllHeaders(ShowAllHeaders_),
+ ShowDepth(ShowDepth_) {}
~HeaderIncludesCallback() {
if (OwnsOutputFile)
}
void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders,
- llvm::StringRef OutputPath) {
+ llvm::StringRef OutputPath, bool ShowDepth) {
llvm::raw_ostream *OutputFile = &llvm::errs();
bool OwnsOutputFile = false;
}
PP.addPPCallbacks(new HeaderIncludesCallback(&PP, ShowAllHeaders,
- OutputFile, OwnsOutputFile));
+ OutputFile, OwnsOutputFile,
+ ShowDepth));
}
void HeaderIncludesCallback::FileChanged(SourceLocation Loc,
Lexer::Stringify(Filename);
llvm::SmallString<256> Msg;
- for (unsigned i = 0; i != CurrentIncludeDepth; ++i)
- Msg += '.';
- Msg += ' ';
+ if (ShowDepth) {
+ for (unsigned i = 0; i != CurrentIncludeDepth; ++i)
+ Msg += '.';
+ Msg += ' ';
+ }
Msg += Filename;
Msg += '\n';