Skip to content

Commit

Permalink
Use 'override/final' instead of 'virtual' for overridden methods
Browse files Browse the repository at this point in the history
Summary:
The patch is generated using clang-tidy misc-use-override check.

This command was used:

  tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \
    -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: klimek, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234678 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
alexfh committed Apr 11, 2015
1 parent 7d191b2 commit dfa4cf3
Show file tree
Hide file tree
Showing 98 changed files with 305 additions and 327 deletions.
6 changes: 3 additions & 3 deletions examples/PrintFunctionNames/PrintFunctionNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace {

class PrintFunctionsConsumer : public ASTConsumer {
public:
virtual bool HandleTopLevelDecl(DeclGroupRef DG) {
bool HandleTopLevelDecl(DeclGroupRef DG) override {
for (DeclGroupRef::iterator i = DG.begin(), e = DG.end(); i != e; ++i) {
const Decl *D = *i;
if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
Expand All @@ -37,12 +37,12 @@ class PrintFunctionsConsumer : public ASTConsumer {
class PrintFunctionNamesAction : public PluginASTAction {
protected:
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
llvm::StringRef) {
llvm::StringRef) override {
return llvm::make_unique<PrintFunctionsConsumer>();
}

bool ParseArgs(const CompilerInstance &CI,
const std::vector<std::string>& args) {
const std::vector<std::string> &args) override {
for (unsigned i = 0, e = args.size(); i != e; ++i) {
llvm::errs() << "PrintFunctionNames arg = " << args[i] << "\n";

Expand Down
4 changes: 2 additions & 2 deletions include/clang/AST/VTableBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class ItaniumVTableContext : public VTableContextBase {

public:
ItaniumVTableContext(ASTContext &Context);
~ItaniumVTableContext();
~ItaniumVTableContext() override;

const VTableLayout &getVTableLayout(const CXXRecordDecl *RD) {
computeVTableRelatedInformation(RD);
Expand Down Expand Up @@ -511,7 +511,7 @@ class MicrosoftVTableContext : public VTableContextBase {
MicrosoftVTableContext(ASTContext &Context)
: VTableContextBase(/*MS=*/true), Context(Context) {}

~MicrosoftVTableContext();
~MicrosoftVTableContext() override;

const VPtrInfoVector &getVFPtrOffsets(const CXXRecordDecl *RD);

Expand Down
2 changes: 1 addition & 1 deletion include/clang/ASTMatchers/ASTMatchersInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class DynMatcherInterface : public RefCountedBaseVPTR {
template <typename T>
class MatcherInterface : public DynMatcherInterface {
public:
virtual ~MatcherInterface() {}
~MatcherInterface() override {}

/// \brief Returns true if 'Node' can be matched.
///
Expand Down
2 changes: 1 addition & 1 deletion include/clang/ASTMatchers/Dynamic/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class Parser {
/// tokens.
class RegistrySema : public Parser::Sema {
public:
virtual ~RegistrySema();
~RegistrySema() override;

llvm::Optional<MatcherCtor>
lookupMatcherCtor(StringRef MatcherName) override;
Expand Down
2 changes: 1 addition & 1 deletion include/clang/ASTMatchers/Dynamic/VariantValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class VariantMatcher {
/// It follows a similar interface as VariantMatcher itself.
class Payload : public RefCountedBaseVPTR {
public:
virtual ~Payload();
~Payload() override;
virtual llvm::Optional<DynTypedMatcher> getSingleMatcher() const = 0;
virtual std::string getTypeAsString() const = 0;
virtual llvm::Optional<DynTypedMatcher>
Expand Down
4 changes: 1 addition & 3 deletions include/clang/Analysis/Analyses/Dominators.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ class DominatorTree : public ManagedAnalysis {
DT = new llvm::DominatorTreeBase<CFGBlock>(false);
}

~DominatorTree() {
delete DT;
}
~DominatorTree() override { delete DT; }

llvm::DominatorTreeBase<CFGBlock>& getBase() { return *DT; }

Expand Down
5 changes: 2 additions & 3 deletions include/clang/Analysis/Analyses/LiveVariables.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,10 @@ class LiveVariables : public ManagedAnalysis {
/// Called when the live variables analysis registers
/// that a variable is killed.
virtual void observerKill(const DeclRefExpr *DR) {}
};
};

~LiveVariables() override;

virtual ~LiveVariables();

/// Compute the liveness information for a given CFG.
static LiveVariables *computeLiveness(AnalysisDeclContext &analysisContext,
bool killAtAssign);
Expand Down
6 changes: 3 additions & 3 deletions include/clang/Analysis/AnalysisContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class StackFrameContext : public LocationContext {
Block(blk), Index(idx) {}

public:
~StackFrameContext() {}
~StackFrameContext() override {}

const Stmt *getCallSite() const { return CallSite; }

Expand Down Expand Up @@ -324,7 +324,7 @@ class ScopeContext : public LocationContext {
: LocationContext(Scope, ctx, parent), Enter(s) {}

public:
~ScopeContext() {}
~ScopeContext() override {}

void Profile(llvm::FoldingSetNodeID &ID) override;

Expand Down Expand Up @@ -352,7 +352,7 @@ class BlockInvocationContext : public LocationContext {
: LocationContext(Block, ctx, parent), BD(bd), ContextData(contextData) {}

public:
~BlockInvocationContext() {}
~BlockInvocationContext() override {}

const BlockDecl *getBlockDecl() const { return BD; }

Expand Down
2 changes: 1 addition & 1 deletion include/clang/Basic/Diagnostic.h
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ class ForwardingDiagnosticConsumer : public DiagnosticConsumer {
public:
ForwardingDiagnosticConsumer(DiagnosticConsumer &Target) : Target(Target) {}

virtual ~ForwardingDiagnosticConsumer();
~ForwardingDiagnosticConsumer() override;

void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
const Diagnostic &Info) override;
Expand Down
2 changes: 1 addition & 1 deletion include/clang/CodeGen/CodeGenAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CodeGenAction : public ASTFrontendAction {
void EndSourceFileAction() override;

public:
~CodeGenAction();
~CodeGenAction() override;

/// setLinkModule - Set the link module to be used by this action. If a link
/// module is not provided, and CodeGenOptions::LinkBitcodeFile is non-empty,
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Driver/Job.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class JobList : public Job {

public:
JobList();
virtual ~JobList() {}
~JobList() override {}

void Print(llvm::raw_ostream &OS, const char *Terminator,
bool Quote, CrashReportInfo *CrashInfo = nullptr) const override;
Expand Down
4 changes: 2 additions & 2 deletions include/clang/Frontend/ASTUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ class ASTUnit : public ModuleLoader {
}
};
friend class ConcurrencyCheck;
~ASTUnit();

~ASTUnit() override;

bool isMainFileAST() const { return MainFileIsAST; }

Expand Down
2 changes: 1 addition & 1 deletion include/clang/Frontend/CompilerInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class CompilerInstance : public ModuleLoader {
void operator=(const CompilerInstance &) = delete;
public:
explicit CompilerInstance(bool BuildingModule = false);
~CompilerInstance();
~CompilerInstance() override;

/// @name High-Level Operations
/// {
Expand Down
4 changes: 2 additions & 2 deletions include/clang/Frontend/DiagnosticRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ class DiagnosticNoteRenderer : public DiagnosticRenderer {
DiagnosticNoteRenderer(const LangOptions &LangOpts,
DiagnosticOptions *DiagOpts)
: DiagnosticRenderer(LangOpts, DiagOpts) {}
virtual ~DiagnosticNoteRenderer();

~DiagnosticNoteRenderer() override;

void emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc,
const SourceManager &SM) override;
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Frontend/FrontendActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class ASTMergeAction : public FrontendAction {

public:
ASTMergeAction(FrontendAction *AdaptedAction, ArrayRef<std::string> ASTFiles);
virtual ~ASTMergeAction();
~ASTMergeAction() override;

bool usesPreprocessorOnly() const override;
TranslationUnitKind getTranslationUnitKind() override;
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Frontend/MultiplexConsumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MultiplexConsumer : public SemaConsumer {
public:
// Takes ownership of the pointers in C.
MultiplexConsumer(std::vector<std::unique_ptr<ASTConsumer>> C);
~MultiplexConsumer();
~MultiplexConsumer() override;

// ASTConsumer
void Initialize(ASTContext &Context) override;
Expand Down
4 changes: 2 additions & 2 deletions include/clang/Frontend/TextDiagnostic.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class TextDiagnostic : public DiagnosticRenderer {
const LangOptions &LangOpts,
DiagnosticOptions *DiagOpts);

virtual ~TextDiagnostic();
~TextDiagnostic() override;

/// \brief Print the diagonstic level to a raw_ostream.
///
/// This is a static helper that handles colorizing the level and formatting
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Frontend/TextDiagnosticPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TextDiagnosticPrinter : public DiagnosticConsumer {
public:
TextDiagnosticPrinter(raw_ostream &os, DiagnosticOptions *diags,
bool OwnsOutputStream = false);
virtual ~TextDiagnosticPrinter();
~TextDiagnosticPrinter() override;

/// setPrefix - Set the diagnostic printer prefix string, which will be
/// printed at the start of any diagnostics. If empty, no prefix string is
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Frontend/VerifyDiagnosticConsumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class VerifyDiagnosticConsumer: public DiagnosticConsumer,
/// the currently-attached diagnostic client when a diagnostic does not match
/// what is expected (as indicated in the source file).
VerifyDiagnosticConsumer(DiagnosticsEngine &Diags);
~VerifyDiagnosticConsumer();
~VerifyDiagnosticConsumer() override;

void BeginSourceFile(const LangOptions &LangOpts,
const Preprocessor *PP) override;
Expand Down
3 changes: 1 addition & 2 deletions include/clang/Lex/PTHLexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ class PTHLexer : public PreprocessorLexer {
PTHLexer(Preprocessor& pp, FileID FID, const unsigned char *D,
const unsigned char* ppcond, PTHManager &PM);
public:

~PTHLexer() {}
~PTHLexer() override {}

/// Lex - Return the next token.
bool Lex(Token &Tok);
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Lex/PTHManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class PTHManager : public IdentifierInfoLookup {
// The current PTH version.
enum { Version = 10 };

~PTHManager();
~PTHManager() override;

/// getOriginalSourceFile - Return the full path to the original header
/// file name that was used to generate the PTH cache.
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Lex/Pragma.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class PragmaNamespace : public PragmaHandler {
llvm::StringMap<PragmaHandler*> Handlers;
public:
explicit PragmaNamespace(StringRef Name) : PragmaHandler(Name) {}
virtual ~PragmaNamespace();
~PragmaNamespace() override;

/// FindHandler - Check to see if there is already a handler for the
/// specified name. If not, return the handler for the null name if it
Expand Down
4 changes: 2 additions & 2 deletions include/clang/Parse/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class Parser : public CodeCompletionHandler {

public:
Parser(Preprocessor &PP, Sema &Actions, bool SkipFunctionBodies);
~Parser();
~Parser() override;

const LangOptions &getLangOpts() const { return PP.getLangOpts(); }
const TargetInfo &getTargetInfo() const { return PP.getTargetInfo(); }
Expand Down Expand Up @@ -887,7 +887,7 @@ class Parser : public CodeCompletionHandler {
class LateParsedClass : public LateParsedDeclaration {
public:
LateParsedClass(Parser *P, ParsingClass *C);
virtual ~LateParsedClass();
~LateParsedClass() override;

void ParseLexedMethodDeclarations() override;
void ParseLexedMemberInitializers() override;
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Rewrite/Frontend/FixItRewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class FixItRewriter : public DiagnosticConsumer {
const LangOptions &LangOpts, FixItOptions *FixItOpts);

/// \brief Destroy the fix-it rewriter.
~FixItRewriter();
~FixItRewriter() override;

/// \brief Check whether there are modifications for a given file.
bool IsModified(FileID ID) const {
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Rewrite/Frontend/FrontendActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class FixItAction : public ASTFrontendAction {

public:
FixItAction();
~FixItAction();
~FixItAction() override;
};

/// \brief Emits changes to temporary files and uses them for the original
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Sema/ExternalSemaSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ExternalSemaSource : public ExternalASTSource {
ExternalASTSource::SemaSource = true;
}

~ExternalSemaSource();
~ExternalSemaSource() override;

/// \brief Initialize the semantic source with the Sema instance
/// being used to perform semantic analysis on the abstract syntax
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Sema/MultiplexExternalSemaSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MultiplexExternalSemaSource : public ExternalSemaSource {
///
MultiplexExternalSemaSource(ExternalSemaSource& s1, ExternalSemaSource& s2);

~MultiplexExternalSemaSource();
~MultiplexExternalSemaSource() override;

///\brief Appends new source to the source list.
///
Expand Down
6 changes: 3 additions & 3 deletions include/clang/Sema/ScopeInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ class BlockScopeInfo : public CapturingScopeInfo {
Kind = SK_Block;
}

virtual ~BlockScopeInfo();
~BlockScopeInfo() override;

static bool classof(const FunctionScopeInfo *FSI) {
return FSI->Kind == SK_Block;
Expand Down Expand Up @@ -599,7 +599,7 @@ class CapturedRegionScopeInfo: public CapturingScopeInfo {
Kind = SK_CapturedRegion;
}

virtual ~CapturedRegionScopeInfo();
~CapturedRegionScopeInfo() override;

/// \brief A descriptive name for the kind of captured region this is.
StringRef getRegionName() const {
Expand Down Expand Up @@ -704,7 +704,7 @@ class LambdaScopeInfo : public CapturingScopeInfo {
Kind = SK_Lambda;
}

virtual ~LambdaScopeInfo();
~LambdaScopeInfo() override;

/// \brief Note when all explicit captures have been added.
void finishedExplicitCaptures() {
Expand Down
2 changes: 1 addition & 1 deletion include/clang/Serialization/ASTReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ class ASTReader
bool ValidateSystemInputs = false,
bool UseGlobalIndex = true);

~ASTReader();
~ASTReader() override;

SourceManager &getSourceManager() const { return SourceMgr; }
FileManager &getFileManager() const { return FileMgr; }
Expand Down
4 changes: 2 additions & 2 deletions include/clang/Serialization/ASTWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ class ASTWriter : public ASTDeserializationListener,
/// \brief Create a new precompiled header writer that outputs to
/// the given bitstream.
ASTWriter(llvm::BitstreamWriter &Stream);
~ASTWriter();
~ASTWriter() override;

const LangOptions &getLangOpts() const;

Expand Down Expand Up @@ -882,7 +882,7 @@ class PCHGenerator : public SemaConsumer {
clang::Module *Module,
StringRef isysroot, raw_ostream *Out,
bool AllowASTWithErrors = false);
~PCHGenerator();
~PCHGenerator() override;
void InitializeSema(Sema &S) override { SemaPtr = &S; }
void HandleTranslationUnit(ASTContext &Ctx) override;
ASTMutationListener *GetASTMutationListener() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ class GRBugReporter : public BugReporter {
GRBugReporter(BugReporterData& d, ExprEngine& eng)
: BugReporter(d, GRBugReporterKind), Eng(eng) {}

virtual ~GRBugReporter();
~GRBugReporter() override;

/// getEngine - Return the analysis engine used to analyze a given
/// function or method.
Expand Down
Loading

0 comments on commit dfa4cf3

Please sign in to comment.