llvm-project/clang/lib/Parse
Zhihao Yuan c81f4538ec Allow conditions to be decomposed with structured bindings
Summary:
This feature was discussed but not yet proposed.  It allows a structured binding to appear as a //condition//

    if (auto [ok, val] = f(...))

So the user can save an extra //condition// if the statement can test the value to-be-decomposed instead.  Formally, it makes the value of the underlying object of the structured binding declaration also the value of a //condition// that is an initialized declaration.

Considering its logicality which is entirely evident from its trivial implementation, I think it might be acceptable to land it as an extension for now before I write the paper.

Reviewers: rsmith, faisalv, aaron.ballman

Reviewed By: rsmith

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 320011
2017-12-07 07:03:15 +00:00
..
CMakeLists.txt [CMake] Reorder libdeps by alphabetical order. 2014-07-14 04:59:27 +00:00
ParseAST.cpp C++ Modules TS: add frontend support for building pcm files from module 2016-08-26 00:14:38 +00:00
ParseCXXInlineMethods.cpp PR34163: Don't cache an incorrect key function for a class if queried between 2017-08-12 01:46:03 +00:00
ParseDecl.cpp Remove old concepts parsing code 2017-12-07 00:34:20 +00:00
ParseDeclCXX.cpp Now that C++17 is official (https://www.iso.org/standard/68564.html), start changing the C++1z terminology over to C++17. NFC intended, these are all mechanical changes. 2017-12-04 20:27:34 +00:00
ParseExpr.cpp Now that C++17 is official (https://www.iso.org/standard/68564.html), start changing the C++1z terminology over to C++17. NFC intended, these are all mechanical changes. 2017-12-04 20:27:34 +00:00
ParseExprCXX.cpp Allow conditions to be decomposed with structured bindings 2017-12-07 07:03:15 +00:00
ParseInit.cpp Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-01 21:23:52 +00:00
ParseObjc.cpp [Modules TS] Added module re-export support. 2017-11-21 09:42:42 +00:00
ParseOpenMP.cpp [OPENMP] Initial support for asynchronous data update, NFC. 2017-11-21 17:08:48 +00:00
ParsePragma.cpp Place implictly declared functions at block scope 2017-08-10 15:43:06 +00:00
ParseStmt.cpp Now that C++17 is official (https://www.iso.org/standard/68564.html), start changing the C++1z terminology over to C++17. NFC intended, these are all mechanical changes. 2017-12-04 20:27:34 +00:00
ParseStmtAsm.cpp Move MS inline asm parser methods out of line to reduce indentation, NFC 2017-10-26 17:07:48 +00:00
ParseTemplate.cpp Now that C++17 is official (https://www.iso.org/standard/68564.html), start changing the C++1z terminology over to C++17. NFC intended, these are all mechanical changes. 2017-12-04 20:27:34 +00:00
ParseTentative.cpp Remove old concepts parsing code 2017-12-07 00:34:20 +00:00
Parser.cpp [Modules TS] Added module re-export support. 2017-11-21 09:42:42 +00:00