[cfe-commits] r80416 - in /cfe/trunk: include/clang/AST/DeclCXX.h lib/AST/DeclCXX.cpp lib/Sema/SemaDeclCXX.cpp
Anders Carlsson
andersca at mac.com
Fri Aug 28 18:31:33 PDT 2009
Author: andersca
Date: Fri Aug 28 20:31:33 2009
New Revision: 80416
URL: http://llvm.org/viewvc/llvm-project?rev=80416&view=rev
Log:
Store the SourceLocation of right parentheses in member initializers. Patch by Anders Johnsen!
Modified:
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=80416&r1=80415&r2=80416&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Fri Aug 28 20:31:33 2009
@@ -841,18 +841,21 @@
/// IdLoc - Location of the id in ctor-initializer list.
SourceLocation IdLoc;
+ /// RParenLoc - Location of the right paren of the ctor-initializer.
+ SourceLocation RParenLoc;
+
public:
/// CXXBaseOrMemberInitializer - Creates a new base-class initializer.
explicit
CXXBaseOrMemberInitializer(QualType BaseType, Expr **Args, unsigned NumArgs,
CXXConstructorDecl *C,
- SourceLocation L);
+ SourceLocation L, SourceLocation R);
/// CXXBaseOrMemberInitializer - Creates a new member initializer.
explicit
CXXBaseOrMemberInitializer(FieldDecl *Member, Expr **Args, unsigned NumArgs,
CXXConstructorDecl *C,
- SourceLocation L);
+ SourceLocation L, SourceLocation R);
/// ~CXXBaseOrMemberInitializer - Destroy the base or member initializer.
~CXXBaseOrMemberInitializer();
@@ -923,6 +926,7 @@
const CXXConstructorDecl *getConstructor() const { return CtorToCall; }
SourceLocation getSourceLocation() const { return IdLoc; }
+ SourceLocation getRParenLoc() const { return RParenLoc; }
/// arg_begin() - Retrieve an iterator to the first initializer argument.
arg_iterator arg_begin() { return Args; }
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=80416&r1=80415&r2=80416&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Fri Aug 28 20:31:33 2009
@@ -400,8 +400,8 @@
CXXBaseOrMemberInitializer::
CXXBaseOrMemberInitializer(QualType BaseType, Expr **Args, unsigned NumArgs,
CXXConstructorDecl *C,
- SourceLocation L)
- : Args(0), NumArgs(0), IdLoc(L) {
+ SourceLocation L, SourceLocation R)
+ : Args(0), NumArgs(0), IdLoc(L), RParenLoc(R) {
BaseOrMember = reinterpret_cast<uintptr_t>(BaseType.getTypePtr());
assert((BaseOrMember & 0x01) == 0 && "Invalid base class type pointer");
BaseOrMember |= 0x01;
@@ -419,8 +419,8 @@
CXXBaseOrMemberInitializer::
CXXBaseOrMemberInitializer(FieldDecl *Member, Expr **Args, unsigned NumArgs,
CXXConstructorDecl *C,
- SourceLocation L)
- : Args(0), NumArgs(0), IdLoc(L) {
+ SourceLocation L, SourceLocation R)
+ : Args(0), NumArgs(0), IdLoc(L), RParenLoc(R) {
BaseOrMember = reinterpret_cast<uintptr_t>(Member);
assert((BaseOrMember & 0x01) == 0 && "Invalid member pointer");
@@ -622,6 +622,7 @@
CXXBaseOrMemberInitializer *Member =
new (C) CXXBaseOrMemberInitializer(VBase->getType(), 0, 0,
VBaseDecl->getDefaultConstructor(C),
+ SourceLocation(),
SourceLocation());
AllToInit.push_back(Member);
}
@@ -648,6 +649,7 @@
CXXBaseOrMemberInitializer *Member =
new (C) CXXBaseOrMemberInitializer(Base->getType(), 0, 0,
BaseDecl->getDefaultConstructor(C),
+ SourceLocation(),
SourceLocation());
AllToInit.push_back(Member);
}
@@ -690,6 +692,7 @@
CXXBaseOrMemberInitializer *Member =
new (C) CXXBaseOrMemberInitializer((*Field), 0, 0,
Ctor,
+ SourceLocation(),
SourceLocation());
AllToInit.push_back(Member);
}
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=80416&r1=80415&r2=80416&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Aug 28 20:31:33 2009
@@ -797,7 +797,7 @@
}
// FIXME: Perform direct initialization of the member.
return new (Context) CXXBaseOrMemberInitializer(Member, (Expr **)Args,
- NumArgs, C, IdLoc);
+ NumArgs, C, IdLoc, RParenLoc);
}
Sema::MemInitResult
@@ -880,7 +880,7 @@
}
return new (Context) CXXBaseOrMemberInitializer(BaseType, (Expr **)Args,
- NumArgs, C, IdLoc);
+ NumArgs, C, IdLoc, RParenLoc);
}
void
More information about the cfe-commits
mailing list