Skip to content

Commit 3394c6b

Browse files
committed
Remove Bogus Macro Assert in LUT Building
This assertion assumes that only visibility directives for builtin-in macros find their way here. However, the presence of textual headers in modules means any macro directive can wind up here since clang will report that it is currently not building a module. It's been half a decade since this code did anything useful with macro directives in textual headers, so just leave things be. rdar://91768988
1 parent 6aca5e5 commit 3394c6b

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

lib/ClangImporter/SwiftLookupTable.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,12 +1969,6 @@ void importer::addMacrosToLookupTable(SwiftLookupTable &table,
19691969

19701970
// If we're in a module, we really need moduleMacro to be valid.
19711971
if (isModule && !moduleMacro) {
1972-
#ifndef NDEBUG
1973-
// Refetch this just for the assertion.
1974-
clang::MacroDirective *MD = pp.getLocalMacroDirective(macro.first);
1975-
assert(isa<clang::VisibilityMacroDirective>(MD));
1976-
#endif
1977-
19781972
// FIXME: "public" visibility macros should actually be added to the
19791973
// table.
19801974
return;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
framework module TextualHeaders [system] {
2+
umbrella "PrivateHeaders"
3+
4+
explicit module TextualHeader {
5+
textual header "TextualHeader.h"
6+
export *
7+
}
8+
9+
explicit module * { export * }
10+
11+
export_as TextualHeaders_Private
12+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define BOOM 42
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -typecheck -F %S/Inputs/custom-modules %s -verify
2+
import TextualHeaders

0 commit comments

Comments
 (0)