[all-commits] [llvm/llvm-project] 537cc6: Rename CXXUnresolvedConstructExpr::arg_size for co...

Stephen Kelly via All-commits all-commits at lists.llvm.org
Mon Nov 2 12:22:33 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 537cc6dd2b36a7219a9bbaa6bc6f32c99a1baae1
      https://github.com/llvm/llvm-project/commit/537cc6dd2b36a7219a9bbaa6bc6f32c99a1baae1
  Author: Stephen Kelly <steveire at gmail.com>
  Date:   2020-11-02 (Mon, 02 Nov 2020)

  Changed paths:
    M clang/include/clang/AST/ExprCXX.h
    M clang/include/clang/ASTMatchers/ASTMatchers.h
    M clang/lib/AST/ASTImporter.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/lib/Serialization/ASTReaderStmt.cpp
    M clang/lib/Serialization/ASTWriterStmt.cpp
    M clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp

  Log Message:
  -----------
  Rename CXXUnresolvedConstructExpr::arg_size for consistency

Make it possible to use argumentCountIs and hasArgument with
CXXUnresolvedConstructExpr.

Differential Revision: https://reviews.llvm.org/D90553


  Commit: 53df3beb624989ed32d87697d0c17601d7871465
      https://github.com/llvm/llvm-project/commit/53df3beb624989ed32d87697d0c17601d7871465
  Author: Stephen Kelly <steveire at gmail.com>
  Date:   2020-11-02 (Mon, 02 Nov 2020)

  Changed paths:
    M clang/include/clang/AST/ASTNodeTraverser.h
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/include/clang/ASTMatchers/ASTMatchersInternal.h
    M clang/lib/AST/ASTDumper.cpp
    M clang/lib/ASTMatchers/ASTMatchFinder.cpp
    M clang/lib/ASTMatchers/ASTMatchersInternal.cpp
    M clang/unittests/AST/ASTTraverserTest.cpp
    M clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
    M clang/unittests/Tooling/TransformerTest.cpp

  Log Message:
  -----------
  Ignore template instantiations if not in AsIs mode

Summary:
IgnoreUnlessSpelledInSource mode should ignore these because they are
not written in the source.  This matters for example when trying to
replace types or values which are templated.  The new test in
TransformerTest.cpp in this commit demonstrates the problem.

In existing matcher code, users can write
`unless(isInTemplateInstantiation())` or `unless(isInstantiated())` (the
user must know which to use).  The point of the
TK_IgnoreUnlessSpelledInSource mode is to allow the novice to avoid such
details.  This patch changes the IgnoreUnlessSpelledInSource mode to
skip over implicit template instantiations.

This patch does not change the TK_AsIs mode.

Note: An obvious attempt at an alternative implementation would simply
change the shouldVisitTemplateInstantiations() in ASTMatchFinder.cpp to
return something conditional on the operational TraversalKind.  That
does not work because shouldVisitTemplateInstantiations() is called
before a possible top-level traverse() matcher changes the operational
TraversalKind.

Reviewers: sammccall, aaron.ballman, gribozavr2, ymandel, klimek

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80961


Compare: https://github.com/llvm/llvm-project/compare/22113341d747...53df3beb6249


More information about the All-commits mailing list