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
7122b70cfc
which changed type of EmbedExpr made the "fast path" unreachable. This
patch fixes this unfortunate situation.
13 lines
456 B
C
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}}
|
|
}
|