Skip to content

Commit 3650cf2

Browse files
committed
Don’t include SourceLoc.h when USED_IN_CPP_SOURCE is not set
1 parent f408619 commit 3650cf2

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

include/swift/Basic/BasicBridging.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@
2222
//
2323
#include "swift/Basic/BridgedSwiftObject.h"
2424
#include "swift/Basic/Compiler.h"
25-
#include "swift/Basic/SourceLoc.h"
26-
// Workaround to avoid a compiler error because `cas::ObjectRef` is not defined
27-
// when including VirtualFileSystem.h
28-
#include "llvm/CAS/CASReference.h"
2925

3026
#include <stddef.h>
3127
#include <stdint.h>
3228
#include <vector>
3329
#ifdef USED_IN_CPP_SOURCE
30+
// Workaround to avoid a compiler error because `cas::ObjectRef` is not defined
31+
// when including VirtualFileSystem.h
3432
#include <cassert>
33+
#include "llvm/CAS/CASReference.h"
3534

3635
#include "swift/Basic/SourceLoc.h"
3736
#include "llvm/ADT/StringRef.h"

include/swift/SILOptimizer/OptimizerBridging.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@
2424

2525
#include "swift/SILOptimizer/Analysis/BasicCalleeAnalysis.h"
2626

27+
#else // USED_IN_CPP_SOURCE
28+
29+
#error "should not include swift headers into bridging header"
30+
31+
#ifdef SWIFT_SIL_SILVALUE_H
32+
#error "should not include swift headers into bridging header"
33+
#endif
34+
#ifdef LLVM_SUPPORT_COMPILER_H
35+
#error "should not include llvm headers into bridging header"
36+
#endif
37+
2738
#endif // USED_IN_CPP_SOURCE
2839

2940
SWIFT_BEGIN_NULLABILITY_ANNOTATIONS

0 commit comments

Comments
 (0)