diff options
Diffstat (limited to 'clang/lib/Frontend/HeaderIncludeGen.cpp')
-rw-r--r-- | clang/lib/Frontend/HeaderIncludeGen.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/clang/lib/Frontend/HeaderIncludeGen.cpp b/clang/lib/Frontend/HeaderIncludeGen.cpp index 97fac8a26fae..1ee47d8d2480 100644 --- a/clang/lib/Frontend/HeaderIncludeGen.cpp +++ b/clang/lib/Frontend/HeaderIncludeGen.cpp @@ -45,6 +45,9 @@ public: void FileChanged(SourceLocation Loc, FileChangeReason Reason, SrcMgr::CharacteristicKind FileType, FileID PrevFID) override; + + void FileSkipped(const FileEntryRef &SkippedFile, const Token &FilenameTok, + SrcMgr::CharacteristicKind FileType) override; }; } @@ -101,7 +104,7 @@ void clang::AttachHeaderIncludeGen(Preprocessor &PP, std::error_code EC; llvm::raw_fd_ostream *OS = new llvm::raw_fd_ostream( OutputPath.str(), EC, - llvm::sys::fs::OF_Append | llvm::sys::fs::OF_Text); + llvm::sys::fs::OF_Append | llvm::sys::fs::OF_TextWithCRLF); if (EC) { PP.getDiagnostics().Report(clang::diag::warn_fe_cc_print_header_failure) << EC.message(); @@ -119,7 +122,7 @@ void clang::AttachHeaderIncludeGen(Preprocessor &PP, // as sanitizer blacklists. It's only important for cl.exe compatibility, // the GNU way to generate rules is -M / -MM / -MD / -MMD. for (const auto &Header : DepOpts.ExtraDeps) - PrintHeaderInfo(OutputFile, Header, ShowDepth, 2, MSStyle); + PrintHeaderInfo(OutputFile, Header.first, ShowDepth, 2, MSStyle); PP.addPPCallbacks(std::make_unique<HeaderIncludesCallback>( &PP, ShowAllHeaders, OutputFile, DepOpts, OwnsOutputFile, ShowDepth, MSStyle)); @@ -181,3 +184,16 @@ void HeaderIncludesCallback::FileChanged(SourceLocation Loc, MSStyle); } } + +void HeaderIncludesCallback::FileSkipped(const FileEntryRef &SkippedFile, const + Token &FilenameTok, + SrcMgr::CharacteristicKind FileType) { + if (!DepOpts.ShowSkippedHeaderIncludes) + return; + + if (!DepOpts.IncludeSystemHeaders && isSystem(FileType)) + return; + + PrintHeaderInfo(OutputFile, SkippedFile.getName(), ShowDepth, + CurrentIncludeDepth + 1, MSStyle); +} |