Skip to content

Commit 6fd0ca2

Browse files
committed
Strip out -fno-implicit-modules and friends from ClangImporter options
LLDB would rather control this itself. rdar://124699949
1 parent 20920cc commit 6fd0ca2

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1748,11 +1748,17 @@ void SwiftASTContext::FilterClangImporterOptions(
17481748
// Copy back a filtered version of ExtraArgs.
17491749
std::vector<std::string> orig_args(std::move(extra_args));
17501750
for (auto &arg : orig_args) {
1751+
StringRef arg_sr(arg);
1752+
// LLDB wants to control implicit/explicit modules build flags.
1753+
if (arg_sr == "-fno-implicit-modules" ||
1754+
arg_sr == "-fno-implicit-module-maps")
1755+
continue;
1756+
17511757
// The VFS options turn into fatal errors when the referenced file
17521758
// is not found. Since the Xcode build system tends to create a
17531759
// lot of VFS overlays by default, stat them and emit a warning if
17541760
// the yaml file couldn't be found.
1755-
if (StringRef(arg).startswith("-ivfs")) {
1761+
if (arg_sr.startswith("-ivfs")) {
17561762
// Stash the argument.
17571763
ivfs_arg = arg;
17581764
continue;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SWIFT_SOURCES := main.swift
2+
SWIFTFLAGS_EXTRAS = -parse-stdlib -Xcc -DMARKER1 -Xcc -fno-implicit-modules -Xcc -fno-implicit-module-maps -Xcc -DMARKER2
3+
4+
include Makefile.rules
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import lldb
2+
from lldbsuite.test.lldbtest import *
3+
from lldbsuite.test.decorators import *
4+
import lldbsuite.test.lldbutil as lldbutil
5+
import os
6+
import unittest2
7+
8+
class TestSwiftFModuleFlags(TestBase):
9+
@skipIfDarwinEmbedded
10+
@swiftTest
11+
def test(self):
12+
"""Test that -fmodule flags get stripped out"""
13+
self.build()
14+
log = self.getBuildArtifact("types.log")
15+
self.runCmd('log enable lldb types -f "%s"' % log)
16+
target, process, thread, bkpt = lldbutil.run_to_name_breakpoint(
17+
self, 'main')
18+
self.expect("expression 1", substrs=["1"])
19+
20+
# Scan through the types log.
21+
self.filecheck('platform shell cat "%s"' % log, __file__)
22+
# CHECK: -DMARKER1
23+
# CHECK-NOT: -fno-implicit-modules
24+
# CHECK-NOT: -fno-implicit-module-maps
25+
# CHECK: -DMARKER2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// This space left intentionally blank.

0 commit comments

Comments
 (0)