No call sites interpreted this value meaningfully. Simplify this
interface.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I think the signature llvm::itaniumDemangle was to match __cxxabiv1::__cxa_demangle: https://itanium-cxx-abi.github.io/cxx-abi/abi.html#demangler
I agree that the status parameter is unneeded by most users. The error categories distinguished by status become unuseful after the buf and n parameters were removed.
This change looks good. I am unfamiliar with how LLVMDemangle code is copied to libcxxabi. Does this change affect libcxxabi/src/cxa_demangle.cpp? If no, I think the patch is good to go.
llvm/include/llvm/Demangle/Demangle.h | ||
---|---|---|
31–34 | Place non-null and a pointer to a NUL-terminated C style string together? I.e. move if successful before or after them. Also explain when the return value may be a null. |
Ah, that makes sense for "historically, why did this interface look like this?"
I agree that the status parameter is unneeded by most users. The error categories distinguished by status become unuseful after the buf and n parameters were removed.
This change looks good. I am unfamiliar with how LLVMDemangle code is copied to libcxxabi. Does this change affect libcxxabi/src/cxa_demangle.cpp? If no, I think the patch is good to go.
Good question; I believe it does not. In my change to llvm/lib/Demangle/ItaniumDemangle.cpp, you can see in the context on phab on line 363 the comment:
// Code beyond this point should not be synchronized with libc++abi.
(My changes are beyond that point).
libcxxabi's demangler only concerns itself with itanium style demangling, not microsoft, rust or D demangling. llvm::itaniumDemangle uses a ManglingParser which is the first point of interface into code that's synchronized between llvm/ and libcxxabi/. This change is not something that is downstream of libcxxabi (and thus has no need to be copied back upstream).
@nickdesaulniers This function is used in a couple more places:
/mnt/d/llvm-project/llvm/lib/Target/SPIRV/SPIRVUtils.cpp:298:25: error: no matching function for call to 'itaniumDemangle'
char *DemangledName = itaniumDemangle(Name.data(), nullptr, &n, &Status); ^~~~~~~~~~~~~~~
/mnt/d/llvm-project/llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp:176:19: error: no matching function for call to 'itaniumDemangle'
char *NameStr = itaniumDemangle(F->getName().data(), nullptr, &n, &status); ^~~~~~~~~~~~~~~
Thanks for the report. Looks like my code indexer is only indexing backends I build; none of the experimental ones were enabled. I'm working on a fix immediately, and will triple check for other callers using grep.
Nevermind, @MaskRay fixed this up in 8e6b3cc4aeedb864a983d849498c03b074570406. Thanks @MaskRay !
I missed SPIRV in my testing of this patch as well. I now use -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD='ARC;AVR;DirectX;LoongArch;M68k;SPIRV;Xtensa' :)
Place non-null and a pointer to a NUL-terminated C style string together? I.e. move if successful before or after them.
Also explain when the return value may be a null.