hokein updated this revision to Diff 47795.
hokein added a comment.

Make test ignore all compliation errors.

http://reviews.llvm.org/D17134

Files:
  clang-tidy/readability/BracesAroundStatementsCheck.cpp
  test/clang-tidy/readability-braces-around-statements-assert-failure.cpp

Index: test/clang-tidy/readability-braces-around-statements-assert-failure.cpp
===================================================================
--- test/clang-tidy/readability-braces-around-statements-assert-failure.cpp
+++ test/clang-tidy/readability-braces-around-statements-assert-failure.cpp
@@ -1,7 +1,16 @@
-// RUN: %check_clang_tidy %s readability-braces-around-statements %t
+// RUN: clang-tidy -checks='-*,readability-braces-around-statements' %s 2>& 1 
| FileCheck -implicit-check-not='{{error:}}' %s
 
 int test_failure() {
   if (std::rand()) {
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: error: use of undeclared identifier 'std'
+  }
+}
+
+#include <vector>
+
+int test_failure2() {
+  std::vector<int> e;
+  for (typename std::vector<T>::const_reverse_iterator iter = e.rbegin(),
+                                                       end2 = e.rend();
+       ;++iter) {
   }
 }
Index: clang-tidy/readability/BracesAroundStatementsCheck.cpp
===================================================================
--- clang-tidy/readability/BracesAroundStatementsCheck.cpp
+++ clang-tidy/readability/BracesAroundStatementsCheck.cpp
@@ -215,6 +215,8 @@
     return false;
   }
 
+  if (!InitialLoc.isValid())
+    return false;
   const SourceManager &SM = *Result.SourceManager;
   const ASTContext *Context = Result.Context;
 
@@ -225,8 +227,6 @@
   if (FileRange.isInvalid())
     return false;
 
-  // InitialLoc points at the last token before opening brace to be inserted.
-  assert(InitialLoc.isValid());
   // Convert InitialLoc to file location, if it's on the same macro expansion
   // level as the start of the statement. We also need file locations for
   // Lexer::getLocForEndOfToken working properly.


Index: test/clang-tidy/readability-braces-around-statements-assert-failure.cpp
===================================================================
--- test/clang-tidy/readability-braces-around-statements-assert-failure.cpp
+++ test/clang-tidy/readability-braces-around-statements-assert-failure.cpp
@@ -1,7 +1,16 @@
-// RUN: %check_clang_tidy %s readability-braces-around-statements %t
+// RUN: clang-tidy -checks='-*,readability-braces-around-statements' %s 2>& 1 | FileCheck -implicit-check-not='{{error:}}' %s
 
 int test_failure() {
   if (std::rand()) {
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: error: use of undeclared identifier 'std'
+  }
+}
+
+#include <vector>
+
+int test_failure2() {
+  std::vector<int> e;
+  for (typename std::vector<T>::const_reverse_iterator iter = e.rbegin(),
+                                                       end2 = e.rend();
+       ;++iter) {
   }
 }
Index: clang-tidy/readability/BracesAroundStatementsCheck.cpp
===================================================================
--- clang-tidy/readability/BracesAroundStatementsCheck.cpp
+++ clang-tidy/readability/BracesAroundStatementsCheck.cpp
@@ -215,6 +215,8 @@
     return false;
   }
 
+  if (!InitialLoc.isValid())
+    return false;
   const SourceManager &SM = *Result.SourceManager;
   const ASTContext *Context = Result.Context;
 
@@ -225,8 +227,6 @@
   if (FileRange.isInvalid())
     return false;
 
-  // InitialLoc points at the last token before opening brace to be inserted.
-  assert(InitialLoc.isValid());
   // Convert InitialLoc to file location, if it's on the same macro expansion
   // level as the start of the statement. We also need file locations for
   // Lexer::getLocForEndOfToken working properly.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to