[PATCH] D57086: Ignore trailing NullStmts in StmtExprs for GCC compatibility

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 09:30:56 PDT 2019


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

In D57086#1535873 <https://reviews.llvm.org/D57086#1535873>, @domdom wrote:

> Sorry I it's taken me a while to get back to this work. I've rebased the changes and taken advantage of the refactoring to stop modifying the CompoundStmt after creating it. This definitely simplified the changes required in Stmt.h, which is nice.
>
> I've addressed the the need to update the TreeTransformer for the template case, and added a test case for that.


Thanks! I think this is looking good to me, but you should wait for the other reviewers before committing in case they have further concerns.

> Something I should ask, it seems like GCC only ignores the NullStmts at the end if it's in C mode. Should clang match this behaviour exactly?

I can't think of a reason that this should only happen in C mode, can you @rsmith?



================
Comment at: clang/test/SemaCXX/statements.cpp:41-52
+template<typename T>
+T test7(T v) {
+  return ({ // expected-warning{{use of GNU statement expression extension}}
+      T a = v;
+      a;;;
+  });
+}
----------------
Be sure to run the patch through clang-format.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57086/new/

https://reviews.llvm.org/D57086





More information about the cfe-commits mailing list