diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-05 05:55:57 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-05 05:55:57 +0000 |
commit | afbcab8d10d4208c7ad8da79e948432117d4a326 (patch) | |
tree | 8c38e1c2c2ad91ebc7e1f7cc54695b9adf9bf2d9 /lib/Sema/SemaExpr.cpp | |
parent | 7305e8c48df5fe373be431ef99399ae649721f3f (diff) |
PR15095: Use more correct source locations for the InitListExpr we fake up for
vector initialization. Patch by John Stratton!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174339 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 5b8b8fdcbf..0d046f15aa 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -4627,10 +4627,15 @@ ExprResult Sema::BuildVectorLiteral(SourceLocation LParenLoc, Expr **exprs; unsigned numExprs; Expr *subExpr; + SourceLocation LiteralLParenLoc, LiteralRParenLoc; if (ParenListExpr *PE = dyn_cast<ParenListExpr>(E)) { + LiteralLParenLoc = PE->getLParenLoc(); + LiteralRParenLoc = PE->getRParenLoc(); exprs = PE->getExprs(); numExprs = PE->getNumExprs(); - } else { + } else { // isa<ParenExpr> by assertion at function entrance + LiteralLParenLoc = cast<ParenExpr>(E)->getLParen(); + LiteralRParenLoc = cast<ParenExpr>(E)->getRParen(); subExpr = cast<ParenExpr>(E)->getSubExpr(); exprs = &subExpr; numExprs = 1; @@ -4687,8 +4692,8 @@ ExprResult Sema::BuildVectorLiteral(SourceLocation LParenLoc, } // FIXME: This means that pretty-printing the final AST will produce curly // braces instead of the original commas. - InitListExpr *initE = new (Context) InitListExpr(Context, LParenLoc, - initExprs, RParenLoc); + InitListExpr *initE = new (Context) InitListExpr(Context, LiteralLParenLoc, + initExprs, LiteralRParenLoc); initE->setType(Ty); return BuildCompoundLiteralExpr(LParenLoc, TInfo, RParenLoc, initE); } |