[PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization
Bruno Ricci via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 7 13:12:08 PDT 2020
riccibruno added a comment.
Is there a way to suppress this diagnostic if someone wants to legitimately initialize an element of the array with a long string by relying on string literal concatenation?
================
Comment at: clang/lib/Sema/SemaExpr.cpp:6910
<< InitArgList[I]->getSourceRange();
+ } else if (StringLiteral *SL = dyn_cast<StringLiteral>(InitArgList[I])) {
+ unsigned numConcat = SL->getNumConcatenated();
----------------
`const auto *`
================
Comment at: clang/lib/Sema/SemaExpr.cpp:6921
+ if (!hasMacro)
+ Diag(SL->getBeginLoc(), diag::warn_concatenated_literal_array_init);
+ }
----------------
Should this point to the location of the suspected missing comma?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85545/new/
https://reviews.llvm.org/D85545
More information about the cfe-commits
mailing list