diff --git a/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp b/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp index 858a328862f30..99d6486c87fca 100644 --- a/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp +++ b/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp @@ -2112,12 +2112,15 @@ void SwiftASTContext::AddExtraClangCC1Args( else ++it; } - invocation.getFrontendOpts().ModuleFiles.erase( - llvm::remove_if(invocation.getFrontendOpts().ModuleFiles, - [&](const auto &mod) { return !CheckFileExists(mod); }), - invocation.getFrontendOpts().ModuleFiles.end()); + llvm::erase_if(invocation.getFrontendOpts().ModuleFiles, + [&](const auto &mod) { return !CheckFileExists(mod); }); } + // Remove -Werror flags. + llvm::erase_if( + invocation.getDiagnosticOpts().Warnings, + [](StringRef Warning) { return Warning.starts_with("error"); }); + invocation.generateCC1CommandLine( [&](const llvm::Twine &arg) { dest.push_back(arg.str()); }); diff --git a/lldb/test/API/lang/swift/clangimporter/caching/Makefile b/lldb/test/API/lang/swift/clangimporter/caching/Makefile index 05a5a6e4c35c7..254fb62895660 100644 --- a/lldb/test/API/lang/swift/clangimporter/caching/Makefile +++ b/lldb/test/API/lang/swift/clangimporter/caching/Makefile @@ -1,6 +1,6 @@ SWIFT_SOURCES := main.swift SWIFT_ENABLE_EXPLICIT_MODULES := YES -SWIFTFLAGS_EXTRAS = -I$(SRCDIR) -I/TEST_DIR -F/FRAMEWORK_DIR -cache-compile-job -cas-path $(BUILDDIR)/cas +SWIFTFLAGS_EXTRAS = -I$(SRCDIR) -I/TEST_DIR -F/FRAMEWORK_DIR -cache-compile-job -cas-path $(BUILDDIR)/cas -Xcc -Werror all: a.out cas-config diff --git a/lldb/test/API/lang/swift/clangimporter/caching/TestSwiftClangImporterCaching.py b/lldb/test/API/lang/swift/clangimporter/caching/TestSwiftClangImporterCaching.py index 50718570d4069..afc09abc3acb2 100644 --- a/lldb/test/API/lang/swift/clangimporter/caching/TestSwiftClangImporterCaching.py +++ b/lldb/test/API/lang/swift/clangimporter/caching/TestSwiftClangImporterCaching.py @@ -34,5 +34,6 @@ def test(self): # CHECK: SwiftASTContextForExpressions(module: "a", cu: "main.swift")::LogConfiguration() -- -DADDED=1 # CHECK: SwiftASTContextForExpressions(module: "a", cu: "main.swift")::LogConfiguration() -- -DEXTRA=1 # CHECK: SwiftASTContextForExpressions(module: "a", cu: "main.swift") Module import remark: loaded module 'ClangA' +# CHECK-NOT: -Werror # CHECK-NOT: -cc1 # CHECK-NOT: Clang error