Skip to content

Commit 5830413

Browse files
Adds an expected-error test characterizing the issue in SR-9482.
1 parent b28b44b commit 5830413

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

test/ClangImporter/macros.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,8 @@ func testNulls() {
176176
let _: Int = DEPRECATED_ONE // expected-error {{use of unresolved identifier 'DEPRECATED_ONE'}}
177177
let _: Int = OKAY_TYPED_ONE // expected-error {{cannot convert value of type 'okay_t' (aka 'UInt32') to specified type 'Int'}}
178178
}
179+
180+
func testHeaderGuard() {
181+
_ = IS_HEADER_GUARD // expected-error {{use of unresolved identifier 'IS_HEADER_GUARD'}}
182+
_ = LOOKS_LIKE_HEADER_GUARD_BUT_IS_USEFUL_CONSTANT // expected-error {{use of unresolved identifier 'LOOKS_LIKE_HEADER_GUARD_BUT_IS_USEFUL_CONSTANT'}}
183+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#ifndef IS_HEADER_GUARD
2+
#define IS_HEADER_GUARD
3+
#endif

test/Inputs/clang-importer-sdk/usr/include/macros.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include <macros_impl.h>
22
#include <macros_private_impl.h>
3+
#include <header_guard.h>
4+
#include <not_a_header_guard.h>
35

46
// Get Clang's NULL.
57
#include <stddef.h>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#ifndef LOOKS_LIKE_HEADER_GUARD_BUT_IS_USEFUL_CONSTANT
2+
#define LOOKS_LIKE_HEADER_GUARD_BUT_IS_USEFUL_CONSTANT 0xcafe
3+
#endif

0 commit comments

Comments
 (0)