================

----------------
NagyDonat wrote:

> Why is this function implemented using this switch?

Very good question and I strongly suspect that it is just yet another instance 
of the omnipresent code quality issues which are especially common in code that 
was written during the early development of the analyzer.

> Maybe I shouldn't overthink this because the 
> `dyn_cast_or_null<FunctionDecl>(ND)` suggests that the author might not have 
> fully thought this through. ND can never be null there, and ND always 
> satisfies the cast and should have been using `cast` instead.

I'm pretty sure that the author did not understand this.

-------

> Naively I'd write this as:
> 
> ```
> if (D is a FunctionDecl)
>   return GetSignature(D);
> 
> if (D is a NamedDecl)
>   return D->getQualifiedNameAsString();
> return "";
> ```

I strongly support switching to this simpler implementation, but this should 
probably be a separate commit.

https://github.com/llvm/llvm-project/pull/214102
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to