[all-commits] [llvm/llvm-project] a247ba: Suggest typo corrections for preprocessor directives
Ken Matsui via All-commits
all-commits at lists.llvm.org
Fri May 13 06:17:07 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a247ba9d15635d96225ef39c8c150c08f492e70a
https://github.com/llvm/llvm-project/commit/a247ba9d15635d96225ef39c8c150c08f492e70a
Author: Ken Matsui <vcs at kmatsui.me>
Date: 2022-05-13 (Fri, 13 May 2022)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/DiagnosticLexKinds.td
M clang/include/clang/Lex/Preprocessor.h
M clang/lib/Lex/PPDirectives.cpp
A clang/test/Preprocessor/suggest-typoed-directive.c
Log Message:
-----------
Suggest typo corrections for preprocessor directives
When a preprocessor directive is unknown outside of a skipped
conditional block, we give an error diagnostic because we don't know
how to proceed with preprocessing. But when the directive is in a
skipped conditional block, we would not diagnose it on the theory that
the directive may be known to an implementation other than Clang.
Now, for unknown directives inside a skipped conditional block, we
diagnose the unknown directive as a warning if it is sufficiently
similar to a directive specific to preprocessor conditional blocks. For
example, we'll warn about `#esle` and suggest `#else` but we won't warn
about `#progma` because it's not a directive specific to preprocessor
conditional blocks.
Fixes #51598
Differential Revision: https://reviews.llvm.org/D124726
More information about the All-commits
mailing list