[C++11] Add 'override' keyword to virtual methods that override their base class.

llvm-svn: 203746
This commit is contained in:
Craig Topper 2014-03-13 02:13:41 +00:00
parent ac58e9fc0b
commit 3e89dfee00
4 changed files with 122 additions and 126 deletions

View File

@ -196,27 +196,25 @@ public:
ChainedASTReaderListener(ASTReaderListener *First, ASTReaderListener *Second)
: First(First), Second(Second) { }
virtual bool ReadFullVersionInformation(StringRef FullVersion);
virtual bool ReadLanguageOptions(const LangOptions &LangOpts,
bool Complain);
virtual bool ReadTargetOptions(const TargetOptions &TargetOpts,
bool Complain);
virtual bool ReadDiagnosticOptions(const DiagnosticOptions &DiagOpts,
bool Complain);
virtual bool ReadFileSystemOptions(const FileSystemOptions &FSOpts,
bool Complain);
bool ReadFullVersionInformation(StringRef FullVersion) override;
bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain) override;
bool ReadTargetOptions(const TargetOptions &TargetOpts,
bool Complain) override;
bool ReadDiagnosticOptions(const DiagnosticOptions &DiagOpts,
bool Complain) override;
bool ReadFileSystemOptions(const FileSystemOptions &FSOpts,
bool Complain) override;
virtual bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
bool Complain);
virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
bool Complain,
std::string &SuggestedPredefines);
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
bool Complain) override;
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
bool Complain,
std::string &SuggestedPredefines) override;
virtual void ReadCounter(const serialization::ModuleFile &M,
unsigned Value);
virtual bool needsInputFileVisitation();
virtual bool needsSystemInputFileVisitation();
virtual bool visitInputFile(StringRef Filename, bool isSystem);
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override;
bool needsInputFileVisitation() override;
bool needsSystemInputFileVisitation() override;
bool visitInputFile(StringRef Filename, bool isSystem) override;
};
/// \brief ASTReaderListener implementation to validate the information of
@ -229,14 +227,13 @@ public:
PCHValidator(Preprocessor &PP, ASTReader &Reader)
: PP(PP), Reader(Reader) {}
virtual bool ReadLanguageOptions(const LangOptions &LangOpts,
bool Complain);
virtual bool ReadTargetOptions(const TargetOptions &TargetOpts,
bool Complain);
virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
bool Complain,
std::string &SuggestedPredefines);
virtual void ReadCounter(const serialization::ModuleFile &M, unsigned Value);
bool ReadLanguageOptions(const LangOptions &LangOpts,
bool Complain) override;
bool ReadTargetOptions(const TargetOptions &TargetOpts,
bool Complain) override;
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain,
std::string &SuggestedPredefines) override;
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override;
private:
void Error(const char *Msg);
@ -1405,20 +1402,20 @@ public:
///
/// \returns null if an error occurred that prevented the preprocessed
/// entity from being loaded.
virtual PreprocessedEntity *ReadPreprocessedEntity(unsigned Index);
PreprocessedEntity *ReadPreprocessedEntity(unsigned Index) override;
/// \brief Returns a pair of [Begin, End) indices of preallocated
/// preprocessed entities that \p Range encompasses.
virtual std::pair<unsigned, unsigned>
findPreprocessedEntitiesInRange(SourceRange Range);
std::pair<unsigned, unsigned>
findPreprocessedEntitiesInRange(SourceRange Range) override;
/// \brief Optionally returns true or false if the preallocated preprocessed
/// entity with index \p Index came from file \p FID.
virtual Optional<bool> isPreprocessedEntityInFileID(unsigned Index,
FileID FID);
Optional<bool> isPreprocessedEntityInFileID(unsigned Index,
FileID FID) override;
/// \brief Read the header file information for the given file entry.
virtual HeaderFileInfo GetHeaderFileInfo(const FileEntry *FE);
HeaderFileInfo GetHeaderFileInfo(const FileEntry *FE) override;
void ReadPragmaDiagnosticMappings(DiagnosticsEngine &Diag);
@ -1530,7 +1527,7 @@ public:
/// \brief Resolve a declaration ID into a declaration, potentially
/// building a new declaration.
Decl *GetDecl(serialization::DeclID ID);
virtual Decl *GetExternalDecl(uint32_t ID);
Decl *GetExternalDecl(uint32_t ID) override;
/// \brief Reads a declaration with the given local ID in the given module.
Decl *GetLocalDecl(ModuleFile &F, uint32_t LocalID) {
@ -1582,14 +1579,14 @@ public:
uint64_t readCXXBaseSpecifiers(ModuleFile &M, const RecordData &Record,
unsigned &Idx);
virtual CXXBaseSpecifier *GetExternalCXXBaseSpecifiers(uint64_t Offset);
CXXBaseSpecifier *GetExternalCXXBaseSpecifiers(uint64_t Offset) override;
/// \brief Resolve the offset of a statement into a statement.
///
/// This operation will read a new statement from the external
/// source each time it is called, and is meant to be used via a
/// LazyOffsetPtr (which is used by Decls for the body of functions, etc).
virtual Stmt *GetExternalDeclStmt(uint64_t Offset);
Stmt *GetExternalDeclStmt(uint64_t Offset) override;
/// ReadBlockAbbrevs - Enter a subblock of the specified BlockID with the
/// specified cursor. Read the abbreviations that are at the top of the block
@ -1599,9 +1596,8 @@ public:
/// \brief Finds all the visible declarations with a given name.
/// The current implementation of this method just loads the entire
/// lookup table as unmaterialized references.
virtual bool
FindExternalVisibleDeclsByName(const DeclContext *DC,
DeclarationName Name);
bool FindExternalVisibleDeclsByName(const DeclContext *DC,
DeclarationName Name) override;
/// \brief Read all of the declarations lexically stored in a
/// declaration context.
@ -1616,49 +1612,49 @@ public:
///
/// \returns true if there was an error while reading the
/// declarations for this declaration context.
virtual ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC,
bool (*isKindWeWant)(Decl::Kind),
SmallVectorImpl<Decl*> &Decls);
ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC,
bool (*isKindWeWant)(Decl::Kind),
SmallVectorImpl<Decl*> &Decls) override;
/// \brief Get the decls that are contained in a file in the Offset/Length
/// range. \p Length can be 0 to indicate a point at \p Offset instead of
/// a range.
virtual void FindFileRegionDecls(FileID File, unsigned Offset,unsigned Length,
SmallVectorImpl<Decl *> &Decls);
void FindFileRegionDecls(FileID File, unsigned Offset, unsigned Length,
SmallVectorImpl<Decl *> &Decls) override;
/// \brief Notify ASTReader that we started deserialization of
/// a decl or type so until FinishedDeserializing is called there may be
/// decls that are initializing. Must be paired with FinishedDeserializing.
virtual void StartedDeserializing() { ++NumCurrentElementsDeserializing; }
void StartedDeserializing() override { ++NumCurrentElementsDeserializing; }
/// \brief Notify ASTReader that we finished the deserialization of
/// a decl or type. Must be paired with StartedDeserializing.
virtual void FinishedDeserializing();
void FinishedDeserializing() override;
/// \brief Function that will be invoked when we begin parsing a new
/// translation unit involving this external AST source.
///
/// This function will provide all of the external definitions to
/// the ASTConsumer.
virtual void StartTranslationUnit(ASTConsumer *Consumer);
void StartTranslationUnit(ASTConsumer *Consumer) override;
/// \brief Print some statistics about AST usage.
virtual void PrintStats();
void PrintStats() override;
/// \brief Dump information about the AST reader to standard error.
void dump();
/// 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;
/// \brief Initialize the semantic source with the Sema instance
/// being used to perform semantic analysis on the abstract syntax
/// tree.
virtual void InitializeSema(Sema &S);
void InitializeSema(Sema &S) override;
/// \brief Inform the semantic consumer that Sema is no longer available.
virtual void ForgetSema() { SemaObj = 0; }
void ForgetSema() override { SemaObj = 0; }
/// \brief Retrieve the IdentifierInfo for the named identifier.
///
@ -1667,56 +1663,57 @@ public:
/// declarations will be deserialized and introduced into the declaration
/// chain of the identifier.
virtual IdentifierInfo *get(const char *NameStart, const char *NameEnd);
IdentifierInfo *get(StringRef Name) {
IdentifierInfo *get(StringRef Name) override {
return get(Name.begin(), Name.end());
}
/// \brief Retrieve an iterator into the set of all identifiers
/// in all loaded AST files.
virtual IdentifierIterator *getIdentifiers();
IdentifierIterator *getIdentifiers() override;
/// \brief Load the contents of the global method pool for a given
/// selector.
virtual void ReadMethodPool(Selector Sel);
void ReadMethodPool(Selector Sel) override;
/// \brief Load the set of namespaces that are known to the external source,
/// which will be used during typo correction.
virtual void ReadKnownNamespaces(
SmallVectorImpl<NamespaceDecl *> &Namespaces);
void ReadKnownNamespaces(
SmallVectorImpl<NamespaceDecl *> &Namespaces) override;
virtual void ReadUndefinedButUsed(
llvm::DenseMap<NamedDecl *, SourceLocation> &Undefined);
void ReadUndefinedButUsed(
llvm::DenseMap<NamedDecl *, SourceLocation> &Undefined) override;
virtual void ReadTentativeDefinitions(
SmallVectorImpl<VarDecl *> &TentativeDefs);
void ReadTentativeDefinitions(
SmallVectorImpl<VarDecl *> &TentativeDefs) override;
virtual void ReadUnusedFileScopedDecls(
SmallVectorImpl<const DeclaratorDecl *> &Decls);
void ReadUnusedFileScopedDecls(
SmallVectorImpl<const DeclaratorDecl *> &Decls) override;
virtual void ReadDelegatingConstructors(
SmallVectorImpl<CXXConstructorDecl *> &Decls);
void ReadDelegatingConstructors(
SmallVectorImpl<CXXConstructorDecl *> &Decls) override;
virtual void ReadExtVectorDecls(SmallVectorImpl<TypedefNameDecl *> &Decls);
void ReadExtVectorDecls(SmallVectorImpl<TypedefNameDecl *> &Decls) override;
virtual void ReadDynamicClasses(SmallVectorImpl<CXXRecordDecl *> &Decls);
void ReadDynamicClasses(SmallVectorImpl<CXXRecordDecl *> &Decls) override;
virtual void ReadLocallyScopedExternCDecls(
SmallVectorImpl<NamedDecl *> &Decls);
void ReadLocallyScopedExternCDecls(
SmallVectorImpl<NamedDecl *> &Decls) override;
virtual void ReadReferencedSelectors(
SmallVectorImpl<std::pair<Selector, SourceLocation> > &Sels);
void ReadReferencedSelectors(
SmallVectorImpl<std::pair<Selector, SourceLocation> > &Sels) override;
virtual void ReadWeakUndeclaredIdentifiers(
SmallVectorImpl<std::pair<IdentifierInfo *, WeakInfo> > &WI);
void ReadWeakUndeclaredIdentifiers(
SmallVectorImpl<std::pair<IdentifierInfo *, WeakInfo> > &WI) override;
virtual void ReadUsedVTables(SmallVectorImpl<ExternalVTableUse> &VTables);
void ReadUsedVTables(SmallVectorImpl<ExternalVTableUse> &VTables) override;
virtual void ReadPendingInstantiations(
void ReadPendingInstantiations(
SmallVectorImpl<std::pair<ValueDecl *,
SourceLocation> > &Pending);
SourceLocation> > &Pending) override;
virtual void ReadLateParsedTemplates(
llvm::DenseMap<const FunctionDecl *, LateParsedTemplate *> &LPTMap);
void ReadLateParsedTemplates(
llvm::DenseMap<const FunctionDecl *,
LateParsedTemplate *> &LPTMap) override;
/// \brief Load a selector from disk, registering its ID if it exists.
void LoadSelector(Selector Sel);
@ -1739,7 +1736,7 @@ public:
return DecodeIdentifierInfo(getGlobalIdentifierID(M, Record[Idx++]));
}
virtual IdentifierInfo *GetIdentifier(serialization::IdentifierID ID) {
IdentifierInfo *GetIdentifier(serialization::IdentifierID ID) override {
// Note that we are loading an identifier.
Deserializing AnIdentifier(this);
@ -1780,11 +1777,11 @@ public:
serialization::MacroID getGlobalMacroID(ModuleFile &M, unsigned LocalID);
/// \brief Read the source location entry with index ID.
virtual bool ReadSLocEntry(int ID);
bool ReadSLocEntry(int ID) override;
/// \brief Retrieve the module import location and module name for the
/// given source manager entry ID.
virtual std::pair<SourceLocation, StringRef> getModuleImportLoc(int ID);
std::pair<SourceLocation, StringRef> getModuleImportLoc(int ID) override;
/// \brief Retrieve the global submodule ID given a module and its local ID
/// number.
@ -1798,7 +1795,7 @@ public:
/// \brief Retrieve the module that corresponds to the given module ID.
///
/// Note: overrides method in ExternalASTSource
virtual Module *getModule(unsigned ID);
Module *getModule(unsigned ID) override;
/// \brief Retrieve a selector from the given module with its local ID
/// number.
@ -1806,8 +1803,8 @@ public:
Selector DecodeSelector(serialization::SelectorID Idx);
virtual Selector GetExternalSelector(serialization::SelectorID ID);
uint32_t GetNumExternalSelectors();
Selector GetExternalSelector(serialization::SelectorID ID) override;
uint32_t GetNumExternalSelectors() override;
Selector ReadSelector(ModuleFile &M, const RecordData &Record, unsigned &Idx) {
return getLocalSelector(M, Record[Idx++]);
@ -1963,16 +1960,16 @@ public:
ModuleFile *M, uint64_t MacroDirectivesOffset);
/// \brief Read the set of macros defined by this external macro source.
virtual void ReadDefinedMacros();
void ReadDefinedMacros() override;
/// \brief Update an out-of-date identifier.
virtual void updateOutOfDateIdentifier(IdentifierInfo &II);
void updateOutOfDateIdentifier(IdentifierInfo &II) override;
/// \brief Note that this identifier is up-to-date.
void markIdentifierUpToDate(IdentifierInfo *II);
/// \brief Load all external visible decls in the given DeclContext.
void completeVisibleDeclsMap(const DeclContext *DC);
void completeVisibleDeclsMap(const DeclContext *DC) override;
/// \brief Retrieve the AST context that this AST reader supplements.
ASTContext &getContext() { return Context; }
@ -2003,8 +2000,8 @@ public:
SmallVector<std::pair<llvm::BitstreamCursor,
serialization::ModuleFile *>, 8> CommentsCursors;
/// \brief Loads comments ranges.
void ReadComments();
//RIDErief Loads comments ranges.
void ReadComments() override;
};
/// \brief Helper class that saves the current stream position and

View File

@ -714,34 +714,33 @@ public:
bool hasChain() const { return Chain; }
// ASTDeserializationListener implementation
void ReaderInitialized(ASTReader *Reader);
void IdentifierRead(serialization::IdentID ID, IdentifierInfo *II);
void MacroRead(serialization::MacroID ID, MacroInfo *MI);
void TypeRead(serialization::TypeIdx Idx, QualType T);
void SelectorRead(serialization::SelectorID ID, Selector Sel);
void ReaderInitialized(ASTReader *Reader) override;
void IdentifierRead(serialization::IdentID ID, IdentifierInfo *II) override;
void MacroRead(serialization::MacroID ID, MacroInfo *MI) override;
void TypeRead(serialization::TypeIdx Idx, QualType T) override;
void SelectorRead(serialization::SelectorID ID, Selector Sel) override;
void MacroDefinitionRead(serialization::PreprocessedEntityID ID,
MacroDefinition *MD);
void ModuleRead(serialization::SubmoduleID ID, Module *Mod);
MacroDefinition *MD) override;
void ModuleRead(serialization::SubmoduleID ID, Module *Mod) override;
// ASTMutationListener implementation.
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;
};
@ -770,10 +769,10 @@ public:
StringRef isysroot, raw_ostream *Out,
bool AllowASTWithErrors = false);
~PCHGenerator();
virtual void InitializeSema(Sema &S) { SemaPtr = &S; }
virtual void HandleTranslationUnit(ASTContext &Ctx);
virtual ASTMutationListener *GetASTMutationListener();
virtual ASTDeserializationListener *GetASTDeserializationListener();
void InitializeSema(Sema &S) override { SemaPtr = &S; }
void HandleTranslationUnit(ASTContext &Ctx) override;
ASTMutationListener *GetASTMutationListener() override;
ASTDeserializationListener *GetASTDeserializationListener() override;
bool hasEmittedPCH() const { return HasEmittedPCH; }
};

View File

@ -3782,17 +3782,17 @@ namespace {
{
}
virtual bool ReadLanguageOptions(const LangOptions &LangOpts,
bool Complain) {
bool ReadLanguageOptions(const LangOptions &LangOpts,
bool Complain) override {
return checkLanguageOptions(ExistingLangOpts, LangOpts, 0);
}
virtual bool ReadTargetOptions(const TargetOptions &TargetOpts,
bool Complain) {
bool ReadTargetOptions(const TargetOptions &TargetOpts,
bool Complain) override {
return checkTargetOptions(ExistingTargetOpts, TargetOpts, 0);
}
virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
bool Complain,
std::string &SuggestedPredefines) {
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
bool Complain,
std::string &SuggestedPredefines) override {
return checkPreprocessorOptions(ExistingPPOpts, PPOpts, 0, FileMgr,
SuggestedPredefines, ExistingLangOpts);
}
@ -6566,7 +6566,7 @@ namespace clang {
public:
explicit ASTIdentifierIterator(const ASTReader &Reader);
virtual StringRef Next();
StringRef Next() override;
};
}

View File

@ -835,7 +835,7 @@ namespace {
End = Idx.key_end();
}
virtual StringRef Next() {
StringRef Next() override {
if (Current == End)
return StringRef();