diff options
author | Nico Weber <nicolasweber@gmx.de> | 2012-03-02 23:01:20 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2012-03-02 23:01:20 +0000 |
commit | 9b9ebfc0906bec979da04f2956eec4dafa151849 (patch) | |
tree | 692c5ad81c2422864b6336674f064a8efb7f6544 /clang/test/SemaCXX/string-plus-int.cpp | |
parent | fc5dfe9f7cafebfc0b8cdee36082a6ef5eb24488 (diff) | |
download | bcm5719-llvm-9b9ebfc0906bec979da04f2956eec4dafa151849.tar.gz bcm5719-llvm-9b9ebfc0906bec979da04f2956eec4dafa151849.zip |
Add a test for the -Wstring-plus-int fixit note.
llvm-svn: 151951
Diffstat (limited to 'clang/test/SemaCXX/string-plus-int.cpp')
-rw-r--r-- | clang/test/SemaCXX/string-plus-int.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/string-plus-int.cpp b/clang/test/SemaCXX/string-plus-int.cpp index 3be3f07033e..5752f8f9663 100644 --- a/clang/test/SemaCXX/string-plus-int.cpp +++ b/clang/test/SemaCXX/string-plus-int.cpp @@ -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 @@ const char* operator+(OperatorOverloadEnum e, const char* c) { 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}} |