diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2010-10-25 08:47:36 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2010-10-25 08:47:36 +0000 |
commit | 428edafa9eb80e01dd40aab31d4166a787a741e1 (patch) | |
tree | 618b88a0399873548adeeeb442cb87be3426862d /lib/Sema/SemaDeclCXX.cpp | |
parent | 8c5e5d6d8a316af5a9842169f541cac49717887d (diff) |
Improve the tracking of source locations for parentheses in constructor calls.
This adds them where missing, and traces them through PCH. We fix at least one
bug in the extents found by the Index library, and make a lot of refactoring
tools which care about the exact formulation of a constructor call easier to
write. Also some minor cleanups to more consistently follow the friend pattern
instead of the setter pattern when rebuilding a serialized AST.
Patch originally by Samuel Benzaquen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117254 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 564dab49de..fcd0dcdfea 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -5365,7 +5365,8 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, CXXConstructorDecl *Constructor, MultiExprArg ExprArgs, bool RequiresZeroInit, - unsigned ConstructKind) { + unsigned ConstructKind, + SourceRange ParenRange) { bool Elidable = false; // C++0x [class.copy]p34: @@ -5386,7 +5387,7 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, return BuildCXXConstructExpr(ConstructLoc, DeclInitType, Constructor, Elidable, move(ExprArgs), RequiresZeroInit, - ConstructKind); + ConstructKind, ParenRange); } /// BuildCXXConstructExpr - Creates a complete call to a constructor, @@ -5396,7 +5397,8 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, CXXConstructorDecl *Constructor, bool Elidable, MultiExprArg ExprArgs, bool RequiresZeroInit, - unsigned ConstructKind) { + unsigned ConstructKind, + SourceRange ParenRange) { unsigned NumExprs = ExprArgs.size(); Expr **Exprs = (Expr **)ExprArgs.release(); @@ -5404,15 +5406,18 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, return Owned(CXXConstructExpr::Create(Context, DeclInitType, ConstructLoc, Constructor, Elidable, Exprs, NumExprs, RequiresZeroInit, - static_cast<CXXConstructExpr::ConstructionKind>(ConstructKind))); + static_cast<CXXConstructExpr::ConstructionKind>(ConstructKind), + ParenRange)); } bool Sema::InitializeVarWithConstructor(VarDecl *VD, CXXConstructorDecl *Constructor, MultiExprArg Exprs) { + // FIXME: Provide the correct paren SourceRange when available. ExprResult TempResult = BuildCXXConstructExpr(VD->getLocation(), VD->getType(), Constructor, - move(Exprs), false, CXXConstructExpr::CK_Complete); + move(Exprs), false, CXXConstructExpr::CK_Complete, + SourceRange()); if (TempResult.isInvalid()) return true; |