Clang Project

clang_source_code/test/Modules/double-quotes.m
1// REQUIRES: shell
2
3// RUN: rm -rf %t
4// RUN: mkdir %t
5
6// RUN: %hmaptool write %S/Inputs/double-quotes/a.hmap.json %t/a.hmap
7// RUN: %hmaptool write %S/Inputs/double-quotes/x.hmap.json %t/x.hmap
8
9// RUN: sed -e "s:TEST_DIR:%S/Inputs/double-quotes:g" \
10// RUN:   %S/Inputs/double-quotes/z.yaml > %t/z.yaml
11
12// The output with and without modules should be the same
13
14// RUN: %clang_cc1 \
15// RUN:   -I %t/x.hmap -iquote %t/a.hmap -ivfsoverlay %t/z.yaml \
16// RUN:   -F%S/Inputs/double-quotes -I%S/Inputs/double-quotes \
17// RUN:   -Wquoted-include-in-framework-header -fsyntax-only %s -verify
18
19// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache \
20// RUN:   -I %t/x.hmap -iquote %t/a.hmap -ivfsoverlay %t/z.yaml \
21// RUN:   -F%S/Inputs/double-quotes -I%S/Inputs/double-quotes \
22// RUN:   -Wquoted-include-in-framework-header -fsyntax-only %s \
23// RUN:   2>%t/stderr
24
25// The same warnings show up when modules is on but -verify doesn't get it
26// because they only show up under the module A building context.
27// RUN: FileCheck --input-file=%t/stderr %s
28// CHECK: double-quoted include "A0.h" in framework header, expected angle-bracketed instead
29// CHECK: double-quoted include "B.h" in framework header, expected angle-bracketed instead
30// CHECK: double-quoted include "B.h" in framework header, expected angle-bracketed instead
31
32#import "A.h"
33#import <Z/Z.h>
34
35// Make sure we correctly handle paths that resemble frameworks, but aren't.
36#import "NotAFramework/Headers/Headers/Thing1.h"
37
38int bar() { return foo(); }
39
40// expected-warning@Inputs/double-quotes/A.framework/Headers/A.h:1{{double-quoted include "A0.h" in framework header, expected angle-bracketed instead}}
41// expected-warning@Inputs/double-quotes/A.framework/Headers/A.h:2{{double-quoted include "B.h" in framework header, expected angle-bracketed instead}}
42// expected-warning@Inputs/double-quotes/flat-header-path/Z.h:1{{double-quoted include "B.h" in framework header, expected angle-bracketed instead}}
43