[cfe-commits] r109024 - in /cfe/trunk/lib: Rewrite/RewriteObjC.cpp Sema/SemaInit.cpp Sema/SemaInit.h
Douglas Gregor
dgregor at apple.com
Wed Jul 21 11:35:17 PDT 2010
On Jul 21, 2010, at 11:31 AM, Fariborz Jahanian wrote:
> 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();
Copy-initialization doesn't always involve an '=' sign, so you probably want to check Kind.isCopyInit() && Kind.getEqualLoc().isValid().
- Doug
More information about the cfe-commits
mailing list