llvm-project/clang-tools-extra/clang-tidy/misc
Ehsan Akhgari c62c639610 Insert override at the same line as the end of the function declaration
Summary:
The existing check converts the code pattern below:

  void f()
  {
  }

to:

  void f()
  override {
  }

which is fairly sub-optimal.  This patch fixes this by inserting the
override keyword on the same line as the function declaration if
possible, so that we instead get:

  void f() override
  {
  }

We do this by looking for the last token before the start of the body
and inserting the override keyword at the end of its location.  Note
that we handle const, volatile and ref-qualifiers correctly.

Test Plan: Includes an automated test.

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D9286

llvm-svn: 245401
2015-08-19 02:05:37 +00:00
..
ArgumentCommentCheck.cpp [clang-tidy] Refactor: Move misc clang-tidy checks to namespace clang::tidy::misc 2015-03-02 12:25:03 +00:00
ArgumentCommentCheck.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
AssertSideEffectCheck.cpp [clang-tidy] Move user-defined matches to unnamed namespaces to prevent ODR violations. 2015-06-17 13:11:37 +00:00
AssertSideEffectCheck.h [clang-tidy] Fixed typos and formatting in a comment. NFC 2015-08-18 16:43:07 +00:00
AssignOperatorSignatureCheck.cpp [clang-tidy] Refactor: Move misc clang-tidy checks to namespace clang::tidy::misc 2015-03-02 12:25:03 +00:00
AssignOperatorSignatureCheck.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
BoolPointerImplicitConversionCheck.cpp [clang-tidy] Move user-defined matches to unnamed namespaces to prevent ODR violations. 2015-06-17 13:11:37 +00:00
BoolPointerImplicitConversionCheck.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
CMakeLists.txt Add misc-unused-alias-decls check that currently finds unused namespace 2015-07-31 16:08:10 +00:00
InaccurateEraseCheck.cpp [clang-tidy] Refactor: Move misc clang-tidy checks to namespace clang::tidy::misc 2015-03-02 12:25:03 +00:00
InaccurateEraseCheck.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
InefficientAlgorithmCheck.cpp [clang-tidy] Support replacements in macro arguments in misc-inefficient-algorithm 2015-07-31 13:34:58 +00:00
InefficientAlgorithmCheck.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
MacroParenthesesCheck.cpp [clang-tidy] minor coding style tweak. make functions static. 2015-07-01 13:29:27 +00:00
MacroParenthesesCheck.h clang-tidy: Add checker that warns about missing parentheses in macros 2015-06-16 14:27:31 +00:00
MacroRepeatedSideEffectsCheck.cpp [clang-tidy] Enhance clang-tidy misc-macro-repeated-side-effects... 2015-07-02 07:49:55 +00:00
MacroRepeatedSideEffectsCheck.h clang-tidy: Add checker that warn when macro argument with side effects is repeated in the macro 2015-06-17 14:19:35 +00:00
Makefile
MiscTidyModule.cpp Add misc-unused-alias-decls check that currently finds unused namespace 2015-07-31 16:08:10 +00:00
NoexceptMoveConstructorCheck.cpp [clang-tidy] Renamed misc-noexcept-move-ctors to misc-noexcept-move-constructor 2015-05-27 14:24:11 +00:00
NoexceptMoveConstructorCheck.h [clang-tidy] Renamed misc-noexcept-move-ctors to misc-noexcept-move-constructor 2015-05-27 14:24:11 +00:00
StaticAssertCheck.cpp [clang-tidy] Fix for llvm.org/PR23355 2015-05-29 09:49:59 +00:00
StaticAssertCheck.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
SwappedArgumentsCheck.cpp [clang-tidy] Refactor: Move misc clang-tidy checks to namespace clang::tidy::misc 2015-03-02 12:25:03 +00:00
SwappedArgumentsCheck.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
UndelegatedConstructor.cpp [clang-tidy] Move user-defined matches to unnamed namespaces to prevent ODR violations. 2015-06-17 13:11:37 +00:00
UndelegatedConstructor.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
UniqueptrResetReleaseCheck.cpp [clang-tidy] Ignore expressions with incompatible deleters. 2015-04-09 17:51:01 +00:00
UniqueptrResetReleaseCheck.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
UnusedAliasDeclsCheck.cpp [clang-tidy] Improve the misc-unused-alias-decl message 2015-08-03 22:02:08 +00:00
UnusedAliasDeclsCheck.h [clang-tidy] Improve the misc-unused-alias-decl message 2015-08-03 22:02:08 +00:00
UnusedParametersCheck.cpp misc-unused-parameters: Fix crasher with C forward declarations that 2015-08-14 13:39:57 +00:00
UnusedParametersCheck.h misc-unused-parameters: Don't warn on ParmVarDecls in the return type. 2015-07-27 13:46:37 +00:00
UnusedRAIICheck.cpp [clang-tidy] Move user-defined matches to unnamed namespaces to prevent ODR violations. 2015-06-17 13:11:37 +00:00
UnusedRAIICheck.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
UseOverrideCheck.cpp Insert override at the same line as the end of the function declaration 2015-08-19 02:05:37 +00:00
UseOverrideCheck.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00