Re-applied in r222765. /me goes watching the bots... On Mon Nov 24 2014 at 6:48:07 PM Aaron Ballman <[email protected]> wrote:
> Author: aaronballman > Date: Mon Nov 24 11:39:44 2014 > New Revision: 222667 > > URL: http://llvm.org/viewvc/llvm-project?rev=222667&view=rev > Log: > Reverting r222646; the tests do not pass on Windows. Also reverts r222664, > which was required for r222646 to compile with Visual Studio 2012. > > Modified: > cfe/trunk/docs/LibASTMatchersReference.html > cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h > cfe/trunk/include/clang/Tooling/Tooling.h > cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp > cfe/trunk/lib/Tooling/Tooling.cpp > cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp > cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h > > Modified: cfe/trunk/docs/LibASTMatchersReference.html > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ > LibASTMatchersReference.html?rev=222667&r1=222666&r2=222667&view=diff > ============================================================ > ================== > --- cfe/trunk/docs/LibASTMatchersReference.html (original) > +++ cfe/trunk/docs/LibASTMatchersReference.html Mon Nov 24 11:39:44 2014 > @@ -307,16 +307,6 @@ Example matches X, Z > </pre></td></tr> > > > -<tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" > onclick="toggle('typedefDecl0')"><a name="typedefDecl0Anchor"> > typedefDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1TypedefDecl.html">TypedefDecl</a>>...</td></tr> > -<tr><td colspan="4" class="doc" id="typedefDecl0"><pre>Matches typedef > declarations. > - > -Given > - typedef int X; > -typedefDecl() > - matches "typedef int X" > -</pre></td></tr> > - > - > <tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" > onclick="toggle('unresolvedUsingValueDecl0')"><a name=" > unresolvedUsingValueDecl0Anchor">unresolvedUsingValueDecl</a></td><td>Matcher<<a > href="http://clang.llvm.org/doxygen/classclang_1_ > 1UnresolvedUsingValueDecl.html">UnresolvedUsingValueDecl</a> > >...</td></tr> > <tr><td colspan="4" class="doc" id="unresolvedUsingValueDecl0"><pre>Matches > unresolved using value declarations. > > @@ -349,15 +339,6 @@ usingDirectiveDecl() > matches using namespace X </pre></td></tr> > > > -<tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" > onclick="toggle('valueDecl0')"><a name="valueDecl0Anchor"> > valueDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>>...</td></tr> > -<tr><td colspan="4" class="doc" id="valueDecl0"><pre>Matches any value > declaration. > - > -Example matches A, B, C and F > - enum X { A, B, C }; > - void F(); > -</pre></td></tr> > - > - > <tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" > onclick="toggle('varDecl0')"><a > name="varDecl0Anchor">varDecl</a></td><td>Matcher<<a > href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html > ">VarDecl</a>>...</td></tr> > <tr><td colspan="4" class="doc" id="varDecl0"><pre>Matches variable > declarations. > > @@ -1673,48 +1654,6 @@ f. > </pre></td></tr> > > > -<tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" > onclick="toggle('isExpansionInFileMatching0')"><a name=" > isExpansionInFileMatching0Anchor">isExpansionInFileMatching</a></td><td>std::string > RegExp</td></tr> > -<tr><td colspan="4" class="doc" id="isExpansionInFileMatching0"><pre>Matches > AST nodes that were expanded within files whose name is > -partially matching a given regex. > - > -Example matches Y but not X > - (matcher = recordDecl(isExpansionInFileMatching("AST.*")) > - #include "ASTMatcher.h" > - class X {}; > -ASTMatcher.h: > - class Y {}; > - > -Usable as: Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href=" > http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, > Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc. > html">TypeLoc</a>> > -</pre></td></tr> > - > - > -<tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" > onclick="toggle('isExpansionInMainFile0')"><a name=" > isExpansionInMainFile0Anchor">isExpansionInMainFile</a></td><td></td></tr> > -<tr><td colspan="4" class="doc" id="isExpansionInMainFile0"><pre>Matches > AST nodes that were expanded within the main-file. > - > -Example matches X but not Y (matcher = recordDecl( > isExpansionInMainFile()) > - #include <Y.h> > - class X {}; > -Y.h: > - class Y {}; > - > -Usable as: Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href=" > http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, > Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc. > html">TypeLoc</a>> > -</pre></td></tr> > - > - > -<tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" > onclick="toggle('isExpansionInSystemHeader0')"><a name=" > isExpansionInSystemHeader0Anchor">isExpansionInSystemHeader< > /a></td><td></td></tr> > -<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader0"><pre>Matches > AST nodes that were expanded within system-header-files. > - > -Example matches Y but not X > - (matcher = recordDecl(isExpansionInSystemHeader()) > - #include <SystemHeader.h> > - class X {}; > -SystemHeader.h: > - class Y {}; > - > -Usable as: Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href=" > http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, > Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc. > html">TypeLoc</a>> > -</pre></td></tr> > - > - > <tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" > onclick="toggle('isImplicit0')"><a name="isImplicit0Anchor"> > isImplicit</a></td><td></td></tr> > <tr><td colspan="4" class="doc" id="isImplicit0"><pre>Matches a > declaration that has been implicitly added > by the compiler (eg. implicit defaultcopy constructors). > @@ -1919,7 +1858,7 @@ memberExpr(isArrow()) > </pre></td></tr> > > > -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_ > 1NamedDecl.html">NamedDecl</a>></td><td class="name" > onclick="toggle('hasName0')"><a > name="hasName0Anchor">hasName</a></td><td>std::string > Name</td></tr> > +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_ > 1NamedDecl.html">NamedDecl</a>></td><td class="name" > onclick="toggle('hasName0')"><a > name="hasName0Anchor">hasName</a></td><td>std::string > Name</td></tr> > <tr><td colspan="4" class="doc" id="hasName0"><pre>Matches NamedDecl > nodes that have the specified name. > > Supports specifying enclosing namespaces or classes by prefixing the name > @@ -2051,48 +1990,6 @@ and reference to that variable declarati > </pre></td></tr> > > > -<tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" > onclick="toggle('isExpansionInFileMatching1')"><a name=" > isExpansionInFileMatching1Anchor">isExpansionInFileMatching</a></td><td>std::string > RegExp</td></tr> > -<tr><td colspan="4" class="doc" id="isExpansionInFileMatching1"><pre>Matches > AST nodes that were expanded within files whose name is > -partially matching a given regex. > - > -Example matches Y but not X > - (matcher = recordDecl(isExpansionInFileMatching("AST.*")) > - #include "ASTMatcher.h" > - class X {}; > -ASTMatcher.h: > - class Y {}; > - > -Usable as: Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href=" > http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, > Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc. > html">TypeLoc</a>> > -</pre></td></tr> > - > - > -<tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" > onclick="toggle('isExpansionInMainFile1')"><a name=" > isExpansionInMainFile1Anchor">isExpansionInMainFile</a></td><td></td></tr> > -<tr><td colspan="4" class="doc" id="isExpansionInMainFile1"><pre>Matches > AST nodes that were expanded within the main-file. > - > -Example matches X but not Y (matcher = recordDecl( > isExpansionInMainFile()) > - #include <Y.h> > - class X {}; > -Y.h: > - class Y {}; > - > -Usable as: Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href=" > http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, > Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc. > html">TypeLoc</a>> > -</pre></td></tr> > - > - > -<tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" > onclick="toggle('isExpansionInSystemHeader1')"><a name=" > isExpansionInSystemHeader1Anchor">isExpansionInSystemHeader< > /a></td><td></td></tr> > -<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader1"><pre>Matches > AST nodes that were expanded within system-header-files. > - > -Example matches Y but not X > - (matcher = recordDecl(isExpansionInSystemHeader()) > - #include <SystemHeader.h> > - class X {}; > -SystemHeader.h: > - class Y {}; > - > -Usable as: Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href=" > http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, > Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc. > html">TypeLoc</a>> > -</pre></td></tr> > - > - > <tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" > onclick="toggle('isInTemplateInstantiation0')"><a name=" > isInTemplateInstantiation0Anchor">isInTemplateInstantiation< > /a></td><td></td></tr> > <tr><td colspan="4" class="doc" id="isInTemplateInstantiation0"><pre>Matches > statements inside of a template instantiation. > > @@ -2164,48 +2061,6 @@ classTemplateSpecializationDecl(template > </pre></td></tr> > > > -<tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td><td class="name" > onclick="toggle('isExpansionInFileMatching2')"><a name=" > isExpansionInFileMatching2Anchor">isExpansionInFileMatching</a></td><td>std::string > RegExp</td></tr> > -<tr><td colspan="4" class="doc" id="isExpansionInFileMatching2"><pre>Matches > AST nodes that were expanded within files whose name is > -partially matching a given regex. > - > -Example matches Y but not X > - (matcher = recordDecl(isExpansionInFileMatching("AST.*")) > - #include "ASTMatcher.h" > - class X {}; > -ASTMatcher.h: > - class Y {}; > - > -Usable as: Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href=" > http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, > Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc. > html">TypeLoc</a>> > -</pre></td></tr> > - > - > -<tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td><td class="name" > onclick="toggle('isExpansionInMainFile2')"><a name=" > isExpansionInMainFile2Anchor">isExpansionInMainFile</a></td><td></td></tr> > -<tr><td colspan="4" class="doc" id="isExpansionInMainFile2"><pre>Matches > AST nodes that were expanded within the main-file. > - > -Example matches X but not Y (matcher = recordDecl( > isExpansionInMainFile()) > - #include <Y.h> > - class X {}; > -Y.h: > - class Y {}; > - > -Usable as: Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href=" > http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, > Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc. > html">TypeLoc</a>> > -</pre></td></tr> > - > - > -<tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td><td class="name" > onclick="toggle('isExpansionInSystemHeader2')"><a name=" > isExpansionInSystemHeader2Anchor">isExpansionInSystemHeader< > /a></td><td></td></tr> > -<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader2"><pre>Matches > AST nodes that were expanded within system-header-files. > - > -Example matches Y but not X > - (matcher = recordDecl(isExpansionInSystemHeader()) > - #include <SystemHeader.h> > - class X {}; > -SystemHeader.h: > - class Y {}; > - > -Usable as: Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href=" > http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, > Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc. > html">TypeLoc</a>> > -</pre></td></tr> > - > - > <tr><td>Matcher<<a href="http://clang.llvm.org/ > doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" > onclick="toggle('equalsBoundNode2')"><a name="equalsBoundNode2Anchor"> > equalsBoundNode</a></td><td>std::string ID</td></tr> > <tr><td colspan="4" class="doc" id="equalsBoundNode2"><pre>Matches if a > node equals a previously bound node. > > > Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/ > clang/ASTMatchers/ASTMatchers.h?rev=222667&r1=222666&r2=222667&view=diff > ============================================================ > ================== > --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original) > +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Mon Nov 24 11:39:44 > 2014 > @@ -47,7 +47,6 @@ > > #include "clang/AST/DeclFriend.h" > #include "clang/AST/DeclTemplate.h" > -#include "clang/AST/ASTContext.h" > #include "clang/ASTMatchers/ASTMatchersInternal.h" > #include "clang/ASTMatchers/ASTMatchersMacros.h" > #include "llvm/ADT/Twine.h" > @@ -143,97 +142,6 @@ typedef internal::Matcher<NestedNameSpec > /// Usable as: Any Matcher > inline internal::TrueMatcher anything() { return internal::TrueMatcher(); > } > > -/// \brief Matches typedef declarations. > -/// > -/// Given > -/// \code > -/// typedef int X; > -/// \endcode > -/// typedefDecl() > -/// matches "typedef int X" > -const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl> > typedefDecl; > - > -/// \brief Matches AST nodes that were expanded within the main-file. > -/// > -/// Example matches X but not Y (matcher = recordDecl( > isExpansionInMainFile()) > -/// \code > -/// #include <Y.h> > -/// class X {}; > -/// \endcode > -/// Y.h: > -/// \code > -/// class Y {}; > -/// \endcode > -/// > -/// Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc> > -AST_POLYMORPHIC_MATCHER(isExpansionInMainFile, > - AST_POLYMORPHIC_SUPPORTED_TYPES_3(Decl, Stmt, > - TypeLoc)) { > - auto &SourceManager = Finder->getASTContext().getSourceManager(); > - return SourceManager.isInMainFile( > - SourceManager.getExpansionLoc(Node.getLocStart())); > -} > - > -/// \brief Matches AST nodes that were expanded within > system-header-files. > -/// > -/// Example matches Y but not X > -/// (matcher = recordDecl(isExpansionInSystemHeader()) > -/// \code > -/// #include <SystemHeader.h> > -/// class X {}; > -/// \endcode > -/// SystemHeader.h: > -/// \code > -/// class Y {}; > -/// \endcode > -/// > -/// Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc> > -AST_POLYMORPHIC_MATCHER(isExpansionInSystemHeader, > - AST_POLYMORPHIC_SUPPORTED_TYPES_3(Decl, Stmt, > - TypeLoc)) { > - auto &SourceManager = Finder->getASTContext().getSourceManager(); > - auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getLocStart()); > - if (ExpansionLoc.isInvalid()) { > - return false; > - } > - return SourceManager.isInSystemHeader(ExpansionLoc); > -} > - > -/// \brief Matches AST nodes that were expanded within files whose name is > -/// partially matching a given regex. > -/// > -/// Example matches Y but not X > -/// (matcher = recordDecl(isExpansionInFileMatching("AST.*")) > -/// \code > -/// #include "ASTMatcher.h" > -/// class X {}; > -/// \endcode > -/// ASTMatcher.h: > -/// \code > -/// class Y {}; > -/// \endcode > -/// > -/// Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc> > -AST_POLYMORPHIC_MATCHER_P(isExpansionInFileMatching, > - AST_POLYMORPHIC_SUPPORTED_TYPES_3(Decl, Stmt, > - TypeLoc), > - std::string, RegExp) { > - auto &SourceManager = Finder->getASTContext().getSourceManager(); > - auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getLocStart()); > - if (ExpansionLoc.isInvalid()) { > - return false; > - } > - auto FileEntry = > - SourceManager.getFileEntryForID(SourceManager.getFileID( > ExpansionLoc)); > - if (!FileEntry) { > - return false; > - } > - > - auto Filename = FileEntry->getName(); > - llvm::Regex RE(RegExp); > - return RE.match(Filename); > -} > - > /// \brief Matches declarations. > /// > /// Examples matches \c X, \c C, and the friend declaration inside \c C; > > Modified: cfe/trunk/include/clang/Tooling/Tooling.h > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/ > clang/Tooling/Tooling.h?rev=222667&r1=222666&r2=222667&view=diff > ============================================================ > ================== > --- cfe/trunk/include/clang/Tooling/Tooling.h (original) > +++ cfe/trunk/include/clang/Tooling/Tooling.h Mon Nov 24 11:39:44 2014 > @@ -143,10 +143,6 @@ inline std::unique_ptr<FrontendActionFac > bool runToolOnCode(clang::FrontendAction *ToolAction, const Twine &Code, > const Twine &FileName = "input.cc"); > > -/// The first part of the pair is the filename, the second part the > -/// file-content. > -typedef std::vector<std::pair<std::string, std::string>> > FileContentMappings; > - > /// \brief Runs (and deletes) the tool on 'Code' with the -fsyntax-only > flag and > /// with additional other flags. > /// > @@ -156,10 +152,9 @@ typedef std::vector<std::pair<std::strin > /// \param FileName The file name which 'Code' will be mapped as. > /// > /// \return - True if 'ToolAction' was successfully executed. > -bool runToolOnCodeWithArgs( > - clang::FrontendAction *ToolAction, const Twine &Code, > - const std::vector<std::string> &Args, const Twine &FileName = > "input.cc", > - const FileContentMappings &VirtualMappedFiles = > FileContentMappings()); > +bool runToolOnCodeWithArgs(clang::FrontendAction *ToolAction, const > Twine &Code, > + const std::vector<std::string> &Args, > + const Twine &FileName = "input.cc"); > > /// \brief Builds an AST for 'Code'. > /// > > Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ > ASTMatchers/Dynamic/Registry.cpp?rev=222667&r1=222666&r2=222667&view=diff > ============================================================ > ================== > --- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original) > +++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Mon Nov 24 11:39:44 > 2014 > @@ -242,10 +242,7 @@ RegistryMaps::RegistryMaps() { > REGISTER_MATCHER(isExpr); > REGISTER_MATCHER(isExternC); > REGISTER_MATCHER(isImplicit); > - REGISTER_MATCHER(isExpansionInFileMatching); > - REGISTER_MATCHER(isExpansionInMainFile); > REGISTER_MATCHER(isInstantiated); > - REGISTER_MATCHER(isExpansionInSystemHeader); > REGISTER_MATCHER(isInteger); > REGISTER_MATCHER(isIntegral); > REGISTER_MATCHER(isInTemplateInstantiation); > @@ -317,7 +314,6 @@ RegistryMaps::RegistryMaps() { > REGISTER_MATCHER(to); > REGISTER_MATCHER(tryStmt); > REGISTER_MATCHER(type); > - REGISTER_MATCHER(typedefDecl); > REGISTER_MATCHER(typedefType); > REGISTER_MATCHER(typeLoc); > REGISTER_MATCHER(unaryExprOrTypeTraitExpr); > > Modified: cfe/trunk/lib/Tooling/Tooling.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/ > Tooling.cpp?rev=222667&r1=222666&r2=222667&view=diff > ============================================================ > ================== > --- cfe/trunk/lib/Tooling/Tooling.cpp (original) > +++ cfe/trunk/lib/Tooling/Tooling.cpp Mon Nov 24 11:39:44 2014 > @@ -123,25 +123,17 @@ getSyntaxOnlyToolArgs(const std::vector< > > bool runToolOnCodeWithArgs(clang::FrontendAction *ToolAction, const > Twine &Code, > const std::vector<std::string> &Args, > - const Twine &FileName, > - const FileContentMappings &VirtualMappedFiles) > { > - > + const Twine &FileName) { > SmallString<16> FileNameStorage; > StringRef FileNameRef = FileName.toNullTerminatedStringRef( > FileNameStorage); > llvm::IntrusiveRefCntPtr<FileManager> Files( > new FileManager(FileSystemOptions())); > - ToolInvocation Invocation(getSyntaxOnlyToolArgs(Args, FileNameRef), > - ToolAction, Files.get()); > + ToolInvocation Invocation(getSyntaxOnlyToolArgs(Args, FileNameRef), > ToolAction, > + Files.get()); > > SmallString<1024> CodeStorage; > Invocation.mapVirtualFile(FileNameRef, > Code.toNullTerminatedStringRef(CodeStorage)); > - > - for (auto &FilenameWithContent : VirtualMappedFiles) { > - Invocation.mapVirtualFile(FilenameWithContent.first, > - FilenameWithContent.second); > - } > - > return Invocation.run(); > } > > > Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ > ASTMatchers/ASTMatchersTest.cpp?rev=222667&r1=222666&r2=222667&view=diff > ============================================================ > ================== > --- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original) > +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Mon Nov 24 > 11:39:44 2014 > @@ -4625,53 +4625,5 @@ TEST(EqualsBoundNodeMatcher, UnlessDesce > .bind("data"))); > } > > -TEST(TypeDefDeclMatcher, Match) { > - EXPECT_TRUE(matches("typedef int typedefDeclTest;", > - typedefDecl(hasName("typedefDeclTest")))); > -} > - > -TEST(Matcher, IsExpansionInMainFileMatcher) { > - EXPECT_TRUE(matches("class X {};", > - recordDecl(hasName("X"), isExpansionInMainFile()))); > - EXPECT_TRUE(notMatches("", recordDecl(isExpansionInMainFile()))); > - FileContentMappings M; > - M.push_back(std::make_pair("/other", "class X {};")); > - EXPECT_TRUE(matchesConditionally("#include <other>\n", > - recordDecl(isExpansionInMainFile()), > false, > - "-isystem/", M)); > -} > - > -TEST(Matcher, IsExpansionInSystemHeader) { > - FileContentMappings M; > - M.push_back(std::make_pair("/other", "class X {};")); > - EXPECT_TRUE(matchesConditionally( > - "#include \"other\"\n", recordDecl(isExpansionInSystemHeader()), > true, > - "-isystem/", M)); > - EXPECT_TRUE(matchesConditionally("#include \"other\"\n", > - recordDecl( > isExpansionInSystemHeader()), > - false, "-I/", M)); > - EXPECT_TRUE(notMatches("class X {};", > - recordDecl(isExpansionInSystemHeader()))); > - EXPECT_TRUE(notMatches("", recordDecl(isExpansionInSystemHeader()))); > -} > - > -TEST(Matcher, IsExpansionInFileMatching) { > - FileContentMappings M; > - M.push_back(std::make_pair("/foo", "class A {};")); > - M.push_back(std::make_pair("/bar", "class B {};")); > - EXPECT_TRUE(matchesConditionally( > - "#include <foo>\n" > - "#include <bar>\n" > - "class X {};", > - recordDecl(isExpansionInFileMatching("b.*"), hasName("B")), true, > - "-isystem/", M)); > - EXPECT_TRUE(matchesConditionally( > - "#include <foo>\n" > - "#include <bar>\n" > - "class X {};", > - recordDecl(isExpansionInFileMatching("f.*"), hasName("X")), false, > - "-isystem/", M)); > -} > - > } // end namespace ast_matchers > } // end namespace clang > > Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ > ASTMatchers/ASTMatchersTest.h?rev=222667&r1=222666&r2=222667&view=diff > ============================================================ > ================== > --- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h (original) > +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h Mon Nov 24 11:39:44 > 2014 > @@ -22,7 +22,6 @@ using clang::tooling::buildASTFromCodeWi > using clang::tooling::newFrontendActionFactory; > using clang::tooling::runToolOnCodeWithArgs; > using clang::tooling::FrontendActionFactory; > -using clang::tooling::FileContentMappings; > > class BoundNodesCallback { > public: > @@ -59,10 +58,10 @@ private: > }; > > template <typename T> > -testing::AssertionResult matchesConditionally( > - const std::string &Code, const T &AMatcher, bool ExpectMatch, > - llvm::StringRef CompileArg, > - const FileContentMappings &VirtualMappedFiles = > FileContentMappings()) { > +testing::AssertionResult matchesConditionally(const std::string &Code, > + const T &AMatcher, > + bool ExpectMatch, > + llvm::StringRef CompileArg) > { > bool Found = false, DynamicFound = false; > MatchFinder Finder; > VerifyMatch VerifyFound(nullptr, &Found); > @@ -74,8 +73,7 @@ testing::AssertionResult matchesConditio > newFrontendActionFactory(&Finder)); > // Some tests use typeof, which is a gnu extension. > std::vector<std::string> Args(1, CompileArg); > - if (!runToolOnCodeWithArgs(Factory->create(), Code, Args, "input.cc", > - VirtualMappedFiles)) { > + if (!runToolOnCodeWithArgs(Factory->create(), Code, Args)) { > return testing::AssertionFailure() << "Parsing error in \"" << Code > << "\""; > } > if (Found != DynamicFound) { > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
