forked from OSchip/llvm-project
[Basic] Split out -Wimplicit-int-conversion and -Wimplicit-float-conversion from -Wconversion
These two diagnostics are noisy, so its reasonable for users to opt-out of them when -Wconversion is enabled. rdar://45058981 Differential revision: https://reviews.llvm.org/D53048 llvm-svn: 344101
This commit is contained in:
parent
8bddfdd59c
commit
abbc51e5c3
|
@ -59,6 +59,8 @@ def BoolConversion : DiagGroup<"bool-conversion", [PointerBoolConversion,
|
|||
UndefinedBoolConversion]>;
|
||||
def IntConversion : DiagGroup<"int-conversion">;
|
||||
def EnumConversion : DiagGroup<"enum-conversion">;
|
||||
def ImplicitIntConversion : DiagGroup<"implicit-int-conversion">;
|
||||
def ImplicitFloatConversion : DiagGroup<"implicit-float-conversion">;
|
||||
|
||||
def FloatOverflowConversion : DiagGroup<"float-overflow-conversion">;
|
||||
def FloatZeroConversion : DiagGroup<"float-zero-conversion">;
|
||||
|
@ -709,6 +711,8 @@ def Conversion : DiagGroup<"conversion",
|
|||
FloatConversion,
|
||||
Shorten64To32,
|
||||
IntConversion,
|
||||
ImplicitIntConversion,
|
||||
ImplicitFloatConversion,
|
||||
LiteralConversion,
|
||||
NonLiteralNullConversion, // (1-1)->pointer (etc)
|
||||
NullConversion, // NULL->non-pointer
|
||||
|
|
|
@ -3181,10 +3181,10 @@ def err_impcast_complex_scalar : Error<
|
|||
"implicit conversion from %0 to %1 is not permitted in C++">;
|
||||
def warn_impcast_float_precision : Warning<
|
||||
"implicit conversion loses floating-point precision: %0 to %1">,
|
||||
InGroup<Conversion>, DefaultIgnore;
|
||||
InGroup<ImplicitFloatConversion>, DefaultIgnore;
|
||||
def warn_impcast_float_result_precision : Warning<
|
||||
"implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
|
||||
InGroup<Conversion>, DefaultIgnore;
|
||||
InGroup<ImplicitFloatConversion>, DefaultIgnore;
|
||||
def warn_impcast_double_promotion : Warning<
|
||||
"implicit conversion increases floating-point precision: %0 to %1">,
|
||||
InGroup<DoublePromotion>, DefaultIgnore;
|
||||
|
@ -3196,10 +3196,10 @@ def warn_impcast_integer_sign_conditional : Warning<
|
|||
InGroup<SignConversion>, DefaultIgnore;
|
||||
def warn_impcast_integer_precision : Warning<
|
||||
"implicit conversion loses integer precision: %0 to %1">,
|
||||
InGroup<Conversion>, DefaultIgnore;
|
||||
InGroup<ImplicitIntConversion>, DefaultIgnore;
|
||||
def warn_impcast_high_order_zero_bits : Warning<
|
||||
"higher order bits are zeroes after implicit conversion">,
|
||||
InGroup<Conversion>, DefaultIgnore;
|
||||
InGroup<ImplicitIntConversion>, DefaultIgnore;
|
||||
def warn_impcast_nonnegative_result : Warning<
|
||||
"the resulting value is always non-negative after implicit conversion">,
|
||||
InGroup<SignConversion>, DefaultIgnore;
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// RUN: %clang_cc1 %s -verify -Wconversion -Wno-implicit-int-conversion -DSMALL=char -DBIG=int -DNO_DIAG
|
||||
// RUN: %clang_cc1 %s -verify -Wno-conversion -Wimplicit-int-conversion -DSMALL=char -DBIG=int
|
||||
// RUN: %clang_cc1 %s -verify -Wconversion -Wno-implicit-float-conversion -DSMALL=float -DBIG=double -DNO_DIAG
|
||||
// RUN: %clang_cc1 %s -verify -Wno-conversion -Wimplicit-float-conversion -DSMALL=float -DBIG=double
|
||||
|
||||
void f() {
|
||||
SMALL a;
|
||||
BIG b = 0;
|
||||
a = b;
|
||||
#ifndef NO_DIAG
|
||||
// expected-warning@-2 {{implicit conversion}}
|
||||
#else
|
||||
// expected-no-diagnostics
|
||||
#endif
|
||||
}
|
Loading…
Reference in New Issue