| Issue |
181179
|
| Summary |
[MicrosoftDemangle] calls to isMemberPointer shadow previous errors
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
soruh
|
# Description
The function [`Demangler::isMemberPointer`](https://github.com/llvm/llvm-project/blob/b4e4616342ca4c7a3c53b99d8d082fd17bfbbb10/llvm/lib/Demangle/MicrosoftDemangle.cpp#L69) sets the internal `Error` state to `false` at the start.
This shadows previous errors and causes `llvm-undname` to accept invalid symbols.
# Example
For example: introducing an invalid qualifier is not detected as invalid
```diff
-??Aklass@@QAAAAHXZ
+??Aklass@@Q%AAAHXZ
```
```sh
> llvm-undname "??Aklass@@Q%AAAHXZ"
??Aklass@@Q%AAAHXZ
public: int & __cdecl klass::operator[](void)
```
msvc `undname` rejects this symbol.
When processing this symbol, [`Demangler::demangleQualifiers`](https://github.com/llvm/llvm-project/blob/b4e4616342ca4c7a3c53b99d8d082fd17bfbbb10/llvm/lib/Demangle/MicrosoftDemangle.cpp#L1824) correctly sets `Error = true` but this flags is not checked before [`Demangler::isMemberPointer`](https://github.com/llvm/llvm-project/blob/b4e4616342ca4c7a3c53b99d8d082fd17bfbbb10/llvm/lib/Demangle/MicrosoftDemangle.cpp#L69) is called, which sets the flag to `false` again.
# Suggested Fix
As far as I can tell there is no reason for [`Demangler::isMemberPointer`](https://github.com/llvm/llvm-project/blob/b4e4616342ca4c7a3c53b99d8d082fd17bfbbb10/llvm/lib/Demangle/MicrosoftDemangle.cpp#L69) to set `Error = false`.
This line should likely be removed.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs