diff options
author | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
commit | 952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch) | |
tree | df8df0b0067b381eab470a3b8f28d14a552a6340 /lib/Frontend/HeaderIncludeGen.cpp | |
parent | ea266cad53e3d49771fa38103913d3ec7a166694 (diff) | |
download | FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz |
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
Diffstat (limited to 'lib/Frontend/HeaderIncludeGen.cpp')
-rw-r--r-- | lib/Frontend/HeaderIncludeGen.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/Frontend/HeaderIncludeGen.cpp b/lib/Frontend/HeaderIncludeGen.cpp index 79920df..237e5b1 100644 --- a/lib/Frontend/HeaderIncludeGen.cpp +++ b/lib/Frontend/HeaderIncludeGen.cpp @@ -24,15 +24,16 @@ class HeaderIncludesCallback : public PPCallbacks { bool OwnsOutputFile; bool ShowAllHeaders; bool ShowDepth; + bool MSStyle; public: HeaderIncludesCallback(const Preprocessor *PP, bool ShowAllHeaders_, raw_ostream *OutputFile_, bool OwnsOutputFile_, - bool ShowDepth_) + bool ShowDepth_, bool MSStyle_) : SM(PP->getSourceManager()), OutputFile(OutputFile_), CurrentIncludeDepth(0), HasProcessedPredefines(false), OwnsOutputFile(OwnsOutputFile_), ShowAllHeaders(ShowAllHeaders_), - ShowDepth(ShowDepth_) {} + ShowDepth(ShowDepth_), MSStyle(MSStyle_) {} ~HeaderIncludesCallback() { if (OwnsOutputFile) @@ -46,7 +47,8 @@ public: } void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders, - StringRef OutputPath, bool ShowDepth) { + StringRef OutputPath, bool ShowDepth, + bool MSStyle) { raw_ostream *OutputFile = &llvm::errs(); bool OwnsOutputFile = false; @@ -54,7 +56,7 @@ void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders, if (!OutputPath.empty()) { std::string Error; llvm::raw_fd_ostream *OS = new llvm::raw_fd_ostream( - OutputPath.str().c_str(), Error, llvm::raw_fd_ostream::F_Append); + OutputPath.str().c_str(), Error, llvm::sys::fs::F_Append); if (!Error.empty()) { PP.getDiagnostics().Report( clang::diag::warn_fe_cc_print_header_failure) << Error; @@ -69,7 +71,7 @@ void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders, PP.addPPCallbacks(new HeaderIncludesCallback(&PP, ShowAllHeaders, OutputFile, OwnsOutputFile, - ShowDepth)); + ShowDepth, MSStyle)); } void HeaderIncludesCallback::FileChanged(SourceLocation Loc, @@ -109,14 +111,20 @@ void HeaderIncludesCallback::FileChanged(SourceLocation Loc, if (ShowHeader && Reason == PPCallbacks::EnterFile) { // Write to a temporary string to avoid unnecessary flushing on errs(). SmallString<512> Filename(UserLoc.getFilename()); - Lexer::Stringify(Filename); + if (!MSStyle) + Lexer::Stringify(Filename); SmallString<256> Msg; + if (MSStyle) + Msg += "Note: including file:"; + if (ShowDepth) { // The main source file is at depth 1, so skip one dot. for (unsigned i = 1; i != CurrentIncludeDepth; ++i) - Msg += '.'; - Msg += ' '; + Msg += MSStyle ? ' ' : '.'; + + if (!MSStyle) + Msg += ' '; } Msg += Filename; Msg += '\n'; |