]> granicus.if.org Git - clang/commit
[Parse] Forward brace locations to TypeConstructExpr
authorVedant Kumar <vsk@apple.com>
Wed, 17 Jan 2018 18:53:51 +0000 (18:53 +0000)
committerVedant Kumar <vsk@apple.com>
Wed, 17 Jan 2018 18:53:51 +0000 (18:53 +0000)
commit9ad8e839ccc3a19ac778c1db0def658f50db3e89
treefe2d4b12f863da549d10cc2aa538d35c291f81f1
parent77ca95f849e4b3d002b8e6a7cbf8c80b72703e1a
[Parse] Forward brace locations to TypeConstructExpr

When parsing C++ type construction expressions with list initialization,
forward the locations of the braces to Sema.

Without these locations, the code coverage pass crashes on the given test
case, because the pass relies on getLocEnd() returning a valid location.

Here is what this patch does in more detail:

  - Forwards init-list brace locations to Sema (ParseExprCXX),
  - Builds an InitializationKind with these locations (SemaExprCXX), and
  - Uses these locations for constructor initialization (SemaInit).

The remaining changes fall out of introducing a new overload for
creating direct-list InitializationKinds.

Testing: check-clang, and a stage2 coverage-enabled build of clang with
asserts enabled.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322729 91177308-0d34-0410-b5e6-96231b3b80d8
12 files changed:
include/clang/AST/ExprCXX.h
include/clang/Sema/Initialization.h
include/clang/Sema/Sema.h
lib/CodeGen/CoverageMappingGen.cpp
lib/Parse/ParseExprCXX.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaInit.cpp
lib/Sema/TreeTransform.h
test/CoverageMapping/classtemplate.cpp
test/SemaCXX/sourceranges.cpp