[clang] Make -frewrite-includes put an endif at the end of the included text (PR #67613)
Paul T Robinson via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 29 09:36:19 PDT 2023
================
@@ -332,12 +346,14 @@ void InclusionRewriter::CommentOutDirective(Lexer &DirectiveLex,
// OutputContentUpTo() would not output anything anyway.
return;
}
- OS << "#if 0 /* expanded by -frewrite-includes */" << MainEOL;
+ OS << "#if 0 /* " << getIncludedFileName(Inc)
----------------
pogo59 wrote:
TIL about `#pragma clang system_header` which turns a header into a system header, regardless of how it was found. But, by the time the rewriter sees the pragma, it has already emitted the `#include` and its wrapper `#if`. That makes the `__CLANG_REWRITTEN_SYSTEM_INCLUDES` not as reliable, and I didn't do that part (yet).
But, I did do the `defined(__CLANG_REWRITTEN_INCLUDES)` part, so you can get all-or-nothing.
https://github.com/llvm/llvm-project/pull/67613
More information about the cfe-commits
mailing list