diff options
98 files changed, 305 insertions, 327 deletions
diff --git a/examples/PrintFunctionNames/PrintFunctionNames.cpp b/examples/PrintFunctionNames/PrintFunctionNames.cpp index b554caeb2a..39443f597f 100644 --- a/examples/PrintFunctionNames/PrintFunctionNames.cpp +++ b/examples/PrintFunctionNames/PrintFunctionNames.cpp @@ -23,7 +23,7 @@ namespace { class PrintFunctionsConsumer : public ASTConsumer { public: - virtual bool HandleTopLevelDecl(DeclGroupRef DG) { + bool HandleTopLevelDecl(DeclGroupRef DG) override { for (DeclGroupRef::iterator i = DG.begin(), e = DG.end(); i != e; ++i) { const Decl *D = *i; if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) @@ -37,12 +37,12 @@ public: class PrintFunctionNamesAction : public PluginASTAction { protected: std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef) { + llvm::StringRef) override { return llvm::make_unique<PrintFunctionsConsumer>(); } bool ParseArgs(const CompilerInstance &CI, - const std::vector<std::string>& args) { + const std::vector<std::string> &args) override { for (unsigned i = 0, e = args.size(); i != e; ++i) { llvm::errs() << "PrintFunctionNames arg = " << args[i] << "\n"; diff --git a/include/clang/AST/VTableBuilder.h b/include/clang/AST/VTableBuilder.h index 4e24bdd730..ebfbb8ad04 100644 --- a/include/clang/AST/VTableBuilder.h +++ b/include/clang/AST/VTableBuilder.h @@ -333,7 +333,7 @@ private: public: ItaniumVTableContext(ASTContext &Context); - ~ItaniumVTableContext(); + ~ItaniumVTableContext() override; const VTableLayout &getVTableLayout(const CXXRecordDecl *RD) { computeVTableRelatedInformation(RD); @@ -511,7 +511,7 @@ public: MicrosoftVTableContext(ASTContext &Context) : VTableContextBase(/*MS=*/true), Context(Context) {} - ~MicrosoftVTableContext(); + ~MicrosoftVTableContext() override; const VPtrInfoVector &getVFPtrOffsets(const CXXRecordDecl *RD); diff --git a/include/clang/ASTMatchers/ASTMatchersInternal.h b/include/clang/ASTMatchers/ASTMatchersInternal.h index 20f1efa5e3..2789223f9a 100644 --- a/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -209,7 +209,7 @@ public: template <typename T> class MatcherInterface : public DynMatcherInterface { public: - virtual ~MatcherInterface() {} + ~MatcherInterface() override {} /// \brief Returns true if 'Node' can be matched. /// diff --git a/include/clang/ASTMatchers/Dynamic/Parser.h b/include/clang/ASTMatchers/Dynamic/Parser.h index bd006b6e12..cdc259e0d0 100644 --- a/include/clang/ASTMatchers/Dynamic/Parser.h +++ b/include/clang/ASTMatchers/Dynamic/Parser.h @@ -123,7 +123,7 @@ public: /// tokens. class RegistrySema : public Parser::Sema { public: - virtual ~RegistrySema(); + ~RegistrySema() override; llvm::Optional<MatcherCtor> lookupMatcherCtor(StringRef MatcherName) override; diff --git a/include/clang/ASTMatchers/Dynamic/VariantValue.h b/include/clang/ASTMatchers/Dynamic/VariantValue.h index ae22e37d8e..bf69e17088 100644 --- a/include/clang/ASTMatchers/Dynamic/VariantValue.h +++ b/include/clang/ASTMatchers/Dynamic/VariantValue.h @@ -122,7 +122,7 @@ class VariantMatcher { /// It follows a similar interface as VariantMatcher itself. class Payload : public RefCountedBaseVPTR { public: - virtual ~Payload(); + ~Payload() override; virtual llvm::Optional<DynTypedMatcher> getSingleMatcher() const = 0; virtual std::string getTypeAsString() const = 0; virtual llvm::Optional<DynTypedMatcher> diff --git a/include/clang/Analysis/Analyses/Dominators.h b/include/clang/Analysis/Analyses/Dominators.h index fcef0fc10a..4524aebe4e 100644 --- a/include/clang/Analysis/Analyses/Dominators.h +++ b/include/clang/Analysis/Analyses/Dominators.h @@ -44,9 +44,7 @@ public: DT = new llvm::DominatorTreeBase<CFGBlock>(false); } - ~DominatorTree() { - delete DT; - } + ~DominatorTree() override { delete DT; } llvm::DominatorTreeBase<CFGBlock>& getBase() { return *DT; } diff --git a/include/clang/Analysis/Analyses/LiveVariables.h b/include/clang/Analysis/Analyses/LiveVariables.h index c29dd409e5..7d11091435 100644 --- a/include/clang/Analysis/Analyses/LiveVariables.h +++ b/include/clang/Analysis/Analyses/LiveVariables.h @@ -66,11 +66,10 @@ public: /// 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); diff --git a/include/clang/Analysis/AnalysisContext.h b/include/clang/Analysis/AnalysisContext.h index a20fc518b4..931190e43a 100644 --- a/include/clang/Analysis/AnalysisContext.h +++ b/include/clang/Analysis/AnalysisContext.h @@ -289,7 +289,7 @@ class StackFrameContext : public LocationContext { Block(blk), Index(idx) {} public: - ~StackFrameContext() {} + ~StackFrameContext() override {} const Stmt *getCallSite() const { return CallSite; } @@ -324,7 +324,7 @@ class ScopeContext : public LocationContext { : LocationContext(Scope, ctx, parent), Enter(s) {} public: - ~ScopeContext() {} + ~ScopeContext() override {} void Profile(llvm::FoldingSetNodeID &ID) override; @@ -352,7 +352,7 @@ class BlockInvocationContext : public LocationContext { : LocationContext(Block, ctx, parent), BD(bd), ContextData(contextData) {} public: - ~BlockInvocationContext() {} + ~BlockInvocationContext() override {} const BlockDecl *getBlockDecl() const { return BD; } diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index f72809cab6..0f3831d600 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -1371,7 +1371,7 @@ class ForwardingDiagnosticConsumer : public DiagnosticConsumer { public: ForwardingDiagnosticConsumer(DiagnosticConsumer &Target) : Target(Target) {} - virtual ~ForwardingDiagnosticConsumer(); + ~ForwardingDiagnosticConsumer() override; void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) override; diff --git a/include/clang/CodeGen/CodeGenAction.h b/include/clang/CodeGen/CodeGenAction.h index f8fd56152f..264780d01c 100644 --- a/include/clang/CodeGen/CodeGenAction.h +++ b/include/clang/CodeGen/CodeGenAction.h @@ -45,7 +45,7 @@ protected: 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, diff --git a/include/clang/Driver/Job.h b/include/clang/Driver/Job.h index b510676c09..bc7e3ecaf0 100644 --- a/include/clang/Driver/Job.h +++ b/include/clang/Driver/Job.h @@ -175,7 +175,7 @@ private: public: JobList(); - virtual ~JobList() {} + ~JobList() override {} void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, CrashReportInfo *CrashInfo = nullptr) const override; diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index 79adf5946d..238069db3b 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -484,8 +484,8 @@ public: } }; friend class ConcurrencyCheck; - - ~ASTUnit(); + + ~ASTUnit() override; bool isMainFileAST() const { return MainFileIsAST; } diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 9adfecfc8b..433c41c224 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -168,7 +168,7 @@ class CompilerInstance : public ModuleLoader { void operator=(const CompilerInstance &) = delete; public: explicit CompilerInstance(bool BuildingModule = false); - ~CompilerInstance(); + ~CompilerInstance() override; /// @name High-Level Operations /// { diff --git a/include/clang/Frontend/DiagnosticRenderer.h b/include/clang/Frontend/DiagnosticRenderer.h index 5becadf40e..84a0f50823 100644 --- a/include/clang/Frontend/DiagnosticRenderer.h +++ b/include/clang/Frontend/DiagnosticRenderer.h @@ -155,8 +155,8 @@ public: DiagnosticNoteRenderer(const LangOptions &LangOpts, DiagnosticOptions *DiagOpts) : DiagnosticRenderer(LangOpts, DiagOpts) {} - - virtual ~DiagnosticNoteRenderer(); + + ~DiagnosticNoteRenderer() override; void emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc, const SourceManager &SM) override; diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h index be1e19ce81..b1508287c8 100644 --- a/include/clang/Frontend/FrontendActions.h +++ b/include/clang/Frontend/FrontendActions.h @@ -186,7 +186,7 @@ protected: public: ASTMergeAction(FrontendAction *AdaptedAction, ArrayRef<std::string> ASTFiles); - virtual ~ASTMergeAction(); + ~ASTMergeAction() override; bool usesPreprocessorOnly() const override; TranslationUnitKind getTranslationUnitKind() override; diff --git a/include/clang/Frontend/MultiplexConsumer.h b/include/clang/Frontend/MultiplexConsumer.h index 2553275dac..873af038f2 100644 --- a/include/clang/Frontend/MultiplexConsumer.h +++ b/include/clang/Frontend/MultiplexConsumer.h @@ -30,7 +30,7 @@ class MultiplexConsumer : public SemaConsumer { public: // Takes ownership of the pointers in C. MultiplexConsumer(std::vector<std::unique_ptr<ASTConsumer>> C); - ~MultiplexConsumer(); + ~MultiplexConsumer() override; // ASTConsumer void Initialize(ASTContext &Context) override; diff --git a/include/clang/Frontend/TextDiagnostic.h b/include/clang/Frontend/TextDiagnostic.h index 42c78af1d2..d41f15a1ff 100644 --- a/include/clang/Frontend/TextDiagnostic.h +++ b/include/clang/Frontend/TextDiagnostic.h @@ -40,8 +40,8 @@ public: 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 diff --git a/include/clang/Frontend/TextDiagnosticPrinter.h b/include/clang/Frontend/TextDiagnosticPrinter.h index f8a71fe5e0..04a570559f 100644 --- a/include/clang/Frontend/TextDiagnosticPrinter.h +++ b/include/clang/Frontend/TextDiagnosticPrinter.h @@ -40,7 +40,7 @@ class TextDiagnosticPrinter : public DiagnosticConsumer { public: TextDiagnosticPrinter(raw_ostream &os, DiagnosticOptions *diags, bool OwnsOutputStream = false); - virtual ~TextDiagnosticPrinter(); + ~TextDiagnosticPrinter() override; /// setPrefix - Set the diagnostic printer prefix string, which will be /// printed at the start of any diagnostics. If empty, no prefix string is diff --git a/include/clang/Frontend/VerifyDiagnosticConsumer.h b/include/clang/Frontend/VerifyDiagnosticConsumer.h index aa0bcc9319..475f07f9dc 100644 --- a/include/clang/Frontend/VerifyDiagnosticConsumer.h +++ b/include/clang/Frontend/VerifyDiagnosticConsumer.h @@ -246,7 +246,7 @@ public: /// 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; diff --git a/include/clang/Lex/PTHLexer.h b/include/clang/Lex/PTHLexer.h index 75abf6bf70..904be792b2 100644 --- a/include/clang/Lex/PTHLexer.h +++ b/include/clang/Lex/PTHLexer.h @@ -64,8 +64,7 @@ protected: PTHLexer(Preprocessor& pp, FileID FID, const unsigned char *D, const unsigned char* ppcond, PTHManager &PM); public: - - ~PTHLexer() {} + ~PTHLexer() override {} /// Lex - Return the next token. bool Lex(Token &Tok); diff --git a/include/clang/Lex/PTHManager.h b/include/clang/Lex/PTHManager.h index e36d3dd87b..a4198f890e 100644 --- a/include/clang/Lex/PTHManager.h +++ b/include/clang/Lex/PTHManager.h @@ -113,7 +113,7 @@ public: // 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. diff --git a/include/clang/Lex/Pragma.h b/include/clang/Lex/Pragma.h index 4123bae2ea..70fcfda6e7 100644 --- a/include/clang/Lex/Pragma.h +++ b/include/clang/Lex/Pragma.h @@ -93,7 +93,7 @@ class PragmaNamespace : public PragmaHandler { llvm::StringMap<PragmaHandler*> Handlers; public: explicit PragmaNamespace(StringRef Name) : PragmaHandler(Name) {} - virtual ~PragmaNamespace(); + ~PragmaNamespace() override; /// FindHandler - Check to see if there is already a handler for the /// specified name. If not, return the handler for the null name if it diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 0352c649fc..f4487c1d9d 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -235,7 +235,7 @@ class Parser : public CodeCompletionHandler { public: Parser(Preprocessor &PP, Sema &Actions, bool SkipFunctionBodies); - ~Parser(); + ~Parser() override; const LangOptions &getLangOpts() const { return PP.getLangOpts(); } const TargetInfo &getTargetInfo() const { return PP.getTargetInfo(); } @@ -887,7 +887,7 @@ private: class LateParsedClass : public LateParsedDeclaration { public: LateParsedClass(Parser *P, ParsingClass *C); - virtual ~LateParsedClass(); + ~LateParsedClass() override; void ParseLexedMethodDeclarations() override; void ParseLexedMemberInitializers() override; diff --git a/include/clang/Rewrite/Frontend/FixItRewriter.h b/include/clang/Rewrite/Frontend/FixItRewriter.h index 5994172354..ad828e55ae 100644 --- a/include/clang/Rewrite/Frontend/FixItRewriter.h +++ b/include/clang/Rewrite/Frontend/FixItRewriter.h @@ -86,7 +86,7 @@ public: 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 { diff --git a/include/clang/Rewrite/Frontend/FrontendActions.h b/include/clang/Rewrite/Frontend/FrontendActions.h index c8ea8b2dd8..6c290e4d60 100644 --- a/include/clang/Rewrite/Frontend/FrontendActions.h +++ b/include/clang/Rewrite/Frontend/FrontendActions.h @@ -43,7 +43,7 @@ protected: public: FixItAction(); - ~FixItAction(); + ~FixItAction() override; }; /// \brief Emits changes to temporary files and uses them for the original diff --git a/include/clang/Sema/ExternalSemaSource.h b/include/clang/Sema/ExternalSemaSource.h index 430cef7846..de4672f1af 100644 --- a/include/clang/Sema/ExternalSemaSource.h +++ b/include/clang/Sema/ExternalSemaSource.h @@ -55,7 +55,7 @@ public: 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 diff --git a/include/clang/Sema/MultiplexExternalSemaSource.h b/include/clang/Sema/MultiplexExternalSemaSource.h index 5f71789103..16646ba4ad 100644 --- a/include/clang/Sema/MultiplexExternalSemaSource.h +++ b/include/clang/Sema/MultiplexExternalSemaSource.h @@ -51,7 +51,7 @@ public: /// MultiplexExternalSemaSource(ExternalSemaSource& s1, ExternalSemaSource& s2); - ~MultiplexExternalSemaSource(); + ~MultiplexExternalSemaSource() override; ///\brief Appends new source to the source list. /// diff --git a/include/clang/Sema/ScopeInfo.h b/include/clang/Sema/ScopeInfo.h index caac651b03..504fe87915 100644 --- a/include/clang/Sema/ScopeInfo.h +++ b/include/clang/Sema/ScopeInfo.h @@ -568,7 +568,7 @@ public: Kind = SK_Block; } - virtual ~BlockScopeInfo(); + ~BlockScopeInfo() override; static bool classof(const FunctionScopeInfo *FSI) { return FSI->Kind == SK_Block; @@ -599,7 +599,7 @@ public: Kind = SK_CapturedRegion; } - virtual ~CapturedRegionScopeInfo(); + ~CapturedRegionScopeInfo() override; /// \brief A descriptive name for the kind of captured region this is. StringRef getRegionName() const { @@ -704,7 +704,7 @@ public: Kind = SK_Lambda; } - virtual ~LambdaScopeInfo(); + ~LambdaScopeInfo() override; /// \brief Note when all explicit captures have been added. void finishedExplicitCaptures() { diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index f8366f7621..3b3ae02235 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -1323,7 +1323,7 @@ public: bool ValidateSystemInputs = false, bool UseGlobalIndex = true); - ~ASTReader(); + ~ASTReader() override; SourceManager &getSourceManager() const { return SourceMgr; } FileManager &getFileManager() const { return FileMgr; } diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h index d7a801df36..bb2e55469a 100644 --- a/include/clang/Serialization/ASTWriter.h +++ b/include/clang/Serialization/ASTWriter.h @@ -559,7 +559,7 @@ public: /// \brief Create a new precompiled header writer that outputs to /// the given bitstream. ASTWriter(llvm::BitstreamWriter &Stream); - ~ASTWriter(); + ~ASTWriter() override; const LangOptions &getLangOpts() const; @@ -882,7 +882,7 @@ public: 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; diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h index 8f8036e98f..308ac8363b 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h @@ -492,7 +492,7 @@ public: 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. diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h index a5a98343f6..941d524079 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h @@ -366,7 +366,7 @@ protected: PathDiagnosticPiece(Kind k, DisplayHint hint = Below); public: - virtual ~PathDiagnosticPiece(); + ~PathDiagnosticPiece() override; StringRef getString() const { return str; } @@ -482,7 +482,7 @@ private: 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. @@ -515,7 +515,7 @@ public: : 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 @@ -574,9 +574,9 @@ public: PathDiagnosticLocation callEnterWithin; PathDiagnosticLocation callReturn; PathPieces path; - - virtual ~PathDiagnosticCallPiece(); - + + ~PathDiagnosticCallPiece() override; + const Decl *getCaller() const { return Caller; } const Decl *getCallee() const { return Callee; } @@ -635,7 +635,7 @@ public: LPairs.push_back(PathDiagnosticLocationPair(startPos, endPos)); } - ~PathDiagnosticControlFlowPiece(); + ~PathDiagnosticControlFlowPiece() override; PathDiagnosticLocation getStartLocation() const { assert(!LPairs.empty() && @@ -690,7 +690,7 @@ public: PathDiagnosticMacroPiece(const PathDiagnosticLocation &pos) : PathDiagnosticSpotPiece(pos, "", Macro) {} - ~PathDiagnosticMacroPiece(); + ~PathDiagnosticMacroPiece() override; PathPieces subPieces; diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h index dbc59cfbd9..3e0913ec4e 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h @@ -55,8 +55,8 @@ public: AnalyzerOptions &Options, CodeInjector* injector = nullptr); - ~AnalysisManager(); - + ~AnalysisManager() override; + void ClearContexts() { AnaCtxMgr.clear(); } diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h index 77b8f2a1bf..d5822e2244 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h @@ -367,7 +367,7 @@ public: EnclosingBldr->takeNodes(*I); } - virtual ~StmtNodeBuilder(); + ~StmtNodeBuilder() override; using NodeBuilder::generateNode; using NodeBuilder::generateSink; diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h index 247bf0c69d..d8f1c34fef 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h @@ -102,7 +102,7 @@ public: 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) { diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h b/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h index b145f76724..4f0712968b 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h @@ -609,7 +609,7 @@ public: 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; diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h index fbeaae48dc..357fc32c7d 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h @@ -109,7 +109,7 @@ protected: SymbolData(Kind k, SymbolID sym) : SymExpr(k), Sym(sym) {} public: - virtual ~SymbolData() {} + ~SymbolData() override {} SymbolID getSymbolID() const { return Sym; } diff --git a/include/clang/Tooling/Tooling.h b/include/clang/Tooling/Tooling.h index 30f327f376..ca187b1684 100644 --- a/include/clang/Tooling/Tooling.h +++ b/include/clang/Tooling/Tooling.h @@ -79,7 +79,7 @@ public: /// 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, diff --git a/lib/ARCMigrate/ARCMT.cpp b/lib/ARCMigrate/ARCMT.cpp index dddc886a26..0a61cfea6c 100644 --- a/lib/ARCMigrate/ARCMT.cpp +++ b/lib/ARCMigrate/ARCMT.cpp @@ -124,7 +124,7 @@ public: } } - virtual ~CaptureDiagnosticConsumer() { + ~CaptureDiagnosticConsumer() override { assert(!HasBegunSourceFile && "FinishCapture not called!"); } @@ -465,7 +465,7 @@ public: if (Listener) Listener->start(ctx); } - ~RewritesApplicator() { + ~RewritesApplicator() override { if (Listener) Listener->finish(); } diff --git a/lib/ARCMigrate/ObjCMT.cpp b/lib/ARCMigrate/ObjCMT.cpp index c24558f9fa..9e7be20453 100644 --- a/lib/ARCMigrate/ObjCMT.cpp +++ b/lib/ARCMigrate/ObjCMT.cpp @@ -1790,9 +1790,7 @@ public: : SourceMgr(SM), OS(OS) { OS << "[\n"; } - ~JSONEditWriter() { - OS << "]\n"; - } + ~JSONEditWriter() override { OS << "]\n"; } private: struct EntryWriter { diff --git a/lib/ASTMatchers/ASTMatchFinder.cpp b/lib/ASTMatchers/ASTMatchFinder.cpp index fa7968a805..c5f3063fb4 100644 --- a/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/lib/ASTMatchers/ASTMatchFinder.cpp @@ -300,7 +300,7 @@ public: const MatchFinder::MatchFinderOptions &Options) : Matchers(Matchers), Options(Options), ActiveASTContext(nullptr) {} - ~MatchASTVisitor() { + ~MatchASTVisitor() override { if (Options.CheckProfiling) { Options.CheckProfiling->Records = std::move(TimeByBucket); } diff --git a/lib/ASTMatchers/Dynamic/Marshallers.h b/lib/ASTMatchers/Dynamic/Marshallers.h index b78bc03819..36a6415ae8 100644 --- a/lib/ASTMatchers/Dynamic/Marshallers.h +++ b/lib/ASTMatchers/Dynamic/Marshallers.h @@ -181,18 +181,20 @@ public: ArgKinds(ArgKinds.begin(), ArgKinds.end()) {} VariantMatcher create(const SourceRange &NameRange, - ArrayRef<ParserValue> Args, Diagnostics *Error) const { + ArrayRef<ParserValue> 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<ArgKind> &Kinds) const { + std::vector<ArgKind> &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 @@ public: } VariantMatcher create(const SourceRange &NameRange, - ArrayRef<ParserValue> Args, Diagnostics *Error) const { + ArrayRef<ParserValue> 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<ArgKind> &Kinds) const { + std::vector<ArgKind> &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 @@ public: OverloadedMatcherDescriptor(ArrayRef<MatcherDescriptor *> Callbacks) : Overloads(Callbacks.begin(), Callbacks.end()) {} - virtual ~OverloadedMatcherDescriptor() {} + ~OverloadedMatcherDescriptor() override {} - virtual VariantMatcher create(const SourceRange &NameRange, - ArrayRef<ParserValue> Args, - Diagnostics *Error) const { + VariantMatcher create(const SourceRange &NameRange, + ArrayRef<ParserValue> Args, + Diagnostics *Error) const override { std::vector<VariantMatcher> Constructed; Diagnostics::OverloadContext Ctx(Error); for (const auto &O : Overloads) { @@ -512,7 +516,7 @@ public: 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 @@ public: 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 @@ public: } void getArgKinds(ast_type_traits::ASTNodeKind ThisKind, unsigned ArgNo, - std::vector<ArgKind> &Kinds) const { + std::vector<ArgKind> &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 @@ public: : MinCount(MinCount), MaxCount(MaxCount), Op(Op), MatcherName(MatcherName) {} - virtual VariantMatcher create(const SourceRange &NameRange, - ArrayRef<ParserValue> Args, - Diagnostics *Error) const override { + VariantMatcher create(const SourceRange &NameRange, + ArrayRef<ParserValue> Args, + Diagnostics *Error) const override { if (Args.size() < MinCount || MaxCount < Args.size()) { const std::string MaxStr = (MaxCount == UINT_MAX ? "" : Twine(MaxCount)).str(); diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index 169f1df9fe..94fa1d931c 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -3950,9 +3950,8 @@ public: } } } - - virtual ~StmtPrinterHelper() {} + ~StmtPrinterHelper() override {} const LangOptions &getLangOpts() const { return LangOpts; } void setBlockID(signed i) { currentBlock = i; } diff --git a/lib/Analysis/UninitializedValues.cpp b/lib/Analysis/UninitializedValues.cpp index 8a6870ffa4..3c7bc4ea29 100644 --- a/lib/Analysis/UninitializedValues.cpp +++ b/lib/Analysis/UninitializedValues.cpp @@ -837,7 +837,7 @@ struct PruneBlocksHandler : public UninitVariablesHandler { : 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; diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index fdec3db62b..082520583c 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -4596,8 +4596,8 @@ class ARMleTargetInfo : public ARMTargetInfo { public: ARMleTargetInfo(const llvm::Triple &Triple) : ARMTargetInfo(Triple, false) { } - virtual void getTargetDefines(const LangOptions &Opts, - MacroBuilder &Builder) const { + void getTargetDefines(const LangOptions &Opts, + MacroBuilder &Builder) const override { Builder.defineMacro("__ARMEL__"); ARMTargetInfo::getTargetDefines(Opts, Builder); } @@ -4607,8 +4607,8 @@ class ARMbeTargetInfo : public ARMTargetInfo { public: ARMbeTargetInfo(const llvm::Triple &Triple) : ARMTargetInfo(Triple, true) { } - virtual void getTargetDefines(const LangOptions &Opts, - MacroBuilder &Builder) const { + void getTargetDefines(const LangOptions &Opts, + MacroBuilder &Builder) const override { Builder.defineMacro("__ARMEB__"); Builder.defineMacro("__ARM_BIG_ENDIAN"); ARMTargetInfo::getTargetDefines(Opts, Builder); @@ -4780,8 +4780,8 @@ public: 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__"); @@ -4840,8 +4840,8 @@ public: 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; } @@ -4877,14 +4877,13 @@ public: return TargetInfo::AArch64ABIBuiltinVaList; } - virtual void getGCCRegNames(const char *const *&Names, - unsigned &NumNames) const override; - virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, - unsigned &NumAliases) const override; + void getGCCRegNames(const char *const *&Names, + unsigned &NumNames) const override; + void getGCCRegAliases(const GCCRegAlias *&Aliases, + unsigned &NumAliases) const override; - virtual bool - validateAsmConstraint(const char *&Name, - TargetInfo::ConstraintInfo &Info) const override { + bool validateAsmConstraint(const char *&Name, + TargetInfo::ConstraintInfo &Info) const override { switch (*Name) { default: return false; diff --git a/lib/Basic/VirtualFileSystem.cpp b/lib/Basic/VirtualFileSystem.cpp index 5164bcffaf..8a882e13f7 100644 --- a/lib/Basic/VirtualFileSystem.cpp +++ b/lib/Basic/VirtualFileSystem.cpp @@ -92,7 +92,7 @@ class RealFile : public File { } public: - ~RealFile(); + ~RealFile() override; ErrorOr<Status> status() override; ErrorOr<std::unique_ptr<MemoryBuffer>> getBuffer(const Twine &Name, int64_t FileSize = -1, @@ -362,7 +362,7 @@ class DirectoryEntry : public Entry { Status S; public: - virtual ~DirectoryEntry(); + ~DirectoryEntry() override; DirectoryEntry(StringRef Name, std::vector<Entry *> Contents, Status S) : Entry(EK_Directory, Name), Contents(std::move(Contents)), S(std::move(S)) {} @@ -498,7 +498,7 @@ private: ErrorOr<Status> 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. diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp index bb00a0cd37..dd143147b7 100644 --- a/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/lib/CodeGen/CGOpenMPRuntime.cpp @@ -87,9 +87,7 @@ public: } /// \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."; } @@ -118,12 +116,10 @@ public: } /// \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 Get the name of the capture helper. StringRef getHelperName() const override { return ".omp_outlined."; } @@ -149,7 +145,7 @@ public: : CGOpenMPRegionInfo(InlinedRegion, CodeGen), OldCSI(OldCSI), OuterRegionInfo(dyn_cast_or_null<CGOpenMPRegionInfo>(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"); @@ -162,27 +158,27 @@ public: 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 { if (auto *OuterRegionInfo = getOldCSI()) return OuterRegionInfo->getHelperName(); llvm_unreachable("No helper name for inlined OpenMP construct"); diff --git a/lib/CodeGen/ModuleBuilder.cpp b/lib/CodeGen/ModuleBuilder.cpp index 03771e187e..25e57401fd 100644 --- a/lib/CodeGen/ModuleBuilder.cpp +++ b/lib/CodeGen/ModuleBuilder.cpp @@ -63,7 +63,7 @@ namespace { 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()); diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index 6fc13203a8..05529656d1 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -1625,7 +1625,7 @@ public: : 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 @@ private: 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 @@ public: 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; } }; } diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h index d1b681f42d..456bf77c28 100644 --- a/lib/Driver/ToolChains.h +++ b/lib/Driver/ToolChains.h @@ -152,7 +152,7 @@ protected: 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; @@ -196,7 +196,7 @@ private: public: MachO(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - ~MachO(); + ~MachO() override; /// @name MachO specific toolchain API /// { @@ -345,7 +345,7 @@ private: 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; @@ -487,8 +487,7 @@ public: 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, @@ -699,7 +698,7 @@ protected: 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 +761,7 @@ class LLVM_LIBRARY_VISIBILITY TCEToolChain : public ToolChain { 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; diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 7afe183236..826356f474 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -68,7 +68,7 @@ public: Line.InPPDirective = true; } - ~ScopedMacroState() { + ~ScopedMacroState() override { TokenSource = PreviousTokenSource; ResetToken = Token; Line.InPPDirective = false; diff --git a/lib/Frontend/CacheTokens.cpp b/lib/Frontend/CacheTokens.cpp index d909d526b5..68429d9686 100644 --- a/lib/Frontend/CacheTokens.cpp +++ b/lib/Frontend/CacheTokens.cpp @@ -537,7 +537,7 @@ 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<vfs::File> *F, diff --git a/lib/Frontend/ChainedIncludesSource.cpp b/lib/Frontend/ChainedIncludesSource.cpp index be99b78295..f3677f8000 100644 --- a/lib/Frontend/ChainedIncludesSource.cpp +++ b/lib/Frontend/ChainedIncludesSource.cpp @@ -27,7 +27,7 @@ using namespace clang; namespace { class ChainedIncludesSource : public ExternalSemaSource { public: - virtual ~ChainedIncludesSource(); + ~ChainedIncludesSource() override; ExternalSemaSource &getFinalReader() const { return *FinalReader; } diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index fd251acc4f..8390624131 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -44,7 +44,7 @@ public: explicit DelegatingDeserializationListener( ASTDeserializationListener *Previous, bool DeletePrevious) : Previous(Previous), DeletePrevious(DeletePrevious) {} - virtual ~DelegatingDeserializationListener() { + ~DelegatingDeserializationListener() override { if (DeletePrevious) delete Previous; } diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp index 082bf92f09..1acaf6862e 100644 --- a/lib/Frontend/FrontendActions.cpp +++ b/lib/Frontend/FrontendActions.cpp @@ -480,9 +480,8 @@ namespace { return false; } - virtual bool - ReadDiagnosticOptions(IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts, - bool Complain) override { + bool ReadDiagnosticOptions(IntrusiveRefCntPtr<DiagnosticOptions> 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) \ diff --git a/lib/Frontend/HeaderIncludeGen.cpp b/lib/Frontend/HeaderIncludeGen.cpp index 2701194571..5732e5b3fb 100644 --- a/lib/Frontend/HeaderIncludeGen.cpp +++ b/lib/Frontend/HeaderIncludeGen.cpp @@ -35,7 +35,7 @@ public: OwnsOutputFile(OwnsOutputFile_), ShowAllHeaders(ShowAllHeaders_), ShowDepth(ShowDepth_), MSStyle(MSStyle_) {} - ~HeaderIncludesCallback() { + ~HeaderIncludesCallback() override { if (OwnsOutputFile) delete OutputFile; } diff --git a/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/lib/Frontend/Rewrite/RewriteModernObjC.cpp index 92ca1acfde..e13cdb3a3e 100644 --- a/lib/Frontend/Rewrite/RewriteModernObjC.cpp +++ b/lib/Frontend/Rewrite/RewriteModernObjC.cpp @@ -243,8 +243,8 @@ namespace { RewriteModernObjC(std::string inFile, raw_ostream *OS, DiagnosticsEngine &D, const LangOptions &LOpts, bool silenceMacroWarn, bool LineInfo); - - ~RewriteModernObjC() {} + + ~RewriteModernObjC() override {} void HandleTranslationUnit(ASTContext &C) override; diff --git a/lib/Frontend/Rewrite/RewriteObjC.cpp b/lib/Frontend/Rewrite/RewriteObjC.cpp index 5802ba7784..170c209d2c 100644 --- a/lib/Frontend/Rewrite/RewriteObjC.cpp +++ b/lib/Frontend/Rewrite/RewriteObjC.cpp @@ -193,7 +193,7 @@ namespace { DiagnosticsEngine &D, const LangOptions &LOpts, bool silenceMacroWarn); - ~RewriteObjC() {} + ~RewriteObjC() override {} void HandleTranslationUnit(ASTContext &C) override; @@ -511,8 +511,8 @@ namespace { bool silenceMacroWarn) : RewriteObjC(inFile, OS, D, LOpts, silenceMacroWarn) {} - - ~RewriteObjCFragileABI() {} + + ~RewriteObjCFragileABI() override {} void Initialize(ASTContext &context) override; // Rewriting metadata diff --git a/lib/Frontend/SerializedDiagnosticPrinter.cpp b/lib/Frontend/SerializedDiagnosticPrinter.cpp index 5dcacfadf2..d31b12e87a 100644 --- a/lib/Frontend/SerializedDiagnosticPrinter.cpp +++ b/lib/Frontend/SerializedDiagnosticPrinter.cpp @@ -61,8 +61,8 @@ public: DiagnosticOptions *DiagOpts) : DiagnosticNoteRenderer(LangOpts, DiagOpts), Writer(Writer) {} - virtual ~SDiagsRenderer() {} - + ~SDiagsRenderer() override {} + protected: void emitDiagnosticMessage(SourceLocation Loc, PresumedLoc PLoc, @@ -158,7 +158,7 @@ public: EmitPreamble(); } - ~SDiagsWriter() {} + ~SDiagsWriter() override {} void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) override; diff --git a/lib/Frontend/VerifyDiagnosticConsumer.cpp b/lib/Frontend/VerifyDiagnosticConsumer.cpp index 3ff6b18e21..910e394553 100644 --- a/lib/Frontend/VerifyDiagnosticConsumer.cpp +++ b/lib/Frontend/VerifyDiagnosticConsumer.cpp @@ -58,9 +58,9 @@ public: /// \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); } diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index 8ee2410845..d697ecb214 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/lib/Sema/AnalysisBasedWarnings.cpp @@ -139,7 +139,7 @@ public: 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 @@ public: << DiagRange << isAlwaysTrue; } - void compareBitwiseEquality(const BinaryOperator *B, bool isAlwaysTrue) { + void compareBitwiseEquality(const BinaryOperator *B, + bool isAlwaysTrue) override { if (HasMacroID(B)) return; @@ -1333,9 +1334,7 @@ class UninitValsDiagReporter : public UninitVariablesHandler { public: UninitValsDiagReporter(Sema &S) : S(S), uses(nullptr) {} - ~UninitValsDiagReporter() { - flushDiagnostics(); - } + ~UninitValsDiagReporter() override { flushDiagnostics(); } MappedType &getUses(const VarDecl *vd) { if (!uses) @@ -1663,9 +1662,8 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler { } } - - virtual void handleNegativeNotHeld(StringRef Kind, Name LockName, Name Neg, - SourceLocation Loc) override { + 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); @@ -1680,17 +1678,14 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler { Warnings.push_back(DelayedDiag(Warning, getNotes())); } - - virtual void handleLockAcquiredBefore(StringRef Kind, Name L1Name, - Name L2Name, SourceLocation Loc) - override { + 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 { + 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())); diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 5c43e0cd9c..b050c93304 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -1418,8 +1418,9 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal, << ConvTy->isEnumeralType() << ConvTy; } - virtual SemaDiagnosticBuilder diagnoseConversion( - Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) override { + 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 diff --git a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp index c1ea76735c..f4be5b3e82 100644 --- a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp @@ -142,7 +142,7 @@ public: : 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)) diff --git a/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp b/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp index 0d731605b7..52e29368ce 100644 --- a/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp @@ -137,7 +137,7 @@ private: public: SecKeychainBugVisitor(SymbolRef S) : Sym(S) {} - virtual ~SecKeychainBugVisitor() {} + ~SecKeychainBugVisitor() override {} void Profile(llvm::FoldingSetNodeID &ID) const override { static int X = 0; diff --git a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp index 41559989c1..70e17684bd 100644 --- a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -393,7 +393,7 @@ private: MallocBugVisitor(SymbolRef S, bool isLeak = false) : Sym(S), Mode(Normal), FailedReallocSymbol(nullptr), IsLeak(isLeak) {} - virtual ~MallocBugVisitor() {} + ~MallocBugVisitor() override {} void Profile(llvm::FoldingSetNodeID &ID) const override { static int X = 0; diff --git a/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index 96ce240fad..58c27d49ac 100644 --- a/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -2475,9 +2475,7 @@ public: : ShouldResetSummaryLog(false), IncludeAllocationLine(shouldIncludeAllocationSiteInLeakDiagnostics(AO)) {} - virtual ~RetainCountChecker() { - DeleteContainerSeconds(DeadSymbolTags); - } + ~RetainCountChecker() override { DeleteContainerSeconds(DeadSymbolTags); } void checkEndAnalysis(ExplodedGraph &G, BugReporter &BR, ExprEngine &Eng) const { diff --git a/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp index 026cc02f63..3c1a3b4111 100644 --- a/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ b/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -45,7 +45,7 @@ class HTMLDiagnostics : public PathDiagnosticConsumer { public: HTMLDiagnostics(AnalyzerOptions &AnalyzerOpts, const std::string& prefix, const Preprocessor &pp); - virtual ~HTMLDiagnostics() { FlushDiagnostics(nullptr); } + ~HTMLDiagnostics() override { FlushDiagnostics(nullptr); } void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags, FilesMade *filesMade) override; diff --git a/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp b/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp index 76026aaed8..e0aff589e0 100644 --- a/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp +++ b/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp @@ -37,7 +37,7 @@ namespace { const LangOptions &LangOpts, bool supportsMultipleFiles); - virtual ~PlistDiagnostics() {} + ~PlistDiagnostics() override {} void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags, FilesMade *filesMade) override; diff --git a/lib/StaticAnalyzer/Core/SimpleConstraintManager.h b/lib/StaticAnalyzer/Core/SimpleConstraintManager.h index a72d1d4f92..135cd4ef86 100644 --- a/lib/StaticAnalyzer/Core/SimpleConstraintManager.h +++ b/lib/StaticAnalyzer/Core/SimpleConstraintManager.h @@ -27,7 +27,7 @@ class SimpleConstraintManager : public ConstraintManager { public: SimpleConstraintManager(SubEngine *subengine, SValBuilder &SB) : SU(subengine), SVB(SB) {} - virtual ~SimpleConstraintManager(); + ~SimpleConstraintManager() override; //===------------------------------------------------------------------===// // Common implementation for the interface provided by ConstraintManager. diff --git a/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp b/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp index df9e4d6f91..b3cab87c80 100644 --- a/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp +++ b/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp @@ -29,7 +29,7 @@ public: SimpleSValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context, ProgramStateManager &stateMgr) : SValBuilder(alloc, context, stateMgr) {} - virtual ~SimpleSValBuilder() {} + ~SimpleSValBuilder() override {} SVal evalMinus(NonLoc val) override; SVal evalComplement(NonLoc val) override; diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index 621718e2d6..fbeffb8aac 100644 --- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -92,7 +92,7 @@ class ClangDiagPathDiagConsumer : public PathDiagnosticConsumer { public: ClangDiagPathDiagConsumer(DiagnosticsEngine &Diag) : Diag(Diag), IncludePath(false) {} - virtual ~ClangDiagPathDiagConsumer() {} + ~ClangDiagPathDiagConsumer() override {} StringRef getName() const override { return "ClangDiags"; } bool supportsLogicalOpControlFlow() const override { return true; } @@ -199,7 +199,7 @@ public: } } - ~AnalysisConsumer() { + ~AnalysisConsumer() override { if (Opts->PrintStats) delete TUTotalTimer; } @@ -373,8 +373,7 @@ public: return true; } - virtual void - AddDiagnosticConsumer(PathDiagnosticConsumer *Consumer) override { + void AddDiagnosticConsumer(PathDiagnosticConsumer *Consumer) override { PathConsumers.push_back(Consumer); } @@ -724,7 +723,7 @@ class UbigraphViz : public ExplodedNode::Auditor { public: UbigraphViz(std::unique_ptr<raw_ostream> Out, StringRef Filename); - ~UbigraphViz(); + ~UbigraphViz() override; void AddEdge(ExplodedNode *Src, ExplodedNode *Dst) override; }; diff --git a/lib/StaticAnalyzer/Frontend/ModelInjector.h b/lib/StaticAnalyzer/Frontend/ModelInjector.h index fd24e32f3a..e23bf8abf3 100644 --- a/lib/StaticAnalyzer/Frontend/ModelInjector.h +++ b/lib/StaticAnalyzer/Frontend/ModelInjector.h @@ -43,8 +43,8 @@ namespace ento { 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 diff --git a/lib/Tooling/CompilationDatabase.cpp b/lib/Tooling/CompilationDatabase.cpp index 383fb1a98e..73564376a5 100644 --- a/lib/Tooling/CompilationDatabase.cpp +++ b/lib/Tooling/CompilationDatabase.cpp @@ -156,8 +156,8 @@ public: // 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)); diff --git a/tools/libclang/CIndexCodeCompletion.cpp b/tools/libclang/CIndexCodeCompletion.cpp index 55f413102a..ca167e8b2e 100644 --- a/tools/libclang/CIndexCodeCompletion.cpp +++ b/tools/libclang/CIndexCodeCompletion.cpp @@ -533,7 +533,7 @@ namespace { : CodeCompleteConsumer(Opts, false), AllocatedResults(Results), CCTUInfo(Results.CodeCompletionAllocator), TU(TranslationUnit) { } - ~CaptureCompletionResults() { Finish(); } + ~CaptureCompletionResults() override { Finish(); } void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context, diff --git a/tools/libclang/CIndexDiagnostic.cpp b/tools/libclang/CIndexDiagnostic.cpp index 4d646f0cf8..9ba36a6a0f 100644 --- a/tools/libclang/CIndexDiagnostic.cpp +++ b/tools/libclang/CIndexDiagnostic.cpp @@ -48,7 +48,7 @@ public: : CXDiagnosticImpl(CustomNoteDiagnosticKind), Message(Msg), Loc(L) {} - virtual ~CXDiagnosticCustomNoteImpl() {} + ~CXDiagnosticCustomNoteImpl() override {} CXDiagnosticSeverity getSeverity() const override { return CXDiagnostic_Note; @@ -91,8 +91,8 @@ public: CXDiagnosticSetImpl *mainSet) : DiagnosticNoteRenderer(LangOpts, DiagOpts), CurrentSet(mainSet), MainSet(mainSet) {} - - virtual ~CXDiagnosticRenderer() {} + + ~CXDiagnosticRenderer() override {} void beginDiagnostic(DiagOrStoredDiag D, DiagnosticsEngine::Level Level) override { diff --git a/tools/libclang/CIndexDiagnostic.h b/tools/libclang/CIndexDiagnostic.h index 4347fb75f4..9f406987eb 100644 --- a/tools/libclang/CIndexDiagnostic.h +++ b/tools/libclang/CIndexDiagnostic.h @@ -116,9 +116,9 @@ struct CXStoredDiagnostic : public CXDiagnosticImpl { const LangOptions &LangOpts) : CXDiagnosticImpl(StoredDiagnosticKind), Diag(Diag), LangOpts(LangOpts) { } - - virtual ~CXStoredDiagnostic() {} - + + ~CXStoredDiagnostic() override {} + /// \brief Return the severity of the diagnostic. CXDiagnosticSeverity getSeverity() const override; diff --git a/tools/libclang/CXLoadedDiagnostic.cpp b/tools/libclang/CXLoadedDiagnostic.cpp index 9bc2369850..754ad55a66 100644 --- a/tools/libclang/CXLoadedDiagnostic.cpp +++ b/tools/libclang/CXLoadedDiagnostic.cpp @@ -37,7 +37,7 @@ namespace { class CXLoadedDiagnosticSetImpl : public CXDiagnosticSetImpl { public: CXLoadedDiagnosticSetImpl() : CXDiagnosticSetImpl(true), FakeFiles(FO) {} - virtual ~CXLoadedDiagnosticSetImpl() {} + ~CXLoadedDiagnosticSetImpl() override {} llvm::BumpPtrAllocator Alloc; Strings Categories; diff --git a/tools/libclang/CXLoadedDiagnostic.h b/tools/libclang/CXLoadedDiagnostic.h index 54261be6cf..d5006a4444 100644 --- a/tools/libclang/CXLoadedDiagnostic.h +++ b/tools/libclang/CXLoadedDiagnostic.h @@ -26,8 +26,8 @@ public: CXLoadedDiagnostic() : CXDiagnosticImpl(LoadedDiagnosticKind), severity(0), category(0) {} - virtual ~CXLoadedDiagnostic(); - + ~CXLoadedDiagnostic() override; + /// \brief Return the severity of the diagnostic. CXDiagnosticSeverity getSeverity() const override; diff --git a/unittests/AST/DeclPrinterTest.cpp b/unittests/AST/DeclPrinterTest.cpp index 9f179c4a3f..070b4daabb 100644 --- a/unittests/AST/DeclPrinterTest.cpp +++ b/unittests/AST/DeclPrinterTest.cpp @@ -44,7 +44,7 @@ class PrintMatch : public MatchFinder::MatchCallback { public: PrintMatch() : NumFoundDecls(0) {} - virtual void run(const MatchFinder::MatchResult &Result) { + void run(const MatchFinder::MatchResult &Result) override { const Decl *D = Result.Nodes.getDeclAs<Decl>("id"); if (!D || D->isImplicit()) return; diff --git a/unittests/AST/ExternalASTSourceTest.cpp b/unittests/AST/ExternalASTSourceTest.cpp index 0cfde74ccc..4f42dcf103 100644 --- a/unittests/AST/ExternalASTSourceTest.cpp +++ b/unittests/AST/ExternalASTSourceTest.cpp @@ -28,15 +28,15 @@ public: TestFrontendAction(ExternalASTSource *Source) : Source(Source) {} private: - virtual void ExecuteAction() { + void ExecuteAction() override { getCompilerInstance().getASTContext().setExternalSource(Source); getCompilerInstance().getASTContext().getTranslationUnitDecl() ->setHasExternalVisibleStorage(); return ASTFrontendAction::ExecuteAction(); } - virtual std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, - StringRef InFile) { + std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override { return llvm::make_unique<ASTConsumer>(); } @@ -67,8 +67,8 @@ TEST(ExternalASTSourceTest, FailedLookupOccursOnce) { 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; diff --git a/unittests/AST/MatchVerifier.h b/unittests/AST/MatchVerifier.h index e6593913b7..31932479ef 100644 --- a/unittests/AST/MatchVerifier.h +++ b/unittests/AST/MatchVerifier.h @@ -63,7 +63,7 @@ public: 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 +166,8 @@ public: } 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 +206,8 @@ public: } 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 +246,7 @@ public: 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 +273,7 @@ public: 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()); diff --git a/unittests/AST/NamedDeclPrinterTest.cpp b/unittests/AST/NamedDeclPrinterTest.cpp index f8fb98454b..cf97a0abf6 100644 --- a/unittests/AST/NamedDeclPrinterTest.cpp +++ b/unittests/AST/NamedDeclPrinterTest.cpp @@ -37,7 +37,7 @@ public: explicit PrintMatch(bool 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<NamedDecl>("id"); if (!ND) return; diff --git a/unittests/AST/SourceLocationTest.cpp b/unittests/AST/SourceLocationTest.cpp index c1f7b18143..a3fc9530ba 100644 --- a/unittests/AST/SourceLocationTest.cpp +++ b/unittests/AST/SourceLocationTest.cpp @@ -60,7 +60,7 @@ TEST(RangeVerifier, WrongRange) { class LabelDeclRangeVerifier : public RangeVerifier<LabelStmt> { protected: - virtual SourceRange getRange(const LabelStmt &Node) { + SourceRange getRange(const LabelStmt &Node) override { return Node.getDecl()->getSourceRange(); } }; @@ -110,8 +110,8 @@ TEST(MemberExpr, ImplicitMemberRange) { }
class MemberExprArrowLocVerifier : public RangeVerifier<MemberExpr> {
-protected:
- virtual SourceRange getRange(const MemberExpr &Node) {
+protected: + SourceRange getRange(const MemberExpr &Node) override { return Node.getOperatorLoc();
}
};
@@ -201,7 +201,7 @@ TEST(InitListExpr, VectorLiteralInitListParens) { class TemplateAngleBracketLocRangeVerifier : public RangeVerifier<TypeLoc> { protected: - virtual SourceRange getRange(const TypeLoc &Node) { + SourceRange getRange(const TypeLoc &Node) override { TemplateSpecializationTypeLoc T = Node.getUnqualifiedLoc().castAs<TemplateSpecializationTypeLoc>(); assert(!T.isNull()); @@ -226,7 +226,7 @@ TEST(CXXNewExpr, TypeParenRange) { class UnaryTransformTypeLocParensRangeVerifier : public RangeVerifier<TypeLoc> { protected: - virtual SourceRange getRange(const TypeLoc &Node) { + SourceRange getRange(const TypeLoc &Node) override { UnaryTransformTypeLoc T = Node.getUnqualifiedLoc().castAs<UnaryTransformTypeLoc>(); assert(!T.isNull()); diff --git a/unittests/AST/StmtPrinterTest.cpp b/unittests/AST/StmtPrinterTest.cpp index 541fb3df1d..b1fd2c1eb4 100644 --- a/unittests/AST/StmtPrinterTest.cpp +++ b/unittests/AST/StmtPrinterTest.cpp @@ -44,7 +44,7 @@ class PrintMatch : public MatchFinder::MatchCallback { public: PrintMatch() : NumFoundStmts(0) {} - virtual void run(const MatchFinder::MatchResult &Result) { + void run(const MatchFinder::MatchResult &Result) override { const Stmt *S = Result.Nodes.getStmtAs<Stmt>("id"); if (!S) return; diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp index 7edec96c0f..4b0580a814 100644 --- a/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -747,12 +747,12 @@ public: 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<T>(Id)) { ++Count; @@ -774,7 +774,7 @@ public: return false; } - virtual bool run(const BoundNodes *Nodes, ASTContext *Context) override { + bool run(const BoundNodes *Nodes, ASTContext *Context) override { return run(Nodes); } @@ -4379,9 +4379,9 @@ public: : 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<T>(Id); return selectFirst<T>(InnerId, match(InnerMatcher, *Node, *Context)) != nullptr; @@ -4430,9 +4430,9 @@ TEST(MatchFinder, CanMatchSingleNodesRecursively) { template <typename T> 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<T>(""); return verify(*Nodes, *Context, Node); } @@ -4488,12 +4488,10 @@ TEST(MatchFinder, CheckProfiling) { 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 +4514,10 @@ TEST(MatchFinder, InterceptsStartOfTranslationUnit) { 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; }; diff --git a/unittests/ASTMatchers/Dynamic/ParserTest.cpp b/unittests/ASTMatchers/Dynamic/ParserTest.cpp index 2a9a61b543..5e6cadd196 100644 --- a/unittests/ASTMatchers/Dynamic/ParserTest.cpp +++ b/unittests/ASTMatchers/Dynamic/ParserTest.cpp @@ -23,7 +23,7 @@ namespace { 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 @@ public: Errors.push_back(Error.toStringFull()); } - llvm::Optional<MatcherCtor> lookupMatcherCtor(StringRef MatcherName) { + llvm::Optional<MatcherCtor> + lookupMatcherCtor(StringRef MatcherName) override { const ExpectedMatchersTy::value_type *Matcher = &*ExpectedMatchers.find(MatcherName); return reinterpret_cast<MatcherCtor>(Matcher); @@ -52,7 +53,7 @@ public: const SourceRange &NameRange, StringRef BindID, ArrayRef<ParserValue> Args, - Diagnostics *Error) { + Diagnostics *Error) override { const ExpectedMatchersTy::value_type *Matcher = reinterpret_cast<const ExpectedMatchersTy::value_type *>(Ctor); MatcherInfo ToStore = { Matcher->first, NameRange, Args, BindID }; diff --git a/unittests/Basic/SourceManagerTest.cpp b/unittests/Basic/SourceManagerTest.cpp index 1dda54dff1..57b87b7604 100644 --- a/unittests/Basic/SourceManagerTest.cpp +++ b/unittests/Basic/SourceManagerTest.cpp @@ -257,15 +257,15 @@ class MacroTracker : public PPCallbacks { public: explicit MacroTracker(std::vector<MacroAction> &Macros) : Macros(Macros) { } - - virtual void MacroDefined(const Token &MacroNameTok, - const MacroDirective *MD) { + + 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)); diff --git a/unittests/Basic/VirtualFileSystemTest.cpp b/unittests/Basic/VirtualFileSystemTest.cpp index 67beb923d9..71d2d2b60c 100644 --- a/unittests/Basic/VirtualFileSystemTest.cpp +++ b/unittests/Basic/VirtualFileSystemTest.cpp @@ -521,9 +521,7 @@ class VFSFromYAMLTest : public ::testing::Test { public: int NumDiagnostics; - void SetUp() { - NumDiagnostics = 0; - } + void SetUp() override { NumDiagnostics = 0; } static void CountingDiagHandler(const SMDiagnostic &, void *Context) { VFSFromYAMLTest *Test = static_cast<VFSFromYAMLTest *>(Context); diff --git a/unittests/Frontend/FrontendActionTest.cpp b/unittests/Frontend/FrontendActionTest.cpp index 5581c4487e..90afd774f1 100644 --- a/unittests/Frontend/FrontendActionTest.cpp +++ b/unittests/Frontend/FrontendActionTest.cpp @@ -35,15 +35,16 @@ public: bool ActOnEndOfTranslationUnit; std::vector<std::string> 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<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, - StringRef InFile) { + std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override { return llvm::make_unique<Visitor>(CI, ActOnEndOfTranslationUnit, decl_names); } @@ -56,7 +57,7 @@ private: CI(CI), ActOnEndOfTranslationUnit(ActOnEndOfTranslationUnit), decl_names_(decl_names) {} - virtual void HandleTranslationUnit(ASTContext &context) { + void HandleTranslationUnit(ASTContext &context) override { if (ActOnEndOfTranslationUnit) { CI.getSema().ActOnEndOfTranslationUnit(); } diff --git a/unittests/Lex/PPCallbacksTest.cpp b/unittests/Lex/PPCallbacksTest.cpp index bb27bac6ed..da641a7afb 100644 --- a/unittests/Lex/PPCallbacksTest.cpp +++ b/unittests/Lex/PPCallbacksTest.cpp @@ -54,15 +54,11 @@ class VoidModuleLoader : public ModuleLoader { // 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) { + 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(); @@ -95,9 +91,10 @@ public: PragmaOpenCLExtensionCallbacks() : Name("Not called."), State(99) {}; - void PragmaOpenCLExtension( - clang::SourceLocation NameLoc, const clang::IdentifierInfo *Name, - clang::SourceLocation StateLoc, unsigned State) { + 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; diff --git a/unittests/Sema/ExternalSemaSourceTest.cpp b/unittests/Sema/ExternalSemaSourceTest.cpp index 3a93fc77fb..703e97b4ac 100644 --- a/unittests/Sema/ExternalSemaSourceTest.cpp +++ b/unittests/Sema/ExternalSemaSourceTest.cpp @@ -30,7 +30,7 @@ class CompleteTypeDiagnoser : public clang::ExternalSemaSource { 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 @@ public: 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 @@ public: } } - 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 @@ public: 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 @@ class ExternalSemaSourceInstaller : public clang::ASTFrontendAction { std::unique_ptr<DiagnosticConsumer> OwnedClient; protected: - virtual std::unique_ptr<clang::ASTConsumer> + std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance &Compiler, - llvm::StringRef /* dummy */) { + llvm::StringRef /* dummy */) override { return llvm::make_unique<clang::ASTConsumer>(); } - virtual void ExecuteAction() { + void ExecuteAction() override { CompilerInstance &CI = getCompilerInstance(); ASSERT_FALSE(CI.hasSema()); CI.createSema(getTranslationUnitKind(), nullptr); diff --git a/unittests/Tooling/CommentHandlerTest.cpp b/unittests/Tooling/CommentHandlerTest.cpp index 117dfc36fe..da5604524c 100644 --- a/unittests/Tooling/CommentHandlerTest.cpp +++ b/unittests/Tooling/CommentHandlerTest.cpp @@ -30,11 +30,11 @@ class CommentHandlerVisitor : public TestVisitor<CommentHandlerVisitor>, 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 @@ public: CommentVerifier GetVerifier(); protected: - virtual ASTFrontendAction* CreateTestAction() { + ASTFrontendAction *CreateTestAction() override { return new CommentHandlerAction(this); } @@ -70,8 +70,8 @@ private: CommentHandlerAction(CommentHandlerVisitor *Visitor) : TestAction(Visitor) { } - virtual bool BeginSourceFileAction(CompilerInstance &CI, - StringRef FileName) { + bool BeginSourceFileAction(CompilerInstance &CI, + StringRef FileName) override { CommentHandlerVisitor *V = static_cast<CommentHandlerVisitor*>(this->Visitor); V->PP = &CI.getPreprocessor(); @@ -79,7 +79,7 @@ private: return true; } - virtual void EndSourceFileAction() { + void EndSourceFileAction() override { CommentHandlerVisitor *V = static_cast<CommentHandlerVisitor*>(this->Visitor); V->PP->removeCommentHandler(V); diff --git a/unittests/Tooling/CompilationDatabaseTest.cpp b/unittests/Tooling/CompilationDatabaseTest.cpp index 8866e751fc..3e5a589caf 100644 --- a/unittests/Tooling/CompilationDatabaseTest.cpp +++ b/unittests/Tooling/CompilationDatabaseTest.cpp @@ -127,8 +127,8 @@ static CompileCommand findCompileArgsInJsonDatabase(StringRef FileName, } 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); } }; diff --git a/unittests/Tooling/RefactoringTest.cpp b/unittests/Tooling/RefactoringTest.cpp index a026a94261..7e643fa66d 100644 --- a/unittests/Tooling/RefactoringTest.cpp +++ b/unittests/Tooling/RefactoringTest.cpp @@ -213,7 +213,7 @@ class FlushRewrittenFilesTest : public ::testing::Test { public: FlushRewrittenFilesTest() {} - ~FlushRewrittenFilesTest() { + ~FlushRewrittenFilesTest() override { for (llvm::StringMap<std::string>::iterator I = TemporaryFiles.begin(), E = TemporaryFiles.end(); I != E; ++I) { @@ -287,7 +287,7 @@ private: 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 @@ private: public: TestAction(TestVisitor *Visitor) : Visitor(Visitor) {} - virtual std::unique_ptr<clang::ASTConsumer> + std::unique_ptr<clang::ASTConsumer> 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<FindConsumer>(Visitor); diff --git a/unittests/Tooling/TestVisitor.h b/unittests/Tooling/TestVisitor.h index d4416950f2..f4a0039448 100644 --- a/unittests/Tooling/TestVisitor.h +++ b/unittests/Tooling/TestVisitor.h @@ -82,7 +82,7 @@ protected: 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 @@ protected: public: TestAction(TestVisitor *Visitor) : Visitor(Visitor) {} - virtual std::unique_ptr<clang::ASTConsumer> - CreateASTConsumer(CompilerInstance &, llvm::StringRef dummy) { + std::unique_ptr<clang::ASTConsumer> + CreateASTConsumer(CompilerInstance &, llvm::StringRef dummy) override { /// TestConsumer will be deleted by the framework calling us. return llvm::make_unique<FindConsumer>(Visitor); } @@ -133,7 +133,7 @@ public: } /// \brief Checks that all expected matches have been found. - virtual ~ExpectedLocationVisitor() { + ~ExpectedLocationVisitor() override { for (typename std::vector<ExpectedMatch>::const_iterator It = ExpectedMatches.begin(), End = ExpectedMatches.end(); It != End; ++It) { diff --git a/unittests/Tooling/ToolingTest.cpp b/unittests/Tooling/ToolingTest.cpp index 5a93e38c80..4b14ebb2c3 100644 --- a/unittests/Tooling/ToolingTest.cpp +++ b/unittests/Tooling/ToolingTest.cpp @@ -35,8 +35,9 @@ public: : TestConsumer(std::move(TestConsumer)) {} protected: - virtual std::unique_ptr<clang::ASTConsumer> - CreateASTConsumer(clang::CompilerInstance &compiler, StringRef dummy) { + std::unique_ptr<clang::ASTConsumer> + CreateASTConsumer(clang::CompilerInstance &compiler, + StringRef dummy) override { /// TestConsumer will be deleted by the framework calling us. return std::move(TestConsumer); } @@ -49,7 +50,7 @@ class FindTopLevelDeclConsumer : public clang::ASTConsumer { public: explicit FindTopLevelDeclConsumer(bool *FoundTopLevelDecl) : FoundTopLevelDecl(FoundTopLevelDecl) {} - virtual bool HandleTopLevelDecl(clang::DeclGroupRef DeclGroup) { + bool HandleTopLevelDecl(clang::DeclGroupRef DeclGroup) override { *FoundTopLevelDecl = true; return true; } @@ -72,7 +73,7 @@ class FindClassDeclXConsumer : public clang::ASTConsumer { public: FindClassDeclXConsumer(bool *FoundClassDeclX) : FoundClassDeclX(FoundClassDeclX) {} - virtual bool HandleTopLevelDecl(clang::DeclGroupRef GroupRef) { + bool HandleTopLevelDecl(clang::DeclGroupRef GroupRef) override { if (CXXRecordDecl* Record = dyn_cast<clang::CXXRecordDecl>( *GroupRef.begin())) { if (Record->getName() == "X") { @@ -184,14 +185,11 @@ TEST(ToolInvocation, TestVirtualModulesCompilation) { 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<ASTConsumer> newASTConsumer() { return llvm::make_unique<FindTopLevelDeclConsumer>(&Matched); } @@ -225,15 +223,15 @@ TEST(newFrontendActionFactory, InjectsSourceFileCallbacks) { struct SkipBodyConsumer : public clang::ASTConsumer { /// Skip the 'skipMe' function. - virtual bool shouldSkipFunctionBody(Decl *D) { + bool shouldSkipFunctionBody(Decl *D) override { FunctionDecl *F = dyn_cast<FunctionDecl>(D); return F && F->getNameAsString() == "skipMe"; } }; struct SkipBodyAction : public clang::ASTFrontendAction { - virtual std::unique_ptr<ASTConsumer> - CreateASTConsumer(CompilerInstance &Compiler, StringRef) { + std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &Compiler, + StringRef) override { Compiler.getFrontendOpts().SkipFunctionBodies = true; return llvm::make_unique<SkipBodyConsumer>(); } @@ -312,8 +310,8 @@ TEST(ClangToolTest, BuildASTs) { 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; diff --git a/unittests/libclang/LibclangTest.cpp b/unittests/libclang/LibclangTest.cpp index a21881429e..e827ebc0da 100644 --- a/unittests/libclang/LibclangTest.cpp +++ b/unittests/libclang/LibclangTest.cpp @@ -357,7 +357,7 @@ public: 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 @@ public: clang_defaultEditingTranslationUnitOptions(); Index = clang_createIndex(0, 0); } - void TearDown() { + void TearDown() override { clang_disposeTranslationUnit(ClangTU); clang_disposeIndex(Index); for (const std::string &Path : Files) diff --git a/utils/TableGen/NeonEmitter.cpp b/utils/TableGen/NeonEmitter.cpp index d4822c993a..d46785d193 100644 --- a/utils/TableGen/NeonEmitter.cpp +++ b/utils/TableGen/NeonEmitter.cpp @@ -1563,10 +1563,10 @@ std::pair<Type, std::string> Intrinsic::DagEmitter::emitDagShuffle(DagInit *DI){ // 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<SMLoc> Loc) { + void anchor() override {} + ~LowHalf() override {} + void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef<SMLoc> 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 @@ std::pair<Type, std::string> Intrinsic::DagEmitter::emitDagShuffle(DagInit *DI){ }; class HighHalf : public SetTheory::Operator { public: - virtual void anchor() {} - virtual ~HighHalf() {} - virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef<SMLoc> Loc) { + void anchor() override {} + ~HighHalf() override {} + void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef<SMLoc> 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 @@ std::pair<Type, std::string> Intrinsic::DagEmitter::emitDagShuffle(DagInit *DI){ public: Rev(unsigned ElementSize) : ElementSize(ElementSize) {} - virtual void anchor() {} - virtual ~Rev() {} - virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef<SMLoc> Loc) { + void anchor() override {} + ~Rev() override {} + void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef<SMLoc> Loc) override { SetTheory::RecSet Elts2; ST.evaluate(Expr->arg_begin() + 1, Expr->arg_end(), Elts2, Loc); @@ -1613,9 +1613,9 @@ std::pair<Type, std::string> Intrinsic::DagEmitter::emitDagShuffle(DagInit *DI){ 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; |