aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
author天音あめ <i@amane-a.me>2025-01-07 20:49:43 +0800
committerGitHub <noreply@github.com>2025-01-07 07:49:43 -0500
commitca5fd06366448c94e1da085984e9e69f8d6398c3 (patch)
tree6e03090a932ae91b90d509b4aaea0a99fe2f4523 /clang/lib/Frontend/CompilerInvocation.cpp
parenta5e129ccdedf5c269a8e0fcad5e21381a7f0342c (diff)
downloadllvm-ca5fd06366448c94e1da085984e9e69f8d6398c3.zip
llvm-ca5fd06366448c94e1da085984e9e69f8d6398c3.tar.gz
llvm-ca5fd06366448c94e1da085984e9e69f8d6398c3.tar.bz2
[clang] Fix crashes when passing VLA to va_arg (#119563)
Closes #119360. This bug occurs when passing a VLA to `va_arg`. Since the return value is inferred to be an array, it triggers `ScalarExprEmitter::VisitCastExpr`, which converts it to a pointer and subsequently calls `CodeGenFunction::EmitAggExpr`. At this point, because the inferred type is an `AggExpr` instead of a `ScalarExpr`, `ScalarExprEmitter::VisitVAArgExpr` is not invoked, and as a result, `CodeGenFunction::EmitVariablyModifiedType` is also not called, leading to the size of the VLA not being retrieved. The solution is to move the call to `CodeGenFunction::EmitVariablyModifiedType` into `CodeGenFunction::EmitVAArg`, ensuring that the size of the VLA is correctly obtained regardless of whether the expression is an `AggExpr` or a `ScalarExpr`.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions