[PATCH] Generalize future keyword compat diagnostics

Richard Smith richard at metafoo.co.uk
Wed May 13 18:22:28 PDT 2015


LGTM with a minor tweak.


================
Comment at: lib/Lex/Preprocessor.cpp:596-597
@@ +595,4 @@
+#define CXX11_KEYWORD(NAME, FLAGS)                                             \
+    if (&II == &Table.get(StringRef(#NAME)))                                   \
+      return diag::warn_cxx11_keyword;
+#include "clang/Basic/TokenKinds.def"
----------------
It would be better to use a [`StringSwitch`](http://llvm.org/docs/doxygen/html/classllvm_1_1StringSwitch.html) here (and generate one `.Case(#NAME, diag::warn_cxx11_keyword` per `CXX11_KEYWORD`) rather than doing an `IdentifierTable` lookup for each keyword.

http://reviews.llvm.org/D9750

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list