Skip to content

Commit d4c2e1c

Browse files
committed
Basic: fix a small corner case for ODR violations
When building the runtime we define `SWIFT_RUNTIME`. `swiftCore_EXPORTS` is only defined when building swiftCore as a shared library. This would thus allow the ODR violations to appear in a static library form of the standard library. This was uncovered with the new runtime build system.
1 parent 6b2fb2e commit d4c2e1c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/swift/Basic/LLVM.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434

3535
// Don't pre-declare certain LLVM types in the runtime, which must
3636
// not put things in namespace llvm for ODR reasons.
37-
#if !defined(swiftCore_EXPORTS)
38-
#define SWIFT_LLVM_ODR_SAFE 1
39-
#else
37+
#if defined(SWIFT_RUNTIME)
4038
#define SWIFT_LLVM_ODR_SAFE 0
39+
#else
40+
#define SWIFT_LLVM_ODR_SAFE 1
4141
#endif
4242

4343
// Forward declarations.

include/swift/RemoteInspection/ReflectionContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1983,7 +1983,7 @@ class ReflectionContext
19831983
std::set<std::pair<const TypeRef *, const MetadataSource *>> Done;
19841984
GenericArgumentMap Subs;
19851985

1986-
ArrayRef<const TypeRef *> CaptureTypes = Info.CaptureTypes;
1986+
llvm::ArrayRef<const TypeRef *> CaptureTypes = Info.CaptureTypes;
19871987

19881988
// Closure context element layout depends on the layout of the
19891989
// captured types, but captured types might depend on element

0 commit comments

Comments
 (0)