forked from OSchip/llvm-project
[Diagnostics] Skip var decl of structs for -Wstring-concatenation
This commit is contained in:
parent
e137b55058
commit
2f7adf5ee3
|
@ -12886,7 +12886,8 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
|
|||
AttributeCommonInfo::AS_Pragma));
|
||||
}
|
||||
|
||||
if (var->hasInit() && isa<InitListExpr>(var->getInit())) {
|
||||
if (!var->getType()->isStructureType() && var->hasInit() &&
|
||||
isa<InitListExpr>(var->getInit())) {
|
||||
const auto *ILE = cast<InitListExpr>(var->getInit());
|
||||
unsigned NumInits = ILE->getNumInits();
|
||||
if (NumInits > 2)
|
||||
|
@ -12927,7 +12928,7 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
|
|||
Diag(SL->getBeginLoc(),
|
||||
diag::note_concatenated_string_literal_silence);
|
||||
}
|
||||
// Warn just once.
|
||||
// In any case, stop now.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,6 +148,12 @@ const A not_warn6 = A{"",
|
|||
""};
|
||||
#endif
|
||||
|
||||
static A not_warn7 = {"",
|
||||
|
||||
""
|
||||
"",
|
||||
""};
|
||||
|
||||
|
||||
// Do not warn when all the elements in the initializer are concatenated together.
|
||||
const char *all_elems_in_init_concatenated[] = {"a" "b" "c"};
|
||||
|
|
Loading…
Reference in New Issue