On Sun, Feb 23, 2014 at 6:34 AM, Benjamin Kramer
<[email protected]> wrote:
> Author: d0k
> Date: Sun Feb 23 08:34:50 2014
> New Revision: 201981
>
> URL: http://llvm.org/viewvc/llvm-project?rev=201981&view=rev
> Log:
> Sema: Simplify away one-iteration loops.
>
> No functionality change.
[…]
> @@ -7381,10 +7375,7 @@ bool GetMatchingCType(
>      return false;
>
>    if (VD) {
> -    for (specific_attr_iterator<TypeTagForDatatypeAttr>
> -             I = VD->specific_attr_begin<TypeTagForDatatypeAttr>(),
> -             E = VD->specific_attr_end<TypeTagForDatatypeAttr>();
> -         I != E; ++I) {
> +    if (TypeTagForDatatypeAttr *I = VD->getAttr<TypeTagForDatatypeAttr>()) {
>        if (I->getArgumentKind() != ArgumentKind) {
>          FoundWrongKind = true;
>          return false;

FYI, this does *look* like a functionality change. Compare the loop in
Sema::FinalizeDeclaration(); a declaration can have more than one
instance of TypeTagForDatatypeAttr. Looking at just the first one
*seems* like it would give different results from looking at all of
them.

If I'm right, then a regression test should definitely be added: one
that distinguishes the old code's behavior from the new code's
behavior and decrees which one should be considered "correct".

–Arthur

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to