diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/AnalysisBasedWarnings.cpp | 48 | ||||
-rw-r--r-- | clang/lib/Sema/SemaCXXScopeSpec.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 43 | ||||
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 38 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 56 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExprMember.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 30 | ||||
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaPseudoObject.cpp | 24 | ||||
-rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 28 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplateVariadic.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 6 |
19 files changed, 158 insertions, 151 deletions
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; } |