JakeMerdichAMD added a comment.

I mainly have concerns with the search for noexcept being too brittle and not 
looking far enough back. Implementing that may have performance implications 
though, so I have no issue ignoring that problem if it's proven sufficiently 
rare.

Also: should this do the same thing for throw()? It has pretty much the same 
constraints/context and would be trivial to add, although it's deprecated 
and/or removed in recent C++ versions. I'm not particularly inclined to 
implement that, but the question ought to be raised since it theoretically has 
the same problem.



================
Comment at: clang/lib/Format/TokenAnnotator.cpp:1933
+        if (PrevPrevToken) {
+          const FormatToken *PrevPrevPrevToken =
+              PrevPrevToken->getPreviousNonComment();
----------------
Doesn't this not handle nested templates? For example, 
`noexcept(Foo<Bar<T>>::value && Baz)` would not work here. Ditto on expressions 
like `Foo<T1, T2>`.

I'm having trouble thinking of a clean generic solution, but the most robust 
thing I can think of is to search the current line for the previous opening 
parens and check if noexcept is before it (if they use multiple sets of parens, 
the other heuristics seem to cover it). 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80041/new/

https://reviews.llvm.org/D80041



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D80041: [clang-form... MyDeveloperDay via Phabricator via cfe-commits
    • [PATCH] D80041: [clang... Jake Merdich via Phabricator via cfe-commits

Reply via email to