[cfe-commits] r109024 - in /cfe/trunk/lib: Rewrite/RewriteObjC.cpp Sema/SemaInit.cpp Sema/SemaInit.h
Fariborz Jahanian
fjahanian at apple.com
Wed Jul 21 11:31:48 PDT 2010
Author: fjahanian
Date: Wed Jul 21 13:31:47 2010
New Revision: 109024
URL: http://llvm.org/viewvc/llvm-project?rev=109024&view=rev
Log:
Fix source location of the initializer in
a copy initialization. Back out hack in objc rewriter.
fixes radar 8213998.
Modified:
cfe/trunk/lib/Rewrite/RewriteObjC.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaInit.h
Modified: cfe/trunk/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteObjC.cpp?rev=109024&r1=109023&r2=109024&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteObjC.cpp Wed Jul 21 13:31:47 2010
@@ -5098,14 +5098,6 @@
startLoc = E->getLocStart();
startLoc = SM->getInstantiationLoc(startLoc);
endBuf = SM->getCharacterData(startLoc);
- if (dyn_cast<CXXConstructExpr>(E)) {
- // Hack alter!
- // SemaInit sets startLoc to beginning of the initialized variable when
- // rhs involvs copy construction initialization. Must compensate for this.
- if (char *atEqual = strchr(endBuf, '='))
- endBuf = atEqual + 1;
- }
-
ByrefType += " " + Name;
ByrefType += " = {(void*)";
ByrefType += utostr(isa);
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=109024&r1=109023&r2=109024&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Wed Jul 21 13:31:47 2010
@@ -3803,7 +3803,8 @@
// Build a call to the selected constructor.
ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(S);
- SourceLocation Loc = Kind.getLocation();
+ SourceLocation Loc = Kind.isCopyInit() ? Kind.getEqualLoc()
+ : Kind.getLocation();
// Determine the arguments required to actually perform the constructor
// call.
@@ -3819,11 +3820,11 @@
// An explicitly-constructed temporary, e.g., X(1, 2).
unsigned NumExprs = ConstructorArgs.size();
Expr **Exprs = (Expr **)ConstructorArgs.take();
- S.MarkDeclarationReferenced(Kind.getLocation(), Constructor);
+ S.MarkDeclarationReferenced(Loc, Constructor);
CurInit = S.Owned(new (S.Context) CXXTemporaryObjectExpr(S.Context,
Constructor,
Entity.getType(),
- Kind.getLocation(),
+ Loc,
Exprs,
NumExprs,
Kind.getParenRange().getEnd(),
Modified: cfe/trunk/lib/Sema/SemaInit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.h?rev=109024&r1=109023&r2=109024&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.h (original)
+++ cfe/trunk/lib/Sema/SemaInit.h Wed Jul 21 13:31:47 2010
@@ -382,6 +382,8 @@
return Locations[1];
}
+ bool isCopyInit() const { return Kind == SIK_Copy; }
+
/// \brief Retrieve the source range containing the locations of the open
/// and closing parentheses for value and direct initializations.
SourceRange getParenRange() const {
More information about the cfe-commits
mailing list