diff options
Diffstat (limited to 'clang')
25 files changed, 241 insertions, 230 deletions
diff --git a/clang/include/clang/Analysis/AnalysisContext.h b/clang/include/clang/Analysis/AnalysisContext.h index b7103c3886c..73b38b78c07 100644 --- a/clang/include/clang/Analysis/AnalysisContext.h +++ b/clang/include/clang/Analysis/AnalysisContext.h @@ -287,11 +287,11 @@ public: const CFGBlock *getCallSiteBlock() const { return Block; } /// Return true if the current LocationContext has no caller context. - virtual bool inTopFrame() const { return getParent() == 0; } + bool inTopFrame() const override { return getParent() == 0; } unsigned getIndex() const { return Index; } - void Profile(llvm::FoldingSetNodeID &ID); + void Profile(llvm::FoldingSetNodeID &ID) override; static void Profile(llvm::FoldingSetNodeID &ID, AnalysisDeclContext *ctx, const LocationContext *parent, const Stmt *s, @@ -317,7 +317,7 @@ class ScopeContext : public LocationContext { public: ~ScopeContext() {} - void Profile(llvm::FoldingSetNodeID &ID); + void Profile(llvm::FoldingSetNodeID &ID) override; static void Profile(llvm::FoldingSetNodeID &ID, AnalysisDeclContext *ctx, const LocationContext *parent, const Stmt *s) { @@ -349,7 +349,7 @@ public: const void *getContextData() const { return ContextData; } - void Profile(llvm::FoldingSetNodeID &ID); + void Profile(llvm::FoldingSetNodeID &ID) override; static void Profile(llvm::FoldingSetNodeID &ID, AnalysisDeclContext *ctx, const LocationContext *parent, const BlockDecl *bd, diff --git a/clang/include/clang/Sema/CodeCompleteConsumer.h b/clang/include/clang/Sema/CodeCompleteConsumer.h index 64de82c6b05..11bdb761c62 100644 --- a/clang/include/clang/Sema/CodeCompleteConsumer.h +++ b/clang/include/clang/Sema/CodeCompleteConsumer.h @@ -966,20 +966,19 @@ public: CCTUInfo(new GlobalCodeCompletionAllocator) {} /// \brief Prints the finalized code-completion results. - virtual void ProcessCodeCompleteResults(Sema &S, - CodeCompletionContext Context, - CodeCompletionResult *Results, - unsigned NumResults); + void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context, + CodeCompletionResult *Results, + unsigned NumResults) override; - virtual void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, - OverloadCandidate *Candidates, - unsigned NumCandidates); + void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, + OverloadCandidate *Candidates, + unsigned NumCandidates) override; - virtual CodeCompletionAllocator &getAllocator() { + CodeCompletionAllocator &getAllocator() override { return CCTUInfo.getAllocator(); } - virtual CodeCompletionTUInfo &getCodeCompletionTUInfo() { return CCTUInfo; } + CodeCompletionTUInfo &getCodeCompletionTUInfo() override { return CCTUInfo; } }; } // end namespace clang diff --git a/clang/include/clang/Sema/MultiplexExternalSemaSource.h b/clang/include/clang/Sema/MultiplexExternalSemaSource.h index e9ba479d125..1f517e7919b 100644 --- a/clang/include/clang/Sema/MultiplexExternalSemaSource.h +++ b/clang/include/clang/Sema/MultiplexExternalSemaSource.h @@ -65,31 +65,31 @@ public: /// \brief Resolve a declaration ID into a declaration, potentially /// building a new declaration. - virtual Decl *GetExternalDecl(uint32_t ID); + Decl *GetExternalDecl(uint32_t ID) override; /// \brief Resolve a selector ID into a selector. - virtual Selector GetExternalSelector(uint32_t ID); + Selector GetExternalSelector(uint32_t ID) override; /// \brief Returns the number of selectors known to the external AST /// source. - virtual uint32_t GetNumExternalSelectors(); + uint32_t GetNumExternalSelectors() override; /// \brief Resolve the offset of a statement in the decl stream into /// a statement. - virtual Stmt *GetExternalDeclStmt(uint64_t Offset); + Stmt *GetExternalDeclStmt(uint64_t Offset) override; /// \brief Resolve the offset of a set of C++ base specifiers in the decl /// stream into an array of specifiers. - virtual CXXBaseSpecifier *GetExternalCXXBaseSpecifiers(uint64_t Offset); + CXXBaseSpecifier *GetExternalCXXBaseSpecifiers(uint64_t Offset) override; /// \brief Find all declarations with the given name in the /// given context. - virtual bool - FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name); + bool + FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) override; /// \brief Ensures that the table of all visible declarations inside this /// context is up to date. - virtual void completeVisibleDeclsMap(const DeclContext *DC); + void completeVisibleDeclsMap(const DeclContext *DC) override; /// \brief Finds all declarations lexically contained within the given /// DeclContext, after applying an optional filter predicate. @@ -99,9 +99,9 @@ public: /// are returned. /// /// \return an indication of whether the load succeeded or failed. - virtual ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC, - bool (*isKindWeWant)(Decl::Kind), - SmallVectorImpl<Decl*> &Result); + ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC, + bool (*isKindWeWant)(Decl::Kind), + SmallVectorImpl<Decl*> &Result) override; /// \brief Finds all declarations lexically contained within the given /// DeclContext. @@ -121,12 +121,12 @@ public: /// \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 Gives the external AST source an opportunity to complete /// an incomplete type. - virtual void CompleteType(TagDecl *Tag); + void CompleteType(TagDecl *Tag) override; /// \brief Gives the external AST source an opportunity to complete an /// incomplete Objective-C class. @@ -134,27 +134,27 @@ public: /// This routine will only be invoked if the "externally completed" bit is /// set on the ObjCInterfaceDecl via the function /// \c ObjCInterfaceDecl::setExternallyCompleted(). - virtual void CompleteType(ObjCInterfaceDecl *Class); + void CompleteType(ObjCInterfaceDecl *Class) override; /// \brief Loads comment ranges. - virtual void ReadComments(); + void ReadComments() override; /// \brief Notify ExternalASTSource 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(); + void StartedDeserializing() override; /// \brief Notify ExternalASTSource 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. - virtual void StartTranslationUnit(ASTConsumer *Consumer); + void StartTranslationUnit(ASTConsumer *Consumer) override; /// \brief Print any statistics that have been gathered regarding /// the external AST source. - virtual void PrintStats(); + void PrintStats() override; /// \brief Perform layout on the given record. @@ -184,16 +184,17 @@ public: /// be laid out according to the ABI. /// /// \returns true if the record layout was provided, false otherwise. - 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; /// 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. @@ -202,24 +203,25 @@ public: /// \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(); + void ForgetSema() 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; /// \brief Load the set of used but not defined functions or variables with /// internal linkage, or used but not defined inline functions. - virtual void ReadUndefinedButUsed( - llvm::DenseMap<NamedDecl*, SourceLocation> &Undefined); - + void ReadUndefinedButUsed( + llvm::DenseMap<NamedDecl*, SourceLocation> &Undefined) override; + /// \brief Do last resort, unqualified lookup on a LookupResult that /// Sema cannot find. /// @@ -228,7 +230,7 @@ public: /// \param S the Scope of the identifier occurrence. /// /// \return true to tell Sema to recover using the LookupResult. - virtual bool LookupUnqualified(LookupResult &R, Scope *S); + bool LookupUnqualified(LookupResult &R, Scope *S) override; /// \brief Read the set of tentative definitions known to the external Sema /// source. @@ -237,8 +239,8 @@ public: /// given vector of tentative definitions. Note that this routine may be /// invoked multiple times; the external source should take care not to /// introduce the same declarations repeatedly. - virtual void ReadTentativeDefinitions(SmallVectorImpl<VarDecl*> &Defs); - + void ReadTentativeDefinitions(SmallVectorImpl<VarDecl*> &Defs) override; + /// \brief Read the set of unused file-scope declarations known to the /// external Sema source. /// @@ -246,9 +248,9 @@ public: /// given vector of declarations. Note that this routine may be /// invoked multiple times; the external source should take care not to /// introduce the same declarations repeatedly. - virtual void ReadUnusedFileScopedDecls( - SmallVectorImpl<const DeclaratorDecl*> &Decls); - + void ReadUnusedFileScopedDecls( + SmallVectorImpl<const DeclaratorDecl*> &Decls) override; + /// \brief Read the set of delegating constructors known to the /// external Sema source. /// @@ -256,8 +258,8 @@ public: /// given vector of declarations. Note that this routine may be /// invoked multiple times; the external source should take care not to /// introduce the same declarations repeatedly. - virtual void ReadDelegatingConstructors( - SmallVectorImpl<CXXConstructorDecl*> &Decls); + void ReadDelegatingConstructors( + SmallVectorImpl<CXXConstructorDecl*> &Decls) override; /// \brief Read the set of ext_vector type declarations known to the /// external Sema source. @@ -266,7 +268,7 @@ public: /// the given vector of declarations. Note that this routine may be /// invoked multiple times; the external source should take care not to /// introduce the same declarations repeatedly. - virtual void ReadExtVectorDecls(SmallVectorImpl<TypedefNameDecl*> &Decls); + void ReadExtVectorDecls(SmallVectorImpl<TypedefNameDecl*> &Decls) override; /// \brief Read the set of dynamic classes known to the external Sema source. /// @@ -274,7 +276,7 @@ public: /// the given vector of declarations. Note that this routine may be /// invoked multiple times; the external source should take care not to /// introduce the same declarations repeatedly. - virtual void ReadDynamicClasses(SmallVectorImpl<CXXRecordDecl*> &Decls); + void ReadDynamicClasses(SmallVectorImpl<CXXRecordDecl*> &Decls) override; /// \brief Read the set of locally-scoped extern "C" declarations known to the /// external Sema source. @@ -283,7 +285,8 @@ public: /// declarations to the given vector of declarations. Note that this routine /// may be invoked multiple times; the external source should take care not /// to introduce the same declarations repeatedly. - virtual void ReadLocallyScopedExternCDecls(SmallVectorImpl<NamedDecl*>&Decls); + void ReadLocallyScopedExternCDecls( + SmallVectorImpl<NamedDecl*> &Decls) override; /// \brief Read the set of referenced selectors known to the /// external Sema source. @@ -292,8 +295,8 @@ public: /// given vector of selectors. Note that this routine /// may be invoked multiple times; the external source should take care not /// to introduce the same selectors repeatedly. - virtual void ReadReferencedSelectors(SmallVectorImpl<std::pair<Selector, - SourceLocation> > &Sels); + void ReadReferencedSelectors(SmallVectorImpl<std::pair<Selector, + SourceLocation> > &Sels) override; /// \brief Read the set of weak, undeclared identifiers known to the /// external Sema source. @@ -302,15 +305,15 @@ public: /// the given vector. Note that this routine may be invoked multiple times; /// the external source should take care not to introduce the same identifiers /// repeatedly. - virtual void ReadWeakUndeclaredIdentifiers( - SmallVectorImpl<std::pair<IdentifierInfo*, WeakInfo> > &WI); + void ReadWeakUndeclaredIdentifiers( + SmallVectorImpl<std::pair<IdentifierInfo*, WeakInfo> > &WI) override; /// \brief Read the set of used vtables known to the external Sema source. /// /// The external source should append its own used vtables to the given /// vector. Note that this routine may be invoked multiple times; the external /// source should take care not to introduce the same vtables repeatedly. - virtual void ReadUsedVTables(SmallVectorImpl<ExternalVTableUse> &VTables); + void ReadUsedVTables(SmallVectorImpl<ExternalVTableUse> &VTables) override; /// \brief Read the set of pending instantiations known to the external /// Sema source. @@ -319,8 +322,8 @@ public: /// given vector. Note that this routine may be invoked multiple times; the /// external source should take care not to introduce the same instantiations /// repeatedly. - virtual void ReadPendingInstantiations( - SmallVectorImpl<std::pair<ValueDecl*, SourceLocation> >& Pending); + void ReadPendingInstantiations( + SmallVectorImpl<std::pair<ValueDecl*, SourceLocation> >& Pending) override; /// \brief Read the set of late parsed template functions for this source. /// @@ -328,17 +331,18 @@ public: /// into the map. Note that this routine may be invoked multiple times; the /// external source should take care not to introduce the same map entries /// repeatedly. - virtual void ReadLateParsedTemplates( - llvm::DenseMap<const FunctionDecl *, LateParsedTemplate *> &LPTMap); + void ReadLateParsedTemplates( + llvm::DenseMap<const FunctionDecl *, + LateParsedTemplate *> &LPTMap) override; /// \copydoc ExternalSemaSource::CorrectTypo /// \note Returns the first nonempty correction. - 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; /// \brief Produces a diagnostic note if one of the attached sources /// contains a complete definition for \p T. Queries the sources in list @@ -350,7 +354,8 @@ public: /// \param T the \c QualType that should have been complete at \p Loc /// /// \return true if a diagnostic was produced, false otherwise. - virtual bool MaybeDiagnoseMissingCompleteType(SourceLocation Loc, QualType T); + bool MaybeDiagnoseMissingCompleteType(SourceLocation Loc, + QualType T) override; // isa/cast/dyn_cast support static bool classof(const MultiplexExternalSemaSource*) { return true; } diff --git a/clang/include/clang/Sema/PrettyDeclStackTrace.h b/clang/include/clang/Sema/PrettyDeclStackTrace.h index aa557052633..c0c772dc598 100644 --- a/clang/include/clang/Sema/PrettyDeclStackTrace.h +++ b/clang/include/clang/Sema/PrettyDeclStackTrace.h @@ -39,7 +39,7 @@ public: const char *Msg) : S(S), TheDecl(D), Loc(Loc), Message(Msg) {} - virtual void print(raw_ostream &OS) const; + void print(raw_ostream &OS) const override; }; } diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index c766018adb1..b030002270d 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -1178,7 +1178,7 @@ public: public: BoundTypeDiagnoser1(unsigned DiagID, const T1 &Arg1) : TypeDiagnoser(DiagID == 0), DiagID(DiagID), Arg1(Arg1) { } - virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) { + void diagnose(Sema &S, SourceLocation Loc, QualType T) override { if (Suppressed) return; S.Diag(Loc, DiagID) << getPrintable(Arg1) << T; } @@ -1198,7 +1198,7 @@ public: : TypeDiagnoser(DiagID == 0), DiagID(DiagID), Arg1(Arg1), Arg2(Arg2) { } - virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) { + void diagnose(Sema &S, SourceLocation Loc, QualType T) override { if (Suppressed) return; S.Diag(Loc, DiagID) << getPrintable(Arg1) << getPrintable(Arg2) << T; } @@ -1219,7 +1219,7 @@ public: : TypeDiagnoser(DiagID == 0), DiagID(DiagID), Arg1(Arg1), Arg2(Arg2), Arg3(Arg3) { } - virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) { + void diagnose(Sema &S, SourceLocation Loc, QualType T) override { if (Suppressed) return; S.Diag(Loc, DiagID) << getPrintable(Arg1) << getPrintable(Arg2) << getPrintable(Arg3) << T; @@ -2096,10 +2096,10 @@ public: AllowScopedEnumerations(AllowScopedEnumerations) {} /// Match an integral or (possibly scoped) enumeration type. - bool match(QualType T); + bool match(QualType T) override; SemaDiagnosticBuilder - diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T) { + diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T) override { return diagnoseNotInt(S, Loc, T); } diff --git a/clang/include/clang/Sema/TypoCorrection.h b/clang/include/clang/Sema/TypoCorrection.h index c28720b2b12..16d732831ad 100644 --- a/clang/include/clang/Sema/TypoCorrection.h +++ b/clang/include/clang/Sema/TypoCorrection.h @@ -294,7 +294,7 @@ public: template <class C> class DeclFilterCCC : public CorrectionCandidateCallback { public: - virtual bool ValidateCandidate(const TypoCorrection &candidate) { + bool ValidateCandidate(const TypoCorrection &candidate) override { return candidate.getCorrectionDeclAs<C>(); } }; @@ -308,7 +308,7 @@ public: bool HasExplicitTemplateArgs, bool AllowNonStaticMethods = true); - virtual bool ValidateCandidate(const TypoCorrection &candidate); + bool ValidateCandidate(const TypoCorrection &candidate) override; private: unsigned NumArgs; @@ -327,7 +327,7 @@ public: WantRemainingKeywords = false; } - virtual bool ValidateCandidate(const TypoCorrection &candidate) { + bool ValidateCandidate(const TypoCorrection &candidate) override { return false; } }; diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp index 46243f402d0..dabac1e6c4c 100644 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -65,7 +65,8 @@ namespace { public: UnreachableCodeHandler(Sema &s) : S(s) {} - void HandleUnreachable(SourceLocation L, SourceRange R1, SourceRange R2) { + void HandleUnreachable(SourceLocation L, SourceRange R1, + SourceRange R2) override { S.Diag(L, diag::warn_unreachable) << R1 << R2; } }; @@ -1296,12 +1297,13 @@ public: return V; } - - void handleUseOfUninitVariable(const VarDecl *vd, const UninitUse &use) { + + void handleUseOfUninitVariable(const VarDecl *vd, + const UninitUse &use) override { getUses(vd).getPointer()->push_back(use); } - void handleSelfInit(const VarDecl *vd) { + void handleSelfInit(const VarDecl *vd) override { getUses(vd).setInt(true); } @@ -1426,22 +1428,22 @@ class ThreadSafetyReporter : public clang::thread_safety::ThreadSafetyHandler { } } - void handleInvalidLockExp(SourceLocation Loc) { + void handleInvalidLockExp(SourceLocation Loc) override { PartialDiagnosticAt Warning(Loc, S.PDiag(diag::warn_cannot_resolve_lock) << Loc); Warnings.push_back(DelayedDiag(Warning, OptionalNotes())); } - void handleUnmatchedUnlock(Name LockName, SourceLocation Loc) { + void handleUnmatchedUnlock(Name LockName, SourceLocation Loc) override { warnLockMismatch(diag::warn_unlock_but_no_lock, LockName, Loc); } - void handleDoubleLock(Name LockName, SourceLocation Loc) { + void handleDoubleLock(Name LockName, SourceLocation Loc) override { warnLockMismatch(diag::warn_double_lock, LockName, Loc); } void handleMutexHeldEndOfScope(Name LockName, SourceLocation LocLocked, SourceLocation LocEndOfScope, - LockErrorKind LEK){ + LockErrorKind LEK) override { unsigned DiagID = 0; switch (LEK) { case LEK_LockedSomePredecessors: @@ -1471,7 +1473,7 @@ class ThreadSafetyReporter : public clang::thread_safety::ThreadSafetyHandler { void handleExclusiveAndShared(Name LockName, SourceLocation Loc1, - SourceLocation Loc2) { + SourceLocation Loc2) override { PartialDiagnosticAt Warning( Loc1, S.PDiag(diag::warn_lock_exclusive_and_shared) << LockName); PartialDiagnosticAt Note( @@ -1480,7 +1482,7 @@ class ThreadSafetyReporter : public clang::thread_safety::ThreadSafetyHandler { } void handleNoMutexHeld(const NamedDecl *D, ProtectedOperationKind POK, - AccessKind AK, SourceLocation Loc) { + AccessKind AK, SourceLocation Loc) override { assert((POK == POK_VarAccess || POK == POK_VarDereference) && "Only works for variables"); unsigned DiagID = POK == POK_VarAccess? @@ -1493,7 +1495,7 @@ class ThreadSafetyReporter : public clang::thread_safety::ThreadSafetyHandler { void handleMutexNotHeld(const NamedDecl *D, ProtectedOperationKind POK, Name LockName, LockKind LK, SourceLocation Loc, - Name *PossibleMatch) { + Name *PossibleMatch) override { unsigned DiagID = 0; if (PossibleMatch) { switch (POK) { @@ -1530,7 +1532,8 @@ class ThreadSafetyReporter : public clang::thread_safety::ThreadSafetyHandler { } } - void handleFunExcludesLock(Name FunName, Name LockName, SourceLocation Loc) { + void handleFunExcludesLock(Name FunName, Name LockName, + SourceLocation Loc) override { PartialDiagnosticAt Warning(Loc, S.PDiag(diag::warn_fun_excludes_mutex) << FunName << LockName); Warnings.push_back(DelayedDiag(Warning, OptionalNotes())); @@ -1555,8 +1558,8 @@ class ConsumedWarningsHandler : public ConsumedWarningsHandlerBase { public: ConsumedWarningsHandler(Sema &S) : S(S) {} - - void emitDiagnostics() { + + void emitDiagnostics() override { Warnings.sort(SortDiagBySourceLocation(S.getSourceManager())); for (DiagList::iterator I = Warnings.begin(), E = Warnings.end(); @@ -1570,8 +1573,9 @@ public: } } } - - void warnLoopStateMismatch(SourceLocation Loc, StringRef VariableName) { + + void warnLoopStateMismatch(SourceLocation Loc, + StringRef VariableName) override { PartialDiagnosticAt Warning(Loc, S.PDiag(diag::warn_loop_state_mismatch) << VariableName); @@ -1581,7 +1585,7 @@ public: void warnParamReturnTypestateMismatch(SourceLocation Loc, StringRef VariableName, StringRef ExpectedState, - StringRef ObservedState) { + StringRef ObservedState) override { PartialDiagnosticAt Warning(Loc, S.PDiag( diag::warn_param_return_typestate_mismatch) << VariableName << @@ -1591,7 +1595,7 @@ public: } void warnParamTypestateMismatch(SourceLocation Loc, StringRef ExpectedState, - StringRef ObservedState) { + StringRef ObservedState) override { PartialDiagnosticAt Warning(Loc, S.PDiag( diag::warn_param_typestate_mismatch) << ExpectedState << ObservedState); @@ -1600,7 +1604,7 @@ public: } void warnReturnTypestateForUnconsumableType(SourceLocation Loc, - StringRef TypeName) { + StringRef TypeName) override { PartialDiagnosticAt Warning(Loc, S.PDiag( diag::warn_return_typestate_for_unconsumable_type) << TypeName); @@ -1608,7 +1612,7 @@ public: } void warnReturnTypestateMismatch(SourceLocation Loc, StringRef ExpectedState, - StringRef ObservedState) { + StringRef ObservedState) override { PartialDiagnosticAt Warning(Loc, S.PDiag( diag::warn_return_typestate_mismatch) << ExpectedState << ObservedState); @@ -1617,7 +1621,7 @@ public: } void warnUseOfTempInInvalidState(StringRef MethodName, StringRef State, - SourceLocation Loc) { + SourceLocation Loc) override { PartialDiagnosticAt Warning(Loc, S.PDiag( diag::warn_use_of_temp_in_invalid_state) << MethodName << State); @@ -1626,7 +1630,7 @@ public: } void warnUseInInvalidState(StringRef MethodName, StringRef VariableName, - StringRef State, SourceLocation Loc) { + StringRef State, SourceLocation Loc) override { PartialDiagnosticAt Warning(Loc, S.PDiag(diag::warn_use_in_invalid_state) << MethodName << VariableName << State); diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp index ef1eaf2c146..ce47cfffa82 100644 --- a/clang/lib/Sema/SemaCXXScopeSpec.cpp +++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp @@ -363,7 +363,7 @@ class NestedNameSpecifierValidatorCCC : public CorrectionCandidateCallback { explicit NestedNameSpecifierValidatorCCC(Sema &SRef) : SRef(SRef) {} - virtual bool ValidateCandidate(const TypoCorrection &candidate) { + bool ValidateCandidate(const TypoCorrection &candidate) override { return SRef.isAcceptableNestedNameSpecifier(candidate.getCorrectionDecl()); } diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 30a872fcab5..74ca197b8de 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -2366,30 +2366,31 @@ public: void DoneProcessing(); void HandleIncompleteSpecifier(const char *startSpecifier, - unsigned specifierLen); + unsigned specifierLen) override; void HandleInvalidLengthModifier( - const analyze_format_string::FormatSpecifier &FS, - const analyze_format_string::ConversionSpecifier &CS, - const char *startSpecifier, unsigned specifierLen, unsigned DiagID); + const analyze_format_string::FormatSpecifier &FS, + const analyze_format_string::ConversionSpecifier &CS, + const char *startSpecifier, unsigned specifierLen, + unsigned DiagID); void HandleNonStandardLengthModifier( - const analyze_format_string::FormatSpecifier &FS, - const char *startSpecifier, unsigned specifierLen); + const analyze_format_string::FormatSpecifier &FS, + const char *startSpecifier, unsigned specifierLen); void HandleNonStandardConversionSpecifier( - const analyze_format_string::ConversionSpecifier &CS, - const char *startSpecifier, unsigned specifierLen); + const analyze_format_string::ConversionSpecifier &CS, + const char *startSpecifier, unsigned specifierLen); - virtual void HandlePosition(const char *startPos, unsigned posLen); + void HandlePosition(const char *startPos, unsigned posLen) override; - virtual void HandleInvalidPosition(const char *startSpecifier, - unsigned specifierLen, - analyze_format_string::PositionContext p); + void HandleInvalidPosition(const char *startSpecifier, + unsigned specifierLen, + analyze_format_string::PositionContext p) override; - virtual void HandleZeroPosition(const char *startPos, unsigned posLen); + void HandleZeroPosition(const char *startPos, unsigned posLen) override; - void HandleNullChar(const char *nullCharacter); + void HandleNullChar(const char *nullCharacter) override; template <typename Range> static void EmitFormatDiagnostic(Sema &S, bool inFunctionCall, @@ -2758,15 +2759,15 @@ public: ObjCContext(isObjC) {} - + bool HandleInvalidPrintfConversionSpecifier( const analyze_printf::PrintfSpecifier &FS, const char *startSpecifier, - unsigned specifierLen); - + unsigned specifierLen) override; + bool HandlePrintfSpecifier(const analyze_printf::PrintfSpecifier &FS, const char *startSpecifier, - unsigned specifierLen); + unsigned specifierLen) override; bool checkFormatExpr(const analyze_printf::PrintfSpecifier &FS, const char *StartSpecifier, unsigned SpecifierLen, @@ -3405,14 +3406,14 @@ public: bool HandleScanfSpecifier(const analyze_scanf::ScanfSpecifier &FS, const char *startSpecifier, - unsigned specifierLen); + unsigned specifierLen) override; bool HandleInvalidScanfConversionSpecifier( const analyze_scanf::ScanfSpecifier &FS, const char *startSpecifier, - unsigned specifierLen); + unsigned specifierLen) override; - void HandleIncompleteScanList(const char *start, const char *end); + void HandleIncompleteScanList(const char *start, const char *end) override; }; } diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 2724c646be1..f981592bd33 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -1253,9 +1253,9 @@ namespace { public: CodeCompletionDeclConsumer(ResultBuilder &Results, DeclContext *CurContext) : Results(Results), CurContext(CurContext) { } - - virtual void FoundDecl(NamedDecl *ND, NamedDecl *Hiding, DeclContext *Ctx, - bool InBaseClass) { + + void FoundDecl(NamedDecl *ND, NamedDecl *Hiding, DeclContext *Ctx, + bool InBaseClass) override { bool Accessible = true; if (Ctx) Accessible = Results.getSema().IsSimplyAccessible(ND, Ctx); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 8e796e6be93..6419c7f584f 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -71,7 +71,7 @@ class TypeNameValidatorCCC : public CorrectionCandidateCallback { WantRemainingKeywords = false; } - virtual bool ValidateCandidate(const TypoCorrection &candidate) { + bool ValidateCandidate(const TypoCorrection &candidate) override { if (NamedDecl *ND = candidate.getCorrectionDecl()) { bool IsType = isa<TypeDecl>(ND) || isa<ObjCInterfaceDecl>(ND); bool AllowedTemplate = AllowClassTemplates && isa<ClassTemplateDecl>(ND); @@ -5990,7 +5990,7 @@ class DifferentNameValidatorCCC : public CorrectionCandidateCallback { : Context(Context), OriginalFD(TypoFD), ExpectedParent(Parent ? Parent->getCanonicalDecl() : 0) {} - virtual bool ValidateCandidate(const TypoCorrection &candidate) { + bool ValidateCandidate(const TypoCorrection &candidate) override { if (candidate.getEditDistance() == 0) return false; diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 4de290b3eb8..bd50cd289cf 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -437,7 +437,7 @@ class ObjCInterfaceValidatorCCC : public CorrectionCandidateCallback { explicit ObjCInterfaceValidatorCCC(ObjCInterfaceDecl *IDecl) : CurrentIDecl(IDecl) {} - virtual bool ValidateCandidate(const TypoCorrection &candidate) { + bool ValidateCandidate(const TypoCorrection &candidate) override { ObjCInterfaceDecl *ID = candidate.getCorrectionDeclAs<ObjCInterfaceDecl>(); return ID && !declaresSameEntity(ID, CurrentIDecl); } diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index dac157f303d..a1ef970ca1d 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3978,7 +3978,7 @@ public: : FunctionCallFilterCCC(SemaRef, NumArgs, HasExplicitTemplateArgs), FunctionName(FuncName) {} - virtual bool ValidateCandidate(const TypoCorrection &candidate) { + bool ValidateCandidate(const TypoCorrection &candidate) override { if (!candidate.getCorrectionSpecifier() || candidate.getCorrectionAsIdentifierInfo() != FunctionName) { return false; @@ -10912,7 +10912,7 @@ ExprResult Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result) { class SimpleICEDiagnoser : public VerifyICEDiagnoser { public: - virtual void diagnoseNotICE(Sema &S, SourceLocation Loc, SourceRange SR) { + void diagnoseNotICE(Sema &S, SourceLocation Loc, SourceRange SR) override { S.Diag(Loc, diag::err_expr_not_ice) << S.LangOpts.CPlusPlus << SR; } } Diagnoser; @@ -10931,7 +10931,7 @@ ExprResult Sema::VerifyIntegerConstantExpression(Expr *E, IDDiagnoser(unsigned DiagID) : VerifyICEDiagnoser(DiagID == 0), DiagID(DiagID) { } - virtual void diagnoseNotICE(Sema &S, SourceLocation Loc, SourceRange SR) { + void diagnoseNotICE(Sema &S, SourceLocation Loc, SourceRange SR) override { S.Diag(Loc, DiagID) << SR; } } Diagnoser(DiagID); @@ -10963,40 +10963,40 @@ Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, : ICEConvertDiagnoser(/*AllowScopedEnumerations*/false, Silent, true) {} - virtual SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc, - QualType T) { + SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc, + QualType T) override { return S.Diag(Loc, diag::err_ice_not_integral) << T; } - virtual SemaDiagnosticBuilder diagnoseIncomplete( - Sema &S, SourceLocation Loc, QualType T) { + SemaDiagnosticBuilder diagnoseIncomplete( + Sema &S, SourceLocation Loc, QualType T) override { return S.Diag(Loc, diag::err_ice_incomplete_type) << T; } - virtual SemaDiagnosticBuilder diagnoseExplicitConv( - Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) { + SemaDiagnosticBuilder diagnoseExplicitConv( + Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) override { return S.Diag(Loc, diag::err_ice_explicit_conversion) << T << ConvTy; } - virtual SemaDiagnosticBuilder noteExplicitConv( - Sema &S, CXXConversionDecl *Conv, QualType ConvTy) { + SemaDiagnosticBuilder noteExplicitConv( + Sema &S, CXXConversionDecl *Conv, QualType ConvTy) override { return S.Diag(Conv->getLocation(), diag::note_ice_conversion_here) << ConvTy->isEnumeralType() << ConvTy; } - virtual SemaDiagnosticBuilder diagnoseAmbiguous( - Sema &S, SourceLocation Loc, QualType T) { + SemaDiagnosticBuilder diagnoseAmbiguous( + Sema &S, SourceLocation Loc, QualType T) override { return S.Diag(Loc, diag::err_ice_ambiguous_conversion) << T; } - virtual SemaDiagnosticBuilder noteAmbiguous( - Sema &S, CXXConversionDecl *Conv, QualType ConvTy) { + SemaDiagnosticBuilder noteAmbiguous( + Sema &S, CXXConversionDecl *Conv, QualType ConvTy) override { return S.Diag(Conv->getLocation(), diag::note_ice_conversion_here) << ConvTy->isEnumeralType() << ConvTy; } - virtual SemaDiagnosticBuilder diagnoseConversion( - Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) { + SemaDiagnosticBuilder diagnoseConversion( + Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) override { llvm_unreachable("conversion functions are permitted"); } } ConvertDiagnoser(Diagnoser.Suppress); @@ -12576,8 +12576,8 @@ bool Sema::CheckCallReturnType(QualType ReturnType, SourceLocation Loc, public: CallReturnIncompleteDiagnoser(FunctionDecl *FD, CallExpr *CE) : FD(FD), CE(CE) { } - - virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) { + + void diagnose(Sema &S, SourceLocation Loc, QualType T) override { if (!FD) { S.Diag(Loc, diag::err_call_incomplete_return) << T << CE->getSourceRange(); diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index d364155c918..3fa5de1a77f 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -1279,43 +1279,43 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal, SizeConvertDiagnoser(Expr *ArraySize) : ICEConvertDiagnoser(/*AllowScopedEnumerations*/false, false, false), ArraySize(ArraySize) {} - - virtual SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc, - QualType T) { + + SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc, + QualType T) override { return S.Diag(Loc, diag::err_array_size_not_integral) << S.getLangOpts().CPlusPlus11 << T; } - - virtual SemaDiagnosticBuilder diagnoseIncomplete( - Sema &S, SourceLocation Loc, QualType T) { + + SemaDiagnosticBuilder diagnoseIncomplete( + Sema &S, SourceLocation Loc, QualType T) override { return S.Diag(Loc, diag::err_array_size_incomplete_type) << T << ArraySize->getSourceRange(); } - - virtual SemaDiagnosticBuilder diagnoseExplicitConv( - Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) { + + SemaDiagnosticBuilder diagnoseExplicitConv( + Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) override { return S.Diag(Loc, diag::err_array_size_explicit_conversion) << T << ConvTy; } - - virtual SemaDiagnosticBuilder noteExplicitConv( - Sema &S, CXXConversionDecl *Conv, QualType ConvTy) { + + SemaDiagnosticBuilder noteExplicitConv( + Sema &S, CXXConversionDecl *Conv, QualType ConvTy) override { return S.Diag(Conv->getLocation(), diag::note_array_size_conversion) << ConvTy->isEnumeralType() << ConvTy; } - - virtual SemaDiagnosticBuilder diagnoseAmbiguous( - Sema &S, SourceLocation Loc, QualType T) { + + SemaDiagnosticBuilder diagnoseAmbiguous( + Sema &S, SourceLocation Loc, QualType T) override { return S.Diag(Loc, diag::err_array_size_ambiguous_conversion) << T; } - - virtual SemaDiagnosticBuilder noteAmbiguous( - Sema &S, CXXConversionDecl *Conv, QualType ConvTy) { + + SemaDiagnosticBuilder noteAmbiguous( + Sema &S, CXXConversionDecl *Conv, QualType ConvTy) override { return S.Diag(Conv->getLocation(), diag::note_array_size_conversion) << ConvTy->isEnumeralType() << ConvTy; } virtual SemaDiagnosticBuilder diagnoseConversion( - Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) { + Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) override { return S.Diag(Loc, S.getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_array_size_conversion @@ -2274,7 +2274,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, public: DeleteConverter() : ContextualImplicitConverter(false, true) {} - bool match(QualType ConvType) { + bool match(QualType ConvType) override { // FIXME: If we have an operator T* and an operator void*, we must pick // the operator T*. if (const PointerType *ConvPtrType = ConvType->getAs<PointerType>()) @@ -2284,39 +2284,41 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, } SemaDiagnosticBuilder diagnoseNoMatch(Sema &S, SourceLocation Loc, - QualType T) { + QualType T) override { return S.Diag(Loc, diag::err_delete_operand) << T; } SemaDiagnosticBuilder diagnoseIncomplete(Sema &S, SourceLocation Loc, - QualType T) { + QualType T) override { return S.Diag(Loc, diag::err_delete_incomplete_class_type) << T; } SemaDiagnosticBuilder diagnoseExplicitConv(Sema &S, SourceLocation Loc, - QualType T, QualType ConvTy) { + QualType T, + QualType ConvTy) override { return S.Diag(Loc, diag::err_delete_explicit_conversion) << T << ConvTy; } SemaDiagnosticBuilder noteExplicitConv(Sema &S, CXXConversionDecl *Conv, - QualType ConvTy) { + QualType ConvTy) override { return S.Diag(Conv->getLocation(), diag::note_delete_conversion) << ConvTy; } SemaDiagnosticBuilder diagnoseAmbiguous(Sema &S, SourceLocation Loc, - QualType T) { + QualType T) override { return S.Diag(Loc, diag::err_ambiguous_delete_operand) << T; } SemaDiagnosticBuilder noteAmbiguous(Sema &S, CXXConversionDecl *Conv, - QualType ConvTy) { + QualType ConvTy) override { return S.Diag(Conv->getLocation(), diag::note_delete_conversion) << ConvTy; } SemaDiagnosticBuilder diagnoseConversion(Sema &S, SourceLocation Loc, - QualType T, QualType ConvTy) { + QualType T, + QualType ConvTy) override { llvm_unreachable("conversion functions are permitted"); } } Converter; diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp index dea44678442..7d2426be87d 100644 --- a/clang/lib/Sema/SemaExprMember.cpp +++ b/clang/lib/Sema/SemaExprMember.cpp @@ -546,7 +546,7 @@ class RecordMemberExprValidatorCCC : public CorrectionCandidateCallback { explicit RecordMemberExprValidatorCCC(const RecordType *RTy) : Record(RTy->getDecl()) {} - virtual bool ValidateCandidate(const TypoCorrection &candidate) { + bool ValidateCandidate(const TypoCorrection &candidate) override { NamedDecl *ND = candidate.getCorrectionDecl(); // Don't accept candidates that cannot be member functions, constants, // variables, or templates. diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 3a7e83c5ac1..0d41d2ef81d 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -1776,7 +1776,7 @@ class ObjCInterfaceOrSuperCCC : public CorrectionCandidateCallback { WantObjCSuper = Method->getClassInterface()->getSuperClass(); } - virtual bool ValidateCandidate(const TypoCorrection &candidate) { + bool ValidateCandidate(const TypoCorrection &candidate) override { return candidate.getCorrectionDeclAs<ObjCInterfaceDecl>() || candidate.isKeyword("super"); } diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index d3b68531096..b8f5583f25f 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -1643,7 +1643,7 @@ class FieldInitializerValidatorCCC : public CorrectionCandidateCallback { explicit FieldInitializerValidatorCCC(RecordDecl *RD) : Record(RD) {} - virtual bool ValidateCandidate(const TypoCorrection &candidate) { + bool ValidateCandidate(const TypoCorrection &candidate) override { FieldDecl *FD = candidate.getCorrectionDeclAs<FieldDecl>(); return FD && FD->getDeclContext()->getRedeclContext()->Equals(Record); } diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index b738d7fddac..2ace8c2769c 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -3383,10 +3383,10 @@ public: : Typo(Typo->getName()), SemaRef(SemaRef) {} - bool includeHiddenDecls() const { return true; } + bool includeHiddenDecls() const override { return true; } - virtual void FoundDecl(NamedDecl *ND, NamedDecl *Hiding, DeclContext *Ctx, - bool InBaseClass); + void FoundDecl(NamedDecl *ND, NamedDecl *Hiding, DeclContext *Ctx, + bool InBaseClass) override; void FoundName(StringRef Name); void addKeywordResult(StringRef Keyword); void addName(StringRef Name, NamedDecl *ND, NestedNameSpecifier *NNS = NULL, diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index b814706a61a..1e1dbfed0b8 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -397,7 +397,7 @@ private: Sema &Actions; public: VarDeclFilterCCC(Sema &S) : Actions(S) { } - virtual bool ValidateCandidate(const TypoCorrection &Candidate) { + bool ValidateCandidate(const TypoCorrection &Candidate) override { NamedDecl *ND = Candidate.getCorrectionDecl(); if (VarDecl *VD = dyn_cast_or_null<VarDecl>(ND)) { return VD->hasGlobalStorage() && @@ -803,34 +803,34 @@ ExprResult Sema::PerformImplicitIntegerConversion(SourceLocation Loc, IntConvertDiagnoser() : ICEConvertDiagnoser(/*AllowScopedEnumerations*/false, false, true) {} - virtual SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc, - QualType T) { + SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc, + QualType T) override { return S.Diag(Loc, diag::err_omp_not_integral) << T; } - virtual SemaDiagnosticBuilder diagnoseIncomplete( - Sema &S, SourceLocation Loc, QualType T) { + SemaDiagnosticBuilder diagnoseIncomplete( + Sema &S, SourceLocation Loc, QualType T) override { return S.Diag(Loc, diag::err_omp_incomplete_type) << T; } - virtual SemaDiagnosticBuilder diagnoseExplicitConv( - Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) { + SemaDiagnosticBuilder diagnoseExplicitConv( + Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) override { return S.Diag(Loc, diag::err_omp_explicit_conversion) << T << ConvTy; } - virtual SemaDiagnosticBuilder noteExplicitConv( - Sema &S, CXXConversionDecl *Conv, QualType ConvTy) { + SemaDiagnosticBuilder noteExplicitConv( + Sema &S, CXXConversionDecl *Conv, QualType ConvTy) override { return S.Diag(Conv->getLocation(), diag::note_omp_conversion_here) << ConvTy->isEnumeralType() << ConvTy; } - virtual SemaDiagnosticBuilder diagnoseAmbiguous( - Sema &S, SourceLocation Loc, QualType T) { + SemaDiagnosticBuilder diagnoseAmbiguous( + Sema &S, SourceLocation Loc, QualType T) override { return S.Diag(Loc, diag::err_omp_ambiguous_conversion) << T; } - virtual SemaDiagnosticBuilder noteAmbiguous( - Sema &S, CXXConversionDecl *Conv, QualType ConvTy) { + SemaDiagnosticBuilder noteAmbiguous( + Sema &S, CXXConversionDecl *Conv, QualType ConvTy) override { return S.Diag(Conv->getLocation(), diag::note_omp_conversion_here) << ConvTy->isEnumeralType() << ConvTy; } - virtual SemaDiagnosticBuilder diagnoseConversion( - Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) { + SemaDiagnosticBuilder diagnoseConversion( + Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) override { llvm_unreachable("conversion functions are permitted"); } } ConvertDiagnoser; diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index cbb2ff71eb8..1dab1501296 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -5329,7 +5329,7 @@ ExprResult Sema::PerformContextualImplicitConversion( TypeDiagnoserPartialDiag(ContextualImplicitConverter &Converter, Expr *From) : TypeDiagnoser(Converter.Suppress), Converter(Converter), From(From) {} - virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) { + void diagnose(Sema &S, SourceLocation Loc, QualType T) override { Converter.diagnoseIncomplete(S, Loc, T) << From->getSourceRange(); } } IncompleteDiagnoser(Converter, From); diff --git a/clang/lib/Sema/SemaPseudoObject.cpp b/clang/lib/Sema/SemaPseudoObject.cpp index 0f1df58e6d1..de02fa935ef 100644 --- a/clang/lib/Sema/SemaPseudoObject.cpp +++ b/clang/lib/Sema/SemaPseudoObject.cpp @@ -283,10 +283,10 @@ namespace { bool findSetter(bool warn=true); bool findGetter(); - Expr *rebuildAndCaptureObject(Expr *syntacticBase); - ExprResult buildGet(); - ExprResult buildSet(Expr *op, SourceLocation, bool); - ExprResult complete(Expr *SyntacticForm); + Expr *rebuildAndCaptureObject(Expr *syntacticBase) override; + ExprResult buildGet() override; + ExprResult buildSet(Expr *op, SourceLocation, bool) override; + ExprResult complete(Expr *SyntacticForm) override; bool isWeakProperty() const; }; @@ -314,13 +314,13 @@ namespace { SourceLocation opLoc, BinaryOperatorKind opcode, Expr *LHS, Expr *RHS); - Expr *rebuildAndCaptureObject(Expr *syntacticBase); - + Expr *rebuildAndCaptureObject(Expr *syntacticBase) override; + bool findAtIndexGetter(); bool findAtIndexSetter(); - - ExprResult buildGet(); - ExprResult buildSet(Expr *op, SourceLocation, bool); + + ExprResult buildGet() override; + ExprResult buildSet(Expr *op, SourceLocation, bool) override; }; class MSPropertyOpBuilder : public PseudoOpBuilder { @@ -331,9 +331,9 @@ namespace { PseudoOpBuilder(S, refExpr->getSourceRange().getBegin()), RefExpr(refExpr) {} - Expr *rebuildAndCaptureObject(Expr *); - ExprResult buildGet(); - ExprResult buildSet(Expr *op, SourceLocation, bool); + Expr *rebuildAndCaptureObject(Expr *) override; + ExprResult buildGet() override; + ExprResult buildSet(Expr *op, SourceLocation, bool) override; }; } diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 2c6dd50e04e..a7ea72f144a 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -601,41 +601,41 @@ Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Expr *Cond, : ICEConvertDiagnoser(/*AllowScopedEnumerations*/true, false, true), Cond(Cond) {} - virtual SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc, - QualType T) { + SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc, + QualType T) override { return S.Diag(Loc, diag::err_typecheck_statement_requires_integer) << T; } - virtual SemaDiagnosticBuilder diagnoseIncomplete( - Sema &S, SourceLocation Loc, QualType T) { + SemaDiagnosticBuilder diagnoseIncomplete( + Sema &S, SourceLocation Loc, QualType T) override { return S.Diag(Loc, diag::err_switch_incomplete_class_type) << T << Cond->getSourceRange(); } - virtual SemaDiagnosticBuilder diagnoseExplicitConv( - Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) { + SemaDiagnosticBuilder diagnoseExplicitConv( + Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) override { return S.Diag(Loc, diag::err_switch_explicit_conversion) << T << ConvTy; } - virtual SemaDiagnosticBuilder noteExplicitConv( - Sema &S, CXXConversionDecl *Conv, QualType ConvTy) { + SemaDiagnosticBuilder noteExplicitConv( + Sema &S, CXXConversionDecl *Conv, QualType ConvTy) override { return S.Diag(Conv->getLocation(), diag::note_switch_conversion) << ConvTy->isEnumeralType() << ConvTy; } - virtual SemaDiagnosticBuilder diagnoseAmbiguous(Sema &S, SourceLocation Loc, - QualType T) { + SemaDiagnosticBuilder diagnoseAmbiguous(Sema &S, SourceLocation Loc, + QualType T) override { return S.Diag(Loc, diag::err_switch_multiple_conversions) << T; } - virtual SemaDiagnosticBuilder noteAmbiguous( - Sema &S, CXXConversionDecl *Conv, QualType ConvTy) { + SemaDiagnosticBuilder noteAmbiguous( + Sema &S, CXXConversionDecl *Conv, QualType ConvTy) override { return S.Diag(Conv->getLocation(), diag::note_switch_conversion) << ConvTy->isEnumeralType() << ConvTy; } - virtual SemaDiagnosticBuilder diagnoseConversion( - Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) { + SemaDiagnosticBuilder diagnoseConversion( + Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) override { llvm_unreachable("conversion functions are permitted"); } } SwitchDiagnoser(Cond); diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 94627aa865b..aacb0b6eead 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -4781,9 +4781,9 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, public: TmplArgICEDiagnoser(QualType T) : T(T) { } - - virtual void diagnoseNotICE(Sema &S, SourceLocation Loc, - SourceRange SR) { + + void diagnoseNotICE(Sema &S, SourceLocation Loc, + SourceRange SR) override { S.Diag(Loc, diag::err_template_arg_not_ice) << T << SR; } } Diagnoser(ArgType); diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp index f2b57dcc13b..de850e39012 100644 --- a/clang/lib/Sema/SemaTemplateVariadic.cpp +++ b/clang/lib/Sema/SemaTemplateVariadic.cpp @@ -767,7 +767,7 @@ namespace { // Callback to only accept typo corrections that refer to parameter packs. class ParameterPackValidatorCCC : public CorrectionCandidateCallback { public: - virtual bool ValidateCandidate(const TypoCorrection &candidate) { + bool ValidateCandidate(const TypoCorrection &candidate) override { NamedDecl *ND = candidate.getCorrectionDecl(); return ND && ND->isParameterPack(); } diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 1f6543875bb..1dadde8da01 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1412,10 +1412,10 @@ static bool isArraySizeVLA(Sema &S, Expr *ArraySize, llvm::APSInt &SizeVal) { public: VLADiagnoser() : Sema::VerifyICEDiagnoser(true) {} - virtual void diagnoseNotICE(Sema &S, SourceLocation Loc, SourceRange SR) { + void diagnoseNotICE(Sema &S, SourceLocation Loc, SourceRange SR) override { } - virtual void diagnoseFold(Sema &S, SourceLocation Loc, SourceRange SR) { + void diagnoseFold(Sema &S, SourceLocation Loc, SourceRange SR) override { S.Diag(Loc, diag::ext_vla_folded_to_constant) << SR; } } Diagnoser; @@ -5027,7 +5027,7 @@ namespace { TypeDiagnoserDiag(unsigned DiagID) : Sema::TypeDiagnoser(DiagID == 0), DiagID(DiagID) {} - virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) { + void diagnose(Sema &S, SourceLocation Loc, QualType T) override { if (Suppressed) return; S.Diag(Loc, DiagID) << T; } |