Skip to content

Commit b948f5f

Browse files
committed
Merging r347261:
------------------------------------------------------------------------ r347261 | vedantk | 2018-11-19 12:10:21 -0800 (Mon, 19 Nov 2018) | 11 lines [Sema] Fix PR38987: keep end location of a direct initializer list If PerformConstructorInitialization of a direct initializer list constructor is called while instantiating a template, it has brace locations in its BraceLoc arguments but not in the Kind argument. This reverts the hunk https://reviews.llvm.org/D41921#inline-468844. Patch by Orivej Desh! Differential Revision: https://reviews.llvm.org/D53231 ------------------------------------------------------------------------ llvm-svn: 347797
1 parent e4023f8 commit b948f5f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

clang/lib/Sema/SemaInit.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6092,7 +6092,10 @@ PerformConstructorInitialization(Sema &S,
60926092
TypeSourceInfo *TSInfo = Entity.getTypeSourceInfo();
60936093
if (!TSInfo)
60946094
TSInfo = S.Context.getTrivialTypeSourceInfo(Entity.getType(), Loc);
6095-
SourceRange ParenOrBraceRange = Kind.getParenOrBraceRange();
6095+
SourceRange ParenOrBraceRange =
6096+
(Kind.getKind() == InitializationKind::IK_DirectList)
6097+
? SourceRange(LBraceLoc, RBraceLoc)
6098+
: Kind.getParenOrBraceRange();
60966099

60976100
if (auto *Shadow = dyn_cast<ConstructorUsingShadowDecl>(
60986101
Step.Function.FoundDecl.getDecl())) {

clang/test/SemaCXX/sourceranges.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ void construct() {
5252
// CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'D' 'void (int){{( __attribute__\(\(thiscall\)\))?}}'
5353
}
5454

55+
namespace PR38987 {
56+
struct A { A(); };
57+
template <class T> void f() { T{}; }
58+
template void f<A>();
59+
// CHECK: CXXTemporaryObjectExpr {{.*}} <col:31, col:33> 'PR38987::A':'PR38987::A'
60+
}
61+
5562
void abort() __attribute__((noreturn));
5663

5764
namespace std {

0 commit comments

Comments
 (0)