aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorTim Neumann <timnn@google.com>2024-04-02 19:59:29 +0200
committerGitHub <noreply@github.com>2024-04-02 10:59:29 -0700
commitf792f14b01605453c7c0c17f3b4564335c0d9d14 (patch)
treeae3db8d7ca006a1432b16959ce8ab0e6db43db4c /clang/lib/Frontend/CompilerInvocation.cpp
parent9c9f94063ce1bd819ba4482f537d1e580dd31eef (diff)
downloadllvm-f792f14b01605453c7c0c17f3b4564335c0d9d14.zip
llvm-f792f14b01605453c7c0c17f3b4564335c0d9d14.tar.gz
llvm-f792f14b01605453c7c0c17f3b4564335c0d9d14.tar.bz2
[WebAssembly] Allocate MCSymbolWasm data on MCContext (#85866)
Fixes #85578, a use-after-free caused by some `MCSymbolWasm` data being freed too early. Previously, `WebAssemblyAsmParser` owned the data that is moved to `MCContext` by this PR, which caused problems when handling module ASM, because the ASM parser was destroyed after parsing the module ASM, but the symbols persisted. The added test passes locally with an LLVM build with AddressSanitizer enabled. Implementation notes: * I've called the added method <code>allocate<b><i>Generic</i></b>String</code> and added the second paragraph of its documentation to maybe guide people a bit on when to use this method (based on my (limited) understanding of the `MCContext` class). We could also just call it `allocateString` and remove that second paragraph. * The added `createWasmSignature` method does not support taking the return and parameter types as arguments: Specifying them afterwards is barely any longer and prevents them from being accidentally specified in the wrong order. * This removes a _"TODO: Do the uniquing of Signatures here instead of ObjectFileWriter?"_ since the field it's attached to is also removed. Let me know if you think that TODO should be preserved somewhere.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions