[PATCH] D79293: [clang-format] [PR45218] Fix an issue where < and > and >> in a for loop gets incorrectly interpreted at a TemplateOpener/Closer
Marek Kurdej via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun May 3 13:17:34 PDT 2020
curdeius added a comment.
> This fix tries to avoid that issue by determining that a ";" between the < and > would not be a template (I couldn't think of an example where that would be the case, but I'm sure there are..
For what is worth, with lambdas in unevaluated context (C++20), you can get a semicolon between template opener/closer easily:
some_templated_type<decltype([](int i) { return i; })>
But I'm not sure if it's something that may break anything here.
Another idea in which a semicolon occurs between <> would be a macro X(;).
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:40
/// keyword as a potential Objective-C selector component.
static bool canBeObjCSelectorComponent(const FormatToken &Tok) {
return Tok.Tok.getIdentifierInfo() != nullptr;
----------------
I know you haven't changed this, but...
Static function (internal linkage) in anonymous namespace?
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:46
/// `[...]<...>(`, where the [ opens a lambda capture list.
static bool isLambdaParameterList(const FormatToken *Left) {
// Skip <...> if present.
----------------
Ditto (static).
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:1987
llvm::SmallPtrSet<FormatToken *, 16> NonTemplateLess;
-};
+}; // namespace
----------------
There should be no comment, it's the ending brace of a class.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79293/new/
https://reviews.llvm.org/D79293
More information about the cfe-commits
mailing list