forked from OSchip/llvm-project
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 llvm-svn: 202392
This commit is contained in:
parent
cb3f6e164b
commit
cb9272fe66
|
@ -64,9 +64,8 @@ class AnalyzerDiagnosticConsumer : public ento::PathDiagnosticConsumer {
|
|||
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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -44,7 +44,8 @@ void ExplicitConstructorCheck::check(const MatchFinder::MatchResult &Result) {
|
|||
|
||||
class GoogleModule : public ClangTidyModule {
|
||||
public:
|
||||
virtual void addCheckFactories(ClangTidyCheckFactories &CheckFactories) {
|
||||
void
|
||||
addCheckFactories(ClangTidyCheckFactories &CheckFactories) LLVM_OVERRIDE {
|
||||
CheckFactories.addCheckFactory(
|
||||
"google-explicit-constructor",
|
||||
new ClangTidyCheckFactory<ExplicitConstructorCheck>());
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 MatchFinder::MatchResult &Result) {
|
|||
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::registerPPCallbacks(CompilerInstance &Compiler) {
|
|||
|
||||
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(
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue