[PATCH] D53048: [Basic] Split out -Wimplicit-int-conversion and -Wimplicit-float-conversion from -Wconversion
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 9 17:42:45 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL344101: [Basic] Split out -Wimplicit-int-conversion and -Wimplicit-float-conversion… (authored by epilk, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D53048?vs=168912&id=168924#toc
Repository:
rL LLVM
https://reviews.llvm.org/D53048
Files:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/Sema/implicit-int-conversion.c
Index: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
===================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td
@@ -59,6 +59,8 @@
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 @@
FloatConversion,
Shorten64To32,
IntConversion,
+ ImplicitIntConversion,
+ ImplicitFloatConversion,
LiteralConversion,
NonLiteralNullConversion, // (1-1)->pointer (etc)
NullConversion, // NULL->non-pointer
Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3181,10 +3181,10 @@
"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 @@
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;
Index: cfe/trunk/test/Sema/implicit-int-conversion.c
===================================================================
--- cfe/trunk/test/Sema/implicit-int-conversion.c
+++ cfe/trunk/test/Sema/implicit-int-conversion.c
@@ -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 at -2 {{implicit conversion}}
+#else
+ // expected-no-diagnostics
+#endif
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53048.168924.patch
Type: text/x-patch
Size: 3552 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181010/ebe4dda8/attachment.bin>
More information about the cfe-commits
mailing list