Mariya Podchishchaeva cdad183194
[clang] Fix #embed "fast path" (#121479)
When a single #embed directive is used to initialize a char array, the
case is optimized via swap of EmbedExpr to underlying StringLiteral,
resulting in better performance in AST consumers.
While browsing through the code, I realized that
7122b70cfc8e23a069410215c363da76d842bda4
which changed type of EmbedExpr made the "fast path" unreachable. This
patch fixes this unfortunate situation.
2025-01-03 11:17:16 +01:00

13 lines
456 B
C

// RUN: %clang_analyze_cc1 -std=c23 -analyzer-checker=core,debug.ExprInspection -verify %s
void clang_analyzer_dump_ptr(const unsigned char *ptr);
void clang_analyzer_dump(unsigned char val);
int main() {
const unsigned char SelfBytes[] = {
#embed "embed.c"
};
clang_analyzer_dump_ptr(SelfBytes); // expected-warning {{&Element{SelfBytes,0 S64b,unsigned char}}}
clang_analyzer_dump(SelfBytes[0]); // expected-warning {{47 U8b}}
}