[PATCH] D33440: clang-format: better handle statement macros

Francois Ferrand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 19 01:04:06 PDT 2017


Typz added inline comments.


================
Comment at: lib/Format/FormatTokenLexer.cpp:642
               tok::pp_define) &&
-        std::find(ForEachMacros.begin(), ForEachMacros.end(),
-                  FormatTok->Tok.getIdentifierInfo()) != ForEachMacros.end()) {
-      FormatTok->Type = TT_ForEachMacro;
+        (it = std::find(Macros.begin(), Macros.end(),
+                        FormatTok->Tok.getIdentifierInfo())) != Macros.end()) {
----------------
djasper wrote:
> This does a binary search. Why aren't you implementing it with a hashtable?
It was already done this way, so I did not change it to avoid any impact on performance.
But I can change it if you prefer.


https://reviews.llvm.org/D33440





More information about the cfe-commits mailing list