Skip to content

Commit 74449ab

Browse files
authored
[Serialization] Downgrade inconsistent flags from erros to warnings (#115416)
There were many many "voices" about the too strict flags checking in modules. Although they rarely challenge this, maybe due to they respect to the compiler implementation details. But from my point of view, there are cases it is "fine" to have different flags. Especially we're too conservative to mark almost language options in `clang/include/clang/Basic/LangOptions.def` as incompatible options (see the comments in the front of the file). In my understanding, this should come from PCH initially since it is natural to ask your headers to be compiled with the same flags with your TU. And then, when Apple and Google goes to implement clang module, they don't challenge it too since they have a closed world where they have a strong control over the ecosystem so that they can make it consistent. Yes, consistency is great and ODR violation are awful. But this is the world we're living today. This is the C++'s ecosystem in the open ended world. Image a situation that we're using a third party module and we add a new option to our library, then the build bails out! THIS IS SUPER ANNOYING. And makes it non practical to make a modular C++ ecosystem. ( This was discussed many times in SG15. And the consensus is, the build systems should generate different BMI based on different flags. But this manner can't avoid ODR violation completely and it would add the times of module files that need to be built, which may kill the benefit of faster compilation of modules. However, I think the build systems may need to do the similar things in the end of the day. Considering libc++'s hardening mechanism (https://libcxx.llvm.org/Hardening.html). So the conclusion of the paragraph is, although this seems related to build systems, I think they are actually unrelated story. ) I think we should give our users a chance to disable such checks. It is theoretically unsafe. But we've done our job to tell the users that it **MAY** be bad. Then I feel it is C++-ish to give users more freedom even if they may shoot their foot. This shouldn't change any thing. Users who want previous behavior can get it easily by `-Werror=`.
1 parent 90a776f commit 74449ab

13 files changed

+86
-65
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,8 @@ Improvements to Clang's diagnostics
590590

591591
- Fixed a false negative ``-Wunused-private-field`` diagnostic when a defaulted comparison operator is defined out of class (#GH116961).
592592

593+
- Clang now downgrades the inconsistent language options between modules to warnings instead of errors.
594+
593595
Improvements to Clang's time-trace
594596
----------------------------------
595597

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ def ModuleLock : DiagGroup<"module-lock">;
557557
def ModuleBuild : DiagGroup<"module-build">;
558558
def ModuleImport : DiagGroup<"module-import">;
559559
def ModuleConflict : DiagGroup<"module-conflict">;
560+
def ModuleMismatchedOption : DiagGroup<"module-mismatched-option">;
560561
def ModuleFileExtension : DiagGroup<"module-file-extension">;
561562
def ModuleIncludeDirectiveTranslation : DiagGroup<"module-include-translation">;
562563
def RoundTripCC1Args : DiagGroup<"round-trip-cc1-args">;

clang/include/clang/Basic/DiagnosticSerializationKinds.td

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ def err_ast_file_targetopt_feature_mismatch : Error<
3636
"%select{AST file '%1' was|current translation unit is}0 compiled with the target "
3737
"feature '%2' but the %select{current translation unit is|AST file '%1' was}0 "
3838
"not">;
39-
def err_ast_file_langopt_mismatch : Error<"%0 was %select{disabled|enabled}1 in "
40-
"AST file '%3' but is currently %select{disabled|enabled}2">;
41-
def err_ast_file_langopt_value_mismatch : Error<
42-
"%0 differs in AST file '%1' vs. current file">;
39+
def warn_ast_file_langopt_mismatch : Warning<"%0 was %select{disabled|enabled}1 in "
40+
"AST file '%3' but is currently %select{disabled|enabled}2">,
41+
InGroup<ModuleMismatchedOption>;
42+
def warn_ast_file_langopt_value_mismatch : Warning<
43+
"%0 differs in AST file '%1' vs. current file">,
44+
InGroup<ModuleMismatchedOption>;
4345
def err_ast_file_diagopt_mismatch : Error<"%0 is currently enabled, but was not in "
4446
"the AST file '%1'">;
4547
def err_ast_file_modulecache_mismatch : Error<"AST file '%2' was compiled with module cache "

clang/lib/Serialization/ASTReader.cpp

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,7 @@ ASTReaderListener::~ASTReaderListener() = default;
279279
/// \param Diags If non-NULL, diagnostics will be emitted via this engine.
280280
/// \param AllowCompatibleDifferences If true, differences between compatible
281281
/// language options will be permitted.
282-
///
283-
/// \returns true if the languagae options mis-match, false otherwise.
284-
static bool checkLanguageOptions(const LangOptions &LangOpts,
282+
static void checkLanguageOptions(const LangOptions &LangOpts,
285283
const LangOptions &ExistingLangOpts,
286284
StringRef ModuleFilename,
287285
DiagnosticsEngine *Diags,
@@ -290,30 +288,27 @@ static bool checkLanguageOptions(const LangOptions &LangOpts,
290288
if (ExistingLangOpts.Name != LangOpts.Name) { \
291289
if (Diags) { \
292290
if (Bits == 1) \
293-
Diags->Report(diag::err_ast_file_langopt_mismatch) \
291+
Diags->Report(diag::warn_ast_file_langopt_mismatch) \
294292
<< Description << LangOpts.Name << ExistingLangOpts.Name \
295293
<< ModuleFilename; \
296294
else \
297-
Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
295+
Diags->Report(diag::warn_ast_file_langopt_value_mismatch) \
298296
<< Description << ModuleFilename; \
299297
} \
300-
return true; \
301298
}
302299

303300
#define VALUE_LANGOPT(Name, Bits, Default, Description) \
304301
if (ExistingLangOpts.Name != LangOpts.Name) { \
305302
if (Diags) \
306-
Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
303+
Diags->Report(diag::warn_ast_file_langopt_value_mismatch) \
307304
<< Description << ModuleFilename; \
308-
return true; \
309305
}
310306

311307
#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
312308
if (ExistingLangOpts.get##Name() != LangOpts.get##Name()) { \
313309
if (Diags) \
314-
Diags->Report(diag::err_ast_file_langopt_value_mismatch) \
310+
Diags->Report(diag::warn_ast_file_langopt_value_mismatch) \
315311
<< Description << ModuleFilename; \
316-
return true; \
317312
}
318313

319314
#define COMPATIBLE_LANGOPT(Name, Bits, Default, Description) \
@@ -335,24 +330,21 @@ static bool checkLanguageOptions(const LangOptions &LangOpts,
335330

336331
if (ExistingLangOpts.ModuleFeatures != LangOpts.ModuleFeatures) {
337332
if (Diags)
338-
Diags->Report(diag::err_ast_file_langopt_value_mismatch)
333+
Diags->Report(diag::warn_ast_file_langopt_value_mismatch)
339334
<< "module features" << ModuleFilename;
340-
return true;
341335
}
342336

343337
if (ExistingLangOpts.ObjCRuntime != LangOpts.ObjCRuntime) {
344338
if (Diags)
345-
Diags->Report(diag::err_ast_file_langopt_value_mismatch)
339+
Diags->Report(diag::warn_ast_file_langopt_value_mismatch)
346340
<< "target Objective-C runtime" << ModuleFilename;
347-
return true;
348341
}
349342

350343
if (ExistingLangOpts.CommentOpts.BlockCommandNames !=
351344
LangOpts.CommentOpts.BlockCommandNames) {
352345
if (Diags)
353-
Diags->Report(diag::err_ast_file_langopt_value_mismatch)
346+
Diags->Report(diag::warn_ast_file_langopt_value_mismatch)
354347
<< "block command names" << ModuleFilename;
355-
return true;
356348
}
357349

358350
// Sanitizer feature mismatches are treated as compatible differences. If
@@ -378,11 +370,8 @@ static bool checkLanguageOptions(const LangOptions &LangOpts,
378370
}
379371
#include "clang/Basic/Sanitizers.def"
380372
}
381-
return true;
382373
}
383374
}
384-
385-
return false;
386375
}
387376

388377
/// Compare the given set of target options against an existing set of
@@ -459,9 +448,10 @@ bool PCHValidator::ReadLanguageOptions(const LangOptions &LangOpts,
459448
StringRef ModuleFilename, bool Complain,
460449
bool AllowCompatibleDifferences) {
461450
const LangOptions &ExistingLangOpts = PP.getLangOpts();
462-
return checkLanguageOptions(LangOpts, ExistingLangOpts, ModuleFilename,
463-
Complain ? &Reader.Diags : nullptr,
464-
AllowCompatibleDifferences);
451+
checkLanguageOptions(LangOpts, ExistingLangOpts, ModuleFilename,
452+
Complain ? &Reader.Diags : nullptr,
453+
AllowCompatibleDifferences);
454+
return false;
465455
}
466456

467457
bool PCHValidator::ReadTargetOptions(const TargetOptions &TargetOpts,
@@ -5398,8 +5388,9 @@ namespace {
53985388
bool ReadLanguageOptions(const LangOptions &LangOpts,
53995389
StringRef ModuleFilename, bool Complain,
54005390
bool AllowCompatibleDifferences) override {
5401-
return checkLanguageOptions(ExistingLangOpts, LangOpts, ModuleFilename,
5402-
nullptr, AllowCompatibleDifferences);
5391+
checkLanguageOptions(ExistingLangOpts, LangOpts, ModuleFilename, nullptr,
5392+
AllowCompatibleDifferences);
5393+
return false;
54035394
}
54045395

54055396
bool ReadTargetOptions(const TargetOptions &TargetOpts,

clang/test/Modules/explicit-build-missing-files.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/b.pcm %s
3434
// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s --check-prefix=MISSING-B
3535
// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm -fmodule-map-file=%t/modulemap.moved %s
36-
// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm -fmodule-map-file=%t/modulemap.moved -std=c++1z %s
36+
// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm -fmodule-map-file=%t/modulemap.moved -std=c++1z %s
3737
// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm -fmodule-map-file=%t/modulemap.moved -std=c++1z -Wno-module-file-config-mismatch %s -Db=a
3838
// RUN: rm %t/a.h
3939
// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -verify

clang/test/Modules/load_failure.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -I %S/Inputs -fdisable-module-hash %s -DNONEXISTENT 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT %s
1212
// CHECK-NONEXISTENT: load_failure.c:2:9: fatal error: module 'load_nonexistent' not found
1313

14-
// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -I %S/Inputs -fdisable-module-hash %s -DFAILURE 2> %t.out
15-
// RUN: FileCheck -check-prefix=CHECK-FAILURE %s < %t.out
14+
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -I %S/Inputs -fdisable-module-hash %s -DFAILURE 2> %t.out
15+
// RUN: FileCheck -check-prefix=CHECK-WARN %s < %t.out
1616

1717
// FIXME: Clean up diagnostic text below and give it a location
18-
// CHECK-FAILURE: error: C99 was disabled in AST file '{{.*}}load_failure.pcm' but is currently enabled
18+
// CHECK-WARN: warning: C99 was disabled in AST file '{{.*}}load_failure.pcm' but is currently enabled
1919
// FIXME: When we have a syntax for modules in C, use that.
2020

2121

clang/test/Modules/mismatch-diagnostics.cpp

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,55 @@
33
// RUN: split-file %s %t
44
// RUN: mkdir -p %t/prebuilt_modules
55
//
6-
// RUN: %clang_cc1 -triple %itanium_abi_triple \
7-
// RUN: -std=c++20 -fprebuilt-module-path=%t/prebuilt-modules \
8-
// RUN: -emit-module-interface -pthread -DBUILD_MODULE \
9-
// RUN: %t/mismatching_module.cppm -o \
6+
// RUN: %clang_cc1 -triple %itanium_abi_triple \
7+
// RUN: -std=c++20 -fprebuilt-module-path=%t/prebuilt-modules \
8+
// RUN: -emit-module-interface -pthread -DBUILD_MODULE \
9+
// RUN: %t/mismatching_module.cppm -o \
1010
// RUN: %t/prebuilt_modules/mismatching_module.pcm
1111
//
12-
// RUN: not %clang_cc1 -triple %itanium_abi_triple -std=c++20 \
13-
// RUN: -fprebuilt-module-path=%t/prebuilt_modules -DCHECK_MISMATCH \
14-
// RUN: %t/use.cpp 2>&1 | FileCheck %s
12+
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 \
13+
// RUN: -fprebuilt-module-path=%t/prebuilt_modules -DCHECK_MISMATCH \
14+
// RUN: %t/use.cpp 2>&1 | FileCheck %t/use.cpp
1515

1616
// Test again with reduced BMI.
17-
// RUN: %clang_cc1 -triple %itanium_abi_triple \
18-
// RUN: -std=c++20 -fprebuilt-module-path=%t/prebuilt-modules \
19-
// RUN: -emit-reduced-module-interface -pthread -DBUILD_MODULE \
20-
// RUN: %t/mismatching_module.cppm -o \
17+
// RUN: %clang_cc1 -triple %itanium_abi_triple \
18+
// RUN: -std=c++20 -fprebuilt-module-path=%t/prebuilt-modules \
19+
// RUN: -emit-reduced-module-interface -pthread -DBUILD_MODULE \
20+
// RUN: %t/mismatching_module.cppm -o \
2121
// RUN: %t/prebuilt_modules/mismatching_module.pcm
2222
//
23-
// RUN: not %clang_cc1 -triple %itanium_abi_triple -std=c++20 \
24-
// RUN: -fprebuilt-module-path=%t/prebuilt_modules -DCHECK_MISMATCH \
25-
// RUN: %t/use.cpp 2>&1 | FileCheck %s
23+
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 \
24+
// RUN: -fprebuilt-module-path=%t/prebuilt_modules -DCHECK_MISMATCH \
25+
// RUN: %t/use.cpp 2>&1 | FileCheck %t/use.cpp
26+
//
27+
// RUN: %clang_cc1 -triple %itanium_abi_triple \
28+
// RUN: -std=c++20 -fprebuilt-module-path=%t/prebuilt-modules \
29+
// RUN: -emit-module-interface -pthread -DBUILD_MODULE \
30+
// RUN: %t/mismatching_module.cppm -o \
31+
// RUN: %t/prebuilt_modules/mismatching_module.pcm
32+
//
33+
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 \
34+
// RUN: -fprebuilt-module-path=%t/prebuilt_modules -DCHECK_MISMATCH \
35+
// RUN: -Wno-module-mismatched-option %t/use.cpp 2>&1 | FileCheck %t/use.cpp \
36+
// RUN: --check-prefix=NOWARN --allow-empty
37+
38+
// Test again with reduced BMI.
39+
// RUN: %clang_cc1 -triple %itanium_abi_triple \
40+
// RUN: -std=c++20 -fprebuilt-module-path=%t/prebuilt-modules \
41+
// RUN: -emit-reduced-module-interface -pthread -DBUILD_MODULE \
42+
// RUN: %t/mismatching_module.cppm -o \
43+
// RUN: %t/prebuilt_modules/mismatching_module.pcm
44+
//
45+
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 \
46+
// RUN: -fprebuilt-module-path=%t/prebuilt_modules -DCHECK_MISMATCH \
47+
// RUN: -Wno-module-mismatched-option %t/use.cpp 2>&1 | FileCheck %t/use.cpp \
48+
// RUN: --check-prefix=NOWARN --allow-empty
2649

2750
//--- mismatching_module.cppm
2851
export module mismatching_module;
2952

3053
//--- use.cpp
3154
import mismatching_module;
32-
// CHECK: error: POSIX thread support was enabled in AST file '{{.*[/|\\\\]}}mismatching_module.pcm' but is currently disabled
33-
// CHECK-NEXT: module file {{.*[/|\\\\]}}mismatching_module.pcm cannot be loaded due to a configuration mismatch with the current compilation
55+
// CHECK: warning: POSIX thread support was enabled in AST file '{{.*[/|\\\\]}}mismatching_module.pcm' but is currently disabled
56+
57+
// NOWARN-NOT: warning

clang/test/Modules/module-feature.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -fmodule-feature f2 -fmodule-feature f1 -F %S/Inputs %s -Rmodule-build 2>&1 | FileCheck %s -allow-empty -check-prefix=ALREADY_BUILT
77
// ALREADY_BUILT-NOT: building module
88

9-
// Errors if we try to force the load.
9+
// Warns if we try to force the load.
1010
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t.nohash -fimplicit-module-maps -fdisable-module-hash -fmodule-feature f1 -fmodule-feature f2 -F %S/Inputs %s -verify -Rmodule-build
11-
// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t.nohash -fimplicit-module-maps -fdisable-module-hash -fmodule-feature f2 -F %S/Inputs %s 2>&1 | FileCheck %s -check-prefix=DIFFERS
12-
// DIFFERS: error: module features differs
11+
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t.nohash -fimplicit-module-maps -fdisable-module-hash -fmodule-feature f2 -F %S/Inputs %s 2>&1 | FileCheck %s -check-prefix=DIFFERS
12+
// DIFFERS: warning: module features differs
1313

1414
@import Module; // expected-remark {{building module 'Module'}} expected-remark {{finished}}

clang/test/Modules/pr62359.cppm

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// RUN: split-file %s %t
44
//
55
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/Hello.cppm -o %t/Hello.pcm
6-
// RUN: not %clang_cc1 -std=c++20 -fopenmp %t/use.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \
6+
// RUN: %clang_cc1 -std=c++20 -fopenmp %t/use.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \
77
// RUN: 2>&1 | FileCheck %t/use.cpp
8-
// RUN: not %clang_cc1 -std=c++20 -fopenmp %t/use2.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \
8+
// RUN: %clang_cc1 -std=c++20 -fopenmp %t/use2.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \
99
// RUN: 2>&1 | FileCheck %t/use2.cpp
1010
//
1111
// RUN: %clang_cc1 -std=c++20 -fopenmp -emit-module-interface %t/Hello.cppm -o %t/Hello.pcm
@@ -18,9 +18,9 @@
1818
// RUN: split-file %s %t
1919
//
2020
// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/Hello.cppm -o %t/Hello.pcm
21-
// RUN: not %clang_cc1 -std=c++20 -fopenmp %t/use.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \
21+
// RUN: %clang_cc1 -std=c++20 -fopenmp %t/use.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \
2222
// RUN: 2>&1 | FileCheck %t/use.cpp
23-
// RUN: not %clang_cc1 -std=c++20 -fopenmp %t/use2.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \
23+
// RUN: %clang_cc1 -std=c++20 -fopenmp %t/use2.cpp -fmodule-file=hello=%t/Hello.pcm -fsyntax-only \
2424
// RUN: 2>&1 | FileCheck %t/use2.cpp
2525
//
2626
// RUN: %clang_cc1 -std=c++20 -fopenmp -emit-reduced-module-interface %t/Hello.cppm -o %t/Hello.pcm
@@ -56,4 +56,3 @@ int use2() {
5656
}
5757

5858
// CHECK: OpenMP{{.*}}differs in AST file '{{.*}}Hello.pcm' vs. current file
59-
// CHECK: use of undeclared identifier 'pragma'

clang/test/Modules/prebuilt-implicit-modules.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// RUN: mkdir -p %t2
2626
// RUN: %clang_cc1 -x objective-c -fmodules %S/Inputs/prebuilt-implicit-module/module.modulemap -emit-module -fmodule-name=module_a -fmodules-cache-path=%t
2727
// RUN: %clang_cc1 -x objective-c -fmodules %S/Inputs/prebuilt-implicit-module/module.modulemap -emit-module -fmodule-name=module_a -o %t/module_a.pcm -fno-signed-char
28-
// RUN: not %clang_cc1 -x objective-c %s -I%S/Inputs/prebuilt-implicit-module -fmodules -fmodule-map-file=%S/Inputs/prebuilt-implicit-module/module.modulemap -fprebuilt-implicit-modules -fprebuilt-module-path=%t -fmodules-cache-path=%t2
28+
// RUN: %clang_cc1 -x objective-c %s -I%S/Inputs/prebuilt-implicit-module -fmodules -fmodule-map-file=%S/Inputs/prebuilt-implicit-module/module.modulemap -fprebuilt-implicit-modules -fprebuilt-module-path=%t -fmodules-cache-path=%t2
2929
// RUN: find %t2 -name "module_a*.pcm" | not grep module_a
3030

3131
// expected-no-diagnostics

clang/test/PCH/arc.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
// RUN: %clang_cc1 -emit-pch -fblocks -triple x86_64-apple-darwin11 -fobjc-arc -x objective-c-header -o %t %S/Inputs/arc.h
77
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin11 -fobjc-arc -include-pch %t -emit-llvm-only %s
88

9-
// Test error when pch's -fobjc-arc state is different.
10-
// RUN: not %clang_cc1 -fblocks -triple x86_64-apple-darwin11 -include-pch %t -emit-llvm-only %s 2>&1 | FileCheck -check-prefix=CHECK-ERR1 %s
9+
// Test warning when pch's -fobjc-arc state is different.
10+
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin11 -include-pch %t -emit-llvm-only %s 2>&1 | FileCheck -check-prefix=CHECK-ERR1 %s
1111
// RUN: %clang_cc1 -emit-pch -fblocks -triple x86_64-apple-darwin11 -x objective-c-header -o %t %S/Inputs/arc.h
12-
// RUN: not %clang_cc1 -fblocks -triple x86_64-apple-darwin11 -fobjc-arc -include-pch %t -emit-llvm-only %s 2>&1 | FileCheck -check-prefix=CHECK-ERR2 %s
12+
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin11 -fobjc-arc -include-pch %t -emit-llvm-only %s 2>&1 | FileCheck -check-prefix=CHECK-ERR2 %s
1313

1414
array0 a0;
1515
array1 a1;

clang/test/PCH/no-validate-pch.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// CHECK: note: previous definition is here
1717
// CHECK: #define X 4
1818

19-
// CHECK-VAL: error: __OPTIMIZE__ predefined macro was enabled in AST file '{{.*}}' but is currently disabled
19+
// CHECK-VAL: warning: __OPTIMIZE__ predefined macro was enabled in AST file '{{.*}}' but is currently disabled
2020
// CHECK-VAL: error: definition of macro 'X' differs between the AST file '{{.*}}' ('4') and the command line ('5')
2121

2222
void test(void) {

clang/test/PCH/pch-dir.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
// RUN: %clang -x c++ -include %t.h -std=c++98 -fsyntax-only %s -Xclang -print-stats 2> %t.cpplog
1212
// RUN: FileCheck -check-prefix=CHECK-CPP %s < %t.cpplog
1313

14-
// RUN: not %clang -x c++ -std=c++11 -include %t.h -fsyntax-only %s 2> %t.cpp11log
15-
// RUN: FileCheck -check-prefix=CHECK-NO-SUITABLE %s < %t.cpp11log
14+
// RUN: %clang -x c++ -std=c++11 -include %t.h -fsyntax-only %s 2> %t.cpp11log
15+
// RUN: FileCheck %s --check-prefix=CHECK-OPT-DIFF < %t.cpp11log
1616

17-
// RUN: not %clang -include %t.h -fsyntax-only %s 2> %t.missinglog2
18-
// RUN: FileCheck -check-prefix=CHECK-NO-SUITABLE %s < %t.missinglog2
17+
// RUN: %clang -include %t.h -fsyntax-only %s 2> %t.missinglog2
18+
// RUN: FileCheck --check-prefix=CHECK-OPT-DIFF %s < %t.missinglog2
1919
// RUN: not %clang -include %t.h -DFOO=foo -DBAR=bar -fsyntax-only %s 2> %t.missinglog2
2020
// RUN: FileCheck -check-prefix=CHECK-NO-SUITABLE %s < %t.missinglog2
2121

@@ -41,6 +41,8 @@ int get(void) {
4141
#endif
4242
}
4343

44+
// CHECK-OPT-DIFF: warning: {{.*}} was disabled in AST file{{.*}} but is currently enabled
45+
4446
// CHECK-NO-SUITABLE: no suitable precompiled header file found in directory
4547

4648
// CHECK-IGNORED-DIR: precompiled header directory '{{.*}}pch-dir.c.tmp.x.h.gch' was ignored because it contains no clang PCH files

0 commit comments

Comments
 (0)