[PATCH] D91103: [tooling] Add support for fixits that indicate code will need reformatting

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 9 14:27:39 PST 2020


njames93 created this revision.
njames93 added reviewers: rsmith, aaron.ballman, klimek, alexfh.
Herald added subscribers: lldb-commits, cfe-commits, dexonsmith.
Herald added projects: clang, LLDB.
njames93 requested review of this revision.
Herald added a subscriber: JDevlieghere.

Implementing a FixItHint which indicates that code needs reformatting but not changing.

This is achieved by creating a FixItHint where the RemoveRange is equal to the InsertFromRange.
This means any dependent clients wont need updating as that is essentially a no-op. For clients that (are updated to) handle it, it signifies that code needs reformatting.
Currently this has been added to clang-tidy but for any refactoring tool that uses the Replacements its rather trivial to include support.
Generally this should be tacked onto other fix-its that maybe span multiple lines or insert/remove braces.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91103

Files:
  clang-tools-extra/clang-tidy/ClangTidy.cpp
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang/include/clang/Basic/Diagnostic.h
  clang/include/clang/Basic/SourceLocation.h
  clang/include/clang/Tooling/Core/Replacement.h
  clang/lib/Frontend/DiagnosticRenderer.cpp
  clang/lib/Frontend/Rewrite/FixItRewriter.cpp
  clang/lib/Tooling/Core/Replacement.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91103.303989.patch
Type: text/x-patch
Size: 23491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201109/bebf05c0/attachment-0001.bin>


More information about the cfe-commits mailing list