[PATCH] D21241: Add an ASTMatcher for ignoring ExprWithCleanups.

Etienne Bergeron via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 15 08:10:57 PDT 2016


etienneb added a subscriber: etienneb.
etienneb added a comment.

I was wondering why we didn't created that Matcher: IgnoreImplicit

I believe it's more commonly used than 'ignoringExprWithCleanups'.

It can be implemented by calling 'Stmt.IgnoreImplicit'.

  /// Skip past any implicit AST nodes which might surround this
  /// statement, such as ExprWithCleanups or ImplicitCastExpr nodes.
  Stmt *IgnoreImplicit();


================
Comment at: unittests/ASTMatchers/ASTMatchersTraversalTest.cpp:2018
@@ +2017,3 @@
+                             ignoringParenImpCasts(unless(anything())))))));
+  EXPECT_TRUE(notMatches("float y = (float(0));",
+                         varDecl(hasInitializer(ignoringExprWithCleanups(
----------------
nit: you can lift that expression to a local variable:

varDecl(hasInitializer(ignoringExprWithCleanups(
                             ignoringParenImpCasts(integerLiteral()))))))

It's used 3 times.


http://reviews.llvm.org/D21241





More information about the cfe-commits mailing list