[PATCH] D65735: [AST] Fix RecursiveASTVisitor visiting implicit constructor initializers.
Johan Vikström via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 5 04:57:22 PDT 2019
jvikstrom marked an inline comment as done.
jvikstrom added inline comments.
================
Comment at: clang/unittests/Tooling/RecursiveASTVisitorTests/ImplicitCtorInitializer.cpp:29
+ if (!Init->isWritten())
+ VisitedImplicitInitializer = true;
+ Match("initializer", Init->getSourceLocation());
----------------
ilya-biryukov wrote:
> NIT: alternatively use different match identifiers for written and unwritten initializers:
> ```
> if (Init->isWritten())
> Match("written-inititiazlier", ...);
> else
> Match("implicit-initializer", ...);
>
> ...
> TEST() {
> Visitor.expectMatch("written-initializer");
> Visitor.disallowMatch("implicit-initializer"); // would that work with invalid source locs, though?
> }
> ```
>
> This allows to reuse the mechanism used by other tests without extra code. But up to you, definitely not a big deal.
disallowMatch requires a valid SourceLocation otherwise that would definitely be the way to do it.
Maybe that is something that should be added (the ability to disallow matches no matter what location) to ExpectedLocationVisitor?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65735/new/
https://reviews.llvm.org/D65735
More information about the cfe-commits
mailing list