File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
source/Plugins/TypeSystem/Swift
test/API/lang/swift/clangimporter/caching Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1954,10 +1954,20 @@ void SwiftASTContext::AddExtraClangCC1Args(
19541954
19551955void SwiftASTContext::AddUserClangArgs (TargetProperties &props) {
19561956 Args args (props.GetSwiftExtraClangFlags ());
1957+ if (args.empty ())
1958+ return ;
1959+
19571960 std::vector<std::string> user_clang_flags;
1958- for (const auto &arg : args.entries ())
1961+ for (const auto &arg : args.entries ()) {
1962+ if (arg.ref () == " --" )
1963+ continue ;
19591964 user_clang_flags.push_back (arg.ref ().str ());
1960- AddExtraClangArgs (user_clang_flags, {}, {});
1965+ }
1966+ if (GetClangImporterOptions ().DirectClangCC1ModuleBuild ) {
1967+ llvm::append_range (GetClangImporterOptions ().ExtraArgs , user_clang_flags);
1968+ } else {
1969+ AddExtraClangArgs (user_clang_flags, {}, {});
1970+ }
19611971}
19621972
19631973// / Turn relative paths in clang options into absolute paths based on
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ def test(self):
2020 lldb .SBFileSpec ('main.swift' ))
2121 log = self .getBuildArtifact ("types.log" )
2222 self .runCmd ("settings set target.swift-clang-override-options +-DADDED=1" )
23+ self .runCmd ("settings set target.swift-extra-clang-flags -- -DEXTRA=1" )
2324 self .expect ('log enable lldb types -f "%s"' % log )
2425 self .expect ("expression obj" , DATA_TYPES_DISPLAYED_CORRECTLY ,
2526 substrs = ["b =" ])
@@ -34,6 +35,7 @@ def test(self):
3435# CHECK: SwiftASTContextForExpressions(module: "a", cu: "main.swift")::LogConfiguration() -- -F
3536# CHECK-NEXT: SwiftASTContextForExpressions(module: "a", cu: "main.swift")::LogConfiguration() -- /FRAMEWORK_DIR
3637# CHECK: SwiftASTContextForExpressions(module: "a", cu: "main.swift")::LogConfiguration() -- -DADDED=1
38+ # CHECK: SwiftASTContextForExpressions(module: "a", cu: "main.swift")::LogConfiguration() -- -DEXTRA=1
3739# CHECK: SwiftASTContextForExpressions(module: "a", cu: "main.swift") Module import remark: loaded module 'ClangA'
3840# CHECK-NOT: -cc1
3941# CHECK-NOT: -fmodule-file-cache-key
You can’t perform that action at this time.
0 commit comments