[cfe-commits] r128014 - in /cfe/trunk: include/clang/Frontend/Utils.h lib/Frontend/CompilerInstance.cpp lib/Frontend/HeaderIncludeGen.cpp
Daniel Dunbar
daniel at zuster.org
Mon Mar 21 12:37:38 PDT 2011
Author: ddunbar
Date: Mon Mar 21 14:37:38 2011
New Revision: 128014
URL: http://llvm.org/viewvc/llvm-project?rev=128014&view=rev
Log:
Frontend: Change CC_PRINT_HEADERS to not print header depth markers, these don't
really make any sense in this environment.
Modified:
cfe/trunk/include/clang/Frontend/Utils.h
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp
Modified: cfe/trunk/include/clang/Frontend/Utils.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/Utils.h?rev=128014&r1=128013&r2=128014&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/Utils.h (original)
+++ cfe/trunk/include/clang/Frontend/Utils.h Mon Mar 21 14:37:38 2011
@@ -85,7 +85,8 @@
/// \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.
Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=128014&r1=128013&r2=128014&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Mon Mar 21 14:37:38 2011
@@ -205,7 +205,8 @@
llvm::StringRef OutputPath = DepOpts.HeaderIncludeOutputFile;
if (OutputPath == "-")
OutputPath = "";
- AttachHeaderIncludeGen(*PP, /*ShowAllHeaders=*/true, OutputPath);
+ AttachHeaderIncludeGen(*PP, /*ShowAllHeaders=*/true, OutputPath,
+ /*ShowDepth=*/false);
}
return PP;
Modified: cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp?rev=128014&r1=128013&r2=128014&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp (original)
+++ cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp Mon Mar 21 14:37:38 2011
@@ -22,13 +22,16 @@
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)
@@ -41,7 +44,7 @@
}
void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders,
- llvm::StringRef OutputPath) {
+ llvm::StringRef OutputPath, bool ShowDepth) {
llvm::raw_ostream *OutputFile = &llvm::errs();
bool OwnsOutputFile = false;
@@ -63,7 +66,8 @@
}
PP.addPPCallbacks(new HeaderIncludesCallback(&PP, ShowAllHeaders,
- OutputFile, OwnsOutputFile));
+ OutputFile, OwnsOutputFile,
+ ShowDepth));
}
void HeaderIncludesCallback::FileChanged(SourceLocation Loc,
@@ -102,9 +106,11 @@
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';
More information about the cfe-commits
mailing list