[cfe-commits] r151951 - /cfe/trunk/test/SemaCXX/string-plus-int.cpp
Nico Weber
nicolasweber at gmx.de
Fri Mar 2 15:01:20 PST 2012
Author: nico
Date: Fri Mar 2 17:01:20 2012
New Revision: 151951
URL: http://llvm.org/viewvc/llvm-project?rev=151951&view=rev
Log:
Add a test for the -Wstring-plus-int fixit note.
Modified:
cfe/trunk/test/SemaCXX/string-plus-int.cpp
Modified: cfe/trunk/test/SemaCXX/string-plus-int.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/string-plus-int.cpp?rev=151951&r1=151950&r2=151951&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/string-plus-int.cpp (original)
+++ cfe/trunk/test/SemaCXX/string-plus-int.cpp Fri Mar 2 17:01:20 2012
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-array-bounds %s -fpascal-strings
+// RUN: %clang_cc1 -fdiagnostics-parseable-fixits -x c++ %s 2>&1 -Wno-array-bounds -fpascal-strings | FileCheck %s
void consume(const char* c) {}
void consume(const unsigned char* c) {}
@@ -24,6 +25,9 @@
void f(int index) {
// Should warn.
+ // CHECK: fix-it:"{{.*}}":{31:11-31:11}:"&"
+ // CHECK: fix-it:"{{.*}}":{31:17-31:18}:"["
+ // CHECK: fix-it:"{{.*}}":{31:20-31:20}:"]"
consume("foo" + 5); // expected-warning {{adding 'int' to a string does not append to the string}} expected-note {{use array indexing to silence this warning}}
consume("foo" + index); // expected-warning {{adding 'int' to a string does not append to the string}} expected-note {{use array indexing to silence this warning}}
consume("foo" + kMyEnum); // expected-warning {{adding 'MyEnum' to a string does not append to the string}} expected-note {{use array indexing to silence this warning}}
More information about the cfe-commits
mailing list