[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

Erich Keane via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 08:40:19 PDT 2022


erichkeane added inline comments.


================
Comment at: clang/lib/Lex/PPDirectives.cpp:441
+  constexpr StringRef Candidates[] = {
+      "if", "ifdef", "ifndef", "elif", "elifdef", "elifndef", "else", "endif"
+  };
----------------
Should this be dependent on C modes?  it would be kind of silly to suggest "invalid preprocessing token elifndef, did you mean elifndef"?


================
Comment at: clang/lib/Lex/PPDirectives.cpp:444
+
+  if (auto Sugg = Directive.find_similar_str(Candidates)) {
+    CharSourceRange DirectiveRange =
----------------
I don't believe this meets our requirements for 'auto'. 


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