[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 08:53:07 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/Lex/PPDirectives.cpp:441
+  constexpr StringRef Candidates[] = {
+      "if", "ifdef", "ifndef", "elif", "elifdef", "elifndef", "else", "endif"
+  };
----------------
erichkeane wrote:
> Should this be dependent on C modes?  it would be kind of silly to suggest "invalid preprocessing token elifndef, did you mean elifndef"?
Both C and C++ have the new directives and we enable them as an extension in all language modes, so no need to care about it being in C mode specifically. However, I think we do need to care about *which* C and C++ mode we're in so that we only suggest the new directives in C2x and C++2b mode.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124726



More information about the llvm-commits mailing list