diff options
author | Ellis Hoag <ellis.sparky.hoag@gmail.com> | 2022-10-13 16:38:02 -0700 |
---|---|---|
committer | Ellis Hoag <ellis.sparky.hoag@gmail.com> | 2022-10-17 08:57:23 -0700 |
commit | 970e1ea01aa0dce4f606eee1610c92b8b838f303 (patch) | |
tree | e965033dde654e6abc8f2c0d05f87ffe7edeff9b /llvm/lib/CodeGen/MachineFunction.cpp | |
parent | 6102364b0d0e16d63cc38c74a2a315a75253b4e8 (diff) | |
download | llvm-970e1ea01aa0dce4f606eee1610c92b8b838f303.zip llvm-970e1ea01aa0dce4f606eee1610c92b8b838f303.tar.gz llvm-970e1ea01aa0dce4f606eee1610c92b8b838f303.tar.bz2 |
[clang] Fix crash with -funique-internal-linkage-names
Calling `getFunctionLinkage(CalleeInfo.getCalleeDecl())` will crash when the declaration does not have a body, e.g., `extern void foo();`. Instead, we can use `isExternallyVisible()` to see if the delcaration has internal linkage.
I believe using `!isExternallyVisible()` is correct because the clang linkage must be `InternalLinkage` or `UniqueExternalLinkage`, both of which are "internal linkage" in llvm.
https://github.com/llvm/llvm-project/blob/9c26f51f5e178ac0fda98419e3a61d205d3b58b1/clang/include/clang/Basic/Linkage.h#L28-L40
Fixes https://github.com/llvm/llvm-project/issues/54139
Reviewed By: tmsriram
Differential Revision: https://reviews.llvm.org/D135926
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
0 files changed, 0 insertions, 0 deletions