diff --git a/include/clang/Driver/Job.h b/include/clang/Driver/Job.h index 3ef8a11434794ae17a4d6c19e14eaab8146a4480..5b19efeddeeaf8e788d3aea388eeaa0dc0b26fb8 100644 --- a/include/clang/Driver/Job.h +++ b/include/clang/Driver/Job.h @@ -76,8 +76,8 @@ public: Command(const Action &_Source, const Tool &_Creator, const char *_Executable, const llvm::opt::ArgStringList &_Arguments); - virtual void Print(llvm::raw_ostream &OS, const char *Terminator, - bool Quote, bool CrashReport = false) const; + void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, + bool CrashReport = false) const override; virtual int Execute(const StringRef **Redirects, std::string *ErrMsg, bool *ExecutionFailed) const; @@ -106,11 +106,11 @@ public: const char *Executable_, const ArgStringList &Arguments_, Command *Fallback_); - virtual void Print(llvm::raw_ostream &OS, const char *Terminator, - bool Quote, bool CrashReport = false) const; + void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, + bool CrashReport = false) const override; - virtual int Execute(const StringRef **Redirects, std::string *ErrMsg, - bool *ExecutionFailed) const; + int Execute(const StringRef **Redirects, std::string *ErrMsg, + bool *ExecutionFailed) const override; static bool classof(const Job *J) { return J->getKind() == FallbackCommandClass; @@ -135,8 +135,8 @@ public: JobList(); virtual ~JobList(); - virtual void Print(llvm::raw_ostream &OS, const char *Terminator, - bool Quote, bool CrashReport = false) const; + void Print(llvm::raw_ostream &OS, const char *Terminator, + bool Quote, bool CrashReport = false) const override; /// Add a job to the list (taking ownership). void addJob(Job *J) { Jobs.push_back(J); } diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index 20aff5bfce40003fe711104f94800928dbb67e9c..3a26df3ef322d5c79c349685357d6bfac182300a 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -858,19 +858,16 @@ public: /// /// \returns True if an error occurred, false otherwise. bool serialize(raw_ostream &OS); - - virtual ModuleLoadResult loadModule(SourceLocation ImportLoc, - ModuleIdPath Path, - Module::NameVisibilityKind Visibility, - bool IsInclusionDirective) { + + ModuleLoadResult loadModule(SourceLocation ImportLoc, ModuleIdPath Path, + Module::NameVisibilityKind Visibility, + bool IsInclusionDirective) override { // ASTUnit doesn't know how to load modules (not that this matters). return ModuleLoadResult(); } - virtual void makeModuleVisible(Module *Mod, - Module::NameVisibilityKind Visibility, - SourceLocation ImportLoc, - bool Complain) { } + void makeModuleVisible(Module *Mod, Module::NameVisibilityKind Visibility, + SourceLocation ImportLoc, bool Complain) override {} }; diff --git a/include/clang/Frontend/ChainedDiagnosticConsumer.h b/include/clang/Frontend/ChainedDiagnosticConsumer.h index 405d3c6ac32cca70340a6a7b83d0cfd8d1585223..11762a97cfc46d010b0be9624452150c6f39eccb 100644 --- a/include/clang/Frontend/ChainedDiagnosticConsumer.h +++ b/include/clang/Frontend/ChainedDiagnosticConsumer.h @@ -32,28 +32,28 @@ public: Secondary.reset(_Secondary); } - virtual void BeginSourceFile(const LangOptions &LO, - const Preprocessor *PP) { + void BeginSourceFile(const LangOptions &LO, + const Preprocessor *PP) override { Primary->BeginSourceFile(LO, PP); Secondary->BeginSourceFile(LO, PP); } - virtual void EndSourceFile() { + void EndSourceFile() override { Secondary->EndSourceFile(); Primary->EndSourceFile(); } - virtual void finish() { + void finish() override { Secondary->finish(); Primary->finish(); } - virtual bool IncludeInDiagnosticCounts() const { + bool IncludeInDiagnosticCounts() const override { return Primary->IncludeInDiagnosticCounts(); } - virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, - const Diagnostic &Info) { + void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, + const Diagnostic &Info) override { // Default implementation (Warnings/errors count). DiagnosticConsumer::HandleDiagnostic(DiagLevel, Info); diff --git a/include/clang/Frontend/ChainedIncludesSource.h b/include/clang/Frontend/ChainedIncludesSource.h index bc05c078a6349a51eb4836ed924528335b7682f7..676e749fb153d38d98041c4be82b5ffcedd7ad78 100644 --- a/include/clang/Frontend/ChainedIncludesSource.h +++ b/include/clang/Frontend/ChainedIncludesSource.h @@ -39,35 +39,35 @@ protected: // ExternalASTSource interface. //===----------------------------------------------------------------------===// - virtual Decl *GetExternalDecl(uint32_t ID); - virtual Selector GetExternalSelector(uint32_t ID); - virtual uint32_t GetNumExternalSelectors(); - virtual Stmt *GetExternalDeclStmt(uint64_t Offset); - virtual CXXBaseSpecifier *GetExternalCXXBaseSpecifiers(uint64_t Offset); - virtual bool FindExternalVisibleDeclsByName(const DeclContext *DC, - DeclarationName Name); - virtual ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC, - bool (*isKindWeWant)(Decl::Kind), - SmallVectorImpl<Decl*> &Result); - virtual void CompleteType(TagDecl *Tag); - virtual void CompleteType(ObjCInterfaceDecl *Class); - virtual void StartedDeserializing(); - virtual void FinishedDeserializing(); - virtual void StartTranslationUnit(ASTConsumer *Consumer); - virtual void PrintStats(); + Decl *GetExternalDecl(uint32_t ID) override; + Selector GetExternalSelector(uint32_t ID) override; + uint32_t GetNumExternalSelectors() override; + Stmt *GetExternalDeclStmt(uint64_t Offset) override; + CXXBaseSpecifier *GetExternalCXXBaseSpecifiers(uint64_t Offset) override; + bool FindExternalVisibleDeclsByName(const DeclContext *DC, + DeclarationName Name) override; + ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC, + bool (*isKindWeWant)(Decl::Kind), + SmallVectorImpl<Decl*> &Result) override; + void CompleteType(TagDecl *Tag) override; + void CompleteType(ObjCInterfaceDecl *Class) override; + void StartedDeserializing() override; + void FinishedDeserializing() override; + void StartTranslationUnit(ASTConsumer *Consumer) override; + void PrintStats() override; /// Return the amount of memory used by memory buffers, breaking down /// by heap-backed versus mmap'ed memory. - virtual void getMemoryBufferSizes(MemoryBufferSizes &sizes) const; + void getMemoryBufferSizes(MemoryBufferSizes &sizes) const override; //===----------------------------------------------------------------------===// // ExternalSemaSource interface. //===----------------------------------------------------------------------===// - virtual void InitializeSema(Sema &S); - virtual void ForgetSema(); - virtual void ReadMethodPool(Selector Sel); - virtual bool LookupUnqualified(LookupResult &R, Scope *S); + void InitializeSema(Sema &S) override; + void ForgetSema() override; + void ReadMethodPool(Selector Sel) override; + bool LookupUnqualified(LookupResult &R, Scope *S) override; }; } diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 3835600b851ff92735329e53a273d848d47873a5..ee97d9bec3ffa8c05cf95355b2091b6262853cad 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -682,16 +682,13 @@ public: const FrontendOptions &Opts); /// } - - virtual ModuleLoadResult loadModule(SourceLocation ImportLoc, - ModuleIdPath Path, - Module::NameVisibilityKind Visibility, - bool IsInclusionDirective); - - virtual void makeModuleVisible(Module *Mod, - Module::NameVisibilityKind Visibility, - SourceLocation ImportLoc, - bool Complain); + + ModuleLoadResult loadModule(SourceLocation ImportLoc, ModuleIdPath Path, + Module::NameVisibilityKind Visibility, + bool IsInclusionDirective) override; + + void makeModuleVisible(Module *Mod, Module::NameVisibilityKind Visibility, + SourceLocation ImportLoc, bool Complain) override; bool hadModuleLoaderFatalFailure() const { return ModuleLoader::HadFatalFailure; diff --git a/include/clang/Frontend/DiagnosticRenderer.h b/include/clang/Frontend/DiagnosticRenderer.h index f3cd054045e33d39cc8a7ec7960349e8788b65d6..f554b88f45497fde075800864f2078079641fcbb 100644 --- a/include/clang/Frontend/DiagnosticRenderer.h +++ b/include/clang/Frontend/DiagnosticRenderer.h @@ -158,20 +158,19 @@ public: : DiagnosticRenderer(LangOpts, DiagOpts) {} virtual ~DiagnosticNoteRenderer(); - - virtual void emitBasicNote(StringRef Message); - - virtual void emitIncludeLocation(SourceLocation Loc, - PresumedLoc PLoc, - const SourceManager &SM); - virtual void emitImportLocation(SourceLocation Loc, PresumedLoc PLoc, - StringRef ModuleName, - const SourceManager &SM); + void emitBasicNote(StringRef Message) override; - virtual void emitBuildingModuleLocation(SourceLocation Loc, PresumedLoc PLoc, - StringRef ModuleName, - const SourceManager &SM); + void emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc, + const SourceManager &SM) override; + + void emitImportLocation(SourceLocation Loc, PresumedLoc PLoc, + StringRef ModuleName, + const SourceManager &SM) override; + + void emitBuildingModuleLocation(SourceLocation Loc, PresumedLoc PLoc, + StringRef ModuleName, + const SourceManager &SM) override; virtual void emitNote(SourceLocation Loc, StringRef Message, const SourceManager *SM) = 0; diff --git a/include/clang/Frontend/FrontendAction.h b/include/clang/Frontend/FrontendAction.h index 87b982096bb870c49062ad940d2fa5961b814799..8c245130ee7afe178eded8d9a6f065ba12904fab 100644 --- a/include/clang/Frontend/FrontendAction.h +++ b/include/clang/Frontend/FrontendAction.h @@ -218,17 +218,17 @@ protected: /// /// This will also take care of instantiating a code completion consumer if /// the user requested it and the action supports it. - virtual void ExecuteAction(); + void ExecuteAction() override; public: - virtual bool usesPreprocessorOnly() const { return false; } + bool usesPreprocessorOnly() const override { return false; } }; class PluginASTAction : public ASTFrontendAction { virtual void anchor(); protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile) = 0; + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override = 0; public: /// \brief Parse the given plugin command line arguments. @@ -246,11 +246,11 @@ class PreprocessorFrontendAction : public FrontendAction { protected: /// \brief Provide a default implementation which returns aborts; /// this method should never be called by FrontendAction clients. - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; public: - virtual bool usesPreprocessorOnly() const { return true; } + bool usesPreprocessorOnly() const override { return true; } }; /// \brief A frontend action which simply wraps some other runtime-specified @@ -263,25 +263,24 @@ class WrapperFrontendAction : public FrontendAction { std::unique_ptr<FrontendAction> WrappedAction; protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); - virtual bool BeginInvocation(CompilerInstance &CI); - virtual bool BeginSourceFileAction(CompilerInstance &CI, - StringRef Filename); - virtual void ExecuteAction(); - virtual void EndSourceFileAction(); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; + bool BeginInvocation(CompilerInstance &CI) override; + bool BeginSourceFileAction(CompilerInstance &CI, StringRef Filename) override; + void ExecuteAction() override; + void EndSourceFileAction() override; public: /// Construct a WrapperFrontendAction from an existing action, taking /// ownership of it. WrapperFrontendAction(FrontendAction *WrappedAction); - virtual bool usesPreprocessorOnly() const; - virtual TranslationUnitKind getTranslationUnitKind(); - virtual bool hasPCHSupport() const; - virtual bool hasASTFileSupport() const; - virtual bool hasIRSupport() const; - virtual bool hasCodeCompletionSupport() const; + bool usesPreprocessorOnly() const override; + TranslationUnitKind getTranslationUnitKind() override; + bool hasPCHSupport() const override; + bool hasASTFileSupport() const override; + bool hasIRSupport() const override; + bool hasCodeCompletionSupport() const override; }; } // end namespace clang diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h index f5557888ad6a77f1fd8e759442ac4e28869de06b..a5db2523d24e456933ba073dd0542ba32057923b 100644 --- a/include/clang/Frontend/FrontendActions.h +++ b/include/clang/Frontend/FrontendActions.h @@ -23,15 +23,15 @@ class Module; //===----------------------------------------------------------------------===// class InitOnlyAction : public FrontendAction { - virtual void ExecuteAction(); + void ExecuteAction() override; - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; public: // Don't claim to only use the preprocessor, we want to follow the AST path, // but do nothing. - virtual bool usesPreprocessorOnly() const { return false; } + bool usesPreprocessorOnly() const override { return false; } }; //===----------------------------------------------------------------------===// @@ -40,44 +40,44 @@ public: class ASTPrintAction : public ASTFrontendAction { protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; }; class ASTDumpAction : public ASTFrontendAction { protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; }; class ASTDeclListAction : public ASTFrontendAction { protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; }; class ASTViewAction : public ASTFrontendAction { protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; }; class DeclContextPrintAction : public ASTFrontendAction { protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; }; class GeneratePCHAction : public ASTFrontendAction { protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; - virtual TranslationUnitKind getTranslationUnitKind() { + TranslationUnitKind getTranslationUnitKind() override { return TU_Prefix; } - virtual bool hasASTFileSupport() const { return false; } + bool hasASTFileSupport() const override { return false; } public: /// \brief Compute the AST consumer arguments that will be used to @@ -96,21 +96,21 @@ class GenerateModuleAction : public ASTFrontendAction { bool IsSystem; protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); - - virtual TranslationUnitKind getTranslationUnitKind() { + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; + + TranslationUnitKind getTranslationUnitKind() override { return TU_Module; } - - virtual bool hasASTFileSupport() const { return false; } - + + bool hasASTFileSupport() const override { return false; } + public: explicit GenerateModuleAction(bool IsSystem = false) : ASTFrontendAction(), IsSystem(IsSystem) { } - virtual bool BeginSourceFileAction(CompilerInstance &CI, StringRef Filename); - + bool BeginSourceFileAction(CompilerInstance &CI, StringRef Filename) override; + /// \brief Compute the AST consumer arguments that will be used to /// create the PCHGenerator instance returned by CreateASTConsumer. /// @@ -124,37 +124,37 @@ public: class SyntaxOnlyAction : public ASTFrontendAction { protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; public: - virtual bool hasCodeCompletionSupport() const { return true; } + bool hasCodeCompletionSupport() const override { return true; } }; /// \brief Dump information about the given module file, to be used for /// basic debugging and discovery. class DumpModuleInfoAction : public ASTFrontendAction { protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); - virtual void ExecuteAction(); - + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; + void ExecuteAction() override; + public: - virtual bool hasPCHSupport() const { return false; } - virtual bool hasASTFileSupport() const { return true; } - virtual bool hasIRSupport() const { return false; } - virtual bool hasCodeCompletionSupport() const { return false; } + bool hasPCHSupport() const override { return false; } + bool hasASTFileSupport() const override { return true; } + bool hasIRSupport() const override { return false; } + bool hasCodeCompletionSupport() const override { return false; } }; class VerifyPCHAction : public ASTFrontendAction { protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; - virtual void ExecuteAction(); + void ExecuteAction() override; public: - virtual bool hasCodeCompletionSupport() const { return false; } + bool hasCodeCompletionSupport() const override { return false; } }; /** @@ -173,34 +173,34 @@ class ASTMergeAction : public FrontendAction { std::vector<std::string> ASTFiles; protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; - virtual bool BeginSourceFileAction(CompilerInstance &CI, - StringRef Filename); + bool BeginSourceFileAction(CompilerInstance &CI, + StringRef Filename) override; - virtual void ExecuteAction(); - virtual void EndSourceFileAction(); + void ExecuteAction() override; + void EndSourceFileAction() override; public: ASTMergeAction(FrontendAction *AdaptedAction, ArrayRef<std::string> ASTFiles); virtual ~ASTMergeAction(); - virtual bool usesPreprocessorOnly() const; - virtual TranslationUnitKind getTranslationUnitKind(); - virtual bool hasPCHSupport() const; - virtual bool hasASTFileSupport() const; - virtual bool hasCodeCompletionSupport() const; + bool usesPreprocessorOnly() const override; + TranslationUnitKind getTranslationUnitKind() override; + bool hasPCHSupport() const override; + bool hasASTFileSupport() const override; + bool hasCodeCompletionSupport() const override; }; class PrintPreambleAction : public FrontendAction { protected: - void ExecuteAction(); - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &, StringRef) { - return 0; + void ExecuteAction() override; + ASTConsumer *CreateASTConsumer(CompilerInstance &, StringRef) override { + return 0; } - - virtual bool usesPreprocessorOnly() const { return true; } + + bool usesPreprocessorOnly() const override { return true; } }; //===----------------------------------------------------------------------===// @@ -209,29 +209,29 @@ protected: class DumpRawTokensAction : public PreprocessorFrontendAction { protected: - void ExecuteAction(); + void ExecuteAction() override; }; class DumpTokensAction : public PreprocessorFrontendAction { protected: - void ExecuteAction(); + void ExecuteAction() override; }; class GeneratePTHAction : public PreprocessorFrontendAction { protected: - void ExecuteAction(); + void ExecuteAction() override; }; class PreprocessOnlyAction : public PreprocessorFrontendAction { protected: - void ExecuteAction(); + void ExecuteAction() override; }; class PrintPreprocessedAction : public PreprocessorFrontendAction { protected: - void ExecuteAction(); + void ExecuteAction() override; - virtual bool hasPCHSupport() const { return true; } + bool hasPCHSupport() const override { return true; } }; } // end namespace clang diff --git a/include/clang/Frontend/LayoutOverrideSource.h b/include/clang/Frontend/LayoutOverrideSource.h index ec34e147650e9d80ced5fef4b675c1a4eb0e8079..16d032b7dd72c27299c1294d0cb4494ca19de628 100644 --- a/include/clang/Frontend/LayoutOverrideSource.h +++ b/include/clang/Frontend/LayoutOverrideSource.h @@ -47,12 +47,13 @@ namespace clang { /// \brief If this particular record type has an overridden layout, /// return that layout. - virtual bool + bool layoutRecordType(const RecordDecl *Record, uint64_t &Size, uint64_t &Alignment, llvm::DenseMap<const FieldDecl *, uint64_t> &FieldOffsets, llvm::DenseMap<const CXXRecordDecl *, CharUnits> &BaseOffsets, - llvm::DenseMap<const CXXRecordDecl *, CharUnits> &VirtualBaseOffsets); + llvm::DenseMap<const CXXRecordDecl *, + CharUnits> &VirtualBaseOffsets) override; /// \brief Dump the overridden layouts. void dump(); diff --git a/include/clang/Frontend/LogDiagnosticPrinter.h b/include/clang/Frontend/LogDiagnosticPrinter.h index e8a6bb357cab370b0c4be39743133b895bd96dfd..4ef643e2ef5976ee43a0ac16ead448f5fe9a202a 100644 --- a/include/clang/Frontend/LogDiagnosticPrinter.h +++ b/include/clang/Frontend/LogDiagnosticPrinter.h @@ -62,14 +62,14 @@ public: DwarfDebugFlags = Value; } - void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP) { + void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP) override { LangOpts = &LO; } - void EndSourceFile(); + void EndSourceFile() override; - virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, - const Diagnostic &Info); + void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, + const Diagnostic &Info) override; }; } // end namespace clang diff --git a/include/clang/Frontend/MultiplexConsumer.h b/include/clang/Frontend/MultiplexConsumer.h index 282cd70a7f9f3c167bc5abe209b1deb9d3490ed1..6ea1d73d2824bd95f9698c8cabf6a2063086dec5 100644 --- a/include/clang/Frontend/MultiplexConsumer.h +++ b/include/clang/Frontend/MultiplexConsumer.h @@ -33,23 +33,23 @@ public: ~MultiplexConsumer(); // ASTConsumer - virtual void Initialize(ASTContext &Context); - virtual void HandleCXXStaticMemberVarInstantiation(VarDecl *VD); - virtual bool HandleTopLevelDecl(DeclGroupRef D); - virtual void HandleInterestingDecl(DeclGroupRef D); - virtual void HandleTranslationUnit(ASTContext &Ctx); - virtual void HandleTagDeclDefinition(TagDecl *D); - virtual void HandleCXXImplicitFunctionInstantiation(FunctionDecl *D); - virtual void HandleTopLevelDeclInObjCContainer(DeclGroupRef D); - virtual void CompleteTentativeDefinition(VarDecl *D); - virtual void HandleVTable(CXXRecordDecl *RD, bool DefinitionRequired); - virtual ASTMutationListener *GetASTMutationListener(); - virtual ASTDeserializationListener *GetASTDeserializationListener(); - virtual void PrintStats(); + void Initialize(ASTContext &Context) override; + void HandleCXXStaticMemberVarInstantiation(VarDecl *VD) override; + bool HandleTopLevelDecl(DeclGroupRef D) override; + void HandleInterestingDecl(DeclGroupRef D) override; + void HandleTranslationUnit(ASTContext &Ctx) override; + void HandleTagDeclDefinition(TagDecl *D) override; + void HandleCXXImplicitFunctionInstantiation(FunctionDecl *D) override; + void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) override; + void CompleteTentativeDefinition(VarDecl *D) override; + void HandleVTable(CXXRecordDecl *RD, bool DefinitionRequired) override; + ASTMutationListener *GetASTMutationListener() override; + ASTDeserializationListener *GetASTDeserializationListener() override; + void PrintStats() override; // SemaConsumer - virtual void InitializeSema(Sema &S); - virtual void ForgetSema(); + void InitializeSema(Sema &S) override; + void ForgetSema() override; private: std::vector<ASTConsumer*> Consumers; // Owns these. diff --git a/include/clang/Frontend/TextDiagnostic.h b/include/clang/Frontend/TextDiagnostic.h index c8d01b0b15eb7be389c51e6be86b4a40fc7c6b04..2aa95760fd3b23c26f98466feea48e8e1faaeff2 100644 --- a/include/clang/Frontend/TextDiagnostic.h +++ b/include/clang/Frontend/TextDiagnostic.h @@ -77,38 +77,38 @@ public: bool ShowColors); protected: - virtual void emitDiagnosticMessage(SourceLocation Loc,PresumedLoc PLoc, - DiagnosticsEngine::Level Level, - StringRef Message, - ArrayRef<CharSourceRange> Ranges, - const SourceManager *SM, - DiagOrStoredDiag D); - - virtual void emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc, - DiagnosticsEngine::Level Level, - ArrayRef<CharSourceRange> Ranges, - const SourceManager &SM); - - virtual void emitCodeContext(SourceLocation Loc, - DiagnosticsEngine::Level Level, - SmallVectorImpl<CharSourceRange>& Ranges, - ArrayRef<FixItHint> Hints, - const SourceManager &SM) { + void emitDiagnosticMessage(SourceLocation Loc,PresumedLoc PLoc, + DiagnosticsEngine::Level Level, + StringRef Message, + ArrayRef<CharSourceRange> Ranges, + const SourceManager *SM, + DiagOrStoredDiag D) override; + + void emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc, + DiagnosticsEngine::Level Level, + ArrayRef<CharSourceRange> Ranges, + const SourceManager &SM) override; + + void emitCodeContext(SourceLocation Loc, + DiagnosticsEngine::Level Level, + SmallVectorImpl<CharSourceRange>& Ranges, + ArrayRef<FixItHint> Hints, + const SourceManager &SM) override { emitSnippetAndCaret(Loc, Level, Ranges, Hints, SM); } - - virtual void emitBasicNote(StringRef Message); - - virtual void emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc, - const SourceManager &SM); - virtual void emitImportLocation(SourceLocation Loc, PresumedLoc PLoc, - StringRef ModuleName, - const SourceManager &SM); + void emitBasicNote(StringRef Message) override; + + void emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc, + const SourceManager &SM) override; - virtual void emitBuildingModuleLocation(SourceLocation Loc, PresumedLoc PLoc, - StringRef ModuleName, - const SourceManager &SM); + void emitImportLocation(SourceLocation Loc, PresumedLoc PLoc, + StringRef ModuleName, + const SourceManager &SM) override; + + void emitBuildingModuleLocation(SourceLocation Loc, PresumedLoc PLoc, + StringRef ModuleName, + const SourceManager &SM) override; private: void emitSnippetAndCaret(SourceLocation Loc, DiagnosticsEngine::Level Level, diff --git a/include/clang/Frontend/TextDiagnosticBuffer.h b/include/clang/Frontend/TextDiagnosticBuffer.h index 93ac299da30e475f324cd4ec64b673822811ecec..feff798f623b1cae9480ed0a72d800b953022af6 100644 --- a/include/clang/Frontend/TextDiagnosticBuffer.h +++ b/include/clang/Frontend/TextDiagnosticBuffer.h @@ -39,8 +39,8 @@ public: const_iterator note_begin() const { return Notes.begin(); } const_iterator note_end() const { return Notes.end(); } - virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, - const Diagnostic &Info); + void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, + const Diagnostic &Info) override; /// FlushDiagnostics - Flush the buffered diagnostics to an given /// diagnostic engine. diff --git a/include/clang/Frontend/TextDiagnosticPrinter.h b/include/clang/Frontend/TextDiagnosticPrinter.h index 65affa8ef1614af3a56d4334c1935856bb607474..9f6d5ff9dd1781cae9f020fcb2bf9cd1fa47c88a 100644 --- a/include/clang/Frontend/TextDiagnosticPrinter.h +++ b/include/clang/Frontend/TextDiagnosticPrinter.h @@ -47,9 +47,10 @@ public: /// used. void setPrefix(std::string Value) { Prefix = Value; } - void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP); - void EndSourceFile(); - void HandleDiagnostic(DiagnosticsEngine::Level Level, const Diagnostic &Info); + void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP) override; + void EndSourceFile() override; + void HandleDiagnostic(DiagnosticsEngine::Level Level, + const Diagnostic &Info) override; }; } // end namespace clang diff --git a/include/clang/Frontend/VerifyDiagnosticConsumer.h b/include/clang/Frontend/VerifyDiagnosticConsumer.h index feb64cc06d83eabd13f0977840ad57fca1b6b94a..39678ef44bc968c0522bcdac557dfd8add606eae 100644 --- a/include/clang/Frontend/VerifyDiagnosticConsumer.h +++ b/include/clang/Frontend/VerifyDiagnosticConsumer.h @@ -239,10 +239,10 @@ public: VerifyDiagnosticConsumer(DiagnosticsEngine &Diags); ~VerifyDiagnosticConsumer(); - virtual void BeginSourceFile(const LangOptions &LangOpts, - const Preprocessor *PP); + void BeginSourceFile(const LangOptions &LangOpts, + const Preprocessor *PP) override; - virtual void EndSourceFile(); + void EndSourceFile() override; enum ParsedStatus { /// File has been processed via HandleComment. @@ -258,10 +258,10 @@ public: /// \brief Update lists of parsed and unparsed files. void UpdateParsedFileStatus(SourceManager &SM, FileID FID, ParsedStatus PS); - virtual bool HandleComment(Preprocessor &PP, SourceRange Comment); + bool HandleComment(Preprocessor &PP, SourceRange Comment) override; - virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, - const Diagnostic &Info); + void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, + const Diagnostic &Info) override; }; } // end namspace clang diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp index aee8cd7167579b3de8d04a1810a1a74d99e4c58f..054148660e097cbf2db55f9ebf3b97d90a41f7b3 100644 --- a/lib/Frontend/ASTConsumers.cpp +++ b/lib/Frontend/ASTConsumers.cpp @@ -41,7 +41,7 @@ namespace { : Out(Out ? *Out : llvm::outs()), Dump(Dump), FilterString(FilterString), DumpLookups(DumpLookups) {} - virtual void HandleTranslationUnit(ASTContext &Context) { + void HandleTranslationUnit(ASTContext &Context) override { TranslationUnitDecl *D = Context.getTranslationUnitDecl(); if (FilterString.empty()) @@ -101,7 +101,7 @@ namespace { ASTDeclNodeLister(raw_ostream *Out = NULL) : Out(Out ? *Out : llvm::outs()) {} - virtual void HandleTranslationUnit(ASTContext &Context) { + void HandleTranslationUnit(ASTContext &Context) override { TraverseDecl(Context.getTranslationUnitDecl()); } @@ -138,11 +138,11 @@ namespace { class ASTViewer : public ASTConsumer { ASTContext *Context; public: - void Initialize(ASTContext &Context) { + void Initialize(ASTContext &Context) override { this->Context = &Context; } - virtual bool HandleTopLevelDecl(DeclGroupRef D) { + bool HandleTopLevelDecl(DeclGroupRef D) override { for (DeclGroupRef::iterator I = D.begin(), E = D.end(); I != E; ++I) HandleTopLevelSingleDecl(*I); return true; @@ -177,7 +177,7 @@ class DeclContextPrinter : public ASTConsumer { public: DeclContextPrinter() : Out(llvm::errs()) {} - void HandleTranslationUnit(ASTContext &C) { + void HandleTranslationUnit(ASTContext &C) override { PrintDeclContext(C.getTranslationUnitDecl(), 4); } diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 7b5e91592ca97f50baf1b1ce2c5f2aa1f67f18b8..c4f7596e0037b908df6eba83350ebd3f9a2240f5 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -519,8 +519,8 @@ public: Counter(Counter), InitializedLanguage(false) {} - virtual bool ReadLanguageOptions(const LangOptions &LangOpts, - bool Complain) { + bool ReadLanguageOptions(const LangOptions &LangOpts, + bool Complain) override { if (InitializedLanguage) return false; @@ -531,8 +531,8 @@ public: return false; } - virtual bool ReadTargetOptions(const TargetOptions &TargetOpts, - bool Complain) { + bool ReadTargetOptions(const TargetOptions &TargetOpts, + bool Complain) override { // If we've already initialized the target, don't do it again. if (Target) return false; @@ -545,7 +545,8 @@ public: return false; } - virtual void ReadCounter(const serialization::ModuleFile &M, unsigned Value) { + void ReadCounter(const serialization::ModuleFile &M, + unsigned Value) override { Counter = Value; } @@ -583,14 +584,14 @@ public: SmallVectorImpl<StoredDiagnostic> &StoredDiags) : StoredDiags(StoredDiags), SourceMgr(0) { } - virtual void BeginSourceFile(const LangOptions &LangOpts, - const Preprocessor *PP = 0) { + void BeginSourceFile(const LangOptions &LangOpts, + const Preprocessor *PP = 0) override { if (PP) SourceMgr = &PP->getSourceManager(); } - virtual void HandleDiagnostic(DiagnosticsEngine::Level Level, - const Diagnostic &Info); + void HandleDiagnostic(DiagnosticsEngine::Level Level, + const Diagnostic &Info) override; }; /// \brief RAII object that optionally captures diagnostics, if @@ -793,9 +794,9 @@ class MacroDefinitionTrackerPPCallbacks : public PPCallbacks { public: explicit MacroDefinitionTrackerPPCallbacks(unsigned &Hash) : Hash(Hash) { } - - virtual void MacroDefined(const Token &MacroNameTok, - const MacroDirective *MD) { + + void MacroDefined(const Token &MacroNameTok, + const MacroDirective *MD) override { Hash = llvm::HashString(MacroNameTok.getIdentifierInfo()->getName(), Hash); } }; @@ -877,25 +878,25 @@ public: } } - bool HandleTopLevelDecl(DeclGroupRef D) { + bool HandleTopLevelDecl(DeclGroupRef D) override { for (DeclGroupRef::iterator it = D.begin(), ie = D.end(); it != ie; ++it) handleTopLevelDecl(*it); return true; } // We're not interested in "interesting" decls. - void HandleInterestingDecl(DeclGroupRef) {} + void HandleInterestingDecl(DeclGroupRef) override {} - void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) { + void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) override { for (DeclGroupRef::iterator it = D.begin(), ie = D.end(); it != ie; ++it) handleTopLevelDecl(*it); } - virtual ASTMutationListener *GetASTMutationListener() { + ASTMutationListener *GetASTMutationListener() override { return Unit.getASTMutationListener(); } - virtual ASTDeserializationListener *GetASTDeserializationListener() { + ASTDeserializationListener *GetASTDeserializationListener() override { return Unit.getDeserializationListener(); } }; @@ -904,8 +905,8 @@ class TopLevelDeclTrackerAction : public ASTFrontendAction { public: ASTUnit &Unit; - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile) { + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override { CI.getPreprocessor().addPPCallbacks( new MacroDefinitionTrackerPPCallbacks(Unit.getCurrentTopLevelHashValue())); return new TopLevelDeclTrackerConsumer(Unit, @@ -915,8 +916,8 @@ public: public: TopLevelDeclTrackerAction(ASTUnit &_Unit) : Unit(_Unit) {} - virtual bool hasCodeCompletionSupport() const { return false; } - virtual TranslationUnitKind getTranslationUnitKind() { + bool hasCodeCompletionSupport() const override { return false; } + TranslationUnitKind getTranslationUnitKind() override { return Unit.getTranslationUnitKind(); } }; @@ -929,15 +930,15 @@ public: explicit PrecompilePreambleAction(ASTUnit &Unit) : Unit(Unit), HasEmittedPreamblePCH(false) {} - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; bool hasEmittedPreamblePCH() const { return HasEmittedPreamblePCH; } void setHasEmittedPreamblePCH() { HasEmittedPreamblePCH = true; } - virtual bool shouldEraseOutputFiles() { return !hasEmittedPreamblePCH(); } + bool shouldEraseOutputFiles() override { return !hasEmittedPreamblePCH(); } - virtual bool hasCodeCompletionSupport() const { return false; } - virtual bool hasASTFileSupport() const { return false; } - virtual TranslationUnitKind getTranslationUnitKind() { return TU_Prefix; } + bool hasCodeCompletionSupport() const override { return false; } + bool hasASTFileSupport() const override { return false; } + TranslationUnitKind getTranslationUnitKind() override { return TU_Prefix; } }; class PrecompilePreambleConsumer : public PCHGenerator { @@ -955,7 +956,7 @@ public: Hash = 0; } - virtual bool HandleTopLevelDecl(DeclGroupRef D) { + bool HandleTopLevelDecl(DeclGroupRef D) override { for (DeclGroupRef::iterator it = D.begin(), ie = D.end(); it != ie; ++it) { Decl *D = *it; // FIXME: Currently ObjC method declarations are incorrectly being @@ -970,7 +971,7 @@ public: return true; } - virtual void HandleTranslationUnit(ASTContext &Ctx) { + void HandleTranslationUnit(ASTContext &Ctx) override { PCHGenerator::HandleTranslationUnit(Ctx); if (hasEmittedPCH()) { // Translate the top-level declarations we captured during @@ -2141,23 +2142,22 @@ namespace { | (1LL << CodeCompletionContext::CCC_UnionTag) | (1LL << CodeCompletionContext::CCC_ClassOrStructTag); } - - virtual void ProcessCodeCompleteResults(Sema &S, - CodeCompletionContext Context, - CodeCompletionResult *Results, - unsigned NumResults); - - virtual void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, - OverloadCandidate *Candidates, - unsigned NumCandidates) { + + void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context, + CodeCompletionResult *Results, + unsigned NumResults) override; + + void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, + OverloadCandidate *Candidates, + unsigned NumCandidates) override { Next.ProcessOverloadCandidates(S, CurrentArg, Candidates, NumCandidates); } - - virtual CodeCompletionAllocator &getAllocator() { + + CodeCompletionAllocator &getAllocator() override { return Next.getAllocator(); } - virtual CodeCompletionTUInfo &getCodeCompletionTUInfo() { + CodeCompletionTUInfo &getCodeCompletionTUInfo() override { return Next.getCodeCompletionTUInfo(); } }; diff --git a/lib/Frontend/CacheTokens.cpp b/lib/Frontend/CacheTokens.cpp index 5cb364e3f5c968cd2babda34180936553077ec6a..0fca5130c5fb1c362b972d0489a234db9b277841 100644 --- a/lib/Frontend/CacheTokens.cpp +++ b/lib/Frontend/CacheTokens.cpp @@ -516,7 +516,7 @@ public: ~StatListener() {} LookupResult getStat(const char *Path, FileData &Data, bool isFile, - vfs::File **F, vfs::FileSystem &FS) { + vfs::File **F, vfs::FileSystem &FS) override { LookupResult Result = statChained(Path, Data, isFile, F, FS); if (Result == CacheMissing) // Failed 'stat'. diff --git a/lib/Frontend/DependencyFile.cpp b/lib/Frontend/DependencyFile.cpp index 175a2c9a26437fe29a386e1325097b11474c81f2..e27381bf7794a50f19138d9b8d2d295c1b27b795 100644 --- a/lib/Frontend/DependencyFile.cpp +++ b/lib/Frontend/DependencyFile.cpp @@ -53,20 +53,16 @@ public: AddMissingHeaderDeps(Opts.AddMissingHeaderDeps), SeenMissingHeader(false) {} - virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, - SrcMgr::CharacteristicKind FileType, - FileID PrevFID); - virtual void InclusionDirective(SourceLocation HashLoc, - const Token &IncludeTok, - StringRef FileName, - bool IsAngled, - CharSourceRange FilenameRange, - const FileEntry *File, - StringRef SearchPath, - StringRef RelativePath, - const Module *Imported); - - virtual void EndOfMainFile() { + void FileChanged(SourceLocation Loc, FileChangeReason Reason, + SrcMgr::CharacteristicKind FileType, + FileID PrevFID) override; + void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, + StringRef FileName, bool IsAngled, + CharSourceRange FilenameRange, const FileEntry *File, + StringRef SearchPath, StringRef RelativePath, + const Module *Imported) override; + + void EndOfMainFile() override { OutputDependencyFile(); } @@ -79,11 +75,11 @@ class DFGASTReaderListener : public ASTReaderListener { public: DFGASTReaderListener(DFGImpl &Parent) : Parent(Parent) { } - virtual bool needsInputFileVisitation() { return true; } - virtual bool needsSystemInputFileVisitation() { + bool needsInputFileVisitation() override { return true; } + bool needsSystemInputFileVisitation() override { return Parent.includeSystemHeaders(); } - virtual bool visitInputFile(StringRef Filename, bool isSystem); + bool visitInputFile(StringRef Filename, bool isSystem) override; }; } diff --git a/lib/Frontend/DependencyGraph.cpp b/lib/Frontend/DependencyGraph.cpp index 6f12e630561948f0d35b0f977473acc2b585ab62..4bff3dba9e4e0e64cff48e9d40a347f66fb6172a 100644 --- a/lib/Frontend/DependencyGraph.cpp +++ b/lib/Frontend/DependencyGraph.cpp @@ -46,17 +46,13 @@ public: StringRef SysRoot) : PP(_PP), OutputFile(OutputFile.str()), SysRoot(SysRoot.str()) { } - virtual void InclusionDirective(SourceLocation HashLoc, - const Token &IncludeTok, - StringRef FileName, - bool IsAngled, - CharSourceRange FilenameRange, - const FileEntry *File, - StringRef SearchPath, - StringRef RelativePath, - const Module *Imported); + void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, + StringRef FileName, bool IsAngled, + CharSourceRange FilenameRange, const FileEntry *File, + StringRef SearchPath, StringRef RelativePath, + const Module *Imported) override; - virtual void EndOfMainFile() { + void EndOfMainFile() override { OutputGraphFile(); } diff --git a/lib/Frontend/DiagnosticRenderer.cpp b/lib/Frontend/DiagnosticRenderer.cpp index b52f0103e6b004f7f2af4cf6fe3b800d36122b84..85e87a21ed19e1d54a70046369c69fbf181ce477 100644 --- a/lib/Frontend/DiagnosticRenderer.cpp +++ b/lib/Frontend/DiagnosticRenderer.cpp @@ -79,10 +79,10 @@ class FixitReceiver : public edit::EditsReceiver { public: FixitReceiver(SmallVectorImpl<FixItHint> &MergedFixits) : MergedFixits(MergedFixits) { } - virtual void insert(SourceLocation loc, StringRef text) { + void insert(SourceLocation loc, StringRef text) override { MergedFixits.push_back(FixItHint::CreateInsertion(loc, text)); } - virtual void replace(CharSourceRange range, StringRef text) { + void replace(CharSourceRange range, StringRef text) override { MergedFixits.push_back(FixItHint::CreateReplacement(range, text)); } }; diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index 24f2ec496cda3954bbb468aa98f9280d67d99c68..d2ece7e732d64f92db6891ee6cb4e92dd2353f1f 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -43,29 +43,29 @@ public: ASTDeserializationListener *Previous) : Previous(Previous) { } - virtual void ReaderInitialized(ASTReader *Reader) { + void ReaderInitialized(ASTReader *Reader) override { if (Previous) Previous->ReaderInitialized(Reader); } - virtual void IdentifierRead(serialization::IdentID ID, - IdentifierInfo *II) { + void IdentifierRead(serialization::IdentID ID, + IdentifierInfo *II) override { if (Previous) Previous->IdentifierRead(ID, II); } - virtual void TypeRead(serialization::TypeIdx Idx, QualType T) { + void TypeRead(serialization::TypeIdx Idx, QualType T) override { if (Previous) Previous->TypeRead(Idx, T); } - virtual void DeclRead(serialization::DeclID ID, const Decl *D) { + void DeclRead(serialization::DeclID ID, const Decl *D) override { if (Previous) Previous->DeclRead(ID, D); } - virtual void SelectorRead(serialization::SelectorID ID, Selector Sel) { + void SelectorRead(serialization::SelectorID ID, Selector Sel) override { if (Previous) Previous->SelectorRead(ID, Sel); } - virtual void MacroDefinitionRead(serialization::PreprocessedEntityID PPID, - MacroDefinition *MD) { + void MacroDefinitionRead(serialization::PreprocessedEntityID PPID, + MacroDefinition *MD) override { if (Previous) Previous->MacroDefinitionRead(PPID, MD); } @@ -77,7 +77,7 @@ public: explicit DeserializedDeclsDumper(ASTDeserializationListener *Previous) : DelegatingDeserializationListener(Previous) { } - virtual void DeclRead(serialization::DeclID ID, const Decl *D) { + void DeclRead(serialization::DeclID ID, const Decl *D) override { llvm::outs() << "PCH DECL: " << D->getDeclKindName(); if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) llvm::outs() << " - " << *ND; @@ -100,7 +100,7 @@ public: : DelegatingDeserializationListener(Previous), Ctx(Ctx), NamesToCheck(NamesToCheck) { } - virtual void DeclRead(serialization::DeclID ID, const Decl *D) { + void DeclRead(serialization::DeclID ID, const Decl *D) override { if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) if (NamesToCheck.find(ND->getNameAsString()) != NamesToCheck.end()) { unsigned DiagID diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp index 786fadb2fe6fa894fffff98ae696b6dfcb5c7436..2657c9878b8e7db05440d622de2b4e0d234f48d4 100644 --- a/lib/Frontend/FrontendActions.cpp +++ b/lib/Frontend/FrontendActions.cpp @@ -403,7 +403,7 @@ namespace { #define DUMP_BOOLEAN(Value, Text) \ Out.indent(4) << Text << ": " << (Value? "Yes" : "No") << "\n" - virtual bool ReadFullVersionInformation(StringRef FullVersion) { + bool ReadFullVersionInformation(StringRef FullVersion) override { Out.indent(2) << "Generated by " << (FullVersion == getClangFullRepositoryVersion()? "this" @@ -412,8 +412,8 @@ namespace { return ASTReaderListener::ReadFullVersionInformation(FullVersion); } - virtual bool ReadLanguageOptions(const LangOptions &LangOpts, - bool Complain) { + bool ReadLanguageOptions(const LangOptions &LangOpts, + bool Complain) override { Out.indent(2) << "Language options:\n"; #define LANGOPT(Name, Bits, Default, Description) \ DUMP_BOOLEAN(LangOpts.Name, Description); @@ -428,8 +428,8 @@ namespace { return false; } - virtual bool ReadTargetOptions(const TargetOptions &TargetOpts, - bool Complain) { + bool ReadTargetOptions(const TargetOptions &TargetOpts, + bool Complain) override { Out.indent(2) << "Target options:\n"; Out.indent(4) << " Triple: " << TargetOpts.Triple << "\n"; Out.indent(4) << " CPU: " << TargetOpts.CPU << "\n"; @@ -447,8 +447,8 @@ namespace { return false; } - virtual bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, - bool Complain) { + bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, + bool Complain) override { Out.indent(2) << "Header search options:\n"; Out.indent(4) << "System root [-isysroot=]: '" << HSOpts.Sysroot << "'\n"; DUMP_BOOLEAN(HSOpts.UseBuiltinIncludes, @@ -462,9 +462,9 @@ namespace { return false; } - virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, - bool Complain, - std::string &SuggestedPredefines) { + bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, + bool Complain, + std::string &SuggestedPredefines) override { Out.indent(2) << "Preprocessor options:\n"; DUMP_BOOLEAN(PPOpts.UsePredefines, "Uses compiler/target-specific predefines [-undef]"); diff --git a/lib/Frontend/HeaderIncludeGen.cpp b/lib/Frontend/HeaderIncludeGen.cpp index 00ff63746c92b93776b92ab9875873817d2a0a0c..6d2e3783211a3e6e02af047fb931c79873ff50ed 100644 --- a/lib/Frontend/HeaderIncludeGen.cpp +++ b/lib/Frontend/HeaderIncludeGen.cpp @@ -40,9 +40,9 @@ public: delete OutputFile; } - virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, - SrcMgr::CharacteristicKind FileType, - FileID PrevFID); + void FileChanged(SourceLocation Loc, FileChangeReason Reason, + SrcMgr::CharacteristicKind FileType, + FileID PrevFID) override; }; } diff --git a/lib/Frontend/MultiplexConsumer.cpp b/lib/Frontend/MultiplexConsumer.cpp index ca7e6d35b19a1567d9ed0144ed72656b80a1eb80..4b4804f035076d9a085c89cf257728b30e5ea950 100644 --- a/lib/Frontend/MultiplexConsumer.cpp +++ b/lib/Frontend/MultiplexConsumer.cpp @@ -30,14 +30,14 @@ public: // Does NOT take ownership of the elements in L. MultiplexASTDeserializationListener( const std::vector<ASTDeserializationListener*>& L); - virtual void ReaderInitialized(ASTReader *Reader); - virtual void IdentifierRead(serialization::IdentID ID, - IdentifierInfo *II); - virtual void TypeRead(serialization::TypeIdx Idx, QualType T); - virtual void DeclRead(serialization::DeclID ID, const Decl *D); - virtual void SelectorRead(serialization::SelectorID iD, Selector Sel); - virtual void MacroDefinitionRead(serialization::PreprocessedEntityID, - MacroDefinition *MD); + void ReaderInitialized(ASTReader *Reader) override; + void IdentifierRead(serialization::IdentID ID, + IdentifierInfo *II) override; + void TypeRead(serialization::TypeIdx Idx, QualType T) override; + void DeclRead(serialization::DeclID ID, const Decl *D) override; + void SelectorRead(serialization::SelectorID iD, Selector Sel) override; + void MacroDefinitionRead(serialization::PreprocessedEntityID, + MacroDefinition *MD) override; private: std::vector<ASTDeserializationListener*> Listeners; }; @@ -89,24 +89,23 @@ class MultiplexASTMutationListener : public ASTMutationListener { public: // Does NOT take ownership of the elements in L. MultiplexASTMutationListener(ArrayRef<ASTMutationListener*> L); - virtual void CompletedTagDefinition(const TagDecl *D); - virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D); - virtual void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D); - virtual void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD, - const ClassTemplateSpecializationDecl *D); - virtual void - AddedCXXTemplateSpecialization(const VarTemplateDecl *TD, - const VarTemplateSpecializationDecl *D); - virtual void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD, - const FunctionDecl *D); - virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType); - virtual void CompletedImplicitDefinition(const FunctionDecl *D); - virtual void StaticDataMemberInstantiated(const VarDecl *D); - virtual void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD, - const ObjCInterfaceDecl *IFD); - virtual void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop, - const ObjCPropertyDecl *OrigProp, - const ObjCCategoryDecl *ClassExt); + void CompletedTagDefinition(const TagDecl *D) override; + void AddedVisibleDecl(const DeclContext *DC, const Decl *D) override; + void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) override; + void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD, + const ClassTemplateSpecializationDecl *D) override; + void AddedCXXTemplateSpecialization(const VarTemplateDecl *TD, + const VarTemplateSpecializationDecl *D) override; + void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD, + const FunctionDecl *D) override; + void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType) override; + void CompletedImplicitDefinition(const FunctionDecl *D) override; + void StaticDataMemberInstantiated(const VarDecl *D) override; + void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD, + const ObjCInterfaceDecl *IFD) override; + void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop, + const ObjCPropertyDecl *OrigProp, + const ObjCCategoryDecl *ClassExt) override; void DeclarationMarkedUsed(const Decl *D) override; private: diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp index 20d7cd3a8c011cda1f57865fb7515beca8626d0b..b7b03f99ae281567e74589371040e630fd0c00a4 100644 --- a/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/lib/Frontend/PrintPreprocessedOutput.cpp @@ -123,34 +123,28 @@ public: } bool startNewLineIfNeeded(bool ShouldUpdateCurrentLine = true); - - virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, - SrcMgr::CharacteristicKind FileType, - FileID PrevFID); - virtual void InclusionDirective(SourceLocation HashLoc, - const Token &IncludeTok, - StringRef FileName, - bool IsAngled, - CharSourceRange FilenameRange, - const FileEntry *File, - StringRef SearchPath, - StringRef RelativePath, - const Module *Imported); - virtual void Ident(SourceLocation Loc, const std::string &str); + + void FileChanged(SourceLocation Loc, FileChangeReason Reason, + SrcMgr::CharacteristicKind FileType, + FileID PrevFID) override; + void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, + StringRef FileName, bool IsAngled, + CharSourceRange FilenameRange, const FileEntry *File, + StringRef SearchPath, StringRef RelativePath, + const Module *Imported) override; + void Ident(SourceLocation Loc, const std::string &str) override; virtual void PragmaCaptured(SourceLocation Loc, StringRef Str); - virtual void PragmaMessage(SourceLocation Loc, StringRef Namespace, - PragmaMessageKind Kind, StringRef Str); - virtual void PragmaDebug(SourceLocation Loc, StringRef DebugType); - virtual void PragmaDiagnosticPush(SourceLocation Loc, - StringRef Namespace); - virtual void PragmaDiagnosticPop(SourceLocation Loc, - StringRef Namespace); - virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace, - diag::Mapping Map, StringRef Str); - virtual void PragmaWarning(SourceLocation Loc, StringRef WarningSpec, - ArrayRef<int> Ids); - virtual void PragmaWarningPush(SourceLocation Loc, int Level); - virtual void PragmaWarningPop(SourceLocation Loc); + void PragmaMessage(SourceLocation Loc, StringRef Namespace, + PragmaMessageKind Kind, StringRef Str) override; + void PragmaDebug(SourceLocation Loc, StringRef DebugType) override; + void PragmaDiagnosticPush(SourceLocation Loc, StringRef Namespace) override; + void PragmaDiagnosticPop(SourceLocation Loc, StringRef Namespace) override; + void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace, + diag::Mapping Map, StringRef Str) override; + void PragmaWarning(SourceLocation Loc, StringRef WarningSpec, + ArrayRef<int> Ids) override; + void PragmaWarningPush(SourceLocation Loc, int Level) override; + void PragmaWarningPop(SourceLocation Loc) override; bool HandleFirstTokOnLine(Token &Tok); @@ -174,10 +168,12 @@ public: void HandleNewlinesInToken(const char *TokStr, unsigned Len); /// MacroDefined - This hook is called whenever a macro definition is seen. - void MacroDefined(const Token &MacroNameTok, const MacroDirective *MD); + void MacroDefined(const Token &MacroNameTok, + const MacroDirective *MD) override; /// MacroUndefined - This hook is called whenever a macro #undef is seen. - void MacroUndefined(const Token &MacroNameTok, const MacroDirective *MD); + void MacroUndefined(const Token &MacroNameTok, + const MacroDirective *MD) override; }; } // end anonymous namespace @@ -577,8 +573,8 @@ struct UnknownPragmaHandler : public PragmaHandler { UnknownPragmaHandler(const char *prefix, PrintPPOutputPPCallbacks *callbacks) : Prefix(prefix), Callbacks(callbacks) {} - virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &PragmaTok) { + void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + Token &PragmaTok) override { // Figure out what line we went to and insert the appropriate number of // newline characters. Callbacks->startNewLineIfNeeded(); diff --git a/lib/Frontend/SerializedDiagnosticPrinter.cpp b/lib/Frontend/SerializedDiagnosticPrinter.cpp index 767843576839994389289ee06a7b396c0663effb..527f727b37d3d52f3b3ec2c62ae22f8f8a7ef24b 100644 --- a/lib/Frontend/SerializedDiagnosticPrinter.cpp +++ b/lib/Frontend/SerializedDiagnosticPrinter.cpp @@ -59,32 +59,32 @@ public: virtual ~SDiagsRenderer() {} protected: - virtual void emitDiagnosticMessage(SourceLocation Loc, - PresumedLoc PLoc, - DiagnosticsEngine::Level Level, - StringRef Message, - ArrayRef<CharSourceRange> Ranges, - const SourceManager *SM, - DiagOrStoredDiag D); - - virtual void emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc, - DiagnosticsEngine::Level Level, - ArrayRef<CharSourceRange> Ranges, - const SourceManager &SM) {} - - virtual void emitNote(SourceLocation Loc, StringRef Message, - const SourceManager *SM); - - virtual void emitCodeContext(SourceLocation Loc, - DiagnosticsEngine::Level Level, - SmallVectorImpl<CharSourceRange>& Ranges, - ArrayRef<FixItHint> Hints, - const SourceManager &SM); - - virtual void beginDiagnostic(DiagOrStoredDiag D, - DiagnosticsEngine::Level Level); - virtual void endDiagnostic(DiagOrStoredDiag D, - DiagnosticsEngine::Level Level); + void emitDiagnosticMessage(SourceLocation Loc, + PresumedLoc PLoc, + DiagnosticsEngine::Level Level, + StringRef Message, + ArrayRef<CharSourceRange> Ranges, + const SourceManager *SM, + DiagOrStoredDiag D) override; + + void emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc, + DiagnosticsEngine::Level Level, + ArrayRef<CharSourceRange> Ranges, + const SourceManager &SM) override {} + + void emitNote(SourceLocation Loc, StringRef Message, + const SourceManager *SM) override; + + void emitCodeContext(SourceLocation Loc, + DiagnosticsEngine::Level Level, + SmallVectorImpl<CharSourceRange>& Ranges, + ArrayRef<FixItHint> Hints, + const SourceManager &SM) override; + + void beginDiagnostic(DiagOrStoredDiag D, + DiagnosticsEngine::Level Level) override; + void endDiagnostic(DiagOrStoredDiag D, + DiagnosticsEngine::Level Level) override; }; class SDiagsWriter : public DiagnosticConsumer { @@ -103,16 +103,15 @@ public: } ~SDiagsWriter() {} - + void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, - const Diagnostic &Info); - - void BeginSourceFile(const LangOptions &LO, - const Preprocessor *PP) { + const Diagnostic &Info) override; + + void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP) override { LangOpts = &LO; } - virtual void finish(); + void finish() override; private: /// \brief Emit the preamble for the serialized diagnostics. diff --git a/lib/Frontend/VerifyDiagnosticConsumer.cpp b/lib/Frontend/VerifyDiagnosticConsumer.cpp index 40992fec3f6aafbd5c40573b0ababb705575768a..0221a5550c039b387620c96ecca75d8edbb36269 100644 --- a/lib/Frontend/VerifyDiagnosticConsumer.cpp +++ b/lib/Frontend/VerifyDiagnosticConsumer.cpp @@ -166,12 +166,12 @@ public: StringRef Text, unsigned Min, unsigned Max) : Directive(DirectiveLoc, DiagnosticLoc, Text, Min, Max) { } - virtual bool isValid(std::string &Error) { + bool isValid(std::string &Error) override { // all strings are considered valid; even empty ones return true; } - virtual bool match(StringRef S) { + bool match(StringRef S) override { return S.find(Text) != StringRef::npos; } }; @@ -184,13 +184,13 @@ public: StringRef Text, unsigned Min, unsigned Max, StringRef RegexStr) : Directive(DirectiveLoc, DiagnosticLoc, Text, Min, Max), Regex(RegexStr) { } - virtual bool isValid(std::string &Error) { + bool isValid(std::string &Error) override { if (Regex.isValid(Error)) return true; return false; } - virtual bool match(StringRef S) { + bool match(StringRef S) override { return Regex.match(S); }