[clang-tools-extra] r207231 - Slightly less blindly fixing clang-tools-extra now that I remember that the "check-clang" target doesn't check clang-tools-extra

David Blaikie dblaikie at gmail.com
Fri Apr 25 08:21:44 PDT 2014


Author: dblaikie
Date: Fri Apr 25 10:21:43 2014
New Revision: 207231

URL: http://llvm.org/viewvc/llvm-project?rev=207231&view=rev
Log:
Slightly less blindly fixing clang-tools-extra now that I remember that the "check-clang" target doesn't check clang-tools-extra

Modified:
    clang-tools-extra/trunk/clang-query/Query.cpp
    clang-tools-extra/trunk/unittests/clang-query/QueryEngineTest.cpp
    clang-tools-extra/trunk/unittests/clang-query/QueryParserTest.cpp

Modified: clang-tools-extra/trunk/clang-query/Query.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/Query.cpp?rev=207231&r1=207230&r2=207231&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-query/Query.cpp (original)
+++ clang-tools-extra/trunk/clang-query/Query.cpp Fri Apr 25 10:21:43 2014
@@ -59,10 +59,7 @@ struct CollectBoundNodes : MatchFinder::
 bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
   unsigned MatchCount = 0;
 
-  for (llvm::ArrayRef<ASTUnit *>::iterator I = QS.ASTs.begin(),
-                                           E = QS.ASTs.end();
-       I != E; ++I) {
-    ASTUnit *AST = *I;
+  for (auto &AST : QS.ASTs) {
     MatchFinder Finder;
     std::vector<BoundNodes> Matches;
     DynTypedMatcher MaybeBoundMatcher = Matcher;

Modified: clang-tools-extra/trunk/unittests/clang-query/QueryEngineTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-query/QueryEngineTest.cpp?rev=207231&r1=207230&r2=207231&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-query/QueryEngineTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-query/QueryEngineTest.cpp Fri Apr 25 10:21:43 2014
@@ -26,23 +26,22 @@ using namespace clang::query;
 using namespace clang::tooling;
 
 class QueryEngineTest : public ::testing::Test {
-  ArrayRef<ASTUnit *> mkASTUnit2(ASTUnit *a, ASTUnit *b) {
-    ASTs[0] = a;
-    ASTs[1] = b;
-    return ArrayRef<ASTUnit *>(ASTs);
+  ArrayRef<std::unique_ptr<ASTUnit>> mkASTUnit2(std::unique_ptr<ASTUnit> a,
+                                                std::unique_ptr<ASTUnit> b) {
+    ASTs[0] = std::move(a);
+    ASTs[1] = std::move(b);
+    return ArrayRef<std::unique_ptr<ASTUnit>>(ASTs);
   }
 
 protected:
   QueryEngineTest()
-      : FooAST(buildASTFromCode("void foo1(void) {}\nvoid foo2(void) {}",
-                                "foo.cc")),
-        BarAST(buildASTFromCode("void bar1(void) {}\nvoid bar2(void) {}",
-                                "bar.cc")),
-        S(mkASTUnit2(FooAST.get(), BarAST.get())), OS(Str) {}
+      : S(mkASTUnit2(std::unique_ptr<ASTUnit>(buildASTFromCode(
+                         "void foo1(void) {}\nvoid foo2(void) {}", "foo.cc")),
+                     std::unique_ptr<ASTUnit>(buildASTFromCode(
+                         "void bar1(void) {}\nvoid bar2(void) {}", "bar.cc")))),
+        OS(Str) {}
 
-  std::unique_ptr<ASTUnit> FooAST;
-  std::unique_ptr<ASTUnit> BarAST;
-  ASTUnit *ASTs[2];
+  std::unique_ptr<ASTUnit> ASTs[2];
   QuerySession S;
 
   std::string Str;

Modified: clang-tools-extra/trunk/unittests/clang-query/QueryParserTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-query/QueryParserTest.cpp?rev=207231&r1=207230&r2=207231&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-query/QueryParserTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-query/QueryParserTest.cpp Fri Apr 25 10:21:43 2014
@@ -18,7 +18,7 @@ using namespace clang::query;
 
 class QueryParserTest : public ::testing::Test {
 protected:
-  QueryParserTest() : QS(llvm::ArrayRef<ASTUnit *>()) {}
+  QueryParserTest() : QS(llvm::ArrayRef<std::unique_ptr<ASTUnit>>()) {}
   QueryRef parse(StringRef Code) { return QueryParser::parse(Code, QS); }
 
   QuerySession QS;





More information about the cfe-commits mailing list