forked from OSchip/llvm-project
				
			Frontend: Change CC_PRINT_HEADERS to not print header depth markers, these don't
really make any sense in this environment. llvm-svn: 128014
This commit is contained in:
		
							parent
							
								
									413e064b45
								
							
						
					
					
						commit
						fe908a805b
					
				| 
						 | 
					@ -85,7 +85,8 @@ void AttachDependencyFileGen(Preprocessor &PP,
 | 
				
			||||||
/// \param OutputPath - If non-empty, a path to write the header include
 | 
					/// \param OutputPath - If non-empty, a path to write the header include
 | 
				
			||||||
/// information to, instead of writing to stderr.
 | 
					/// information to, instead of writing to stderr.
 | 
				
			||||||
void AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders = false,
 | 
					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
 | 
					/// CacheTokens - Cache tokens for use with PCH. Note that this requires
 | 
				
			||||||
/// a seekable stream.
 | 
					/// a seekable stream.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -205,7 +205,8 @@ CompilerInstance::createPreprocessor(Diagnostic &Diags,
 | 
				
			||||||
    llvm::StringRef OutputPath = DepOpts.HeaderIncludeOutputFile;
 | 
					    llvm::StringRef OutputPath = DepOpts.HeaderIncludeOutputFile;
 | 
				
			||||||
    if (OutputPath == "-")
 | 
					    if (OutputPath == "-")
 | 
				
			||||||
      OutputPath = "";
 | 
					      OutputPath = "";
 | 
				
			||||||
    AttachHeaderIncludeGen(*PP, /*ShowAllHeaders=*/true, OutputPath);
 | 
					    AttachHeaderIncludeGen(*PP, /*ShowAllHeaders=*/true, OutputPath,
 | 
				
			||||||
 | 
					                           /*ShowDepth=*/false);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return PP;
 | 
					  return PP;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,13 +22,16 @@ class HeaderIncludesCallback : public PPCallbacks {
 | 
				
			||||||
  bool HasProcessedPredefines;
 | 
					  bool HasProcessedPredefines;
 | 
				
			||||||
  bool OwnsOutputFile;
 | 
					  bool OwnsOutputFile;
 | 
				
			||||||
  bool ShowAllHeaders;
 | 
					  bool ShowAllHeaders;
 | 
				
			||||||
 | 
					  bool ShowDepth;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  HeaderIncludesCallback(const Preprocessor *PP, bool ShowAllHeaders_,
 | 
					  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_),
 | 
					    : SM(PP->getSourceManager()), OutputFile(OutputFile_),
 | 
				
			||||||
      CurrentIncludeDepth(0), HasProcessedPredefines(false),
 | 
					      CurrentIncludeDepth(0), HasProcessedPredefines(false),
 | 
				
			||||||
      OwnsOutputFile(OwnsOutputFile_), ShowAllHeaders(ShowAllHeaders_) {}
 | 
					      OwnsOutputFile(OwnsOutputFile_), ShowAllHeaders(ShowAllHeaders_),
 | 
				
			||||||
 | 
					      ShowDepth(ShowDepth_) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ~HeaderIncludesCallback() {
 | 
					  ~HeaderIncludesCallback() {
 | 
				
			||||||
    if (OwnsOutputFile)
 | 
					    if (OwnsOutputFile)
 | 
				
			||||||
| 
						 | 
					@ -41,7 +44,7 @@ public:
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders,
 | 
					void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders,
 | 
				
			||||||
                                   llvm::StringRef OutputPath) {
 | 
					                                   llvm::StringRef OutputPath, bool ShowDepth) {
 | 
				
			||||||
  llvm::raw_ostream *OutputFile = &llvm::errs();
 | 
					  llvm::raw_ostream *OutputFile = &llvm::errs();
 | 
				
			||||||
  bool OwnsOutputFile = false;
 | 
					  bool OwnsOutputFile = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,7 +66,8 @@ void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders,
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  PP.addPPCallbacks(new HeaderIncludesCallback(&PP, ShowAllHeaders,
 | 
					  PP.addPPCallbacks(new HeaderIncludesCallback(&PP, ShowAllHeaders,
 | 
				
			||||||
                                               OutputFile, OwnsOutputFile));
 | 
					                                               OutputFile, OwnsOutputFile,
 | 
				
			||||||
 | 
					                                               ShowDepth));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void HeaderIncludesCallback::FileChanged(SourceLocation Loc,
 | 
					void HeaderIncludesCallback::FileChanged(SourceLocation Loc,
 | 
				
			||||||
| 
						 | 
					@ -102,9 +106,11 @@ void HeaderIncludesCallback::FileChanged(SourceLocation Loc,
 | 
				
			||||||
    Lexer::Stringify(Filename);
 | 
					    Lexer::Stringify(Filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    llvm::SmallString<256> Msg;
 | 
					    llvm::SmallString<256> Msg;
 | 
				
			||||||
 | 
					    if (ShowDepth) {
 | 
				
			||||||
      for (unsigned i = 0; i != CurrentIncludeDepth; ++i)
 | 
					      for (unsigned i = 0; i != CurrentIncludeDepth; ++i)
 | 
				
			||||||
        Msg += '.';
 | 
					        Msg += '.';
 | 
				
			||||||
      Msg += ' ';
 | 
					      Msg += ' ';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    Msg += Filename;
 | 
					    Msg += Filename;
 | 
				
			||||||
    Msg += '\n';
 | 
					    Msg += '\n';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue