Index: examples/PrintFunctionNames/PrintFunctionNames.cpp =================================================================== --- examples/PrintFunctionNames/PrintFunctionNames.cpp +++ examples/PrintFunctionNames/PrintFunctionNames.cpp @@ -23,7 +23,7 @@ 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(D)) @@ -37,12 +37,12 @@ class PrintFunctionNamesAction : public PluginASTAction { protected: std::unique_ptr CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef) { + llvm::StringRef) override { return llvm::make_unique(); } bool ParseArgs(const CompilerInstance &CI, - const std::vector& args) { + const std::vector &args) override { for (unsigned i = 0, e = args.size(); i != e; ++i) { llvm::errs() << "PrintFunctionNames arg = " << args[i] << "\n"; Index: include/clang/AST/VTableBuilder.h =================================================================== --- include/clang/AST/VTableBuilder.h +++ include/clang/AST/VTableBuilder.h @@ -333,7 +333,7 @@ public: ItaniumVTableContext(ASTContext &Context); - ~ItaniumVTableContext(); + ~ItaniumVTableContext() override; const VTableLayout &getVTableLayout(const CXXRecordDecl *RD) { computeVTableRelatedInformation(RD); @@ -511,7 +511,7 @@ MicrosoftVTableContext(ASTContext &Context) : VTableContextBase(/*MS=*/true), Context(Context) {} - ~MicrosoftVTableContext(); + ~MicrosoftVTableContext() override; const VPtrInfoVector &getVFPtrOffsets(const CXXRecordDecl *RD); Index: include/clang/ASTMatchers/ASTMatchersInternal.h =================================================================== --- include/clang/ASTMatchers/ASTMatchersInternal.h +++ include/clang/ASTMatchers/ASTMatchersInternal.h @@ -206,10 +206,9 @@ /// writing a simple matcher that only inspects properties of the /// current node and doesn't care about its children or descendants, /// implement SingleNodeMatcherInterface instead. -template -class MatcherInterface : public DynMatcherInterface { +template class MatcherInterface : public DynMatcherInterface { public: - virtual ~MatcherInterface() {} + ~MatcherInterface() override {} /// \brief Returns true if 'Node' can be matched. /// Index: include/clang/ASTMatchers/Dynamic/Parser.h =================================================================== --- include/clang/ASTMatchers/Dynamic/Parser.h +++ include/clang/ASTMatchers/Dynamic/Parser.h @@ -122,8 +122,8 @@ /// \brief Sema implementation that uses the matcher registry to process the /// tokens. class RegistrySema : public Parser::Sema { - public: - virtual ~RegistrySema(); + public: + ~RegistrySema() override; llvm::Optional lookupMatcherCtor(StringRef MatcherName) override; Index: include/clang/ASTMatchers/Dynamic/VariantValue.h =================================================================== --- include/clang/ASTMatchers/Dynamic/VariantValue.h +++ include/clang/ASTMatchers/Dynamic/VariantValue.h @@ -122,7 +122,7 @@ /// It follows a similar interface as VariantMatcher itself. class Payload : public RefCountedBaseVPTR { public: - virtual ~Payload(); + ~Payload() override; virtual llvm::Optional getSingleMatcher() const = 0; virtual std::string getTypeAsString() const = 0; virtual llvm::Optional Index: include/clang/Analysis/Analyses/Dominators.h =================================================================== --- include/clang/Analysis/Analyses/Dominators.h +++ include/clang/Analysis/Analyses/Dominators.h @@ -40,13 +40,9 @@ public: llvm::DominatorTreeBase* DT; - DominatorTree() { - DT = new llvm::DominatorTreeBase(false); - } + DominatorTree() { DT = new llvm::DominatorTreeBase(false); } - ~DominatorTree() { - delete DT; - } + ~DominatorTree() override { delete DT; } llvm::DominatorTreeBase& getBase() { return *DT; } Index: include/clang/Analysis/Analyses/LiveVariables.h =================================================================== --- include/clang/Analysis/Analyses/LiveVariables.h +++ include/clang/Analysis/Analyses/LiveVariables.h @@ -66,15 +66,14 @@ /// 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); - + /// Return true if a variable is live at the end of a /// specified block. bool isLive(const CFGBlock *B, const VarDecl *D); Index: include/clang/Analysis/AnalysisContext.h =================================================================== --- include/clang/Analysis/AnalysisContext.h +++ include/clang/Analysis/AnalysisContext.h @@ -283,13 +283,12 @@ friend class LocationContextManager; StackFrameContext(AnalysisDeclContext *ctx, const LocationContext *parent, - const Stmt *s, const CFGBlock *blk, - unsigned idx) - : LocationContext(StackFrame, ctx, parent), CallSite(s), - Block(blk), Index(idx) {} + const Stmt *s, const CFGBlock *blk, unsigned idx) + : LocationContext(StackFrame, ctx, parent), CallSite(s), Block(blk), + Index(idx) {} public: - ~StackFrameContext() {} + ~StackFrameContext() override {} const Stmt *getCallSite() const { return CallSite; } @@ -321,10 +320,10 @@ friend class LocationContextManager; ScopeContext(AnalysisDeclContext *ctx, const LocationContext *parent, const Stmt *s) - : LocationContext(Scope, ctx, parent), Enter(s) {} + : LocationContext(Scope, ctx, parent), Enter(s) {} public: - ~ScopeContext() {} + ~ScopeContext() override {} void Profile(llvm::FoldingSetNodeID &ID) override; @@ -347,15 +346,15 @@ friend class LocationContextManager; BlockInvocationContext(AnalysisDeclContext *ctx, - const LocationContext *parent, - const BlockDecl *bd, const void *contextData) - : LocationContext(Block, ctx, parent), BD(bd), ContextData(contextData) {} + const LocationContext *parent, const BlockDecl *bd, + const void *contextData) + : LocationContext(Block, ctx, parent), BD(bd), ContextData(contextData) {} public: - ~BlockInvocationContext() {} + ~BlockInvocationContext() override {} const BlockDecl *getBlockDecl() const { return BD; } - + const void *getContextData() const { return ContextData; } void Profile(llvm::FoldingSetNodeID &ID) override; Index: include/clang/Basic/Diagnostic.h =================================================================== --- include/clang/Basic/Diagnostic.h +++ include/clang/Basic/Diagnostic.h @@ -1371,7 +1371,7 @@ public: ForwardingDiagnosticConsumer(DiagnosticConsumer &Target) : Target(Target) {} - virtual ~ForwardingDiagnosticConsumer(); + ~ForwardingDiagnosticConsumer() override; void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) override; Index: include/clang/CodeGen/CodeGenAction.h =================================================================== --- include/clang/CodeGen/CodeGenAction.h +++ include/clang/CodeGen/CodeGenAction.h @@ -45,7 +45,7 @@ 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, Index: include/clang/Driver/Job.h =================================================================== --- include/clang/Driver/Job.h +++ include/clang/Driver/Job.h @@ -175,10 +175,10 @@ public: JobList(); - virtual ~JobList() {} + ~JobList() override {} - void Print(llvm::raw_ostream &OS, const char *Terminator, - bool Quote, CrashReportInfo *CrashInfo = nullptr) const override; + void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, + CrashReportInfo *CrashInfo = nullptr) const override; /// Add a job to the list (taking ownership). void addJob(std::unique_ptr J) { Jobs.push_back(std::move(J)); } Index: include/clang/Frontend/ASTUnit.h =================================================================== --- include/clang/Frontend/ASTUnit.h +++ include/clang/Frontend/ASTUnit.h @@ -484,8 +484,8 @@ } }; friend class ConcurrencyCheck; - - ~ASTUnit(); + + ~ASTUnit() override; bool isMainFileAST() const { return MainFileIsAST; } Index: include/clang/Frontend/CompilerInstance.h =================================================================== --- include/clang/Frontend/CompilerInstance.h +++ include/clang/Frontend/CompilerInstance.h @@ -163,9 +163,10 @@ CompilerInstance(const CompilerInstance &) = delete; void operator=(const CompilerInstance &) = delete; + public: explicit CompilerInstance(bool BuildingModule = false); - ~CompilerInstance(); + ~CompilerInstance() override; /// @name High-Level Operations /// { Index: include/clang/Frontend/DiagnosticRenderer.h =================================================================== --- include/clang/Frontend/DiagnosticRenderer.h +++ include/clang/Frontend/DiagnosticRenderer.h @@ -154,9 +154,9 @@ public: DiagnosticNoteRenderer(const LangOptions &LangOpts, DiagnosticOptions *DiagOpts) - : DiagnosticRenderer(LangOpts, DiagOpts) {} - - virtual ~DiagnosticNoteRenderer(); + : DiagnosticRenderer(LangOpts, DiagOpts) {} + + ~DiagnosticNoteRenderer() override; void emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc, const SourceManager &SM) override; Index: include/clang/Frontend/FrontendActions.h =================================================================== --- include/clang/Frontend/FrontendActions.h +++ include/clang/Frontend/FrontendActions.h @@ -188,7 +188,7 @@ public: ASTMergeAction(FrontendAction *AdaptedAction, ArrayRef ASTFiles); - virtual ~ASTMergeAction(); + ~ASTMergeAction() override; bool usesPreprocessorOnly() const override; TranslationUnitKind getTranslationUnitKind() override; Index: include/clang/Frontend/MultiplexConsumer.h =================================================================== --- include/clang/Frontend/MultiplexConsumer.h +++ include/clang/Frontend/MultiplexConsumer.h @@ -30,7 +30,7 @@ public: // Takes ownership of the pointers in C. MultiplexConsumer(std::vector> C); - ~MultiplexConsumer(); + ~MultiplexConsumer() override; // ASTConsumer void Initialize(ASTContext &Context) override; Index: include/clang/Frontend/TextDiagnostic.h =================================================================== --- include/clang/Frontend/TextDiagnostic.h +++ include/clang/Frontend/TextDiagnostic.h @@ -36,12 +36,11 @@ raw_ostream &OS; public: - TextDiagnostic(raw_ostream &OS, - const LangOptions &LangOpts, + TextDiagnostic(raw_ostream &OS, 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 Index: include/clang/Frontend/TextDiagnosticPrinter.h =================================================================== --- include/clang/Frontend/TextDiagnosticPrinter.h +++ include/clang/Frontend/TextDiagnosticPrinter.h @@ -40,7 +40,7 @@ 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 Index: include/clang/Frontend/VerifyDiagnosticConsumer.h =================================================================== --- include/clang/Frontend/VerifyDiagnosticConsumer.h +++ include/clang/Frontend/VerifyDiagnosticConsumer.h @@ -243,10 +243,10 @@ public: /// Create a new verifying diagnostic client, which will issue errors to - /// the currently-attached diagnostic client when a diagnostic does not match + /// 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; Index: include/clang/Lex/PTHLexer.h =================================================================== --- include/clang/Lex/PTHLexer.h +++ include/clang/Lex/PTHLexer.h @@ -61,11 +61,11 @@ friend class PTHManager; /// Create a PTHLexer for the specified token stream. - PTHLexer(Preprocessor& pp, FileID FID, const unsigned char *D, - const unsigned char* ppcond, PTHManager &PM); -public: + PTHLexer(Preprocessor &pp, FileID FID, const unsigned char *D, + const unsigned char *ppcond, PTHManager &PM); - ~PTHLexer() {} +public: + ~PTHLexer() override {} /// Lex - Return the next token. bool Lex(Token &Tok); Index: include/clang/Lex/PTHManager.h =================================================================== --- include/clang/Lex/PTHManager.h +++ include/clang/Lex/PTHManager.h @@ -113,7 +113,7 @@ // 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. Index: include/clang/Lex/Pragma.h =================================================================== --- include/clang/Lex/Pragma.h +++ include/clang/Lex/Pragma.h @@ -90,10 +90,11 @@ /// Handlers - This is a map of the handlers in this namespace with their name /// as key. /// - llvm::StringMap Handlers; + llvm::StringMap 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 Index: include/clang/Parse/Parser.h =================================================================== --- include/clang/Parse/Parser.h +++ include/clang/Parse/Parser.h @@ -235,7 +235,7 @@ 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(); } @@ -887,7 +887,7 @@ class LateParsedClass : public LateParsedDeclaration { public: LateParsedClass(Parser *P, ParsingClass *C); - virtual ~LateParsedClass(); + ~LateParsedClass() override; void ParseLexedMethodDeclarations() override; void ParseLexedMemberInitializers() override; Index: include/clang/Rewrite/Frontend/FixItRewriter.h =================================================================== --- include/clang/Rewrite/Frontend/FixItRewriter.h +++ include/clang/Rewrite/Frontend/FixItRewriter.h @@ -86,7 +86,7 @@ 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 { Index: include/clang/Rewrite/Frontend/FrontendActions.h =================================================================== --- include/clang/Rewrite/Frontend/FrontendActions.h +++ include/clang/Rewrite/Frontend/FrontendActions.h @@ -43,7 +43,7 @@ public: FixItAction(); - ~FixItAction(); + ~FixItAction() override; }; /// \brief Emits changes to temporary files and uses them for the original Index: include/clang/Sema/ExternalSemaSource.h =================================================================== --- include/clang/Sema/ExternalSemaSource.h +++ include/clang/Sema/ExternalSemaSource.h @@ -51,11 +51,9 @@ /// analysis. class ExternalSemaSource : public ExternalASTSource { public: - ExternalSemaSource() { - ExternalASTSource::SemaSource = true; - } + ExternalSemaSource() { 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 Index: include/clang/Sema/MultiplexExternalSemaSource.h =================================================================== --- include/clang/Sema/MultiplexExternalSemaSource.h +++ include/clang/Sema/MultiplexExternalSemaSource.h @@ -49,9 +49,9 @@ ///\param[in] s1 - A non-null (old) ExternalSemaSource. ///\param[in] s2 - A non-null (new) ExternalSemaSource. /// - MultiplexExternalSemaSource(ExternalSemaSource& s1, ExternalSemaSource& s2); + MultiplexExternalSemaSource(ExternalSemaSource &s1, ExternalSemaSource &s2); - ~MultiplexExternalSemaSource(); + ~MultiplexExternalSemaSource() override; ///\brief Appends new source to the source list. /// Index: include/clang/Sema/ScopeInfo.h =================================================================== --- include/clang/Sema/ScopeInfo.h +++ include/clang/Sema/ScopeInfo.h @@ -568,10 +568,10 @@ Kind = SK_Block; } - virtual ~BlockScopeInfo(); + ~BlockScopeInfo() override; - static bool classof(const FunctionScopeInfo *FSI) { - return FSI->Kind == SK_Block; + static bool classof(const FunctionScopeInfo *FSI) { + return FSI->Kind == SK_Block; } }; @@ -599,7 +599,7 @@ Kind = SK_CapturedRegion; } - virtual ~CapturedRegionScopeInfo(); + ~CapturedRegionScopeInfo() override; /// \brief A descriptive name for the kind of captured region this is. StringRef getRegionName() const { @@ -704,12 +704,10 @@ Kind = SK_Lambda; } - virtual ~LambdaScopeInfo(); + ~LambdaScopeInfo() override; /// \brief Note when all explicit captures have been added. - void finishedExplicitCaptures() { - NumExplicitCaptures = Captures.size(); - } + void finishedExplicitCaptures() { NumExplicitCaptures = Captures.size(); } static bool classof(const FunctionScopeInfo *FSI) { return FSI->Kind == SK_Lambda; Index: include/clang/Serialization/ASTReader.h =================================================================== --- include/clang/Serialization/ASTReader.h +++ include/clang/Serialization/ASTReader.h @@ -1320,10 +1320,9 @@ bool DisableValidation = false, bool AllowASTWithCompilerErrors = false, bool AllowConfigurationMismatch = false, - bool ValidateSystemInputs = false, - bool UseGlobalIndex = true); + bool ValidateSystemInputs = false, bool UseGlobalIndex = true); - ~ASTReader(); + ~ASTReader() override; SourceManager &getSourceManager() const { return SourceMgr; } FileManager &getFileManager() const { return FileMgr; } Index: include/clang/Serialization/ASTWriter.h =================================================================== --- include/clang/Serialization/ASTWriter.h +++ include/clang/Serialization/ASTWriter.h @@ -559,7 +559,7 @@ /// \brief Create a new precompiled header writer that outputs to /// the given bitstream. ASTWriter(llvm::BitstreamWriter &Stream); - ~ASTWriter(); + ~ASTWriter() override; const LangOptions &getLangOpts() const; @@ -879,10 +879,9 @@ public: PCHGenerator(const Preprocessor &PP, StringRef OutputFile, - clang::Module *Module, - StringRef isysroot, raw_ostream *Out, + 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; Index: include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h =================================================================== --- include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h +++ include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h @@ -489,10 +489,10 @@ class GRBugReporter : public BugReporter { ExprEngine& Eng; public: - GRBugReporter(BugReporterData& d, ExprEngine& eng) - : BugReporter(d, GRBugReporterKind), Eng(eng) {} + 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. Index: include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h =================================================================== --- include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h +++ include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h @@ -366,7 +366,7 @@ PathDiagnosticPiece(Kind k, DisplayHint hint = Below); public: - virtual ~PathDiagnosticPiece(); + ~PathDiagnosticPiece() override; StringRef getString() const { return str; } @@ -482,7 +482,7 @@ public: StackHintGeneratorForSymbol(SymbolRef S, StringRef M) : Sym(S), Msg(M) {} - virtual ~StackHintGeneratorForSymbol() {} + ~StackHintGeneratorForSymbol() override {} /// \brief Search the call expression for the symbol Sym and dispatch the /// 'getMessageForX()' methods to construct a specific message. @@ -509,13 +509,13 @@ std::unique_ptr CallStackHint; public: - PathDiagnosticEventPiece(const PathDiagnosticLocation &pos, - StringRef s, bool addPosRange = true, + PathDiagnosticEventPiece(const PathDiagnosticLocation &pos, StringRef s, + bool addPosRange = true, StackHintGenerator *stackHint = nullptr) - : PathDiagnosticSpotPiece(pos, s, Event, addPosRange), - CallStackHint(stackHint) {} + : PathDiagnosticSpotPiece(pos, s, Event, addPosRange), + CallStackHint(stackHint) {} - ~PathDiagnosticEventPiece(); + ~PathDiagnosticEventPiece() override; /// Mark the diagnostic piece as being potentially prunable. This /// flag may have been previously set, at which point it will not @@ -572,13 +572,13 @@ public: PathDiagnosticLocation callEnter; PathDiagnosticLocation callEnterWithin; - PathDiagnosticLocation callReturn; + PathDiagnosticLocation callReturn; PathPieces path; - - virtual ~PathDiagnosticCallPiece(); - + + ~PathDiagnosticCallPiece() override; + const Decl *getCaller() const { return Caller; } - + const Decl *getCallee() const { return Callee; } void setCallee(const CallEnter &CE, const SourceManager &SM); @@ -632,10 +632,10 @@ PathDiagnosticControlFlowPiece(const PathDiagnosticLocation &startPos, const PathDiagnosticLocation &endPos) : PathDiagnosticPiece(ControlFlow) { - LPairs.push_back(PathDiagnosticLocationPair(startPos, endPos)); - } + LPairs.push_back(PathDiagnosticLocationPair(startPos, endPos)); + } - ~PathDiagnosticControlFlowPiece(); + ~PathDiagnosticControlFlowPiece() override; PathDiagnosticLocation getStartLocation() const { assert(!LPairs.empty() && @@ -688,12 +688,12 @@ class PathDiagnosticMacroPiece : public PathDiagnosticSpotPiece { public: PathDiagnosticMacroPiece(const PathDiagnosticLocation &pos) - : PathDiagnosticSpotPiece(pos, "", Macro) {} + : PathDiagnosticSpotPiece(pos, "", Macro) {} - ~PathDiagnosticMacroPiece(); + ~PathDiagnosticMacroPiece() override; PathPieces subPieces; - + bool containsEvent() const; void flattenLocations() override { Index: include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h =================================================================== --- include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h +++ include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h @@ -45,21 +45,18 @@ public: AnalyzerOptions &options; - - AnalysisManager(ASTContext &ctx,DiagnosticsEngine &diags, + + AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags, const LangOptions &lang, const PathDiagnosticConsumers &Consumers, StoreManagerCreator storemgr, - ConstraintManagerCreator constraintmgr, - CheckerManager *checkerMgr, - AnalyzerOptions &Options, - CodeInjector* injector = nullptr); + ConstraintManagerCreator constraintmgr, + CheckerManager *checkerMgr, AnalyzerOptions &Options, + CodeInjector *injector = nullptr); - ~AnalysisManager(); - - void ClearContexts() { - AnaCtxMgr.clear(); - } + ~AnalysisManager() override; + + void ClearContexts() { AnaCtxMgr.clear(); } AnalysisDeclContextManager& getAnalysisDeclContextManager() { return AnaCtxMgr; Index: include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h =================================================================== --- include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h +++ include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h @@ -367,7 +367,7 @@ EnclosingBldr->takeNodes(*I); } - virtual ~StmtNodeBuilder(); + ~StmtNodeBuilder() override; using NodeBuilder::generateNode; using NodeBuilder::generateSink; Index: include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h =================================================================== --- include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h +++ include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h @@ -98,11 +98,10 @@ public: ExprEngine(AnalysisManager &mgr, bool gcEnabled, - SetOfConstDecls *VisitedCalleesIn, - FunctionSummariesTy *FS, + SetOfConstDecls *VisitedCalleesIn, FunctionSummariesTy *FS, InliningModes HowToInlineIn); - ~ExprEngine(); + ~ExprEngine() override; /// Returns true if there is still simulation state on the worklist. bool ExecuteWorkList(const LocationContext *L, unsigned Steps = 150000) { Index: include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h =================================================================== --- include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h +++ include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h @@ -609,9 +609,9 @@ AnalysisDeclContext *getAnalysisDeclContext() const { return AC; } - virtual void dumpToStream(raw_ostream &os) const override; + void dumpToStream(raw_ostream &os) const override; - void Profile(llvm::FoldingSetNodeID& ID) const override; + void Profile(llvm::FoldingSetNodeID &ID) const override; static void ProfileRegion(llvm::FoldingSetNodeID& ID, const BlockDecl *BD, CanQualType, const AnalysisDeclContext*, Index: include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h =================================================================== --- include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h +++ include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h @@ -109,7 +109,7 @@ SymbolData(Kind k, SymbolID sym) : SymExpr(k), Sym(sym) {} public: - virtual ~SymbolData() {} + ~SymbolData() override {} SymbolID getSymbolID() const { return Sym; } Index: include/clang/Tooling/Tooling.h =================================================================== --- include/clang/Tooling/Tooling.h +++ include/clang/Tooling/Tooling.h @@ -79,7 +79,7 @@ /// process each translation unit. class FrontendActionFactory : public ToolAction { public: - virtual ~FrontendActionFactory(); + ~FrontendActionFactory() override; /// \brief Invokes the compiler with a FrontendAction created by create(). bool runInvocation(clang::CompilerInvocation *Invocation, FileManager *Files, Index: lib/ARCMigrate/ARCMT.cpp =================================================================== --- lib/ARCMigrate/ARCMT.cpp +++ lib/ARCMigrate/ARCMT.cpp @@ -124,7 +124,7 @@ } } - virtual ~CaptureDiagnosticConsumer() { + ~CaptureDiagnosticConsumer() override { assert(!HasBegunSourceFile && "FinishCapture not called!"); } @@ -465,7 +465,7 @@ if (Listener) Listener->start(ctx); } - ~RewritesApplicator() { + ~RewritesApplicator() override { if (Listener) Listener->finish(); } Index: lib/ARCMigrate/ObjCMT.cpp =================================================================== --- lib/ARCMigrate/ObjCMT.cpp +++ lib/ARCMigrate/ObjCMT.cpp @@ -1787,12 +1787,10 @@ public: JSONEditWriter(SourceManager &SM, llvm::raw_ostream &OS) - : SourceMgr(SM), OS(OS) { + : SourceMgr(SM), OS(OS) { OS << "[\n"; } - ~JSONEditWriter() { - OS << "]\n"; - } + ~JSONEditWriter() override { OS << "]\n"; } private: struct EntryWriter { Index: lib/ASTMatchers/ASTMatchFinder.cpp =================================================================== --- lib/ASTMatchers/ASTMatchFinder.cpp +++ lib/ASTMatchers/ASTMatchFinder.cpp @@ -300,7 +300,7 @@ const MatchFinder::MatchFinderOptions &Options) : Matchers(Matchers), Options(Options), ActiveASTContext(nullptr) {} - ~MatchASTVisitor() { + ~MatchASTVisitor() override { if (Options.CheckProfiling) { Options.CheckProfiling->Records = std::move(TimeByBucket); } Index: lib/ASTMatchers/Dynamic/Marshallers.h =================================================================== --- lib/ASTMatchers/Dynamic/Marshallers.h +++ lib/ASTMatchers/Dynamic/Marshallers.h @@ -181,18 +181,20 @@ ArgKinds(ArgKinds.begin(), ArgKinds.end()) {} VariantMatcher create(const SourceRange &NameRange, - ArrayRef Args, Diagnostics *Error) const { + ArrayRef Args, + Diagnostics *Error) const override { return Marshaller(Func, MatcherName, NameRange, Args, Error); } - bool isVariadic() const { return false; } - unsigned getNumArgs() const { return ArgKinds.size(); } + bool isVariadic() const override { return false; } + unsigned getNumArgs() const override { return ArgKinds.size(); } void getArgKinds(ast_type_traits::ASTNodeKind ThisKind, unsigned ArgNo, - std::vector &Kinds) const { + std::vector &Kinds) const override { Kinds.push_back(ArgKinds[ArgNo]); } - bool isConvertibleTo(ast_type_traits::ASTNodeKind Kind, unsigned *Specificity, - ast_type_traits::ASTNodeKind *LeastDerivedKind) const { + bool isConvertibleTo( + ast_type_traits::ASTNodeKind Kind, unsigned *Specificity, + ast_type_traits::ASTNodeKind *LeastDerivedKind) const override { return isRetKindConvertibleTo(RetKinds, Kind, Specificity, LeastDerivedKind); } @@ -333,18 +335,20 @@ } VariantMatcher create(const SourceRange &NameRange, - ArrayRef Args, Diagnostics *Error) const { + ArrayRef Args, + Diagnostics *Error) const override { return Func(MatcherName, NameRange, Args, Error); } - bool isVariadic() const { return true; } - unsigned getNumArgs() const { return 0; } + bool isVariadic() const override { return true; } + unsigned getNumArgs() const override { return 0; } void getArgKinds(ast_type_traits::ASTNodeKind ThisKind, unsigned ArgNo, - std::vector &Kinds) const { + std::vector &Kinds) const override { Kinds.push_back(ArgsKind); } - bool isConvertibleTo(ast_type_traits::ASTNodeKind Kind, unsigned *Specificity, - ast_type_traits::ASTNodeKind *LeastDerivedKind) const { + bool isConvertibleTo( + ast_type_traits::ASTNodeKind Kind, unsigned *Specificity, + ast_type_traits::ASTNodeKind *LeastDerivedKind) const override { return isRetKindConvertibleTo(RetKinds, Kind, Specificity, LeastDerivedKind); } @@ -487,11 +491,11 @@ OverloadedMatcherDescriptor(ArrayRef Callbacks) : Overloads(Callbacks.begin(), Callbacks.end()) {} - virtual ~OverloadedMatcherDescriptor() {} + ~OverloadedMatcherDescriptor() override {} - virtual VariantMatcher create(const SourceRange &NameRange, - ArrayRef Args, - Diagnostics *Error) const { + VariantMatcher create(const SourceRange &NameRange, + ArrayRef Args, + Diagnostics *Error) const override { std::vector Constructed; Diagnostics::OverloadContext Ctx(Error); for (const auto &O : Overloads) { @@ -512,7 +516,7 @@ return Constructed[0]; } - bool isVariadic() const { + bool isVariadic() const override { bool Overload0Variadic = Overloads[0]->isVariadic(); #ifndef NDEBUG for (const auto &O : Overloads) { @@ -522,7 +526,7 @@ return Overload0Variadic; } - unsigned getNumArgs() const { + unsigned getNumArgs() const override { unsigned Overload0NumArgs = Overloads[0]->getNumArgs(); #ifndef NDEBUG for (const auto &O : Overloads) { @@ -533,15 +537,16 @@ } void getArgKinds(ast_type_traits::ASTNodeKind ThisKind, unsigned ArgNo, - std::vector &Kinds) const { + std::vector &Kinds) const override { for (const auto &O : Overloads) { if (O->isConvertibleTo(ThisKind)) O->getArgKinds(ThisKind, ArgNo, Kinds); } } - bool isConvertibleTo(ast_type_traits::ASTNodeKind Kind, unsigned *Specificity, - ast_type_traits::ASTNodeKind *LeastDerivedKind) const { + bool isConvertibleTo( + ast_type_traits::ASTNodeKind Kind, unsigned *Specificity, + ast_type_traits::ASTNodeKind *LeastDerivedKind) const override { for (const auto &O : Overloads) { if (O->isConvertibleTo(Kind, Specificity, LeastDerivedKind)) return true; @@ -562,9 +567,9 @@ : MinCount(MinCount), MaxCount(MaxCount), Op(Op), MatcherName(MatcherName) {} - virtual VariantMatcher create(const SourceRange &NameRange, - ArrayRef Args, - Diagnostics *Error) const override { + VariantMatcher create(const SourceRange &NameRange, + ArrayRef Args, + Diagnostics *Error) const override { if (Args.size() < MinCount || MaxCount < Args.size()) { const std::string MaxStr = (MaxCount == UINT_MAX ? "" : Twine(MaxCount)).str(); Index: lib/Analysis/CFG.cpp =================================================================== --- lib/Analysis/CFG.cpp +++ lib/Analysis/CFG.cpp @@ -3950,9 +3950,8 @@ } } } - - virtual ~StmtPrinterHelper() {} + ~StmtPrinterHelper() override {} const LangOptions &getLangOpts() const { return LangOpts; } void setBlockID(signed i) { currentBlock = i; } Index: lib/Analysis/UninitializedValues.cpp =================================================================== --- lib/Analysis/UninitializedValues.cpp +++ lib/Analysis/UninitializedValues.cpp @@ -834,10 +834,9 @@ namespace { struct PruneBlocksHandler : public UninitVariablesHandler { PruneBlocksHandler(unsigned numBlocks) - : hadUse(numBlocks, false), hadAnyUse(false), - currentBlock(0) {} + : hadUse(numBlocks, false), hadAnyUse(false), currentBlock(0) {} - virtual ~PruneBlocksHandler() {} + ~PruneBlocksHandler() override {} /// Records if a CFGBlock had a potential use of an uninitialized variable. llvm::BitVector hadUse; Index: lib/Basic/Targets.cpp =================================================================== --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -4568,10 +4568,9 @@ class ARMleTargetInfo : public ARMTargetInfo { public: - ARMleTargetInfo(const llvm::Triple &Triple) - : ARMTargetInfo(Triple, false) { } - virtual void getTargetDefines(const LangOptions &Opts, - MacroBuilder &Builder) const { + ARMleTargetInfo(const llvm::Triple &Triple) : ARMTargetInfo(Triple, false) {} + void getTargetDefines(const LangOptions &Opts, + MacroBuilder &Builder) const override { Builder.defineMacro("__ARMEL__"); ARMTargetInfo::getTargetDefines(Opts, Builder); } @@ -4579,10 +4578,9 @@ class ARMbeTargetInfo : public ARMTargetInfo { public: - ARMbeTargetInfo(const llvm::Triple &Triple) - : ARMTargetInfo(Triple, true) { } - virtual void getTargetDefines(const LangOptions &Opts, - MacroBuilder &Builder) const { + ARMbeTargetInfo(const llvm::Triple &Triple) : ARMTargetInfo(Triple, true) {} + void getTargetDefines(const LangOptions &Opts, + MacroBuilder &Builder) const override { Builder.defineMacro("__ARMEB__"); Builder.defineMacro("__ARM_BIG_ENDIAN"); ARMTargetInfo::getTargetDefines(Opts, Builder); @@ -4754,8 +4752,8 @@ return CPUKnown; } - virtual void getTargetDefines(const LangOptions &Opts, - MacroBuilder &Builder) const override { + void getTargetDefines(const LangOptions &Opts, + MacroBuilder &Builder) const override { // Target identification. Builder.defineMacro("__aarch64__"); @@ -4814,8 +4812,8 @@ Builder.defineMacro("__ARM_FEATURE_CRYPTO"); } - virtual void getTargetBuiltins(const Builtin::Info *&Records, - unsigned &NumRecords) const override { + void getTargetBuiltins(const Builtin::Info *&Records, + unsigned &NumRecords) const override { Records = BuiltinInfo; NumRecords = clang::AArch64::LastTSBuiltin - Builtin::FirstTSBuiltin; } @@ -4851,14 +4849,13 @@ return TargetInfo::AArch64ABIBuiltinVaList; } - virtual void getGCCRegNames(const char *const *&Names, - unsigned &NumNames) const override; - virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, - unsigned &NumAliases) const override; - - virtual bool - validateAsmConstraint(const char *&Name, - TargetInfo::ConstraintInfo &Info) const override { + void getGCCRegNames(const char *const *&Names, + unsigned &NumNames) const override; + void getGCCRegAliases(const GCCRegAlias *&Aliases, + unsigned &NumAliases) const override; + + bool validateAsmConstraint(const char *&Name, + TargetInfo::ConstraintInfo &Info) const override { switch (*Name) { default: return false; Index: lib/Basic/VirtualFileSystem.cpp =================================================================== --- lib/Basic/VirtualFileSystem.cpp +++ lib/Basic/VirtualFileSystem.cpp @@ -92,7 +92,7 @@ } public: - ~RealFile(); + ~RealFile() override; ErrorOr status() override; ErrorOr> getBuffer(const Twine &Name, int64_t FileSize = -1, @@ -362,7 +362,7 @@ Status S; public: - virtual ~DirectoryEntry(); + ~DirectoryEntry() override; DirectoryEntry(StringRef Name, std::vector Contents, Status S) : Entry(EK_Directory, Name), Contents(std::move(Contents)), S(std::move(S)) {} @@ -498,7 +498,7 @@ ErrorOr status(const Twine &Path, Entry *E); public: - ~VFSFromYAML(); + ~VFSFromYAML() override; /// \brief Parses \p Buffer, which is expected to be in YAML format and /// returns a virtual file system representing its contents. Index: lib/CodeGen/CGOpenMPRuntime.cpp =================================================================== --- lib/CodeGen/CGOpenMPRuntime.cpp +++ lib/CodeGen/CGOpenMPRuntime.cpp @@ -45,8 +45,8 @@ /// \return LValue for thread id variable. This LValue always has type int32*. virtual LValue getThreadIDVariableLValue(CodeGenFunction &CGF); - /// \brief Emit the captured statement body. - virtual void EmitBody(CodeGenFunction &CGF, const Stmt *S) override; + /// \brief Emit the captured statement body. + void EmitBody(CodeGenFunction &CGF, const Stmt *S) override; static bool classof(const CGCapturedStmtInfo *Info) { return Info->getKind() == CR_OpenMP; @@ -66,9 +66,7 @@ } /// \brief Get a variable or parameter for storing global thread id /// inside OpenMP construct. - virtual const VarDecl *getThreadIDVariable() const override { - return ThreadIDVar; - } + const VarDecl *getThreadIDVariable() const override { return ThreadIDVar; } /// \brief Get the name of the capture helper. StringRef getHelperName() const override { return ".omp_outlined."; } @@ -91,15 +89,13 @@ } /// \brief Get a variable or parameter for storing global thread id /// inside OpenMP construct. - virtual const VarDecl *getThreadIDVariable() const override { - return ThreadIDVar; - } + const VarDecl *getThreadIDVariable() const override { return ThreadIDVar; } /// \brief Get an LValue for the current ThreadID variable. - virtual LValue getThreadIDVariableLValue(CodeGenFunction &CGF) override; + LValue getThreadIDVariableLValue(CodeGenFunction &CGF) override; /// \brief Emit the captured statement body. - virtual void EmitBody(CodeGenFunction &CGF, const Stmt *S) override; + void EmitBody(CodeGenFunction &CGF, const Stmt *S) override; /// \brief Get the name of the capture helper. StringRef getHelperName() const override { return ".omp_outlined."; } @@ -122,33 +118,33 @@ : CGOpenMPRegionInfo(D), OldCSI(OldCSI), OuterRegionInfo(dyn_cast_or_null(OldCSI)) {} // \brief Retrieve the value of the context parameter. - virtual llvm::Value *getContextValue() const override { + llvm::Value *getContextValue() const override { if (OuterRegionInfo) return OuterRegionInfo->getContextValue(); llvm_unreachable("No context value for inlined OpenMP region"); } /// \brief Lookup the captured field decl for a variable. - virtual const FieldDecl *lookup(const VarDecl *VD) const override { + const FieldDecl *lookup(const VarDecl *VD) const override { if (OuterRegionInfo) return OuterRegionInfo->lookup(VD); llvm_unreachable("Trying to reference VarDecl that is neither local nor " "captured in outer OpenMP region"); } - virtual FieldDecl *getThisFieldDecl() const override { + FieldDecl *getThisFieldDecl() const override { if (OuterRegionInfo) return OuterRegionInfo->getThisFieldDecl(); return nullptr; } /// \brief Get a variable or parameter for storing global thread id /// inside OpenMP construct. - virtual const VarDecl *getThreadIDVariable() const override { + const VarDecl *getThreadIDVariable() const override { if (OuterRegionInfo) return OuterRegionInfo->getThreadIDVariable(); return nullptr; } /// \brief Get the name of the capture helper. - virtual StringRef getHelperName() const override { + StringRef getHelperName() const override { llvm_unreachable("No helper name for inlined OpenMP construct"); } Index: lib/CodeGen/ModuleBuilder.cpp =================================================================== --- lib/CodeGen/ModuleBuilder.cpp +++ lib/CodeGen/ModuleBuilder.cpp @@ -56,14 +56,14 @@ SmallVector DeferredInlineMethodDefinitions; public: - CodeGeneratorImpl(DiagnosticsEngine &diags, const std::string& ModuleName, - const CodeGenOptions &CGO, llvm::LLVMContext& C, + CodeGeneratorImpl(DiagnosticsEngine &diags, const std::string &ModuleName, + const CodeGenOptions &CGO, llvm::LLVMContext &C, CoverageSourceInfo *CoverageInfo = nullptr) - : Diags(diags), Ctx(nullptr), CodeGenOpts(CGO), HandlingTopLevelDecls(0), - CoverageInfo(CoverageInfo), - M(new llvm::Module(ModuleName, C)) {} + : Diags(diags), Ctx(nullptr), CodeGenOpts(CGO), + HandlingTopLevelDecls(0), CoverageInfo(CoverageInfo), + M(new llvm::Module(ModuleName, C)) {} - virtual ~CodeGeneratorImpl() { + ~CodeGeneratorImpl() override { // There should normally not be any leftover inline method definitions. assert(DeferredInlineMethodDefinitions.empty() || Diags.hasErrorOccurred()); Index: lib/CodeGen/TargetInfo.cpp =================================================================== --- lib/CodeGen/TargetInfo.cpp +++ lib/CodeGen/TargetInfo.cpp @@ -1622,10 +1622,10 @@ class PS4TargetCodeGenInfo : public X86_64TargetCodeGenInfo { public: PS4TargetCodeGenInfo(CodeGen::CodeGenTypes &CGT, bool HasAVX) - : X86_64TargetCodeGenInfo(CGT, HasAVX) {} + : X86_64TargetCodeGenInfo(CGT, HasAVX) {} void getDependentLibraryOption(llvm::StringRef Lib, - llvm::SmallString<24> &Opt) const { + llvm::SmallString<24> &Opt) const override { Opt = "\01"; Opt += Lib; } @@ -3915,8 +3915,8 @@ llvm::Value *EmitAAPCSVAArg(llvm::Value *VAListAddr, QualType Ty, CodeGenFunction &CGF) const; - virtual llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty, - CodeGenFunction &CGF) const override { + llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty, + CodeGenFunction &CGF) const override { return isDarwinPCS() ? EmitDarwinVAArg(VAListAddr, Ty, CGF) : EmitAAPCSVAArg(VAListAddr, Ty, CGF); } @@ -3927,13 +3927,15 @@ AArch64TargetCodeGenInfo(CodeGenTypes &CGT, AArch64ABIInfo::ABIKind Kind) : TargetCodeGenInfo(new AArch64ABIInfo(CGT, Kind)) {} - StringRef getARCRetainAutoreleasedReturnValueMarker() const { + StringRef getARCRetainAutoreleasedReturnValueMarker() const override { return "mov\tfp, fp\t\t; marker for objc_retainAutoreleaseReturnValue"; } - int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const { return 31; } + int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const override { + return 31; + } - virtual bool doesReturnSlotInterfereWithArgs() const { return false; } + bool doesReturnSlotInterfereWithArgs() const override { return false; } }; } Index: lib/Driver/ToolChains.h =================================================================== --- lib/Driver/ToolChains.h +++ lib/Driver/ToolChains.h @@ -152,7 +152,7 @@ public: Generic_GCC(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - ~Generic_GCC(); + ~Generic_GCC() override; void printVerboseInfo(raw_ostream &OS) const override; @@ -195,8 +195,8 @@ public: MachO(const Driver &D, const llvm::Triple &Triple, - const llvm::opt::ArgList &Args); - ~MachO(); + const llvm::opt::ArgList &Args); + ~MachO() override; /// @name MachO specific toolchain API /// { @@ -345,7 +345,7 @@ public: Darwin(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - ~Darwin(); + ~Darwin() override; std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args, types::ID InputType) const override; @@ -483,16 +483,13 @@ AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const override; - void - AddCCKextLibArgs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const override; + void AddCCKextLibArgs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const override; - virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) - const override; + void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override; - void - AddLinkARCArgs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const override; + void AddLinkARCArgs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const override; /// } private: @@ -699,7 +696,7 @@ public: Hexagon_TC(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - ~Hexagon_TC(); + ~Hexagon_TC() override; void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, @@ -762,7 +759,7 @@ public: TCEToolChain(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - ~TCEToolChain(); + ~TCEToolChain() override; bool IsMathErrnoDefault() const override; bool isPICDefault() const override; Index: lib/Format/UnwrappedLineParser.cpp =================================================================== --- lib/Format/UnwrappedLineParser.cpp +++ lib/Format/UnwrappedLineParser.cpp @@ -68,7 +68,7 @@ Line.InPPDirective = true; } - ~ScopedMacroState() { + ~ScopedMacroState() override { TokenSource = PreviousTokenSource; ResetToken = Token; Line.InPPDirective = false; Index: lib/Frontend/CacheTokens.cpp =================================================================== --- lib/Frontend/CacheTokens.cpp +++ lib/Frontend/CacheTokens.cpp @@ -535,9 +535,10 @@ /// Stat information for files are populated elsewhere. class StatListener : public FileSystemStatCache { PTHMap &PM; + public: StatListener(PTHMap &pm) : PM(pm) {} - ~StatListener() {} + ~StatListener() override {} LookupResult getStat(const char *Path, FileData &Data, bool isFile, std::unique_ptr *F, Index: lib/Frontend/ChainedIncludesSource.cpp =================================================================== --- lib/Frontend/ChainedIncludesSource.cpp +++ lib/Frontend/ChainedIncludesSource.cpp @@ -27,7 +27,7 @@ namespace { class ChainedIncludesSource : public ExternalSemaSource { public: - virtual ~ChainedIncludesSource(); + ~ChainedIncludesSource() override; ExternalSemaSource &getFinalReader() const { return *FinalReader; } Index: lib/Frontend/FrontendAction.cpp =================================================================== --- lib/Frontend/FrontendAction.cpp +++ lib/Frontend/FrontendAction.cpp @@ -44,7 +44,7 @@ explicit DelegatingDeserializationListener( ASTDeserializationListener *Previous, bool DeletePrevious) : Previous(Previous), DeletePrevious(DeletePrevious) {} - virtual ~DelegatingDeserializationListener() { + ~DelegatingDeserializationListener() override { if (DeletePrevious) delete Previous; } Index: lib/Frontend/FrontendActions.cpp =================================================================== --- lib/Frontend/FrontendActions.cpp +++ lib/Frontend/FrontendActions.cpp @@ -480,9 +480,8 @@ return false; } - virtual bool - ReadDiagnosticOptions(IntrusiveRefCntPtr DiagOpts, - bool Complain) override { + bool ReadDiagnosticOptions(IntrusiveRefCntPtr DiagOpts, + bool Complain) override { Out.indent(2) << "Diagnostic options:\n"; #define DIAGOPT(Name, Bits, Default) DUMP_BOOLEAN(DiagOpts->Name, #Name); #define ENUM_DIAGOPT(Name, Type, Bits, Default) \ Index: lib/Frontend/HeaderIncludeGen.cpp =================================================================== --- lib/Frontend/HeaderIncludeGen.cpp +++ lib/Frontend/HeaderIncludeGen.cpp @@ -30,12 +30,12 @@ HeaderIncludesCallback(const Preprocessor *PP, bool ShowAllHeaders_, raw_ostream *OutputFile_, bool OwnsOutputFile_, bool ShowDepth_, bool MSStyle_) - : SM(PP->getSourceManager()), OutputFile(OutputFile_), - CurrentIncludeDepth(0), HasProcessedPredefines(false), - OwnsOutputFile(OwnsOutputFile_), ShowAllHeaders(ShowAllHeaders_), - ShowDepth(ShowDepth_), MSStyle(MSStyle_) {} + : SM(PP->getSourceManager()), OutputFile(OutputFile_), + CurrentIncludeDepth(0), HasProcessedPredefines(false), + OwnsOutputFile(OwnsOutputFile_), ShowAllHeaders(ShowAllHeaders_), + ShowDepth(ShowDepth_), MSStyle(MSStyle_) {} - ~HeaderIncludesCallback() { + ~HeaderIncludesCallback() override { if (OwnsOutputFile) delete OutputFile; } Index: lib/Frontend/Rewrite/RewriteModernObjC.cpp =================================================================== --- lib/Frontend/Rewrite/RewriteModernObjC.cpp +++ lib/Frontend/Rewrite/RewriteModernObjC.cpp @@ -240,11 +240,11 @@ void HandleTopLevelSingleDecl(Decl *D); void HandleDeclInMainFile(Decl *D); - RewriteModernObjC(std::string inFile, raw_ostream *OS, - DiagnosticsEngine &D, const LangOptions &LOpts, - bool silenceMacroWarn, bool LineInfo); - - ~RewriteModernObjC() {} + RewriteModernObjC(std::string inFile, raw_ostream *OS, DiagnosticsEngine &D, + const LangOptions &LOpts, bool silenceMacroWarn, + bool LineInfo); + + ~RewriteModernObjC() override {} void HandleTranslationUnit(ASTContext &C) override; Index: lib/Frontend/Rewrite/RewriteObjC.cpp =================================================================== --- lib/Frontend/Rewrite/RewriteObjC.cpp +++ lib/Frontend/Rewrite/RewriteObjC.cpp @@ -189,11 +189,10 @@ } void HandleTopLevelSingleDecl(Decl *D); void HandleDeclInMainFile(Decl *D); - RewriteObjC(std::string inFile, raw_ostream *OS, - DiagnosticsEngine &D, const LangOptions &LOpts, - bool silenceMacroWarn); + RewriteObjC(std::string inFile, raw_ostream *OS, DiagnosticsEngine &D, + const LangOptions &LOpts, bool silenceMacroWarn); - ~RewriteObjC() {} + ~RewriteObjC() override {} void HandleTranslationUnit(ASTContext &C) override; @@ -505,14 +504,12 @@ class RewriteObjCFragileABI : public RewriteObjC { public: - RewriteObjCFragileABI(std::string inFile, raw_ostream *OS, - DiagnosticsEngine &D, const LangOptions &LOpts, - bool silenceMacroWarn) : RewriteObjC(inFile, OS, - D, LOpts, - silenceMacroWarn) {} - - ~RewriteObjCFragileABI() {} + DiagnosticsEngine &D, const LangOptions &LOpts, + bool silenceMacroWarn) + : RewriteObjC(inFile, OS, D, LOpts, silenceMacroWarn) {} + + ~RewriteObjCFragileABI() override {} void Initialize(ASTContext &context) override; // Rewriting metadata Index: lib/Frontend/SerializedDiagnosticPrinter.cpp =================================================================== --- lib/Frontend/SerializedDiagnosticPrinter.cpp +++ lib/Frontend/SerializedDiagnosticPrinter.cpp @@ -59,15 +59,13 @@ public: SDiagsRenderer(SDiagsWriter &Writer, const LangOptions &LangOpts, DiagnosticOptions *DiagOpts) - : DiagnosticNoteRenderer(LangOpts, DiagOpts), Writer(Writer) {} + : DiagnosticNoteRenderer(LangOpts, DiagOpts), Writer(Writer) {} + + ~SDiagsRenderer() override {} - virtual ~SDiagsRenderer() {} - protected: - void emitDiagnosticMessage(SourceLocation Loc, - PresumedLoc PLoc, - DiagnosticsEngine::Level Level, - StringRef Message, + void emitDiagnosticMessage(SourceLocation Loc, PresumedLoc PLoc, + DiagnosticsEngine::Level Level, StringRef Message, ArrayRef Ranges, const SourceManager *SM, DiagOrStoredDiag D) override; @@ -158,7 +156,7 @@ EmitPreamble(); } - ~SDiagsWriter() {} + ~SDiagsWriter() override {} void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) override; Index: lib/Frontend/VerifyDiagnosticConsumer.cpp =================================================================== --- lib/Frontend/VerifyDiagnosticConsumer.cpp +++ lib/Frontend/VerifyDiagnosticConsumer.cpp @@ -58,9 +58,9 @@ /// \brief Hook into the preprocessor and update the list of parsed /// files when the preprocessor indicates a new file is entered. - virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, - SrcMgr::CharacteristicKind FileType, - FileID PrevFID) { + void FileChanged(SourceLocation Loc, FileChangeReason Reason, + SrcMgr::CharacteristicKind FileType, + FileID PrevFID) override { Verify.UpdateParsedFileStatus(SM, SM.getFileID(Loc), VerifyDiagnosticConsumer::IsParsed); } Index: lib/Sema/AnalysisBasedWarnings.cpp =================================================================== --- lib/Sema/AnalysisBasedWarnings.cpp +++ lib/Sema/AnalysisBasedWarnings.cpp @@ -139,7 +139,7 @@ return false; } - void compareAlwaysTrue(const BinaryOperator *B, bool isAlwaysTrue) { + void compareAlwaysTrue(const BinaryOperator *B, bool isAlwaysTrue) override { if (HasMacroID(B)) return; @@ -148,7 +148,8 @@ << DiagRange << isAlwaysTrue; } - void compareBitwiseEquality(const BinaryOperator *B, bool isAlwaysTrue) { + void compareBitwiseEquality(const BinaryOperator *B, + bool isAlwaysTrue) override { if (HasMacroID(B)) return; @@ -1330,12 +1331,10 @@ // order of diagnostics when calling flushDiagnostics(). typedef llvm::MapVector UsesMap; UsesMap *uses; - + public: UninitValsDiagReporter(Sema &S) : S(S), uses(nullptr) {} - ~UninitValsDiagReporter() { - flushDiagnostics(); - } + ~UninitValsDiagReporter() override { flushDiagnostics(); } MappedType &getUses(const VarDecl *vd) { if (!uses) @@ -1663,12 +1662,11 @@ } } - - virtual void handleNegativeNotHeld(StringRef Kind, Name LockName, Name Neg, - SourceLocation Loc) override { - PartialDiagnosticAt Warning(Loc, - S.PDiag(diag::warn_acquire_requires_negative_cap) - << Kind << LockName << Neg); + void handleNegativeNotHeld(StringRef Kind, Name LockName, Name Neg, + SourceLocation Loc) override { + PartialDiagnosticAt Warning( + Loc, S.PDiag(diag::warn_acquire_requires_negative_cap) + << Kind << LockName << Neg); Warnings.push_back(DelayedDiag(Warning, getNotes())); } @@ -1680,19 +1678,16 @@ Warnings.push_back(DelayedDiag(Warning, getNotes())); } - - virtual void handleLockAcquiredBefore(StringRef Kind, Name L1Name, - Name L2Name, SourceLocation Loc) - override { - PartialDiagnosticAt Warning(Loc, - S.PDiag(diag::warn_acquired_before) << Kind << L1Name << L2Name); + void handleLockAcquiredBefore(StringRef Kind, Name L1Name, Name L2Name, + SourceLocation Loc) override { + PartialDiagnosticAt Warning(Loc, S.PDiag(diag::warn_acquired_before) + << Kind << L1Name << L2Name); Warnings.push_back(DelayedDiag(Warning, getNotes())); } - virtual void handleBeforeAfterCycle(Name L1Name, SourceLocation Loc) - override { - PartialDiagnosticAt Warning(Loc, - S.PDiag(diag::warn_acquired_before_after_cycle) << L1Name); + void handleBeforeAfterCycle(Name L1Name, SourceLocation Loc) override { + PartialDiagnosticAt Warning( + Loc, S.PDiag(diag::warn_acquired_before_after_cycle) << L1Name); Warnings.push_back(DelayedDiag(Warning, getNotes())); } Index: lib/Sema/SemaExprCXX.cpp =================================================================== --- lib/Sema/SemaExprCXX.cpp +++ lib/Sema/SemaExprCXX.cpp @@ -1415,16 +1415,16 @@ SemaDiagnosticBuilder noteAmbiguous( Sema &S, CXXConversionDecl *Conv, QualType ConvTy) override { return S.Diag(Conv->getLocation(), diag::note_array_size_conversion) - << ConvTy->isEnumeralType() << ConvTy; + << ConvTy->isEnumeralType() << ConvTy; } - virtual SemaDiagnosticBuilder diagnoseConversion( - Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) override { - return S.Diag(Loc, - S.getLangOpts().CPlusPlus11 - ? diag::warn_cxx98_compat_array_size_conversion - : diag::ext_array_size_conversion) - << T << ConvTy->isEnumeralType() << ConvTy; + SemaDiagnosticBuilder diagnoseConversion(Sema &S, SourceLocation Loc, + QualType T, + QualType ConvTy) override { + return S.Diag(Loc, S.getLangOpts().CPlusPlus11 + ? diag::warn_cxx98_compat_array_size_conversion + : diag::ext_array_size_conversion) + << T << ConvTy->isEnumeralType() << ConvTy; } } SizeDiagnoser(ArraySize); Index: lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp @@ -142,7 +142,7 @@ : cfg(cfg), Ctx(ctx), BR(br), Checker(checker), AC(ac), Parents(parents), Escaped(escaped), currentBlock(nullptr) {} - virtual ~DeadStoreObs() {} + ~DeadStoreObs() override {} bool isLive(const LiveVariables::LivenessValues &Live, const VarDecl *D) { if (Live.isLive(D)) Index: lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp +++ lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp @@ -137,7 +137,7 @@ public: SecKeychainBugVisitor(SymbolRef S) : Sym(S) {} - virtual ~SecKeychainBugVisitor() {} + ~SecKeychainBugVisitor() override {} void Profile(llvm::FoldingSetNodeID &ID) const override { static int X = 0; Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -391,9 +391,9 @@ public: MallocBugVisitor(SymbolRef S, bool isLeak = false) - : Sym(S), Mode(Normal), FailedReallocSymbol(nullptr), IsLeak(isLeak) {} + : Sym(S), Mode(Normal), FailedReallocSymbol(nullptr), IsLeak(isLeak) {} - virtual ~MallocBugVisitor() {} + ~MallocBugVisitor() override {} void Profile(llvm::FoldingSetNodeID &ID) const override { static int X = 0; Index: lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -2470,14 +2470,13 @@ /// the allocation line. mutable bool IncludeAllocationLine; -public: +public: RetainCountChecker(AnalyzerOptions &AO) - : ShouldResetSummaryLog(false), - IncludeAllocationLine(shouldIncludeAllocationSiteInLeakDiagnostics(AO)) {} + : ShouldResetSummaryLog(false), + IncludeAllocationLine( + shouldIncludeAllocationSiteInLeakDiagnostics(AO)) {} - virtual ~RetainCountChecker() { - DeleteContainerSeconds(DeadSymbolTags); - } + ~RetainCountChecker() override { DeleteContainerSeconds(DeadSymbolTags); } void checkEndAnalysis(ExplodedGraph &G, BugReporter &BR, ExprEngine &Eng) const { Index: lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp =================================================================== --- lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -42,10 +42,12 @@ bool createdDir, noDir; const Preprocessor &PP; AnalyzerOptions &AnalyzerOpts; + public: - HTMLDiagnostics(AnalyzerOptions &AnalyzerOpts, const std::string& prefix, const Preprocessor &pp); + HTMLDiagnostics(AnalyzerOptions &AnalyzerOpts, const std::string &prefix, + const Preprocessor &pp); - virtual ~HTMLDiagnostics() { FlushDiagnostics(nullptr); } + ~HTMLDiagnostics() override { FlushDiagnostics(nullptr); } void FlushDiagnosticsImpl(std::vector &Diags, FilesMade *filesMade) override; Index: lib/StaticAnalyzer/Core/PlistDiagnostics.cpp =================================================================== --- lib/StaticAnalyzer/Core/PlistDiagnostics.cpp +++ lib/StaticAnalyzer/Core/PlistDiagnostics.cpp @@ -32,12 +32,10 @@ const LangOptions &LangOpts; const bool SupportsCrossFileDiagnostics; public: - PlistDiagnostics(AnalyzerOptions &AnalyzerOpts, - const std::string& prefix, - const LangOptions &LangOpts, - bool supportsMultipleFiles); + PlistDiagnostics(AnalyzerOptions &AnalyzerOpts, const std::string &prefix, + const LangOptions &LangOpts, bool supportsMultipleFiles); - virtual ~PlistDiagnostics() {} + ~PlistDiagnostics() override {} void FlushDiagnosticsImpl(std::vector &Diags, FilesMade *filesMade) override; Index: lib/StaticAnalyzer/Core/SimpleConstraintManager.h =================================================================== --- lib/StaticAnalyzer/Core/SimpleConstraintManager.h +++ lib/StaticAnalyzer/Core/SimpleConstraintManager.h @@ -24,10 +24,11 @@ class SimpleConstraintManager : public ConstraintManager { SubEngine *SU; SValBuilder &SVB; + public: SimpleConstraintManager(SubEngine *subengine, SValBuilder &SB) - : SU(subengine), SVB(SB) {} - virtual ~SimpleConstraintManager(); + : SU(subengine), SVB(SB) {} + ~SimpleConstraintManager() override; //===------------------------------------------------------------------===// // Common implementation for the interface provided by ConstraintManager. Index: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp =================================================================== --- lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp +++ lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp @@ -28,8 +28,8 @@ public: SimpleSValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context, ProgramStateManager &stateMgr) - : SValBuilder(alloc, context, stateMgr) {} - virtual ~SimpleSValBuilder() {} + : SValBuilder(alloc, context, stateMgr) {} + ~SimpleSValBuilder() override {} SVal evalMinus(NonLoc val) override; SVal evalComplement(NonLoc val) override; Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp =================================================================== --- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -89,10 +89,11 @@ class ClangDiagPathDiagConsumer : public PathDiagnosticConsumer { DiagnosticsEngine &Diag; bool IncludePath; + public: ClangDiagPathDiagConsumer(DiagnosticsEngine &Diag) - : Diag(Diag), IncludePath(false) {} - virtual ~ClangDiagPathDiagConsumer() {} + : Diag(Diag), IncludePath(false) {} + ~ClangDiagPathDiagConsumer() override {} StringRef getName() const override { return "ClangDiags"; } bool supportsLogicalOpControlFlow() const override { return true; } @@ -199,7 +200,7 @@ } } - ~AnalysisConsumer() { + ~AnalysisConsumer() override { if (Opts->PrintStats) delete TUTotalTimer; } @@ -373,8 +374,7 @@ return true; } - virtual void - AddDiagnosticConsumer(PathDiagnosticConsumer *Consumer) override { + void AddDiagnosticConsumer(PathDiagnosticConsumer *Consumer) override { PathConsumers.push_back(Consumer); } @@ -724,7 +724,7 @@ public: UbigraphViz(std::unique_ptr Out, StringRef Filename); - ~UbigraphViz(); + ~UbigraphViz() override; void AddEdge(ExplodedNode *Src, ExplodedNode *Dst) override; }; Index: lib/StaticAnalyzer/Frontend/ModelInjector.h =================================================================== --- lib/StaticAnalyzer/Frontend/ModelInjector.h +++ lib/StaticAnalyzer/Frontend/ModelInjector.h @@ -43,8 +43,8 @@ class ModelInjector : public CodeInjector { public: ModelInjector(CompilerInstance &CI); - Stmt *getBody(const FunctionDecl *D); - Stmt *getBody(const ObjCMethodDecl *D); + Stmt *getBody(const FunctionDecl *D) override; + Stmt *getBody(const ObjCMethodDecl *D) override; private: /// \brief Synthesize a body for a declaration Index: lib/Tooling/CompilationDatabase.cpp =================================================================== --- lib/Tooling/CompilationDatabase.cpp +++ lib/Tooling/CompilationDatabase.cpp @@ -156,8 +156,8 @@ // recording for our own purposes. UnusedInputDiagConsumer(DiagnosticConsumer *Other) : Other(Other) {} - virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, - const Diagnostic &Info) override { + void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, + const Diagnostic &Info) override { if (Info.getID() == clang::diag::warn_drv_input_file_unused) { // Arg 1 for this diagnostic is the option that didn't get used. UnusedInputs.push_back(Info.getArgStdStr(0)); Index: tools/libclang/CIndexCodeCompletion.cpp =================================================================== --- tools/libclang/CIndexCodeCompletion.cpp +++ tools/libclang/CIndexCodeCompletion.cpp @@ -530,13 +530,11 @@ CaptureCompletionResults(const CodeCompleteOptions &Opts, AllocatedCXCodeCompleteResults &Results, CXTranslationUnit *TranslationUnit) - : CodeCompleteConsumer(Opts, false), - AllocatedResults(Results), CCTUInfo(Results.CodeCompletionAllocator), - TU(TranslationUnit) { } - ~CaptureCompletionResults() { Finish(); } + : CodeCompleteConsumer(Opts, false), AllocatedResults(Results), + CCTUInfo(Results.CodeCompletionAllocator), TU(TranslationUnit) {} + ~CaptureCompletionResults() override { Finish(); } - void ProcessCodeCompleteResults(Sema &S, - CodeCompletionContext Context, + void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context, CodeCompletionResult *Results, unsigned NumResults) override { StoredResults.reserve(StoredResults.size() + NumResults); Index: tools/libclang/CIndexDiagnostic.h =================================================================== --- tools/libclang/CIndexDiagnostic.h +++ tools/libclang/CIndexDiagnostic.h @@ -111,14 +111,13 @@ struct CXStoredDiagnostic : public CXDiagnosticImpl { const StoredDiagnostic &Diag; const LangOptions &LangOpts; - - CXStoredDiagnostic(const StoredDiagnostic &Diag, - const LangOptions &LangOpts) - : CXDiagnosticImpl(StoredDiagnosticKind), - Diag(Diag), LangOpts(LangOpts) { } - - virtual ~CXStoredDiagnostic() {} - + + CXStoredDiagnostic(const StoredDiagnostic &Diag, const LangOptions &LangOpts) + : CXDiagnosticImpl(StoredDiagnosticKind), Diag(Diag), LangOpts(LangOpts) { + } + + ~CXStoredDiagnostic() override {} + /// \brief Return the severity of the diagnostic. CXDiagnosticSeverity getSeverity() const override; Index: tools/libclang/CIndexDiagnostic.cpp =================================================================== --- tools/libclang/CIndexDiagnostic.cpp +++ tools/libclang/CIndexDiagnostic.cpp @@ -45,10 +45,9 @@ CXSourceLocation Loc; public: CXDiagnosticCustomNoteImpl(StringRef Msg, CXSourceLocation L) - : CXDiagnosticImpl(CustomNoteDiagnosticKind), - Message(Msg), Loc(L) {} + : CXDiagnosticImpl(CustomNoteDiagnosticKind), Message(Msg), Loc(L) {} - virtual ~CXDiagnosticCustomNoteImpl() {} + ~CXDiagnosticCustomNoteImpl() override {} CXDiagnosticSeverity getSeverity() const override { return CXDiagnostic_Note; @@ -85,14 +84,13 @@ }; class CXDiagnosticRenderer : public DiagnosticNoteRenderer { -public: - CXDiagnosticRenderer(const LangOptions &LangOpts, - DiagnosticOptions *DiagOpts, +public: + CXDiagnosticRenderer(const LangOptions &LangOpts, DiagnosticOptions *DiagOpts, CXDiagnosticSetImpl *mainSet) - : DiagnosticNoteRenderer(LangOpts, DiagOpts), - CurrentSet(mainSet), MainSet(mainSet) {} - - virtual ~CXDiagnosticRenderer() {} + : DiagnosticNoteRenderer(LangOpts, DiagOpts), CurrentSet(mainSet), + MainSet(mainSet) {} + + ~CXDiagnosticRenderer() override {} void beginDiagnostic(DiagOrStoredDiag D, DiagnosticsEngine::Level Level) override { Index: tools/libclang/CXLoadedDiagnostic.h =================================================================== --- tools/libclang/CXLoadedDiagnostic.h +++ tools/libclang/CXLoadedDiagnostic.h @@ -23,11 +23,11 @@ namespace clang { class CXLoadedDiagnostic : public CXDiagnosticImpl { public: - CXLoadedDiagnostic() : CXDiagnosticImpl(LoadedDiagnosticKind), - severity(0), category(0) {} + CXLoadedDiagnostic() + : CXDiagnosticImpl(LoadedDiagnosticKind), severity(0), category(0) {} + + ~CXLoadedDiagnostic() override; - virtual ~CXLoadedDiagnostic(); - /// \brief Return the severity of the diagnostic. CXDiagnosticSeverity getSeverity() const override; Index: tools/libclang/CXLoadedDiagnostic.cpp =================================================================== --- tools/libclang/CXLoadedDiagnostic.cpp +++ tools/libclang/CXLoadedDiagnostic.cpp @@ -37,7 +37,7 @@ class CXLoadedDiagnosticSetImpl : public CXDiagnosticSetImpl { public: CXLoadedDiagnosticSetImpl() : CXDiagnosticSetImpl(true), FakeFiles(FO) {} - virtual ~CXLoadedDiagnosticSetImpl() {} + ~CXLoadedDiagnosticSetImpl() override {} llvm::BumpPtrAllocator Alloc; Strings Categories; Index: unittests/AST/DeclPrinterTest.cpp =================================================================== --- unittests/AST/DeclPrinterTest.cpp +++ unittests/AST/DeclPrinterTest.cpp @@ -44,7 +44,7 @@ public: PrintMatch() : NumFoundDecls(0) {} - virtual void run(const MatchFinder::MatchResult &Result) { + void run(const MatchFinder::MatchResult &Result) override { const Decl *D = Result.Nodes.getDeclAs("id"); if (!D || D->isImplicit()) return; Index: unittests/AST/ExternalASTSourceTest.cpp =================================================================== --- unittests/AST/ExternalASTSourceTest.cpp +++ unittests/AST/ExternalASTSourceTest.cpp @@ -28,15 +28,17 @@ TestFrontendAction(ExternalASTSource *Source) : Source(Source) {} private: - virtual void ExecuteAction() { + void ExecuteAction() override { getCompilerInstance().getASTContext().setExternalSource(Source); - getCompilerInstance().getASTContext().getTranslationUnitDecl() + getCompilerInstance() + .getASTContext() + .getTranslationUnitDecl() ->setHasExternalVisibleStorage(); return ASTFrontendAction::ExecuteAction(); } - virtual std::unique_ptr CreateASTConsumer(CompilerInstance &CI, - StringRef InFile) { + std::unique_ptr CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override { return llvm::make_unique(); } @@ -67,8 +69,8 @@ struct TestSource : ExternalASTSource { TestSource(unsigned &Calls) : Calls(Calls) {} - bool FindExternalVisibleDeclsByName(const DeclContext*, - DeclarationName Name) { + bool FindExternalVisibleDeclsByName(const DeclContext *, + DeclarationName Name) override { if (Name.getAsString() == "j") ++Calls; return false; Index: unittests/AST/MatchVerifier.h =================================================================== --- unittests/AST/MatchVerifier.h +++ unittests/AST/MatchVerifier.h @@ -59,11 +59,10 @@ template testing::AssertionResult match(const std::string &Code, const MatcherType &AMatcher, - std::vector& Args, - Language L); + std::vector &Args, Language L); protected: - virtual void run(const MatchFinder::MatchResult &Result); + void run(const MatchFinder::MatchResult &Result) override; virtual void verify(const MatchFinder::MatchResult &Result, const NodeType &Node) {} @@ -166,7 +165,8 @@ } protected: - void verify(const MatchFinder::MatchResult &Result, const NodeType &Node) { + void verify(const MatchFinder::MatchResult &Result, + const NodeType &Node) override { SourceLocation Loc = getLocation(Node); unsigned Line = Result.SourceManager->getSpellingLineNumber(Loc); unsigned Column = Result.SourceManager->getSpellingColumnNumber(Loc); @@ -205,7 +205,8 @@ } protected: - void verify(const MatchFinder::MatchResult &Result, const NodeType &Node) { + void verify(const MatchFinder::MatchResult &Result, + const NodeType &Node) override { SourceRange R = getRange(Node); SourceLocation Begin = R.getBegin(); SourceLocation End = R.getEnd(); @@ -244,7 +245,7 @@ protected: void verify(const MatchFinder::MatchResult &Result, - const ast_type_traits::DynTypedNode &Node) { + const ast_type_traits::DynTypedNode &Node) override { std::string DumpStr; llvm::raw_string_ostream Dump(DumpStr); Node.dump(Dump, *Result.SourceManager); @@ -271,7 +272,7 @@ protected: void verify(const MatchFinder::MatchResult &Result, - const ast_type_traits::DynTypedNode &Node) { + const ast_type_traits::DynTypedNode &Node) override { std::string PrintStr; llvm::raw_string_ostream Print(PrintStr); Node.print(Print, Result.Context->getPrintingPolicy()); Index: unittests/AST/NamedDeclPrinterTest.cpp =================================================================== --- unittests/AST/NamedDeclPrinterTest.cpp +++ unittests/AST/NamedDeclPrinterTest.cpp @@ -35,9 +35,9 @@ public: explicit PrintMatch(bool suppressUnwrittenScope) - : NumFoundDecls(0), SuppressUnwrittenScope(suppressUnwrittenScope) {} + : NumFoundDecls(0), SuppressUnwrittenScope(suppressUnwrittenScope) {} - virtual void run(const MatchFinder::MatchResult &Result) { + void run(const MatchFinder::MatchResult &Result) override { const NamedDecl *ND = Result.Nodes.getNodeAs("id"); if (!ND) return; Index: unittests/AST/SourceLocationTest.cpp =================================================================== --- unittests/AST/SourceLocationTest.cpp +++ unittests/AST/SourceLocationTest.cpp @@ -60,7 +60,7 @@ class LabelDeclRangeVerifier : public RangeVerifier { protected: - virtual SourceRange getRange(const LabelStmt &Node) { + SourceRange getRange(const LabelStmt &Node) override { return Node.getDecl()->getSourceRange(); } }; @@ -107,15 +107,15 @@ EXPECT_TRUE(Verifier.match("struct S { operator int() const; };\n" "int foo(const S& s) { return s; }", memberExpr())); -} - -class MemberExprArrowLocVerifier : public RangeVerifier { -protected: - virtual SourceRange getRange(const MemberExpr &Node) { - return Node.getOperatorLoc(); - } -}; - +} + +class MemberExprArrowLocVerifier : public RangeVerifier { +protected: + SourceRange getRange(const MemberExpr &Node) override { + return Node.getOperatorLoc(); + } +}; + TEST(MemberExpr, ArrowRange) { MemberExprArrowLocVerifier Verifier; Verifier.expectRange(2, 19, 2, 19); @@ -201,7 +201,7 @@ class TemplateAngleBracketLocRangeVerifier : public RangeVerifier { protected: - virtual SourceRange getRange(const TypeLoc &Node) { + SourceRange getRange(const TypeLoc &Node) override { TemplateSpecializationTypeLoc T = Node.getUnqualifiedLoc().castAs(); assert(!T.isNull()); @@ -226,7 +226,7 @@ class UnaryTransformTypeLocParensRangeVerifier : public RangeVerifier { protected: - virtual SourceRange getRange(const TypeLoc &Node) { + SourceRange getRange(const TypeLoc &Node) override { UnaryTransformTypeLoc T = Node.getUnqualifiedLoc().castAs(); assert(!T.isNull()); Index: unittests/AST/StmtPrinterTest.cpp =================================================================== --- unittests/AST/StmtPrinterTest.cpp +++ unittests/AST/StmtPrinterTest.cpp @@ -44,7 +44,7 @@ public: PrintMatch() : NumFoundStmts(0) {} - virtual void run(const MatchFinder::MatchResult &Result) { + void run(const MatchFinder::MatchResult &Result) override { const Stmt *S = Result.Nodes.getStmtAs("id"); if (!S) return; Index: unittests/ASTMatchers/ASTMatchersTest.cpp =================================================================== --- unittests/ASTMatchers/ASTMatchersTest.cpp +++ unittests/ASTMatchers/ASTMatchersTest.cpp @@ -747,12 +747,12 @@ Name.clear(); } - ~VerifyIdIsBoundTo() { + ~VerifyIdIsBoundTo() override { EXPECT_EQ(0, Count); EXPECT_EQ("", Name); } - virtual bool run(const BoundNodes *Nodes) override { + bool run(const BoundNodes *Nodes) override { const BoundNodes::IDToNodeMap &M = Nodes->getMap(); if (Nodes->getNodeAs(Id)) { ++Count; @@ -774,7 +774,7 @@ return false; } - virtual bool run(const BoundNodes *Nodes, ASTContext *Context) override { + bool run(const BoundNodes *Nodes, ASTContext *Context) override { return run(Nodes); } @@ -4376,12 +4376,11 @@ public: VerifyMatchOnNode(StringRef Id, const internal::Matcher &InnerMatcher, StringRef InnerId) - : Id(Id), InnerMatcher(InnerMatcher), InnerId(InnerId) { - } + : Id(Id), InnerMatcher(InnerMatcher), InnerId(InnerId) {} - virtual bool run(const BoundNodes *Nodes) { return false; } + bool run(const BoundNodes *Nodes) override { return false; } - virtual bool run(const BoundNodes *Nodes, ASTContext *Context) { + bool run(const BoundNodes *Nodes, ASTContext *Context) override { const T *Node = Nodes->getNodeAs(Id); return selectFirst(InnerId, match(InnerMatcher, *Node, *Context)) != nullptr; @@ -4430,9 +4429,9 @@ template class VerifyAncestorHasChildIsEqual : public BoundNodesCallback { public: - virtual bool run(const BoundNodes *Nodes) { return false; } + bool run(const BoundNodes *Nodes) override { return false; } - virtual bool run(const BoundNodes *Nodes, ASTContext *Context) { + bool run(const BoundNodes *Nodes, ASTContext *Context) override { const T *Node = Nodes->getNodeAs(""); return verify(*Nodes, *Context, Node); } @@ -4488,12 +4487,10 @@ class VerifyStartOfTranslationUnit : public MatchFinder::MatchCallback { public: VerifyStartOfTranslationUnit() : Called(false) {} - virtual void run(const MatchFinder::MatchResult &Result) { + void run(const MatchFinder::MatchResult &Result) override { EXPECT_TRUE(Called); } - virtual void onStartOfTranslationUnit() { - Called = true; - } + void onStartOfTranslationUnit() override { Called = true; } bool Called; }; @@ -4516,12 +4513,10 @@ class VerifyEndOfTranslationUnit : public MatchFinder::MatchCallback { public: VerifyEndOfTranslationUnit() : Called(false) {} - virtual void run(const MatchFinder::MatchResult &Result) { + void run(const MatchFinder::MatchResult &Result) override { EXPECT_FALSE(Called); } - virtual void onEndOfTranslationUnit() { - Called = true; - } + void onEndOfTranslationUnit() override { Called = true; } bool Called; }; Index: unittests/ASTMatchers/Dynamic/ParserTest.cpp =================================================================== --- unittests/ASTMatchers/Dynamic/ParserTest.cpp +++ unittests/ASTMatchers/Dynamic/ParserTest.cpp @@ -23,7 +23,7 @@ class MockSema : public Parser::Sema { public: - virtual ~MockSema() {} + ~MockSema() override {} uint64_t expectMatcher(StringRef MatcherName) { // Optimizations on the matcher framework make simple matchers like @@ -42,7 +42,8 @@ Errors.push_back(Error.toStringFull()); } - llvm::Optional lookupMatcherCtor(StringRef MatcherName) { + llvm::Optional + lookupMatcherCtor(StringRef MatcherName) override { const ExpectedMatchersTy::value_type *Matcher = &*ExpectedMatchers.find(MatcherName); return reinterpret_cast(Matcher); @@ -52,10 +53,10 @@ const SourceRange &NameRange, StringRef BindID, ArrayRef Args, - Diagnostics *Error) { + Diagnostics *Error) override { const ExpectedMatchersTy::value_type *Matcher = reinterpret_cast(Ctor); - MatcherInfo ToStore = { Matcher->first, NameRange, Args, BindID }; + MatcherInfo ToStore = {Matcher->first, NameRange, Args, BindID}; Matchers.push_back(ToStore); return VariantMatcher::SingleMatcher(Matcher->second); } Index: unittests/Basic/SourceManagerTest.cpp =================================================================== --- unittests/Basic/SourceManagerTest.cpp +++ unittests/Basic/SourceManagerTest.cpp @@ -256,16 +256,15 @@ std::vector &Macros; public: - explicit MacroTracker(std::vector &Macros) : Macros(Macros) { } - - virtual void MacroDefined(const Token &MacroNameTok, - const MacroDirective *MD) { - Macros.push_back(MacroAction(MD->getLocation(), - MacroNameTok.getIdentifierInfo()->getName(), - true)); + explicit MacroTracker(std::vector &Macros) : Macros(Macros) {} + + void MacroDefined(const Token &MacroNameTok, + const MacroDirective *MD) override { + Macros.push_back(MacroAction( + MD->getLocation(), MacroNameTok.getIdentifierInfo()->getName(), true)); } - virtual void MacroExpands(const Token &MacroNameTok, const MacroDirective *MD, - SourceRange Range, const MacroArgs *Args) { + void MacroExpands(const Token &MacroNameTok, const MacroDirective *MD, + SourceRange Range, const MacroArgs *Args) override { Macros.push_back(MacroAction(MacroNameTok.getLocation(), MacroNameTok.getIdentifierInfo()->getName(), false)); Index: unittests/Basic/VirtualFileSystemTest.cpp =================================================================== --- unittests/Basic/VirtualFileSystemTest.cpp +++ unittests/Basic/VirtualFileSystemTest.cpp @@ -521,9 +521,7 @@ public: int NumDiagnostics; - void SetUp() { - NumDiagnostics = 0; - } + void SetUp() override { NumDiagnostics = 0; } static void CountingDiagHandler(const SMDiagnostic &, void *Context) { VFSFromYAMLTest *Test = static_cast(Context); Index: unittests/Frontend/FrontendActionTest.cpp =================================================================== --- unittests/Frontend/FrontendActionTest.cpp +++ unittests/Frontend/FrontendActionTest.cpp @@ -35,15 +35,16 @@ bool ActOnEndOfTranslationUnit; std::vector decl_names; - virtual bool BeginSourceFileAction(CompilerInstance &ci, StringRef filename) { + bool BeginSourceFileAction(CompilerInstance &ci, + StringRef filename) override { if (EnableIncrementalProcessing) ci.getPreprocessor().enableIncrementalProcessing(); return ASTFrontendAction::BeginSourceFileAction(ci, filename); } - virtual std::unique_ptr CreateASTConsumer(CompilerInstance &CI, - StringRef InFile) { + std::unique_ptr CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override { return llvm::make_unique(CI, ActOnEndOfTranslationUnit, decl_names); } @@ -52,11 +53,11 @@ class Visitor : public ASTConsumer, public RecursiveASTVisitor { public: Visitor(CompilerInstance &CI, bool ActOnEndOfTranslationUnit, - std::vector &decl_names) : - CI(CI), ActOnEndOfTranslationUnit(ActOnEndOfTranslationUnit), - decl_names_(decl_names) {} + std::vector &decl_names) + : CI(CI), ActOnEndOfTranslationUnit(ActOnEndOfTranslationUnit), + decl_names_(decl_names) {} - virtual void HandleTranslationUnit(ASTContext &context) { + void HandleTranslationUnit(ASTContext &context) override { if (ActOnEndOfTranslationUnit) { CI.getSema().ActOnEndOfTranslationUnit(); } Index: unittests/Lex/PPCallbacksTest.cpp =================================================================== --- unittests/Lex/PPCallbacksTest.cpp +++ unittests/Lex/PPCallbacksTest.cpp @@ -54,18 +54,14 @@ // Stub to collect data from InclusionDirective callbacks. class InclusionDirectiveCallbacks : public PPCallbacks { public: - void InclusionDirective(SourceLocation HashLoc, - const Token &IncludeTok, - StringRef FileName, - bool IsAngled, - CharSourceRange FilenameRange, - const FileEntry *File, - StringRef SearchPath, - StringRef RelativePath, - const Module *Imported) { - this->HashLoc = HashLoc; - this->IncludeTok = IncludeTok; - this->FileName = FileName.str(); + void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, + StringRef FileName, bool IsAngled, + CharSourceRange FilenameRange, const FileEntry *File, + StringRef SearchPath, StringRef RelativePath, + const Module *Imported) override { + this->HashLoc = HashLoc; + this->IncludeTok = IncludeTok; + this->FileName = FileName.str(); this->IsAngled = IsAngled; this->FilenameRange = FilenameRange; this->File = File; @@ -95,12 +91,13 @@ PragmaOpenCLExtensionCallbacks() : Name("Not called."), State(99) {}; - void PragmaOpenCLExtension( - clang::SourceLocation NameLoc, const clang::IdentifierInfo *Name, - clang::SourceLocation StateLoc, unsigned State) { - this->NameLoc = NameLoc; - this->Name = Name->getName(); - this->StateLoc = StateLoc; + void PragmaOpenCLExtension(clang::SourceLocation NameLoc, + const clang::IdentifierInfo *Name, + clang::SourceLocation StateLoc, + unsigned State) override { + this->NameLoc = NameLoc; + this->Name = Name->getName(); + this->StateLoc = StateLoc; this->State = State; }; Index: unittests/Sema/ExternalSemaSourceTest.cpp =================================================================== --- unittests/Sema/ExternalSemaSourceTest.cpp +++ unittests/Sema/ExternalSemaSourceTest.cpp @@ -30,7 +30,7 @@ public: CompleteTypeDiagnoser(bool MockResult) : CallCount(0), Result(MockResult) {} - virtual bool MaybeDiagnoseMissingCompleteType(SourceLocation L, QualType T) { + bool MaybeDiagnoseMissingCompleteType(SourceLocation L, QualType T) override { ++CallCount; return Result; } @@ -54,8 +54,8 @@ ToNS.append("'"); } - virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, - const Diagnostic &Info) { + void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, + const Diagnostic &Info) override { if (Chained) Chained->HandleDiagnostic(DiagLevel, Info); if (Info.getID() - 1 == diag::err_using_directive_member_suggest) { @@ -66,13 +66,13 @@ } } - virtual void clear() { + void clear() override { DiagnosticConsumer::clear(); if (Chained) Chained->clear(); } - virtual bool IncludeInDiagnosticCounts() const { + bool IncludeInDiagnosticCounts() const override { if (Chained) return Chained->IncludeInDiagnosticCounts(); return false; @@ -97,16 +97,15 @@ NamespaceTypoProvider(StringRef From, StringRef To) : CorrectFrom(From), CorrectTo(To), CurrentSema(nullptr), CallCount(0) {} - virtual void InitializeSema(Sema &S) { CurrentSema = &S; } + void InitializeSema(Sema &S) override { CurrentSema = &S; } - virtual void ForgetSema() { CurrentSema = nullptr; } + void ForgetSema() override { CurrentSema = nullptr; } - virtual TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, - int LookupKind, Scope *S, CXXScopeSpec *SS, - CorrectionCandidateCallback &CCC, - DeclContext *MemberContext, - bool EnteringContext, - const ObjCObjectPointerType *OPT) { + TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, int LookupKind, + Scope *S, CXXScopeSpec *SS, + CorrectionCandidateCallback &CCC, + DeclContext *MemberContext, bool EnteringContext, + const ObjCObjectPointerType *OPT) override { ++CallCount; if (CurrentSema && Typo.getName().getAsString() == CorrectFrom) { DeclContext *DestContext = nullptr; @@ -140,13 +139,13 @@ std::unique_ptr OwnedClient; protected: - virtual std::unique_ptr + std::unique_ptr CreateASTConsumer(clang::CompilerInstance &Compiler, - llvm::StringRef /* dummy */) { + llvm::StringRef /* dummy */) override { return llvm::make_unique(); } - virtual void ExecuteAction() { + void ExecuteAction() override { CompilerInstance &CI = getCompilerInstance(); ASSERT_FALSE(CI.hasSema()); CI.createSema(getTranslationUnitKind(), nullptr); Index: unittests/Tooling/CommentHandlerTest.cpp =================================================================== --- unittests/Tooling/CommentHandlerTest.cpp +++ unittests/Tooling/CommentHandlerTest.cpp @@ -30,11 +30,11 @@ public: CommentHandlerVisitor() : base(), PP(nullptr), Verified(false) {} - ~CommentHandlerVisitor() { + ~CommentHandlerVisitor() override { EXPECT_TRUE(Verified) << "CommentVerifier not accessed"; } - virtual bool HandleComment(Preprocessor &PP, SourceRange Loc) { + bool HandleComment(Preprocessor &PP, SourceRange Loc) override { assert(&PP == this->PP && "Preprocessor changed!"); SourceLocation Start = Loc.getBegin(); @@ -56,7 +56,7 @@ CommentVerifier GetVerifier(); protected: - virtual ASTFrontendAction* CreateTestAction() { + ASTFrontendAction *CreateTestAction() override { return new CommentHandlerAction(this); } @@ -68,20 +68,20 @@ class CommentHandlerAction : public base::TestAction { public: CommentHandlerAction(CommentHandlerVisitor *Visitor) - : TestAction(Visitor) { } + : TestAction(Visitor) {} - virtual bool BeginSourceFileAction(CompilerInstance &CI, - StringRef FileName) { + bool BeginSourceFileAction(CompilerInstance &CI, + StringRef FileName) override { CommentHandlerVisitor *V = - static_cast(this->Visitor); + static_cast(this->Visitor); V->PP = &CI.getPreprocessor(); V->PP->addCommentHandler(V); return true; } - virtual void EndSourceFileAction() { + void EndSourceFileAction() override { CommentHandlerVisitor *V = - static_cast(this->Visitor); + static_cast(this->Visitor); V->PP->removeCommentHandler(V); } }; Index: unittests/Tooling/CompilationDatabaseTest.cpp =================================================================== --- unittests/Tooling/CompilationDatabaseTest.cpp +++ unittests/Tooling/CompilationDatabaseTest.cpp @@ -127,8 +127,8 @@ } struct FakeComparator : public PathComparator { - virtual ~FakeComparator() {} - virtual bool equivalent(StringRef FileA, StringRef FileB) const { + ~FakeComparator() override {} + bool equivalent(StringRef FileA, StringRef FileB) const override { return FileA.equals_lower(FileB); } }; Index: unittests/Tooling/RefactoringTest.cpp =================================================================== --- unittests/Tooling/RefactoringTest.cpp +++ unittests/Tooling/RefactoringTest.cpp @@ -211,9 +211,9 @@ class FlushRewrittenFilesTest : public ::testing::Test { public: - FlushRewrittenFilesTest() {} + FlushRewrittenFilesTest() {} - ~FlushRewrittenFilesTest() { + ~FlushRewrittenFilesTest() override { for (llvm::StringMap::iterator I = TemporaryFiles.begin(), E = TemporaryFiles.end(); I != E; ++I) { @@ -287,7 +287,7 @@ public: FindConsumer(TestVisitor *Visitor) : Visitor(Visitor) {} - virtual void HandleTranslationUnit(clang::ASTContext &Context) { + void HandleTranslationUnit(clang::ASTContext &Context) override { Visitor->TraverseDecl(Context.getTranslationUnitDecl()); } @@ -299,9 +299,9 @@ public: TestAction(TestVisitor *Visitor) : Visitor(Visitor) {} - virtual std::unique_ptr + std::unique_ptr CreateASTConsumer(clang::CompilerInstance &compiler, - llvm::StringRef dummy) { + llvm::StringRef dummy) override { Visitor->SM = &compiler.getSourceManager(); /// TestConsumer will be deleted by the framework calling us. return llvm::make_unique(Visitor); Index: unittests/Tooling/TestVisitor.h =================================================================== --- unittests/Tooling/TestVisitor.h +++ unittests/Tooling/TestVisitor.h @@ -82,7 +82,7 @@ public: FindConsumer(TestVisitor *Visitor) : Visitor(Visitor) {} - virtual void HandleTranslationUnit(clang::ASTContext &Context) { + void HandleTranslationUnit(clang::ASTContext &Context) override { Visitor->Context = &Context; Visitor->TraverseDecl(Context.getTranslationUnitDecl()); } @@ -95,8 +95,8 @@ public: TestAction(TestVisitor *Visitor) : Visitor(Visitor) {} - virtual std::unique_ptr - CreateASTConsumer(CompilerInstance &, llvm::StringRef dummy) { + std::unique_ptr + CreateASTConsumer(CompilerInstance &, llvm::StringRef dummy) override { /// TestConsumer will be deleted by the framework calling us. return llvm::make_unique(Visitor); } @@ -133,9 +133,10 @@ } /// \brief Checks that all expected matches have been found. - virtual ~ExpectedLocationVisitor() { + ~ExpectedLocationVisitor() override { for (typename std::vector::const_iterator - It = ExpectedMatches.begin(), End = ExpectedMatches.end(); + It = ExpectedMatches.begin(), + End = ExpectedMatches.end(); It != End; ++It) { It->ExpectFound(); } Index: unittests/Tooling/ToolingTest.cpp =================================================================== --- unittests/Tooling/ToolingTest.cpp +++ unittests/Tooling/ToolingTest.cpp @@ -35,8 +35,9 @@ : TestConsumer(std::move(TestConsumer)) {} protected: - virtual std::unique_ptr - CreateASTConsumer(clang::CompilerInstance &compiler, StringRef dummy) { + std::unique_ptr + CreateASTConsumer(clang::CompilerInstance &compiler, + StringRef dummy) override { /// TestConsumer will be deleted by the framework calling us. return std::move(TestConsumer); } @@ -46,13 +47,14 @@ }; class FindTopLevelDeclConsumer : public clang::ASTConsumer { - public: +public: explicit FindTopLevelDeclConsumer(bool *FoundTopLevelDecl) : FoundTopLevelDecl(FoundTopLevelDecl) {} - virtual bool HandleTopLevelDecl(clang::DeclGroupRef DeclGroup) { + bool HandleTopLevelDecl(clang::DeclGroupRef DeclGroup) override { *FoundTopLevelDecl = true; return true; } + private: bool * const FoundTopLevelDecl; }; @@ -69,12 +71,12 @@ namespace { class FindClassDeclXConsumer : public clang::ASTConsumer { - public: +public: FindClassDeclXConsumer(bool *FoundClassDeclX) : FoundClassDeclX(FoundClassDeclX) {} - virtual bool HandleTopLevelDecl(clang::DeclGroupRef GroupRef) { - if (CXXRecordDecl* Record = dyn_cast( - *GroupRef.begin())) { + bool HandleTopLevelDecl(clang::DeclGroupRef GroupRef) override { + if (CXXRecordDecl *Record = + dyn_cast(*GroupRef.begin())) { if (Record->getName() == "X") { *FoundClassDeclX = true; } @@ -184,14 +186,11 @@ struct VerifyEndCallback : public SourceFileCallbacks { VerifyEndCallback() : BeginCalled(0), EndCalled(0), Matched(false) {} - virtual bool handleBeginSource(CompilerInstance &CI, - StringRef Filename) override { + bool handleBeginSource(CompilerInstance &CI, StringRef Filename) override { ++BeginCalled; return true; } - virtual void handleEndSource() override { - ++EndCalled; - } + void handleEndSource() override { ++EndCalled; } std::unique_ptr newASTConsumer() { return llvm::make_unique(&Matched); } @@ -225,15 +224,15 @@ struct SkipBodyConsumer : public clang::ASTConsumer { /// Skip the 'skipMe' function. - virtual bool shouldSkipFunctionBody(Decl *D) { + bool shouldSkipFunctionBody(Decl *D) override { FunctionDecl *F = dyn_cast(D); return F && F->getNameAsString() == "skipMe"; } }; struct SkipBodyAction : public clang::ASTFrontendAction { - virtual std::unique_ptr - CreateASTConsumer(CompilerInstance &Compiler, StringRef) { + std::unique_ptr CreateASTConsumer(CompilerInstance &Compiler, + StringRef) override { Compiler.getFrontendOpts().SkipFunctionBodies = true; return llvm::make_unique(); } @@ -312,8 +311,8 @@ struct TestDiagnosticConsumer : public DiagnosticConsumer { TestDiagnosticConsumer() : NumDiagnosticsSeen(0) {} - virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, - const Diagnostic &Info) { + void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, + const Diagnostic &Info) override { ++NumDiagnosticsSeen; } unsigned NumDiagnosticsSeen; Index: unittests/libclang/LibclangTest.cpp =================================================================== --- unittests/libclang/LibclangTest.cpp +++ unittests/libclang/LibclangTest.cpp @@ -357,7 +357,7 @@ CXTranslationUnit ClangTU; unsigned TUFlags; - void SetUp() { + void SetUp() override { llvm::SmallString<256> Dir; ASSERT_FALSE(llvm::sys::fs::createUniqueDirectory("libclang-test", Dir)); TestDir = Dir.str(); @@ -365,7 +365,7 @@ clang_defaultEditingTranslationUnitOptions(); Index = clang_createIndex(0, 0); } - void TearDown() { + void TearDown() override { clang_disposeTranslationUnit(ClangTU); clang_disposeIndex(Index); for (const std::string &Path : Files) Index: utils/TableGen/NeonEmitter.cpp =================================================================== --- utils/TableGen/NeonEmitter.cpp +++ utils/TableGen/NeonEmitter.cpp @@ -1563,10 +1563,10 @@ // See the documentation in arm_neon.td for a description of these operators. class LowHalf : public SetTheory::Operator { public: - virtual void anchor() {} - virtual ~LowHalf() {} - virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef Loc) { + void anchor() override {} + ~LowHalf() override {} + void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef Loc) override { SetTheory::RecSet Elts2; ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts2, Loc); Elts.insert(Elts2.begin(), Elts2.begin() + (Elts2.size() / 2)); @@ -1574,10 +1574,10 @@ }; class HighHalf : public SetTheory::Operator { public: - virtual void anchor() {} - virtual ~HighHalf() {} - virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef Loc) { + void anchor() override {} + ~HighHalf() override {} + void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef Loc) override { SetTheory::RecSet Elts2; ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts2, Loc); Elts.insert(Elts2.begin() + (Elts2.size() / 2), Elts2.end()); @@ -1588,10 +1588,10 @@ public: Rev(unsigned ElementSize) : ElementSize(ElementSize) {} - virtual void anchor() {} - virtual ~Rev() {} - virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef Loc) { + void anchor() override {} + ~Rev() override {} + void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef Loc) override { SetTheory::RecSet Elts2; ST.evaluate(Expr->arg_begin() + 1, Expr->arg_end(), Elts2, Loc); @@ -1613,9 +1613,9 @@ public: MaskExpander(unsigned N) : N(N) {} - virtual void anchor() {} - virtual ~MaskExpander() {} - virtual void expand(SetTheory &ST, Record *R, SetTheory::RecSet &Elts) { + void anchor() override {} + ~MaskExpander() override {} + void expand(SetTheory &ST, Record *R, SetTheory::RecSet &Elts) override { unsigned Addend = 0; if (R->getName() == "mask0") Addend = 0;