[PATCH] D98799: [UniqueLinkageName] Use consistent checks when mangling symbo linkage name and debug linkage name.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 25 23:58:10 PDT 2021


rjmccall added a comment.

In D98799#2761684 <https://reviews.llvm.org/D98799#2761684>, @dblaikie wrote:

> OK - poked around a bit more to better understand this, so attempting to summarize my current understanding (excuse the repetition from previous parts of this thread) and results.
>
> - `__attribute__((overloadable))` can/does mangle K&R C style declarations <https://reviews.llvm.org/D98799#2638997>
> - with this patch (currently committed), `-funique-internal-linkage-names` does not mangle K&R C style declarations (see `bar` in the included test case, unmangled)
> - I'd like to avoid that divergence if possible
> - Changing the debug info code to be more generous with names it mangles (by using `FD->getType()->getAs<FunctionProtoType>()` rather than `hasPrototype()`) causes problems
>   - Specifically: Objective C blocks (which have a `FunctionProtoType` type, but `!hasPrototype` it seems) are missing parameter info so this <https://github.com/llvm-mirror/clang/blob/aa231e4be75ac4759c236b755c57876f76e3cf05/lib/AST/ItaniumMangle.cpp#L2908> call crashes
>     - There doesn't seem to be any way to test for this property of the `FunctionDecl` that I can see - where it has a type, but doesn't have parameter info
>
> Trying to pull in some folks who might know what's going on here/be able to suggest a way to split these cases if needed, or fix the block `FunctionDecl`s to have param info. @rjmccall @JDevlieghere - I'd really appreciate some help here.

Unlike lambdas, `BlockDecl` is not a subclass of `FunctionDecl`, so I'm not quite sure what you're asking — there shouldn't be a way for that line to crash on a `BlockDecl` because `FD` should be null.

Not sure what you mean by block `FunctionDecl` — a block doesn't make a `FunctionDecl`.  If it's useful for `BlockDecl` to return


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98799/new/

https://reviews.llvm.org/D98799



More information about the cfe-commits mailing list