aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/Frontend/HeaderIncludeGen.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-08-22 19:00:43 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-11-13 20:39:49 +0000
commitfe6060f10f634930ff71b7c50291ddc610da2475 (patch)
tree1483580c790bd4d27b6500a7542b5ee00534d3cc /contrib/llvm-project/clang/lib/Frontend/HeaderIncludeGen.cpp
parentb61bce17f346d79cecfd8f195a64b10f77be43b1 (diff)
parent344a3780b2e33f6ca763666c380202b18aab72a3 (diff)
Diffstat (limited to 'contrib/llvm-project/clang/lib/Frontend/HeaderIncludeGen.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/Frontend/HeaderIncludeGen.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/contrib/llvm-project/clang/lib/Frontend/HeaderIncludeGen.cpp b/contrib/llvm-project/clang/lib/Frontend/HeaderIncludeGen.cpp
index 97fac8a26fae..1ee47d8d2480 100644
--- a/contrib/llvm-project/clang/lib/Frontend/HeaderIncludeGen.cpp
+++ b/contrib/llvm-project/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);
+}