Improve diagnsotic further on integer overflow.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173461 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/DiagnosticASTKinds.td b/include/clang/Basic/DiagnosticASTKinds.td
index 7074e02..08369a5 100644
--- a/include/clang/Basic/DiagnosticASTKinds.td
+++ b/include/clang/Basic/DiagnosticASTKinds.td
@@ -107,7 +107,7 @@
"see all)">;
def note_constexpr_call_here : Note<"in call to '%0'">;
def warn_integer_constant_overflow : Warning<
- "overflow of constant expression results in value %0 of type %1">,
+ "overflow in expression;result is %0 with type %1">,
InGroup<DiagGroup<"integer-overflow">>;
// inline asm related.
diff --git a/test/Sema/switch-1.c b/test/Sema/switch-1.c
index 50129c3..4a5ded3 100644
--- a/test/Sema/switch-1.c
+++ b/test/Sema/switch-1.c
@@ -4,14 +4,15 @@
int f(int i) {
switch (i) {
- case 2147483647 + 2: // expected-warning {{overflow of constant expression results in value -2147483647 of type 'int'}}
+ case 2147483647 + 2: // expected-warning {{overflow in expression;result is -2147483647 with type 'int'}}
return 1;
- case 9223372036854775807L * 4: // expected-warning {{overflow of constant expression results in value -4 of type 'long'}}
+ case 9223372036854775807L * 4: // expected-warning {{overflow in expression;result is -4 with type 'long'}}
return 2;
- case (123456 *789012) + 1: // expected-warning {{overflow of constant expression results in value -1375982336 of type 'int'}}
+ case (123456 *789012) + 1: // expected-warning {{overflow in expression;result is -1375982336 with type 'int'}}
return 3;
case 2147483647:
return 0;
}
- return 0;
+ return (i, 65537) * 65537; // expected-warning {{overflow in expression;result is 131073 with type 'int'}} \
+ // expected-warning {{expression result unused}}
}