[frontend] Don't allow a mapping to a warning override an error/fatal mapping.

rdar://10736625

llvm-svn: 149662
This commit is contained in:
Chad Rosier 2012-02-03 01:49:51 +00:00
parent 1d261d1c0c
commit d1956e46dd
6 changed files with 13 additions and 6 deletions

View File

@ -172,6 +172,13 @@ void DiagnosticsEngine::setDiagnosticMapping(diag::kind Diag, diag::Mapping Map,
FullSourceLoc Loc(L, *SourceMgr);
FullSourceLoc LastStateChangePos = DiagStatePoints.back().Loc;
// Don't allow a mapping to a warning override an error/fatal mapping.
if (Map == diag::MAP_WARNING) {
DiagnosticMappingInfo &Info = GetCurDiagState()->getOrAddMappingInfo(Diag);
if (Info.getMapping() == diag::MAP_ERROR ||
Info.getMapping() == diag::MAP_FATAL)
Map = Info.getMapping();
}
DiagnosticMappingInfo MappingInfo = makeMappingInfo(Map, L);
// Common case; setting all the diagnostics of a group in one place.

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,experimental.deadcode.IdempotentOperations,experimental.core -std=gnu99 -analyzer-store=region -analyzer-constraints=range -analyzer-purge=none -verify %s -Wreturn-type
// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,experimental.deadcode.IdempotentOperations,experimental.core -std=gnu99 -analyzer-store=region -analyzer-constraints=range -verify %s -Wreturn-type
// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,experimental.deadcode.IdempotentOperations,experimental.core -std=gnu99 -analyzer-store=region -analyzer-constraints=range -analyzer-purge=none -verify %s -Wno-error=return-type
// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,experimental.deadcode.IdempotentOperations,experimental.core -std=gnu99 -analyzer-store=region -analyzer-constraints=range -verify %s -Wno-error=return-type
typedef unsigned uintptr_t;

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -Wreturn-type %s -emit-llvm-only
// RUN: %clang_cc1 -Wno-error=return-type %s -emit-llvm-only
void test1(int x) {
switch (x) {

View File

@ -1,4 +1,4 @@
// RUN: %clang %s -fsyntax-only -Wignored-qualifiers -Wreturn-type -Xclang -verify -fblocks -Wno-unreachable-code -Wno-unused-value
// RUN: %clang %s -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -Xclang -verify -fblocks -Wno-unreachable-code -Wno-unused-value
// clang emits the following warning by default.
// With GCC, -pedantic, -Wreturn-type or -Wall are required to produce the

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wnon-pod-varargs
// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wno-error=non-pod-varargs
extern char version[];

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -Wnon-pod-varargs
// RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-error=non-pod-varargs
extern char version[];