llvm-capstone/clang
Nicolas Lesser 0276d12426 [SemaCXX] Fix ICE with structure bindings to members of template
Summary:
Trying to use structure binding with a structure that doesn't implement
std::tuple_size, should unpack the data members. When the struct is a
template though, clang might hit an assertion (if the type has not been
completed before), because CXXRecordDecl::DefinitionData is nullptr.

This commit fixes the problem by completing the type while trying to
decompose the structured binding.

The ICE happens in real world code, for example, when trying to iterate
a protobuf generated map with a range-based for loop and structure
bindings (because google::protobuf::MapPair is a template and doesn't
support std::tuple_size).

Reported-by: nicholas.sun@nlsun.com

Patch by Daniele Di Proietto

Reviewers: #clang, rsmith

Reviewed By: #clang, rsmith

Subscribers: cpplearner, Rakete1111, cfe-commits

Tags: #clang

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

llvm-svn: 352323
2019-01-27 19:19:59 +00:00
..
bindings Fix python3 compability issue in clang binding 2019-01-24 10:34:44 +00:00
cmake [CMake][Fuchsia] Enable hermetic static libc++abi for Fuchsia 2019-01-24 03:24:37 +00:00
docs Fix incorrect indent from r352221 2019-01-25 17:39:57 +00:00
examples
include [analyzer] Add CheckerManager::getChecker, make sure that a registry function registers no more than 1 checker 2019-01-26 21:41:50 +00:00
INPUTS
lib [SemaCXX] Fix ICE with structure bindings to members of template 2019-01-27 19:19:59 +00:00
runtime
test [SemaCXX] Fix ICE with structure bindings to members of template 2019-01-27 19:19:59 +00:00
tools Attempt to fix build on Windows with LLVM_ENABLE_PIC=OFF 2019-01-25 23:37:57 +00:00
unittests [clang-format] square parens with one token are not Objective-C message sends 2019-01-24 23:07:58 +00:00
utils [analyzer] Reimplement dependencies between checkers 2019-01-26 20:06:54 +00:00
www Mark the lambda function pointer conversion operator as noexcept. 2019-01-21 16:25:08 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
INSTALL.txt
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
ModuleInfo.txt
NOTES.txt
README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source-level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:             http://clang.llvm.org/
Building and using Clang:         http://clang.llvm.org/get_started.html
Clang Static Analyzer:            http://clang-analyzer.llvm.org/
Information on the LLVM project:  http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
  http://lists.llvm.org/mailman/listinfo/cfe-dev

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/