[PATCH] D64932: [Parser] Emit descriptive diagnostic for misplaced pragma

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 26 11:21:18 PDT 2019


rjmccall added inline comments.


================
Comment at: clang/lib/Basic/TokenKinds.cpp:55
+    return std::strncmp(#X, "pragma_", sizeof("pragma_") - 1) == 0;
+#include "clang/Basic/TokenKinds.def"
+  default:
----------------
The right way to do this is to make a `PRAGMA_ANNOTATION` macro in `TokenKinds.def` that defaults to `ANNOTATION`, like that file already does with e.g. `CXX11_KEYWORD`.  But for future reference, there's also a `StringRef::startsWith`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64932





More information about the cfe-commits mailing list