[PATCH] D94802: [clang][cli] Parse HeaderSearch options separately
Jan Svoboda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 15 09:28:33 PST 2021
jansvoboda11 created this revision.
jansvoboda11 added reviewers: dexonsmith, Bigcheese.
Herald added a subscriber: dang.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94802
Files:
clang/include/clang/Driver/Options.td
clang/lib/Frontend/CompilerInvocation.cpp
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1796,7 +1796,23 @@
}
static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
+ DiagnosticsEngine &Diags,
const std::string &WorkingDir) {
+ HeaderSearchOptions *HeaderSearchOpts = &Opts;
+ bool Success = true;
+
+#define HEADER_SEARCH_OPTION_WITH_MARSHALLING( \
+ PREFIX_TYPE, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
+ HELPTEXT, METAVAR, VALUES, SPELLING, SHOULD_PARSE, ALWAYS_EMIT, KEYPATH, \
+ DEFAULT_VALUE, IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, DENORMALIZER, \
+ MERGER, EXTRACTOR, TABLE_INDEX) \
+ PARSE_OPTION_WITH_MARSHALLING(Args, Diags, Success, ID, FLAGS, PARAM, \
+ SHOULD_PARSE, KEYPATH, DEFAULT_VALUE, \
+ IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, \
+ MERGER, TABLE_INDEX)
+#include "clang/Driver/Options.inc"
+#undef HEADER_SEARCH_OPTION_WITH_MARSHALLING
+
if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
@@ -2993,7 +3009,7 @@
LangOpts.IsHeaderFile);
ParseTargetArgs(Res.getTargetOpts(), Args, Diags);
llvm::Triple T(Res.getTargetOpts().Triple);
- ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), Args,
+ ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), Args, Diags,
Res.getFileSystemOpts().WorkingDir);
if (DashX.getFormat() == InputKind::Precompiled ||
DashX.getLanguage() == Language::LLVM_IR) {
@@ -3214,6 +3230,7 @@
EXTRACTOR, TABLE_INDEX)
#define DIAG_OPTION_WITH_MARSHALLING OPTION_WITH_MARSHALLING
+#define HEADER_SEARCH_OPTION_WITH_MARSHALLING OPTION_WITH_MARSHALLING
#define LANG_OPTION_WITH_MARSHALLING OPTION_WITH_MARSHALLING
#define CODEGEN_OPTION_WITH_MARSHALLING OPTION_WITH_MARSHALLING
@@ -3221,6 +3238,7 @@
#undef CODEGEN_OPTION_WITH_MARSHALLING
#undef LANG_OPTION_WITH_MARSHALLING
+#undef HEADER_SEARCH_OPTION_WITH_MARSHALLING
#undef DIAG_OPTION_WITH_MARSHALLING
#undef OPTION_WITH_MARSHALLING
#undef GENERATE_OPTION_WITH_MARSHALLING
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -256,7 +256,7 @@
class CodeGenOpts<string base>
: KeyPathAndMacro<"CodeGenOpts.", base, "CODEGEN_"> {}
class HeaderSearchOpts<string base>
- : KeyPathAndMacro<"HeaderSearchOpts->", base> {}
+ : KeyPathAndMacro<"HeaderSearchOpts->", base, "HEADER_SEARCH_"> {}
class PreprocessorOpts<string base>
: KeyPathAndMacro<"PreprocessorOpts->", base> {}
class FileSystemOpts<string base>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94802.317000.patch
Type: text/x-patch
Size: 3101 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210115/6117bc4c/attachment-0001.bin>
More information about the cfe-commits
mailing list