apolloww wrote:

> The change is correct. The problem is subtle though. It comes from the 
> difference in behavior between the member and non-member Profile functions.
> 
> I think we could do better instead with a change which makes it harder to 
> trip on this.
> 
> I think a simplification like this should work (untested):
> 
> ```
> diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
> index ea425791fc97..3d411051084c 100644
> --- a/clang/include/clang/AST/Type.h
> +++ b/clang/include/clang/AST/Type.h
> @@ -4729,13 +4729,12 @@ public:
>    bool typeMatchesDecl() const { return !UsingBits.hasTypeDifferentFromDecl; 
> }
> 
>    void Profile(llvm::FoldingSetNodeID &ID) {
> -    Profile(ID, Found, typeMatchesDecl() ? QualType() : getUnderlyingType());
> +    Profile(ID, Found, getUnderlyingType());
>    }
>    static void Profile(llvm::FoldingSetNodeID &ID, const UsingShadowDecl 
> *Found,
>                        QualType Underlying) {
>      ID.AddPointer(Found);
> -    if (!Underlying.isNull())
> -      Underlying.Profile(ID);
> +    Underlying.Profile(ID);
>    }
>    static bool classof(const Type *T) { return T->getTypeClass() == Using; }
>  };
> ```

Thanks. This works and looks better. 

https://github.com/llvm/llvm-project/pull/79182
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to