[PATCH] D41921: [Parse] Forward brace locations to TypeConstructExpr

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 10 15:22:10 PST 2018


vsk created this revision.
vsk added reviewers: rsmith, aaron.ballman, faisalv.

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.


https://reviews.llvm.org/D41921

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41921.129349.patch
Type: text/x-patch
Size: 30118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180110/73392aaa/attachment-0001.bin>


More information about the cfe-commits mailing list