Skip to content

Commit aa31794

Browse files
committed
[Clang Importer] Pass in clang executable argument even if -only-use-extra-clang-opts is specified.
Instead of *just* passing in `ExtraArgs`, we need to make sure to still form a command-line according to Clang's expectation.
1 parent a17d5ee commit aa31794

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -958,13 +958,17 @@ ClangImporter::getOrCreatePCH(const ClangImporterOptions &ImporterOptions,
958958

959959
std::vector<std::string>
960960
ClangImporter::getClangArguments(ASTContext &ctx) {
961-
if (ctx.ClangImporterOpts.ExtraArgsOnly) {
962-
return ctx.ClangImporterOpts.ExtraArgs;
963-
}
964961
std::vector<std::string> invocationArgStrs;
965962
// Clang expects this to be like an actual command line. So we need to pass in
966963
// "clang" for argv[0]
967964
invocationArgStrs.push_back(ctx.ClangImporterOpts.clangPath);
965+
if (ctx.ClangImporterOpts.ExtraArgsOnly) {
966+
invocationArgStrs.insert(invocationArgStrs.end(),
967+
ctx.ClangImporterOpts.ExtraArgs.begin(),
968+
ctx.ClangImporterOpts.ExtraArgs.end());
969+
return invocationArgStrs;
970+
}
971+
968972
switch (ctx.ClangImporterOpts.Mode) {
969973
case ClangImporterOptions::Modes::Normal:
970974
case ClangImporterOptions::Modes::PrecompiledModule:

0 commit comments

Comments
 (0)