1// RUN: rm -rf %t
2
3// Here, we build the module without "non-modular-include-in-framework-module".
4// RUN: echo '@import UseAfterFreePublic;' | \
5// RUN:   %clang_cc1 -fmodules -fimplicit-module-maps \
6// RUN:     -fmodules-cache-path=%t -isystem %S/Inputs/UseAfterFree/ -fsyntax-only \
7// RUN:     -x objective-c -
8
9// RUN:   %clang_cc1 -fmodules -fimplicit-module-maps \
10// RUN:     -fmodules-cache-path=%t -isystem %S/Inputs/UseAfterFree/ -fsyntax-only \
11// RUN:     -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module \
12// RUN:     -x objective-c %s -verify
13// expected-no-diagnostics
14
15// Here, we load the module UseAfterFreePublic, it is treated as a system module,
16// we ignore the inconsistency for "non-modular-include-in-framework-module".
17@import UseAfterFreePublic;
18
19// We start a thread to build the module for UseAfterFreePrivate.h. In the thread,
20// we load UseAfterFreePublic and should treat it as a system module as well.
21// If not, we will invalidate UseAfterFreePublic because of the inconsistency
22// for "non-modular-include-in-framework-module", and have a use-after-free error
23// of the FileEntry.
24#import <UseAfterFreePrivate.h>
25