]> granicus.if.org Git - clang/commitdiff
Frontend: Change CC_PRINT_HEADERS to not print header depth markers, these don't
authorDaniel Dunbar <daniel@zuster.org>
Mon, 21 Mar 2011 19:37:38 +0000 (19:37 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 21 Mar 2011 19:37:38 +0000 (19:37 +0000)
really make any sense in this environment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128014 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Frontend/Utils.h
lib/Frontend/CompilerInstance.cpp
lib/Frontend/HeaderIncludeGen.cpp

index 02342c1a4710b9c031c2ab2547fa36ff484b8641..dc99bc34bea250c515d750858d77acaf116d557b 100644 (file)
@@ -85,7 +85,8 @@ void AttachDependencyFileGen(Preprocessor &PP,
 /// \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.
index 26d40e4f80b215421254276a6101cba465a80935..bbdfcaf57e03efa6992b3cb7cd501d03bf7c894a 100644 (file)
@@ -205,7 +205,8 @@ CompilerInstance::createPreprocessor(Diagnostic &Diags,
     llvm::StringRef OutputPath = DepOpts.HeaderIncludeOutputFile;
     if (OutputPath == "-")
       OutputPath = "";
-    AttachHeaderIncludeGen(*PP, /*ShowAllHeaders=*/true, OutputPath);
+    AttachHeaderIncludeGen(*PP, /*ShowAllHeaders=*/true, OutputPath,
+                           /*ShowDepth=*/false);
   }
 
   return PP;
index 45ff1d2e412f3ec1817d2f68dfcd3bf87979b470..b77badf77f297c8e5b09be6cdb8b032f8ddf68e4 100644 (file)
@@ -22,13 +22,16 @@ class HeaderIncludesCallback : public PPCallbacks {
   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 @@ public:
 }
 
 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 @@ void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders,
   }
 
   PP.addPPCallbacks(new HeaderIncludesCallback(&PP, ShowAllHeaders,
-                                               OutputFile, OwnsOutputFile));
+                                               OutputFile, OwnsOutputFile,
+                                               ShowDepth));
 }
 
 void HeaderIncludesCallback::FileChanged(SourceLocation Loc,
@@ -102,9 +106,11 @@ 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';