[all-commits] [llvm/llvm-project] d11998: [clang][ConstExprEmitter] handle ArrayToPointerDec...
Nick Desaulniers via All-commits
all-commits at lists.llvm.org
Tue Jul 25 15:27:30 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d1199808afa5b46dfb6738f123b869d0e2fa050a
https://github.com/llvm/llvm-project/commit/d1199808afa5b46dfb6738f123b869d0e2fa050a
Author: Nick Desaulniers <ndesaulniers at google.com>
Date: 2023-07-25 (Tue, 25 Jul 2023)
Changed paths:
M clang/lib/CodeGen/CGExprConstant.cpp
Log Message:
-----------
[clang][ConstExprEmitter] handle ArrayToPointerDecay ImplicitCastExpr of StringLiterals
Consider the following statement:
const char* foo = "foo";
For the sub-AST:
`-ImplicitCastExpr <col:19> 'const char *' <NoOp>
`-ImplicitCastExpr <col:19> 'char *' <ArrayToPointerDecay>
`-StringLiteral <col:19> 'char[4]' lvalue "foo"
The address of the StringLiteral can be emitted as the Constant.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D156185
More information about the All-commits
mailing list