r226624 - Correct all typos in the initialization arguments, even if one could not

Kaelyn Takata rikka at google.com
Tue Jan 20 16:10:26 PST 2015


FYI, this fixes a diagnostic regression from 3.5 to 3.6 and should be
merged to the 3.6 branch. The regression manifests as either a failed
assertion or at least one missing error message.

On Tue, Jan 20, 2015 at 4:04 PM, Kaelyn Takata <rikka at google.com> wrote:

> Author: rikka
> Date: Tue Jan 20 18:04:19 2015
> New Revision: 226624
>
> URL: http://llvm.org/viewvc/llvm-project?rev=226624&view=rev
> Log:
> Correct all typos in the initialization arguments, even if one could not
> be corrected.
>
> This fixes PR22250, which exposed the bug where if there's more than one
> TypoExpr in the arguments, once one failed to be corrected none of the
> TypoExprs after it would be handled at all thanks to an early return.
>
> Modified:
>     cfe/trunk/lib/Sema/SemaDecl.cpp
>     cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=226624&r1=226623&r2=226624&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Jan 20 18:04:19 2015
> @@ -8841,11 +8841,12 @@ void Sema::AddInitializerToDecl(Decl *Re
>            });
>        if (Res.isInvalid()) {
>          VDecl->setInvalidDecl();
> -        return;
> -      }
> -      if (Res.get() != Args[Idx])
> +      } else if (Res.get() != Args[Idx]) {
>          Args[Idx] = Res.get();
> +      }
>      }
> +    if (VDecl->isInvalidDecl())
> +      return;
>
>      InitializationSequence InitSeq(*this, Entity, Kind, Args);
>      ExprResult Result = InitSeq.Perform(*this, Entity, Kind, Args, &DclT);
>
> Modified: cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp?rev=226624&r1=226623&r2=226624&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp (original)
> +++ cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp Tue Jan 20 18:04:19
> 2015
> @@ -167,3 +167,11 @@ void MovePointer(Pointer &Click, int x,
>    click.set_xpos(x);  // expected-error {{use of undeclared identifier
> 'click'; did you mean 'Click'?}}
>    click.set_ypos(x);  // expected-error {{use of undeclared identifier
> 'click'; did you mean 'Click'?}}
>  }
> +
> +namespace PR22250 {
> +// expected-error at +4 {{use of undeclared identifier 'size_t'; did you
> mean 'sizeof'?}}
> +// expected-error-re at +3 {{use of undeclared identifier 'y'{{$}}}}
> +// expected-error-re at +2 {{use of undeclared identifier 'z'{{$}}}}
> +// expected-error at +1 {{expected ';' after top level declarator}}
> +int getenv_s(size_t *y, char(&z)) {}
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150120/fbef3975/attachment.html>


More information about the cfe-commits mailing list