[clang-tools-extra] r202392 - Normalized "virtual" and "LLVM_OVERRIDE" usage in clang-tidy.

Sean Silva silvas at purdue.edu
Sat Mar 1 17:51:10 PST 2014


On Sat, Mar 1, 2014 at 8:05 PM, Alexander Kornienko <alexfh at google.com>wrote:

> That's a nice idea! Do you want to contribute? :)
>

I'm currently finishing up my last semester of school and unfortunately my
plate is kind of full.

-- Sean Silva


> On 2 Mar 2014 01:33, "Sean Silva" <silvas at purdue.edu> wrote:
>
>> Please tell me that you have a clang-tidy check that fixed this for you :)
>>
>>
>> On Thu, Feb 27, 2014 at 8:14 AM, Alexander Kornienko <alexfh at google.com>wrote:
>>
>>> Author: alexfh
>>> Date: Thu Feb 27 07:14:51 2014
>>> New Revision: 202392
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=202392&view=rev
>>> Log:
>>> Normalized "virtual" and "LLVM_OVERRIDE" usage in clang-tidy.
>>>
>>> Reviewers: klimek
>>>
>>> Reviewed By: klimek
>>>
>>> CC: cfe-commits
>>>
>>> Differential Revision: http://llvm-reviews.chandlerc.com/D2894
>>>
>>> Modified:
>>>     clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
>>>     clang-tools-extra/trunk/clang-tidy/ClangTidy.h
>>>     clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h
>>>     clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h
>>>     clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.cpp
>>>     clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.h
>>>     clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp
>>>     clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.h
>>>
>>> Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=202392&r1=202391&r2=202392&view=diff
>>>
>>> ==============================================================================
>>> --- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
>>> +++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Thu Feb 27 07:14:51
>>> 2014
>>> @@ -64,9 +64,8 @@ class AnalyzerDiagnosticConsumer : publi
>>>  public:
>>>    AnalyzerDiagnosticConsumer(ClangTidyContext &Context) :
>>> Context(Context) {}
>>>
>>> -  virtual void
>>> -  FlushDiagnosticsImpl(std::vector<const ento::PathDiagnostic *> &Diags,
>>> -                       FilesMade *filesMade) LLVM_OVERRIDE {
>>> +  void FlushDiagnosticsImpl(std::vector<const ento::PathDiagnostic *>
>>> &Diags,
>>> +                            FilesMade *filesMade) LLVM_OVERRIDE {
>>>      for (std::vector<const ento::PathDiagnostic *>::iterator I =
>>> Diags.begin(),
>>>                                                               E =
>>> Diags.end();
>>>           I != E; ++I) {
>>> @@ -89,14 +88,9 @@ public:
>>>      }
>>>    }
>>>
>>> -  virtual StringRef getName() const { return "ClangTidyDiags"; }
>>> -
>>> -  virtual bool supportsLogicalOpControlFlow() const LLVM_OVERRIDE {
>>> -    return true;
>>> -  }
>>> -  virtual bool supportsCrossFileDiagnostics() const LLVM_OVERRIDE {
>>> -    return true;
>>> -  }
>>> +  StringRef getName() const LLVM_OVERRIDE { return "ClangTidyDiags"; }
>>> +  bool supportsLogicalOpControlFlow() const LLVM_OVERRIDE { return
>>> true; }
>>> +  bool supportsCrossFileDiagnostics() const LLVM_OVERRIDE { return
>>> true; }
>>>
>>>  private:
>>>    ClangTidyContext &Context;
>>>
>>> Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.h?rev=202392&r1=202391&r2=202392&view=diff
>>>
>>> ==============================================================================
>>> --- clang-tools-extra/trunk/clang-tidy/ClangTidy.h (original)
>>> +++ clang-tools-extra/trunk/clang-tidy/ClangTidy.h Thu Feb 27 07:14:51
>>> 2014
>>> @@ -83,7 +83,7 @@ public:
>>>    void setName(StringRef Name);
>>>
>>>  private:
>>> -  virtual void run(const ast_matchers::MatchFinder::MatchResult
>>> &Result);
>>> +  void run(const ast_matchers::MatchFinder::MatchResult &Result)
>>> LLVM_OVERRIDE;
>>>    ClangTidyContext *Context;
>>>    std::string CheckName;
>>>  };
>>>
>>> Modified:
>>> clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h?rev=202392&r1=202391&r2=202392&view=diff
>>>
>>> ==============================================================================
>>> --- clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h
>>> (original)
>>> +++ clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h Thu
>>> Feb 27 07:14:51 2014
>>> @@ -116,11 +116,11 @@ public:
>>>    // FIXME: The concept of converting between FixItHints and
>>> Replacements is
>>>    // more generic and should be pulled out into a more useful
>>> Diagnostics
>>>    // library.
>>> -  virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
>>> -                                const Diagnostic &Info) LLVM_OVERRIDE;
>>> +  void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
>>> +                        const Diagnostic &Info) LLVM_OVERRIDE;
>>>
>>>    // Flushes the internal diagnostics buffer to the ClangTidyContext.
>>> -  virtual void finish() LLVM_OVERRIDE;
>>> +  void finish() LLVM_OVERRIDE;
>>>
>>>  private:
>>>    void addFixes(const Diagnostic &Info, ClangTidyError &Error);
>>>
>>> Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h?rev=202392&r1=202391&r2=202392&view=diff
>>>
>>> ==============================================================================
>>> --- clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h (original)
>>> +++ clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h Thu Feb 27
>>> 07:14:51 2014
>>> @@ -36,13 +36,16 @@ public:
>>>  /// For example, if have a clang-tidy check like:
>>>  /// \code
>>>  /// class MyTidyCheck : public ClangTidyCheck {
>>> -///   virtual void registerMatchers(ast_matchers::MatchFinder *Finder)
>>> { .. }
>>> +///   void registerMatchers(ast_matchers::MatchFinder *Finder)
>>> LLVM_OVERRIDE {
>>> +///     ..
>>> +///   }
>>>  /// };
>>>  /// \endcode
>>>  /// you can register it with:
>>>  /// \code
>>>  /// class MyModule : public ClangTidyModule {
>>> -///   virtual void addCheckFactories(ClangTidyCheckFactories
>>> &CheckFactories) {
>>> +///   void
>>> +///   addCheckFactories(ClangTidyCheckFactories &CheckFactories)
>>> LLVM_OVERRIDE {
>>>  ///     CheckFactories.addCheckFactory(
>>>  ///         "myproject-my-check", new
>>> ClangTidyCheckFactory<MyTidyCheck>());
>>>  ///   }
>>> @@ -50,7 +53,7 @@ public:
>>>  /// \endcode
>>>  template <typename T> class ClangTidyCheckFactory : public
>>> CheckFactoryBase {
>>>  public:
>>> -  virtual ClangTidyCheck *createCheck() { return new T; }
>>> +  ClangTidyCheck *createCheck() LLVM_OVERRIDE { return new T; }
>>>  };
>>>
>>>  class ClangTidyCheckFactories;
>>>
>>> Modified: clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.cpp?rev=202392&r1=202391&r2=202392&view=diff
>>>
>>> ==============================================================================
>>> --- clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.cpp
>>> (original)
>>> +++ clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.cpp Thu
>>> Feb 27 07:14:51 2014
>>> @@ -44,7 +44,8 @@ void ExplicitConstructorCheck::check(con
>>>
>>>  class GoogleModule : public ClangTidyModule {
>>>  public:
>>> -  virtual void addCheckFactories(ClangTidyCheckFactories
>>> &CheckFactories) {
>>> +  void
>>> +  addCheckFactories(ClangTidyCheckFactories &CheckFactories)
>>> LLVM_OVERRIDE {
>>>      CheckFactories.addCheckFactory(
>>>          "google-explicit-constructor",
>>>          new ClangTidyCheckFactory<ExplicitConstructorCheck>());
>>>
>>> Modified: clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.h?rev=202392&r1=202391&r2=202392&view=diff
>>>
>>> ==============================================================================
>>> --- clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.h
>>> (original)
>>> +++ clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.h Thu Feb
>>> 27 07:14:51 2014
>>> @@ -21,8 +21,9 @@ namespace tidy {
>>>  ///
>>> http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Explicit_Constructors
>>>  class ExplicitConstructorCheck : public ClangTidyCheck {
>>>  public:
>>> -  virtual void registerMatchers(ast_matchers::MatchFinder *Finder);
>>> -  virtual void check(const ast_matchers::MatchFinder::MatchResult
>>> &Result);
>>> +  void registerMatchers(ast_matchers::MatchFinder *Finder)
>>> LLVM_OVERRIDE;
>>> +  void
>>> +  check(const ast_matchers::MatchFinder::MatchResult &Result)
>>> LLVM_OVERRIDE;
>>>  };
>>>
>>>  } // namespace tidy
>>>
>>> Modified: clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp?rev=202392&r1=202391&r2=202392&view=diff
>>>
>>> ==============================================================================
>>> --- clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp (original)
>>> +++ clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp Thu Feb
>>> 27 07:14:51 2014
>>> @@ -24,8 +24,7 @@ using namespace clang::ast_matchers;
>>>  namespace clang {
>>>  namespace tidy {
>>>
>>> -void
>>> -NamespaceCommentCheck::registerMatchers(ast_matchers::MatchFinder
>>> *Finder) {
>>> +void NamespaceCommentCheck::registerMatchers(MatchFinder *Finder) {
>>>    Finder->addMatcher(namespaceDecl().bind("namespace"), this);
>>>  }
>>>
>>> @@ -55,15 +54,13 @@ void NamespaceCommentCheck::check(const
>>>  namespace {
>>>  class IncludeOrderPPCallbacks : public PPCallbacks {
>>>  public:
>>> -  explicit IncludeOrderPPCallbacks(IncludeOrderCheck &Check)
>>> -      : Check(Check) {}
>>> +  explicit IncludeOrderPPCallbacks(IncludeOrderCheck &Check) :
>>> Check(Check) {}
>>>
>>> -  virtual void InclusionDirective(SourceLocation HashLoc,
>>> -                                  const Token &IncludeTok, StringRef
>>> FileName,
>>> -                                  bool IsAngled, CharSourceRange
>>> FilenameRange,
>>> -                                  const FileEntry *File, StringRef
>>> SearchPath,
>>> -                                  StringRef RelativePath,
>>> -                                  const Module *Imported) {
>>> +  void InclusionDirective(SourceLocation HashLoc, const Token
>>> &IncludeTok,
>>> +                          StringRef FileName, bool IsAngled,
>>> +                          CharSourceRange FilenameRange, const
>>> FileEntry *File,
>>> +                          StringRef SearchPath, StringRef RelativePath,
>>> +                          const Module *Imported) LLVM_OVERRIDE {
>>>      // FIXME: This is a dummy implementation to show how to get at
>>> preprocessor
>>>      // information. Implement a real include order check.
>>>      Check.diag(HashLoc, "This is an include");
>>> @@ -81,9 +78,8 @@ void IncludeOrderCheck::registerPPCallba
>>>
>>>  class LLVMModule : public ClangTidyModule {
>>>  public:
>>> -  virtual ~LLVMModule() {}
>>> -
>>> -  virtual void addCheckFactories(ClangTidyCheckFactories
>>> &CheckFactories) {
>>> +  void
>>> +  addCheckFactories(ClangTidyCheckFactories &CheckFactories)
>>> LLVM_OVERRIDE {
>>>      CheckFactories.addCheckFactory(
>>>          "llvm-include-order", new
>>> ClangTidyCheckFactory<IncludeOrderCheck>());
>>>      CheckFactories.addCheckFactory(
>>>
>>> Modified: clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.h?rev=202392&r1=202391&r2=202392&view=diff
>>>
>>> ==============================================================================
>>> --- clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.h (original)
>>> +++ clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.h Thu Feb 27
>>> 07:14:51 2014
>>> @@ -20,7 +20,7 @@ namespace tidy {
>>>  /// see: http://llvm.org/docs/CodingStandards.html#include-style
>>>  class IncludeOrderCheck : public ClangTidyCheck {
>>>  public:
>>> -  virtual void registerPPCallbacks(CompilerInstance &Compiler);
>>> +  void registerPPCallbacks(CompilerInstance &Compiler) LLVM_OVERRIDE;
>>>  };
>>>
>>>  /// \brief Checks that long namespaces have a closing comment.
>>> @@ -28,8 +28,9 @@ public:
>>>  /// see:
>>> http://llvm.org/docs/CodingStandards.html#namespace-indentation
>>>  class NamespaceCommentCheck : public ClangTidyCheck {
>>>  public:
>>> -  virtual void registerMatchers(ast_matchers::MatchFinder *Finder);
>>> -  virtual void check(const ast_matchers::MatchFinder::MatchResult
>>> &Result);
>>> +  void registerMatchers(ast_matchers::MatchFinder *Finder)
>>> LLVM_OVERRIDE;
>>> +  void
>>> +  check(const ast_matchers::MatchFinder::MatchResult &Result)
>>> LLVM_OVERRIDE;
>>>  };
>>>
>>>  } // namespace tidy
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140301/061160d6/attachment.html>


More information about the cfe-commits mailing list