]> granicus.if.org Git - clang/commitdiff
Add a test for the -Wstring-plus-int fixit note.
authorNico Weber <nicolasweber@gmx.de>
Fri, 2 Mar 2012 23:01:20 +0000 (23:01 +0000)
committerNico Weber <nicolasweber@gmx.de>
Fri, 2 Mar 2012 23:01:20 +0000 (23:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151951 91177308-0d34-0410-b5e6-96231b3b80d8

test/SemaCXX/string-plus-int.cpp

index 3be3f07033e97c68e894d0aec0540ea9208ab5d9..5752f8f96631727579403bf81fd5d7b38b56c61d 100644 (file)
@@ -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}}