File tree 2 files changed +14
-2
lines changed
source/Plugins/TypeSystem/Swift
test/API/lang/swift/clangimporter/caching
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1954,10 +1954,20 @@ void SwiftASTContext::AddExtraClangCC1Args(
1954
1954
1955
1955
void SwiftASTContext::AddUserClangArgs (TargetProperties &props) {
1956
1956
Args args (props.GetSwiftExtraClangFlags ());
1957
+ if (args.empty ())
1958
+ return ;
1959
+
1957
1960
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 ;
1959
1964
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
+ }
1961
1971
}
1962
1972
1963
1973
// / 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):
20
20
lldb .SBFileSpec ('main.swift' ))
21
21
log = self .getBuildArtifact ("types.log" )
22
22
self .runCmd ("settings set target.swift-clang-override-options +-DADDED=1" )
23
+ self .runCmd ("settings set target.swift-extra-clang-flags -- -DEXTRA=1" )
23
24
self .expect ('log enable lldb types -f "%s"' % log )
24
25
self .expect ("expression obj" , DATA_TYPES_DISPLAYED_CORRECTLY ,
25
26
substrs = ["b =" ])
@@ -34,6 +35,7 @@ def test(self):
34
35
# CHECK: SwiftASTContextForExpressions(module: "a", cu: "main.swift")::LogConfiguration() -- -F
35
36
# CHECK-NEXT: SwiftASTContextForExpressions(module: "a", cu: "main.swift")::LogConfiguration() -- /FRAMEWORK_DIR
36
37
# CHECK: SwiftASTContextForExpressions(module: "a", cu: "main.swift")::LogConfiguration() -- -DADDED=1
38
+ # CHECK: SwiftASTContextForExpressions(module: "a", cu: "main.swift")::LogConfiguration() -- -DEXTRA=1
37
39
# CHECK: SwiftASTContextForExpressions(module: "a", cu: "main.swift") Module import remark: loaded module 'ClangA'
38
40
# CHECK-NOT: -cc1
39
41
# CHECK-NOT: -fmodule-file-cache-key
You can’t perform that action at this time.
0 commit comments