diff options
Diffstat (limited to 'clang/include')
21 files changed, 330 insertions, 330 deletions
diff --git a/clang/include/clang/CodeGen/CodeGenAction.h b/clang/include/clang/CodeGen/CodeGenAction.h index 10fa2e0b5eb..2300d291de8 100644 --- a/clang/include/clang/CodeGen/CodeGenAction.h +++ b/clang/include/clang/CodeGen/CodeGenAction.h @@ -35,14 +35,14 @@ protected: /// otherwise it creates a fresh LLVM context and takes ownership. CodeGenAction(unsigned _Act, llvm::LLVMContext *_VMContext = 0); - virtual bool hasIRSupport() const; + bool hasIRSupport() const override; - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; - virtual void ExecuteAction(); + void ExecuteAction() override; - virtual void EndSourceFileAction(); + void EndSourceFileAction() override; public: ~CodeGenAction(); diff --git a/clang/include/clang/Rewrite/Frontend/FixItRewriter.h b/clang/include/clang/Rewrite/Frontend/FixItRewriter.h index 423f0667cde..ff03eff4863 100644 --- a/clang/include/clang/Rewrite/Frontend/FixItRewriter.h +++ b/clang/include/clang/Rewrite/Frontend/FixItRewriter.h @@ -112,12 +112,12 @@ public: /// returns true) indicates whether the diagnostics handled by this /// DiagnosticConsumer should be included in the number of diagnostics /// reported by DiagnosticsEngine. - virtual bool IncludeInDiagnosticCounts() const; + bool IncludeInDiagnosticCounts() const override; /// HandleDiagnostic - Handle this diagnostic, reporting it to the user or /// capturing it to a log as needed. - virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, - const Diagnostic &Info); + void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, + const Diagnostic &Info) override; /// \brief Emit a diagnostic via the adapted diagnostic client. void Diag(SourceLocation Loc, unsigned DiagID); diff --git a/clang/include/clang/Rewrite/Frontend/FrontendActions.h b/clang/include/clang/Rewrite/Frontend/FrontendActions.h index 70ff71f9906..fc792707487 100644 --- a/clang/include/clang/Rewrite/Frontend/FrontendActions.h +++ b/clang/include/clang/Rewrite/Frontend/FrontendActions.h @@ -22,8 +22,8 @@ class FixItOptions; class HTMLPrintAction : public ASTFrontendAction { protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; }; class FixItAction : public ASTFrontendAction { @@ -31,15 +31,15 @@ protected: std::unique_ptr<FixItRewriter> Rewriter; std::unique_ptr<FixItOptions> FixItOpts; - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; - virtual bool BeginSourceFileAction(CompilerInstance &CI, - StringRef Filename); + bool BeginSourceFileAction(CompilerInstance &CI, + StringRef Filename) override; - virtual void EndSourceFileAction(); + void EndSourceFileAction() override; - virtual bool hasASTFileSupport() const { return false; } + bool hasASTFileSupport() const override { return false; } public: FixItAction(); @@ -54,28 +54,28 @@ public: : WrapperFrontendAction(WrappedAction) {} protected: - virtual bool BeginInvocation(CompilerInstance &CI); + bool BeginInvocation(CompilerInstance &CI) override; }; class RewriteObjCAction : public ASTFrontendAction { protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; }; class RewriteMacrosAction : public PreprocessorFrontendAction { protected: - void ExecuteAction(); + void ExecuteAction() override; }; class RewriteTestAction : public PreprocessorFrontendAction { protected: - void ExecuteAction(); + void ExecuteAction() override; }; class RewriteIncludesAction : public PreprocessorFrontendAction { protected: - void ExecuteAction(); + void ExecuteAction() override; }; } // end namespace clang diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h index e61c11c31bb..ccbc47f49b3 100644 --- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h +++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h @@ -512,9 +512,8 @@ public: /// /// \return True if the report was valid and a path was generated, /// false if the reports should be considered invalid. - virtual bool generatePathDiagnostic(PathDiagnostic &PD, - PathDiagnosticConsumer &PC, - ArrayRef<BugReport*> &bugReports); + bool generatePathDiagnostic(PathDiagnostic &PD, PathDiagnosticConsumer &PC, + ArrayRef<BugReport*> &bugReports) override; /// classof - Used by isa<>, cast<>, and dyn_cast<>. static bool classof(const BugReporter* R) { diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h index 2e67180beac..302e0f821a6 100644 --- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h +++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h @@ -89,7 +89,7 @@ public: /// will have to provide your own implementation.) template <class DERIVED> class BugReporterVisitorImpl : public BugReporterVisitor { - virtual BugReporterVisitor *clone() const { + BugReporterVisitor *clone() const override { return new DERIVED(*static_cast<const DERIVED *>(this)); } }; @@ -118,12 +118,12 @@ public: Satisfied(false), EnableNullFPSuppression(InEnableNullFPSuppression) {} - void Profile(llvm::FoldingSetNodeID &ID) const; + void Profile(llvm::FoldingSetNodeID &ID) const override; PathDiagnosticPiece *VisitNode(const ExplodedNode *N, const ExplodedNode *PrevN, BugReporterContext &BRC, - BugReport &BR); + BugReport &BR) override; }; class TrackConstraintBRVisitor @@ -144,7 +144,7 @@ public: IsZeroCheck(!Assumption && Constraint.getAs<Loc>()), IsTrackingTurnedOn(false) {} - void Profile(llvm::FoldingSetNodeID &ID) const; + void Profile(llvm::FoldingSetNodeID &ID) const override; /// Return the tag associated with this visitor. This tag will be used /// to make all PathDiagnosticPieces created by this visitor. @@ -153,7 +153,7 @@ public: PathDiagnosticPiece *VisitNode(const ExplodedNode *N, const ExplodedNode *PrevN, BugReporterContext &BRC, - BugReport &BR); + BugReport &BR) override; private: /// Checks if the constraint is valid in the current state. @@ -166,8 +166,8 @@ private: class NilReceiverBRVisitor : public BugReporterVisitorImpl<NilReceiverBRVisitor> { public: - - void Profile(llvm::FoldingSetNodeID &ID) const { + + void Profile(llvm::FoldingSetNodeID &ID) const override { static int x = 0; ID.AddPointer(&x); } @@ -175,7 +175,7 @@ public: PathDiagnosticPiece *VisitNode(const ExplodedNode *N, const ExplodedNode *PrevN, BugReporterContext &BRC, - BugReport &BR); + BugReport &BR) override; /// If the statement is a message send expression with nil receiver, returns /// the receiver expression. Returns NULL otherwise. @@ -185,7 +185,7 @@ public: /// Visitor that tries to report interesting diagnostics from conditions. class ConditionBRVisitor : public BugReporterVisitorImpl<ConditionBRVisitor> { public: - void Profile(llvm::FoldingSetNodeID &ID) const { + void Profile(llvm::FoldingSetNodeID &ID) const override{ static int x = 0; ID.AddPointer(&x); } @@ -193,11 +193,11 @@ public: /// Return the tag associated with this visitor. This tag will be used /// to make all PathDiagnosticPieces created by this visitor. static const char *getTag(); - - virtual PathDiagnosticPiece *VisitNode(const ExplodedNode *N, - const ExplodedNode *Prev, - BugReporterContext &BRC, - BugReport &BR); + + PathDiagnosticPiece *VisitNode(const ExplodedNode *N, + const ExplodedNode *Prev, + BugReporterContext &BRC, + BugReport &BR) override; PathDiagnosticPiece *VisitNodeImpl(const ExplodedNode *N, const ExplodedNode *Prev, @@ -257,20 +257,20 @@ public: return static_cast<void *>(&Tag); } - void Profile(llvm::FoldingSetNodeID &ID) const { + void Profile(llvm::FoldingSetNodeID &ID) const override { ID.AddPointer(getTag()); } - virtual PathDiagnosticPiece *VisitNode(const ExplodedNode *N, - const ExplodedNode *Prev, - BugReporterContext &BRC, - BugReport &BR) { + PathDiagnosticPiece *VisitNode(const ExplodedNode *N, + const ExplodedNode *Prev, + BugReporterContext &BRC, + BugReport &BR) override { return 0; } - virtual PathDiagnosticPiece *getEndPath(BugReporterContext &BRC, - const ExplodedNode *N, - BugReport &BR); + PathDiagnosticPiece *getEndPath(BugReporterContext &BRC, + const ExplodedNode *N, + BugReport &BR) override; }; /// \brief When a region containing undefined value or '0' value is passed @@ -287,7 +287,7 @@ class UndefOrNullArgVisitor public: UndefOrNullArgVisitor(const MemRegion *InR) : R(InR) {} - virtual void Profile(llvm::FoldingSetNodeID &ID) const { + void Profile(llvm::FoldingSetNodeID &ID) const override { static int Tag = 0; ID.AddPointer(&Tag); ID.AddPointer(R); @@ -296,7 +296,7 @@ public: PathDiagnosticPiece *VisitNode(const ExplodedNode *N, const ExplodedNode *PrevN, BugReporterContext &BRC, - BugReport &BR); + BugReport &BR) override; }; class SuppressInlineDefensiveChecksVisitor @@ -319,7 +319,7 @@ class SuppressInlineDefensiveChecksVisitor public: SuppressInlineDefensiveChecksVisitor(DefinedSVal Val, const ExplodedNode *N); - void Profile(llvm::FoldingSetNodeID &ID) const; + void Profile(llvm::FoldingSetNodeID &ID) const override; /// Return the tag associated with this visitor. This tag will be used /// to make all PathDiagnosticPieces created by this visitor. @@ -328,7 +328,7 @@ public: PathDiagnosticPiece *VisitNode(const ExplodedNode *Succ, const ExplodedNode *Pred, BugReporterContext &BRC, - BugReport &BR); + BugReport &BR) override; }; namespace bugreporter { diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h index a9174ac569d..24c778552ee 100644 --- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h +++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h @@ -60,7 +60,7 @@ public: class BuiltinBug : public BugType { const std::string desc; - virtual void anchor(); + void anchor() override; public: BuiltinBug(class CheckName check, const char *name, const char *description) : BugType(check, name, categories::LogicError), desc(description) {} diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h index 6e41f38f54d..cc315938333 100644 --- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h +++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h @@ -440,10 +440,10 @@ public: if (addPosRange && Pos.hasRange()) addRange(Pos.asRange()); } - PathDiagnosticLocation getLocation() const { return Pos; } - virtual void flattenLocations() { Pos.flatten(); } + PathDiagnosticLocation getLocation() const override { return Pos; } + void flattenLocations() override { Pos.flatten(); } - virtual void Profile(llvm::FoldingSetNodeID &ID) const; + void Profile(llvm::FoldingSetNodeID &ID) const override; static bool classof(const PathDiagnosticPiece *P) { return P->getKind() == Event || P->getKind() == Macro; @@ -479,7 +479,7 @@ public: /// \brief Search the call expression for the symbol Sym and dispatch the /// 'getMessageForX()' methods to construct a specific message. - virtual std::string getMessage(const ExplodedNode *N); + std::string getMessage(const ExplodedNode *N) override; /// Produces the message of the following form: /// 'Msg via Nth parameter' @@ -534,7 +534,7 @@ public: return ""; } - virtual void dump() const; + void dump() const override; static inline bool classof(const PathDiagnosticPiece *P) { return P->getKind() == Event; @@ -580,7 +580,7 @@ public: CallStackMessage = st; } - virtual PathDiagnosticLocation getLocation() const { + PathDiagnosticLocation getLocation() const override { return callEnter; } @@ -589,7 +589,7 @@ public: getCallEnterWithinCallerEvent() const; IntrusiveRefCntPtr<PathDiagnosticEventPiece> getCallExitEvent() const; - virtual void flattenLocations() { + void flattenLocations() override { callEnter.flatten(); callReturn.flatten(); for (PathPieces::iterator I = path.begin(), @@ -602,10 +602,10 @@ public: static PathDiagnosticCallPiece *construct(PathPieces &pieces, const Decl *caller); - - virtual void dump() const; - virtual void Profile(llvm::FoldingSetNodeID &ID) const; + void dump() const override; + + void Profile(llvm::FoldingSetNodeID &ID) const override; static inline bool classof(const PathDiagnosticPiece *P) { return P->getKind() == Call; @@ -652,7 +652,7 @@ public: void push_back(const PathDiagnosticLocationPair &X) { LPairs.push_back(X); } - virtual PathDiagnosticLocation getLocation() const { + PathDiagnosticLocation getLocation() const override { return getStartLocation(); } @@ -660,7 +660,7 @@ public: iterator begin() { return LPairs.begin(); } iterator end() { return LPairs.end(); } - virtual void flattenLocations() { + void flattenLocations() override { for (iterator I=begin(), E=end(); I!=E; ++I) I->flatten(); } @@ -673,9 +673,9 @@ public: return P->getKind() == ControlFlow; } - virtual void dump() const; + void dump() const override; - virtual void Profile(llvm::FoldingSetNodeID &ID) const; + void Profile(llvm::FoldingSetNodeID &ID) const override; }; class PathDiagnosticMacroPiece : public PathDiagnosticSpotPiece { @@ -689,7 +689,7 @@ public: bool containsEvent() const; - virtual void flattenLocations() { + void flattenLocations() override { PathDiagnosticSpotPiece::flattenLocations(); for (PathPieces::iterator I = subPieces.begin(), E = subPieces.end(); I != E; ++I) (*I)->flattenLocations(); @@ -699,9 +699,9 @@ public: return P->getKind() == Macro; } - virtual void dump() const; + void dump() const override; - virtual void Profile(llvm::FoldingSetNodeID &ID) const; + void Profile(llvm::FoldingSetNodeID &ID) const override; }; /// PathDiagnostic - PathDiagnostic objects represent a single path-sensitive diff --git a/clang/include/clang/StaticAnalyzer/Core/Checker.h b/clang/include/clang/StaticAnalyzer/Core/Checker.h index 6153b879893..be1e9cf02fa 100644 --- a/clang/include/clang/StaticAnalyzer/Core/Checker.h +++ b/clang/include/clang/StaticAnalyzer/Core/Checker.h @@ -457,7 +457,7 @@ class CheckerBase : public ProgramPointTag { friend class ::clang::ento::CheckerManager; public: - StringRef getTagDescription() const; + StringRef getTagDescription() const override; CheckName getCheckName() const; /// See CheckerManager::runCheckersForPrintState. diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h index d7d83ce8b17..1a398b86484 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h @@ -65,8 +65,8 @@ public: StoreManagerCreator getStoreManagerCreator() { return CreateStoreMgr; } - - AnalyzerOptions& getAnalyzerOptions() { + + AnalyzerOptions& getAnalyzerOptions() override { return options; } @@ -76,15 +76,15 @@ public: CheckerManager *getCheckerManager() const { return CheckerMgr; } - virtual ASTContext &getASTContext() { + ASTContext &getASTContext() override { return Ctx; } - virtual SourceManager &getSourceManager() { + SourceManager &getSourceManager() override { return getASTContext().getSourceManager(); } - virtual DiagnosticsEngine &getDiagnostic() { + DiagnosticsEngine &getDiagnostic() override { return Diags; } @@ -92,7 +92,7 @@ public: return LangOpts; } - ArrayRef<PathDiagnosticConsumer*> getPathDiagnosticConsumers() { + ArrayRef<PathDiagnosticConsumer*> getPathDiagnosticConsumers() override { return PathConsumers; } diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h index fe1a65d47e7..4d65350d27e 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h @@ -390,11 +390,11 @@ protected: public: // This function is overridden by subclasses, but they must return // a FunctionDecl. - virtual const FunctionDecl *getDecl() const { + const FunctionDecl *getDecl() const override { return cast<FunctionDecl>(CallEvent::getDecl()); } - virtual RuntimeDefinition getRuntimeDefinition() const { + RuntimeDefinition getRuntimeDefinition() const override { const FunctionDecl *FD = getDecl(); // Note that the AnalysisDeclContext will have the FunctionDecl with // the definition (if one exists). @@ -409,12 +409,12 @@ public: return RuntimeDefinition(); } - virtual bool argumentsMayEscape() const; + bool argumentsMayEscape() const override; - virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, - BindingsTy &Bindings) const; + void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, + BindingsTy &Bindings) const override; - virtual ArrayRef<ParmVarDecl *> parameters() const; + ArrayRef<ParmVarDecl *> parameters() const override; static bool classof(const CallEvent *CA) { return CA->getKind() >= CE_BEG_FUNCTION_CALLS && @@ -434,7 +434,7 @@ protected: : AnyFunctionCall(CE, St, LCtx) {} SimpleFunctionCall(const SimpleFunctionCall &Other) : AnyFunctionCall(Other) {} - virtual void cloneTo(void *Dest) const { + void cloneTo(void *Dest) const override { new (Dest) SimpleFunctionCall(*this); } @@ -443,15 +443,15 @@ public: return cast<CallExpr>(AnyFunctionCall::getOriginExpr()); } - virtual const FunctionDecl *getDecl() const; + const FunctionDecl *getDecl() const override; - virtual unsigned getNumArgs() const { return getOriginExpr()->getNumArgs(); } + unsigned getNumArgs() const override { return getOriginExpr()->getNumArgs(); } - virtual const Expr *getArgExpr(unsigned Index) const { + const Expr *getArgExpr(unsigned Index) const override { return getOriginExpr()->getArg(Index); } - virtual Kind getKind() const { return CE_Function; } + Kind getKind() const override { return CE_Function; } static bool classof(const CallEvent *CA) { return CA->getKind() == CE_Function; @@ -470,18 +470,18 @@ protected: : CallEvent(CE, St, LCtx) {} BlockCall(const BlockCall &Other) : CallEvent(Other) {} - virtual void cloneTo(void *Dest) const { new (Dest) BlockCall(*this); } + void cloneTo(void *Dest) const override { new (Dest) BlockCall(*this); } - virtual void getExtraInvalidatedValues(ValueList &Values) const; + void getExtraInvalidatedValues(ValueList &Values) const override; public: virtual const CallExpr *getOriginExpr() const { return cast<CallExpr>(CallEvent::getOriginExpr()); } - virtual unsigned getNumArgs() const { return getOriginExpr()->getNumArgs(); } + unsigned getNumArgs() const override { return getOriginExpr()->getNumArgs(); } - virtual const Expr *getArgExpr(unsigned Index) const { + const Expr *getArgExpr(unsigned Index) const override { return getOriginExpr()->getArg(Index); } @@ -490,27 +490,27 @@ public: /// This may be NULL if the block's origin is unknown. const BlockDataRegion *getBlockRegion() const; - virtual const BlockDecl *getDecl() const { + const BlockDecl *getDecl() const override { const BlockDataRegion *BR = getBlockRegion(); if (!BR) return 0; return BR->getDecl(); } - virtual RuntimeDefinition getRuntimeDefinition() const { + RuntimeDefinition getRuntimeDefinition() const override { return RuntimeDefinition(getDecl()); } - virtual bool argumentsMayEscape() const { + bool argumentsMayEscape() const override { return true; } - virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, - BindingsTy &Bindings) const; + void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, + BindingsTy &Bindings) const override; - virtual ArrayRef<ParmVarDecl*> parameters() const; + ArrayRef<ParmVarDecl*> parameters() const override; - virtual Kind getKind() const { return CE_Block; } + Kind getKind() const override { return CE_Block; } static bool classof(const CallEvent *CA) { return CA->getKind() == CE_Block; @@ -521,7 +521,7 @@ public: /// it is written. class CXXInstanceCall : public AnyFunctionCall { protected: - virtual void getExtraInvalidatedValues(ValueList &Values) const; + void getExtraInvalidatedValues(ValueList &Values) const override; CXXInstanceCall(const CallExpr *CE, ProgramStateRef St, const LocationContext *LCtx) @@ -540,12 +540,12 @@ public: /// \brief Returns the value of the implicit 'this' object. virtual SVal getCXXThisVal() const; - virtual const FunctionDecl *getDecl() const; + const FunctionDecl *getDecl() const override; - virtual RuntimeDefinition getRuntimeDefinition() const; + RuntimeDefinition getRuntimeDefinition() const override; - virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, - BindingsTy &Bindings) const; + void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, + BindingsTy &Bindings) const override; static bool classof(const CallEvent *CA) { return CA->getKind() >= CE_BEG_CXX_INSTANCE_CALLS && @@ -565,28 +565,28 @@ protected: : CXXInstanceCall(CE, St, LCtx) {} CXXMemberCall(const CXXMemberCall &Other) : CXXInstanceCall(Other) {} - virtual void cloneTo(void *Dest) const { new (Dest) CXXMemberCall(*this); } + void cloneTo(void *Dest) const override { new (Dest) CXXMemberCall(*this); } public: virtual const CXXMemberCallExpr *getOriginExpr() const { return cast<CXXMemberCallExpr>(CXXInstanceCall::getOriginExpr()); } - virtual unsigned getNumArgs() const { + unsigned getNumArgs() const override { if (const CallExpr *CE = getOriginExpr()) return CE->getNumArgs(); return 0; } - virtual const Expr *getArgExpr(unsigned Index) const { + const Expr *getArgExpr(unsigned Index) const override { return getOriginExpr()->getArg(Index); } - virtual const Expr *getCXXThisExpr() const; - - virtual RuntimeDefinition getRuntimeDefinition() const; + const Expr *getCXXThisExpr() const override; - virtual Kind getKind() const { return CE_CXXMember; } + RuntimeDefinition getRuntimeDefinition() const override; + + Kind getKind() const override { return CE_CXXMember; } static bool classof(const CallEvent *CA) { return CA->getKind() == CE_CXXMember; @@ -607,7 +607,7 @@ protected: CXXMemberOperatorCall(const CXXMemberOperatorCall &Other) : CXXInstanceCall(Other) {} - virtual void cloneTo(void *Dest) const { + void cloneTo(void *Dest) const override { new (Dest) CXXMemberOperatorCall(*this); } @@ -616,16 +616,16 @@ public: return cast<CXXOperatorCallExpr>(CXXInstanceCall::getOriginExpr()); } - virtual unsigned getNumArgs() const { + unsigned getNumArgs() const override { return getOriginExpr()->getNumArgs() - 1; } - virtual const Expr *getArgExpr(unsigned Index) const { + const Expr *getArgExpr(unsigned Index) const override { return getOriginExpr()->getArg(Index + 1); } - virtual const Expr *getCXXThisExpr() const; + const Expr *getCXXThisExpr() const override; - virtual Kind getKind() const { return CE_CXXMemberOperator; } + Kind getKind() const override { return CE_CXXMemberOperator; } static bool classof(const CallEvent *CA) { return CA->getKind() == CE_CXXMemberOperator; @@ -658,23 +658,23 @@ protected: } CXXDestructorCall(const CXXDestructorCall &Other) : CXXInstanceCall(Other) {} - virtual void cloneTo(void *Dest) const { new (Dest) CXXDestructorCall(*this); } + void cloneTo(void *Dest) const override {new (Dest) CXXDestructorCall(*this);} public: - virtual SourceRange getSourceRange() const { return Location; } - virtual unsigned getNumArgs() const { return 0; } + SourceRange getSourceRange() const override { return Location; } + unsigned getNumArgs() const override { return 0; } - virtual RuntimeDefinition getRuntimeDefinition() const; + RuntimeDefinition getRuntimeDefinition() const override; /// \brief Returns the value of the implicit 'this' object. - virtual SVal getCXXThisVal() const; + SVal getCXXThisVal() const override; /// Returns true if this is a call to a base class destructor. bool isBaseDestructor() const { return DtorDataTy::getFromOpaqueValue(Data).getInt(); } - virtual Kind getKind() const { return CE_CXXDestructor; } + Kind getKind() const override { return CE_CXXDestructor; } static bool classof(const CallEvent *CA) { return CA->getKind() == CE_CXXDestructor; @@ -702,32 +702,32 @@ protected: } CXXConstructorCall(const CXXConstructorCall &Other) : AnyFunctionCall(Other){} - virtual void cloneTo(void *Dest) const { new (Dest) CXXConstructorCall(*this); } + void cloneTo(void *Dest) const override { new (Dest) CXXConstructorCall(*this); } - virtual void getExtraInvalidatedValues(ValueList &Values) const; + void getExtraInvalidatedValues(ValueList &Values) const override; public: virtual const CXXConstructExpr *getOriginExpr() const { return cast<CXXConstructExpr>(AnyFunctionCall::getOriginExpr()); } - virtual const CXXConstructorDecl *getDecl() const { + const CXXConstructorDecl *getDecl() const override { return getOriginExpr()->getConstructor(); } - virtual unsigned getNumArgs() const { return getOriginExpr()->getNumArgs(); } + unsigned getNumArgs() const override { return getOriginExpr()->getNumArgs(); } - virtual const Expr *getArgExpr(unsigned Index) const { + const Expr *getArgExpr(unsigned Index) const override { return getOriginExpr()->getArg(Index); } /// \brief Returns the value of the implicit 'this' object. SVal getCXXThisVal() const; - virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, - BindingsTy &Bindings) const; + void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, + BindingsTy &Bindings) const override; - virtual Kind getKind() const { return CE_CXXConstructor; } + Kind getKind() const override { return CE_CXXConstructor; } static bool classof(const CallEvent *CA) { return CA->getKind() == CE_CXXConstructor; @@ -746,29 +746,29 @@ protected: : AnyFunctionCall(E, St, LCtx) {} CXXAllocatorCall(const CXXAllocatorCall &Other) : AnyFunctionCall(Other) {} - virtual void cloneTo(void *Dest) const { new (Dest) CXXAllocatorCall(*this); } + void cloneTo(void *Dest) const override { new (Dest) CXXAllocatorCall(*this); } public: virtual const CXXNewExpr *getOriginExpr() const { return cast<CXXNewExpr>(AnyFunctionCall::getOriginExpr()); } - virtual const FunctionDecl *getDecl() const { + const FunctionDecl *getDecl() const override { return getOriginExpr()->getOperatorNew(); } - virtual unsigned getNumArgs() const { + unsigned getNumArgs() const override { return getOriginExpr()->getNumPlacementArgs() + 1; } - virtual const Expr *getArgExpr(unsigned Index) const { + const Expr *getArgExpr(unsigned Index) const override { // The first argument of an allocator call is the size of the allocation. if (Index == 0) return 0; return getOriginExpr()->getPlacementArg(Index - 1); } - virtual Kind getKind() const { return CE_CXXAllocator; } + Kind getKind() const override { return CE_CXXAllocator; } static bool classof(const CallEvent *CE) { return CE->getKind() == CE_CXXAllocator; @@ -801,9 +801,9 @@ protected: } ObjCMethodCall(const ObjCMethodCall &Other) : CallEvent(Other) {} - virtual void cloneTo(void *Dest) const { new (Dest) ObjCMethodCall(*this); } + void cloneTo(void *Dest) const override { new (Dest) ObjCMethodCall(*this); } - virtual void getExtraInvalidatedValues(ValueList &Values) const; + void getExtraInvalidatedValues(ValueList &Values) const override; /// Check if the selector may have multiple definitions (may have overrides). virtual bool canBeOverridenInSubclass(ObjCInterfaceDecl *IDecl, @@ -813,13 +813,13 @@ public: virtual const ObjCMessageExpr *getOriginExpr() const { return cast<ObjCMessageExpr>(CallEvent::getOriginExpr()); } - virtual const ObjCMethodDecl *getDecl() const { + const ObjCMethodDecl *getDecl() const override { return getOriginExpr()->getMethodDecl(); } - virtual unsigned getNumArgs() const { + unsigned getNumArgs() const override { return getOriginExpr()->getNumArgs(); } - virtual const Expr *getArgExpr(unsigned Index) const { + const Expr *getArgExpr(unsigned Index) const override { return getOriginExpr()->getArg(Index); } @@ -833,7 +833,7 @@ public: return getOriginExpr()->getSelector(); } - virtual SourceRange getSourceRange() const; + SourceRange getSourceRange() const override; /// \brief Returns the value of the receiver at the time of this call. SVal getReceiverSVal() const; @@ -870,16 +870,16 @@ public: llvm_unreachable("Unknown message kind"); } - virtual RuntimeDefinition getRuntimeDefinition() const; + RuntimeDefinition getRuntimeDefinition() const override; - virtual bool argumentsMayEscape() const; + bool argumentsMayEscape() const override; - virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, - BindingsTy &Bindings) const; + void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, + BindingsTy &Bindings) const override; - virtual ArrayRef<ParmVarDecl*> parameters() const; + ArrayRef<ParmVarDecl*> parameters() const override; - virtual Kind getKind() const { return CE_ObjCMessage; } + Kind getKind() const override { return CE_ObjCMessage; } static bool classof(const CallEvent *CA) { return CA->getKind() == CE_ObjCMessage; diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h index 903c686d7d8..14a0417b7ef 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h @@ -312,7 +312,7 @@ public: /// \class NodeBuilderWithSinks /// \brief This node builder keeps track of the generated sink nodes. class NodeBuilderWithSinks: public NodeBuilder { - virtual void anchor(); + void anchor() override; protected: SmallVector<ExplodedNode*, 2> sinksGenerated; ProgramPoint &Location; @@ -399,7 +399,7 @@ public: /// \brief BranchNodeBuilder is responsible for constructing the nodes /// corresponding to the two branches of the if statement - true and false. class BranchNodeBuilder: public NodeBuilder { - virtual void anchor(); + void anchor() override; const CFGBlock *DstT; const CFGBlock *DstF; diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h index 4ef0a8ba350..2fbe5657303 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h @@ -122,7 +122,7 @@ public: /// getContext - Return the ASTContext associated with this analysis. ASTContext &getContext() const { return AMgr.getASTContext(); } - virtual AnalysisManager &getAnalysisManager() { return AMgr; } + AnalysisManager &getAnalysisManager() override { return AMgr; } CheckerManager &getCheckerManager() const { return *AMgr.getCheckerManager(); @@ -154,7 +154,7 @@ public: /// getInitialState - Return the initial state used for the root vertex /// in the ExplodedGraph. - ProgramStateRef getInitialState(const LocationContext *InitLoc); + ProgramStateRef getInitialState(const LocationContext *InitLoc) override; ExplodedGraph& getGraph() { return G; } const ExplodedGraph& getGraph() const { return G; } @@ -192,7 +192,7 @@ public: /// processCFGElement - Called by CoreEngine. Used to generate new successor /// nodes by processing the 'effects' of a CFG element. void processCFGElement(const CFGElement E, ExplodedNode *Pred, - unsigned StmtIdx, NodeBuilderContext *Ctx); + unsigned StmtIdx, NodeBuilderContext *Ctx) override; void ProcessStmt(const CFGStmt S, ExplodedNode *Pred); @@ -214,10 +214,10 @@ public: ExplodedNode *Pred, ExplodedNodeSet &Dst); /// Called by CoreEngine when processing the entrance of a CFGBlock. - virtual void processCFGBlockEntrance(const BlockEdge &L, - NodeBuilderWithSinks &nodeBuilder, - ExplodedNode *Pred); - + void processCFGBlockEntrance(const BlockEdge &L, + NodeBuilderWithSinks &nodeBuilder, + ExplodedNode *Pred) override; + /// ProcessBranch - Called by CoreEngine. Used to generate successor /// nodes by processing the 'effects' of a branch condition. void processBranch(const Stmt *Condition, const Stmt *Term, @@ -225,7 +225,7 @@ public: ExplodedNode *Pred, ExplodedNodeSet &Dst, const CFGBlock *DstT, - const CFGBlock *DstF); + const CFGBlock *DstF) override; /// Called by CoreEngine. Used to processing branching behavior /// at static initalizers. @@ -234,20 +234,20 @@ public: ExplodedNode *Pred, ExplodedNodeSet &Dst, const CFGBlock *DstT, - const CFGBlock *DstF); + const CFGBlock *DstF) override; /// processIndirectGoto - Called by CoreEngine. Used to generate successor /// nodes by processing the 'effects' of a computed goto jump. - void processIndirectGoto(IndirectGotoNodeBuilder& builder); + void processIndirectGoto(IndirectGotoNodeBuilder& builder) override; /// ProcessSwitch - Called by CoreEngine. Used to generate successor /// nodes by processing the 'effects' of a switch statement. - void processSwitch(SwitchNodeBuilder& builder); + void processSwitch(SwitchNodeBuilder& builder) override; /// Called by CoreEngine. Used to generate end-of-path /// nodes when the control reaches the end of a function. void processEndOfFunction(NodeBuilderContext& BC, - ExplodedNode *Pred); + ExplodedNode *Pred) override; /// Remove dead bindings/symbols before exiting a function. void removeDeadOnEndOfFunction(NodeBuilderContext& BC, @@ -255,22 +255,23 @@ public: ExplodedNodeSet &Dst); /// Generate the entry node of the callee. - void processCallEnter(CallEnter CE, ExplodedNode *Pred); + void processCallEnter(CallEnter CE, ExplodedNode *Pred) override; /// Generate the sequence of nodes that simulate the call exit and the post /// visit for CallExpr. - void processCallExit(ExplodedNode *Pred); + void processCallExit(ExplodedNode *Pred) override; /// Called by CoreEngine when the analysis worklist has terminated. - void processEndWorklist(bool hasWorkRemaining); + void processEndWorklist(bool hasWorkRemaining) override; /// evalAssume - Callback function invoked by the ConstraintManager when /// making assumptions about state values. - ProgramStateRef processAssume(ProgramStateRef state, SVal cond,bool assumption); + ProgramStateRef processAssume(ProgramStateRef state, SVal cond, + bool assumption) override; /// wantsRegionChangeUpdate - Called by ProgramStateManager to determine if a /// region change should trigger a processRegionChanges update. - bool wantsRegionChangeUpdate(ProgramStateRef state); + bool wantsRegionChangeUpdate(ProgramStateRef state) override; /// processRegionChanges - Called by ProgramStateManager whenever a change is made /// to the store. Used to update checkers that track region values. @@ -279,13 +280,13 @@ public: const InvalidatedSymbols *invalidated, ArrayRef<const MemRegion *> ExplicitRegions, ArrayRef<const MemRegion *> Regions, - const CallEvent *Call); + const CallEvent *Call) override; /// printState - Called by ProgramStateManager to print checker-specific data. void printState(raw_ostream &Out, ProgramStateRef State, - const char *NL, const char *Sep); + const char *NL, const char *Sep) override; - virtual ProgramStateManager& getStateManager() { return StateMgr; } + ProgramStateManager& getStateManager() override { return StateMgr; } StoreManager& getStoreManager() { return StateMgr.getStoreManager(); } @@ -480,17 +481,17 @@ protected: /// Call PointerEscape callback when a value escapes as a result of bind. ProgramStateRef processPointerEscapedOnBind(ProgramStateRef State, - SVal Loc, SVal Val); + SVal Loc, SVal Val) override; /// Call PointerEscape callback when a value escapes as a result of /// region invalidation. /// \param[in] ITraits Specifies invalidation traits for regions/symbols. ProgramStateRef notifyCheckersOfPointerEscape( - ProgramStateRef State, - const InvalidatedSymbols *Invalidated, - ArrayRef<const MemRegion *> ExplicitRegions, - ArrayRef<const MemRegion *> Regions, - const CallEvent *Call, - RegionAndSymbolInvalidationTraits &ITraits); + ProgramStateRef State, + const InvalidatedSymbols *Invalidated, + ArrayRef<const MemRegion *> ExplicitRegions, + ArrayRef<const MemRegion *> Regions, + const CallEvent *Call, + RegionAndSymbolInvalidationTraits &ITraits) override; public: // FIXME: 'tag' should be removed, and a LocationContext should be used diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h index cc790c1b6b3..6b03519b44e 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h @@ -204,12 +204,12 @@ protected: assert(classof(this)); } - MemRegionManager* getMemRegionManager() const { return Mgr; } + MemRegionManager* getMemRegionManager() const override { return Mgr; } public: - bool isBoundable() const { return false; } - - void Profile(llvm::FoldingSetNodeID &ID) const; + bool isBoundable() const override { return false; } + + void Profile(llvm::FoldingSetNodeID &ID) const override; static bool classof(const MemRegion *R) { Kind k = R->getKind(); @@ -243,9 +243,9 @@ class StaticGlobalSpaceRegion : public GlobalsSpaceRegion { : GlobalsSpaceRegion(mgr, StaticGlobalSpaceRegionKind), CR(cr) {} public: - void Profile(llvm::FoldingSetNodeID &ID) const; - - void dumpToStream(raw_ostream &os) const; + void Profile(llvm::FoldingSetNodeID &ID) const override; + + void dumpToStream(raw_ostream &os) const override; const CodeTextRegion *getCodeRegion() const { return CR; } @@ -286,7 +286,7 @@ class GlobalSystemSpaceRegion : public NonStaticGlobalSpaceRegion { public: - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static bool classof(const MemRegion *R) { return R->getKind() == GlobalSystemSpaceRegionKind; @@ -306,7 +306,7 @@ class GlobalImmutableSpaceRegion : public NonStaticGlobalSpaceRegion { public: - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static bool classof(const MemRegion *R) { return R->getKind() == GlobalImmutableSpaceRegionKind; @@ -324,7 +324,7 @@ class GlobalInternalSpaceRegion : public NonStaticGlobalSpaceRegion { public: - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static bool classof(const MemRegion *R) { return R->getKind() == GlobalInternalSpaceRegionKind; @@ -339,7 +339,7 @@ class HeapSpaceRegion : public MemSpaceRegion { : MemSpaceRegion(mgr, HeapSpaceRegionKind) {} public: - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static bool classof(const MemRegion *R) { return R->getKind() == HeapSpaceRegionKind; @@ -353,7 +353,7 @@ class UnknownSpaceRegion : public MemSpaceRegion { : MemSpaceRegion(mgr, UnknownSpaceRegionKind) {} public: - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static bool classof(const MemRegion *R) { return R->getKind() == UnknownSpaceRegionKind; @@ -373,7 +373,7 @@ protected: public: const StackFrameContext *getStackFrame() const { return SFC; } - void Profile(llvm::FoldingSetNodeID &ID) const; + void Profile(llvm::FoldingSetNodeID &ID) const override; static bool classof(const MemRegion *R) { Kind k = R->getKind(); @@ -389,7 +389,7 @@ class StackLocalsSpaceRegion : public StackSpaceRegion { : StackSpaceRegion(mgr, StackLocalsSpaceRegionKind, sfc) {} public: - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static bool classof(const MemRegion *R) { return R->getKind() == StackLocalsSpaceRegionKind; @@ -404,7 +404,7 @@ private: : StackSpaceRegion(mgr, StackArgumentsSpaceRegionKind, sfc) {} public: - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static bool classof(const MemRegion *R) { return R->getKind() == StackArgumentsSpaceRegionKind; @@ -430,9 +430,9 @@ public: return UnknownVal(); } - MemRegionManager* getMemRegionManager() const; + MemRegionManager* getMemRegionManager() const override; - virtual bool isSubRegionOf(const MemRegion* R) const; + bool isSubRegionOf(const MemRegion* R) const override; static bool classof(const MemRegion* R) { return R->getKind() > END_MEMSPACES; @@ -459,16 +459,16 @@ public: const Expr *getExpr() const { return Ex; } - bool isBoundable() const { return true; } + bool isBoundable() const override { return true; } - DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const; + DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override; - void Profile(llvm::FoldingSetNodeID& ID) const; + void Profile(llvm::FoldingSetNodeID& ID) const override; static void ProfileRegion(llvm::FoldingSetNodeID& ID, const Expr *Ex, unsigned Cnt, const MemRegion *superRegion); - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static bool classof(const MemRegion* R) { return R->getKind() == AllocaRegionKind; @@ -478,7 +478,7 @@ public: /// TypedRegion - An abstract class representing regions that are typed. class TypedRegion : public SubRegion { public: - virtual void anchor(); + void anchor() override; protected: TypedRegion(const MemRegion* sReg, Kind k) : SubRegion(sReg, k) {} @@ -489,7 +489,7 @@ public: return getLocationType().getDesugaredType(Context); } - bool isBoundable() const { return true; } + bool isBoundable() const override { return true; } static bool classof(const MemRegion* R) { unsigned k = R->getKind(); @@ -500,14 +500,14 @@ public: /// TypedValueRegion - An abstract class representing regions having a typed value. class TypedValueRegion : public TypedRegion { public: - virtual void anchor(); + void anchor() override; protected: TypedValueRegion(const MemRegion* sReg, Kind k) : TypedRegion(sReg, k) {} public: virtual QualType getValueType() const = 0; - virtual QualType getLocationType() const { + QualType getLocationType() const override { // FIXME: We can possibly optimize this later to cache this value. QualType T = getValueType(); ASTContext &ctx = getContext(); @@ -521,7 +521,7 @@ public: return T.getTypePtrOrNull() ? T.getDesugaredType(Context) : T; } - DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const; + DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override; static bool classof(const MemRegion* R) { unsigned k = R->getKind(); @@ -532,12 +532,12 @@ public: class CodeTextRegion : public TypedRegion { public: - virtual void anchor(); + void anchor() override; protected: CodeTextRegion(const MemRegion *sreg, Kind k) : TypedRegion(sreg, k) {} public: - bool isBoundable() const { return false; } - + bool isBoundable() const override { return false; } + static bool classof(const MemRegion* R) { Kind k = R->getKind(); return k >= FunctionTextRegionKind && k <= BlockTextRegionKind; @@ -552,8 +552,8 @@ public: : CodeTextRegion(sreg, FunctionTextRegionKind), FD(fd) { assert(isa<ObjCMethodDecl>(fd) || isa<FunctionDecl>(fd)); } - - QualType getLocationType() const { + + QualType getLocationType() const override { const ASTContext &Ctx = getContext(); if (const FunctionDecl *D = dyn_cast<FunctionDecl>(FD)) { return Ctx.getPointerType(D->getType()); @@ -570,11 +570,11 @@ public: const NamedDecl *getDecl() const { return FD; } - - virtual void dumpToStream(raw_ostream &os) const; - - void Profile(llvm::FoldingSetNodeID& ID) const; - + + void dumpToStream(raw_ostream &os) const override; + + void Profile(llvm::FoldingSetNodeID& ID) const override; + static void ProfileRegion(llvm::FoldingSetNodeID& ID, const NamedDecl *FD, const MemRegion*); @@ -602,7 +602,7 @@ class BlockTextRegion : public CodeTextRegion { : CodeTextRegion(sreg, BlockTextRegionKind), BD(bd), AC(ac), locTy(lTy) {} public: - QualType getLocationType() const { + QualType getLocationType() const override { return locTy; } @@ -611,11 +611,11 @@ public: } AnalysisDeclContext *getAnalysisDeclContext() const { return AC; } - - virtual void dumpToStream(raw_ostream &os) const; - - void Profile(llvm::FoldingSetNodeID& ID) const; - + + virtual void dumpToStream(raw_ostream &os) const override; + + void Profile(llvm::FoldingSetNodeID& ID) const override; + static void ProfileRegion(llvm::FoldingSetNodeID& ID, const BlockDecl *BD, CanQualType, const AnalysisDeclContext*, const MemRegion*); @@ -650,8 +650,8 @@ public: const BlockDecl *getDecl() const { return BC->getDecl(); } - QualType getLocationType() const { return BC->getLocationType(); } - + QualType getLocationType() const override { return BC->getLocationType(); } + class referenced_vars_iterator { const MemRegion * const *R; const MemRegion * const *OriginalR; @@ -688,11 +688,11 @@ public: referenced_vars_iterator referenced_vars_begin() const; referenced_vars_iterator referenced_vars_end() const; - - virtual void dumpToStream(raw_ostream &os) const; - - void Profile(llvm::FoldingSetNodeID& ID) const; - + + void dumpToStream(raw_ostream &os) const override; + + void Profile(llvm::FoldingSetNodeID& ID) const override; + static void ProfileRegion(llvm::FoldingSetNodeID&, const BlockTextRegion *, const LocationContext *, unsigned, const MemRegion *); @@ -723,17 +723,17 @@ public: return sym; } - bool isBoundable() const { return true; } + bool isBoundable() const override { return true; } - DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const; + DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override; - void Profile(llvm::FoldingSetNodeID& ID) const; + void Profile(llvm::FoldingSetNodeID& ID) const override; static void ProfileRegion(llvm::FoldingSetNodeID& ID, SymbolRef sym, const MemRegion* superRegion); - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static bool classof(const MemRegion* R) { return R->getKind() == SymbolicRegionKind; @@ -757,19 +757,19 @@ public: const StringLiteral* getStringLiteral() const { return Str; } - QualType getValueType() const { + QualType getValueType() const override { return Str->getType(); } - DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const; + DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override; - bool isBoundable() const { return false; } + bool isBoundable() const override { return false; } - void Profile(llvm::FoldingSetNodeID& ID) const { + void Profile(llvm::FoldingSetNodeID& ID) const override { ProfileRegion(ID, Str, superRegion); } - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static bool classof(const MemRegion* R) { return R->getKind() == StringRegionKind; @@ -792,19 +792,19 @@ protected: public: const ObjCStringLiteral* getObjCStringLiteral() const { return Str; } - - QualType getValueType() const { + + QualType getValueType() const override { return Str->getType(); } - - bool isBoundable() const { return false; } - - void Profile(llvm::FoldingSetNodeID& ID) const { + + bool isBoundable() const override { return false; } + + void Profile(llvm::FoldingSetNodeID& ID) const override { ProfileRegion(ID, Str, superRegion); } - - void dumpToStream(raw_ostream &os) const; - + + void dumpToStream(raw_ostream &os) const override; + static bool classof(const MemRegion* R) { return R->getKind() == ObjCStringRegionKind; } @@ -825,15 +825,15 @@ private: const CompoundLiteralExpr *CL, const MemRegion* superRegion); public: - QualType getValueType() const { + QualType getValueType() const override { return CL->getType(); } - bool isBoundable() const { return !CL->isFileScope(); } + bool isBoundable() const override { return !CL->isFileScope(); } - void Profile(llvm::FoldingSetNodeID& ID) const; + void Profile(llvm::FoldingSetNodeID& ID) const override; - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; const CompoundLiteralExpr *getLiteralExpr() const { return CL; } @@ -854,7 +854,7 @@ protected: public: const Decl *getDecl() const { return D; } - void Profile(llvm::FoldingSetNodeID& ID) const; + void Profile(llvm::FoldingSetNodeID& ID) const override; static bool classof(const MemRegion* R) { unsigned k = R->getKind(); @@ -874,27 +874,27 @@ class VarRegion : public DeclRegion { DeclRegion::ProfileRegion(ID, VD, superRegion, VarRegionKind); } - void Profile(llvm::FoldingSetNodeID& ID) const; + void Profile(llvm::FoldingSetNodeID& ID) const override; public: const VarDecl *getDecl() const { return cast<VarDecl>(D); } const StackFrameContext *getStackFrame() const; - - QualType getValueType() const { + + QualType getValueType() const override { // FIXME: We can cache this if needed. return getDecl()->getType(); } - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static bool classof(const MemRegion* R) { return R->getKind() == VarRegionKind; } - bool canPrintPrettyAsExpr() const; + bool canPrintPrettyAsExpr() const override; - void printPrettyAsExpr(raw_ostream &os) const; + void printPrettyAsExpr(raw_ostream &os) const override; }; /// CXXThisRegion - Represents the region for the implicit 'this' parameter @@ -910,15 +910,15 @@ class CXXThisRegion : public TypedValueRegion { const PointerType *PT, const MemRegion *sReg); - void Profile(llvm::FoldingSetNodeID &ID) const; + void Profile(llvm::FoldingSetNodeID &ID) const override; -public: - QualType getValueType() const { +public: + QualType getValueType() const override { return QualType(ThisPointerTy, 0); } - void dumpToStream(raw_ostream &os) const; - + void dumpToStream(raw_ostream &os) const override; + static bool classof(const MemRegion* R) { return R->getKind() == CXXThisRegionKind; } @@ -936,12 +936,12 @@ class FieldRegion : public DeclRegion { public: const FieldDecl *getDecl() const { return cast<FieldDecl>(D); } - QualType getValueType() const { + QualType getValueType() const override { // FIXME: We can cache this if needed. return getDecl()->getType(); } - DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const; + DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override; static void ProfileRegion(llvm::FoldingSetNodeID& ID, const FieldDecl *FD, const MemRegion* superRegion) { @@ -952,12 +952,12 @@ public: return R->getKind() == FieldRegionKind; } - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; - bool canPrintPretty() const; - void printPretty(raw_ostream &os) const; - bool canPrintPrettyAsExpr() const; - void printPrettyAsExpr(raw_ostream &os) const; + bool canPrintPretty() const override; + void printPretty(raw_ostream &os) const override; + bool canPrintPrettyAsExpr() const override; + void printPrettyAsExpr(raw_ostream &os) const override; }; class ObjCIvarRegion : public DeclRegion { @@ -971,12 +971,12 @@ class ObjCIvarRegion : public DeclRegion { public: const ObjCIvarDecl *getDecl() const; - QualType getValueType() const; + QualType getValueType() const override; - bool canPrintPrettyAsExpr() const; - void printPrettyAsExpr(raw_ostream &os) const; + bool canPrintPrettyAsExpr() const override; + void printPrettyAsExpr(raw_ostream &os) const override; - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static bool classof(const MemRegion* R) { return R->getKind() == ObjCIvarRegionKind; @@ -1029,7 +1029,7 @@ public: NonLoc getIndex() const { return Index; } - QualType getValueType() const { + QualType getValueType() const override { return ElementType; } @@ -1039,9 +1039,9 @@ public: /// Compute the offset within the array. The array might also be a subobject. RegionRawOffset getAsArrayOffset() const; - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; - void Profile(llvm::FoldingSetNodeID& ID) const; + void Profile(llvm::FoldingSetNodeID& ID) const override; static bool classof(const MemRegion* R) { return R->getKind() == ElementRegionKind; @@ -1063,13 +1063,13 @@ class CXXTempObjectRegion : public TypedValueRegion { public: const Expr *getExpr() const { return Ex; } - QualType getValueType() const { + QualType getValueType() const override { return Ex->getType(); } - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; - void Profile(llvm::FoldingSetNodeID &ID) const; + void Profile(llvm::FoldingSetNodeID &ID) const override; static bool classof(const MemRegion* R) { return R->getKind() == CXXTempObjectRegionKind; @@ -1094,19 +1094,19 @@ public: const CXXRecordDecl *getDecl() const { return Data.getPointer(); } bool isVirtual() const { return Data.getInt(); } - QualType getValueType() const; + QualType getValueType() const override; - void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; - void Profile(llvm::FoldingSetNodeID &ID) const; + void Profile(llvm::FoldingSetNodeID &ID) const override; static bool classof(const MemRegion *region) { return region->getKind() == CXXBaseObjectRegionKind; } - bool canPrintPrettyAsExpr() const; - - void printPrettyAsExpr(raw_ostream &os) const; + bool canPrintPrettyAsExpr() const override; + + void printPrettyAsExpr(raw_ostream &os) const override; }; template<typename RegionTy> diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h index 530dae59892..a6da2e1e344 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h @@ -223,7 +223,7 @@ public: FindUniqueBinding(SymbolRef sym) : Sym(sym), Binding(0), First(true) {} bool HandleBinding(StoreManager& SMgr, Store store, const MemRegion* R, - SVal val); + SVal val) override; LLVM_EXPLICIT operator bool() { return First && Binding; } const MemRegion *getRegion() { return Binding; } }; diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h index 914b2bea2d1..0827e35dbea 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h @@ -105,7 +105,7 @@ typedef unsigned SymbolID; /// \brief A symbol representing data which can be stored in a memory location /// (region). class SymbolData : public SymExpr { - virtual void anchor(); + void anchor() override; const SymbolID Sym; protected: @@ -138,13 +138,13 @@ public: profile.AddPointer(R); } - virtual void Profile(llvm::FoldingSetNodeID& profile) { + void Profile(llvm::FoldingSetNodeID& profile) override { Profile(profile, R); } - virtual void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; - QualType getType() const; + QualType getType() const override; // Implement isa<T> support. static inline bool classof(const SymExpr *SE) { @@ -173,9 +173,9 @@ public: unsigned getCount() const { return Count; } const void *getTag() const { return SymbolTag; } - QualType getType() const; + QualType getType() const override; - virtual void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static void Profile(llvm::FoldingSetNodeID& profile, const Stmt *S, QualType T, unsigned Count, const LocationContext *LCtx, @@ -188,7 +188,7 @@ public: profile.AddPointer(SymbolTag); } - virtual void Profile(llvm::FoldingSetNodeID& profile) { + void Profile(llvm::FoldingSetNodeID& profile) override { Profile(profile, S, T, Count, LCtx, SymbolTag); } @@ -211,9 +211,9 @@ public: SymbolRef getParentSymbol() const { return parentSymbol; } const TypedValueRegion *getRegion() const { return R; } - QualType getType() const; + QualType getType() const override; - virtual void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static void Profile(llvm::FoldingSetNodeID& profile, SymbolRef parent, const TypedValueRegion *r) { @@ -222,7 +222,7 @@ public: profile.AddPointer(parent); } - virtual void Profile(llvm::FoldingSetNodeID& profile) { + void Profile(llvm::FoldingSetNodeID& profile) override { Profile(profile, parentSymbol, R); } @@ -244,16 +244,16 @@ public: const SubRegion *getRegion() const { return R; } - QualType getType() const; + QualType getType() const override; - virtual void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static void Profile(llvm::FoldingSetNodeID& profile, const SubRegion *R) { profile.AddInteger((unsigned) ExtentKind); profile.AddPointer(R); } - virtual void Profile(llvm::FoldingSetNodeID& profile) { + void Profile(llvm::FoldingSetNodeID& profile) override { Profile(profile, R); } @@ -283,9 +283,9 @@ public: unsigned getCount() const { return Count; } const void *getTag() const { return Tag; } - QualType getType() const; + QualType getType() const override; - virtual void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static void Profile(llvm::FoldingSetNodeID& profile, const MemRegion *R, const Stmt *S, QualType T, unsigned Count, @@ -298,7 +298,7 @@ public: profile.AddPointer(Tag); } - virtual void Profile(llvm::FoldingSetNodeID& profile) { + void Profile(llvm::FoldingSetNodeID& profile) override { Profile(profile, R, S, T, Count, Tag); } @@ -320,11 +320,11 @@ public: SymbolCast(const SymExpr *In, QualType From, QualType To) : SymExpr(CastSymbolKind), Operand(In), FromTy(From), ToTy(To) { } - QualType getType() const { return ToTy; } + QualType getType() const override { return ToTy; } const SymExpr *getOperand() const { return Operand; } - virtual void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static void Profile(llvm::FoldingSetNodeID& ID, const SymExpr *In, QualType From, QualType To) { @@ -334,7 +334,7 @@ public: ID.Add(To); } - void Profile(llvm::FoldingSetNodeID& ID) { + void Profile(llvm::FoldingSetNodeID& ID) override { Profile(ID, Operand, FromTy, ToTy); } @@ -356,7 +356,7 @@ protected: public: // FIXME: We probably need to make this out-of-line to avoid redundant // generation of virtual functions. - QualType getType() const { return T; } + QualType getType() const override { return T; } BinaryOperator::Opcode getOpcode() const { return Op; } @@ -377,7 +377,7 @@ public: const llvm::APSInt& rhs, QualType t) : BinarySymExpr(SymIntKind, op, t), LHS(lhs), RHS(rhs) {} - virtual void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; const SymExpr *getLHS() const { return LHS; } const llvm::APSInt &getRHS() const { return RHS; } @@ -392,7 +392,7 @@ public: ID.Add(t); } - void Profile(llvm::FoldingSetNodeID& ID) { + void Profile(llvm::FoldingSetNodeID& ID) override { Profile(ID, LHS, getOpcode(), RHS, getType()); } @@ -412,7 +412,7 @@ public: const SymExpr *rhs, QualType t) : BinarySymExpr(IntSymKind, op, t), LHS(lhs), RHS(rhs) {} - virtual void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; const SymExpr *getRHS() const { return RHS; } const llvm::APSInt &getLHS() const { return LHS; } @@ -427,7 +427,7 @@ public: ID.Add(t); } - void Profile(llvm::FoldingSetNodeID& ID) { + void Profile(llvm::FoldingSetNodeID& ID) override { Profile(ID, LHS, getOpcode(), RHS, getType()); } @@ -450,7 +450,7 @@ public: const SymExpr *getLHS() const { return LHS; } const SymExpr *getRHS() const { return RHS; } - virtual void dumpToStream(raw_ostream &os) const; + void dumpToStream(raw_ostream &os) const override; static void Profile(llvm::FoldingSetNodeID& ID, const SymExpr *lhs, BinaryOperator::Opcode op, const SymExpr *rhs, QualType t) { @@ -461,7 +461,7 @@ public: ID.Add(t); } - void Profile(llvm::FoldingSetNodeID& ID) { + void Profile(llvm::FoldingSetNodeID& ID) override { Profile(ID, LHS, getOpcode(), RHS, getType()); } diff --git a/clang/include/clang/StaticAnalyzer/Frontend/FrontendActions.h b/clang/include/clang/StaticAnalyzer/Frontend/FrontendActions.h index 838ac925533..21ecfc234fb 100644 --- a/clang/include/clang/StaticAnalyzer/Frontend/FrontendActions.h +++ b/clang/include/clang/StaticAnalyzer/Frontend/FrontendActions.h @@ -22,8 +22,8 @@ namespace ento { class AnalysisAction : public ASTFrontendAction { protected: - virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - StringRef InFile); + ASTConsumer *CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) override; }; void printCheckerHelp(raw_ostream &OS, ArrayRef<std::string> plugins); diff --git a/clang/include/clang/Tooling/ArgumentsAdjusters.h b/clang/include/clang/Tooling/ArgumentsAdjusters.h index 71acef8650f..765e7d2e051 100644 --- a/clang/include/clang/Tooling/ArgumentsAdjusters.h +++ b/clang/include/clang/Tooling/ArgumentsAdjusters.h @@ -49,13 +49,13 @@ public: /// This class implements ArgumentsAdjuster interface and converts input /// command line arguments to the "syntax check only" variant. class ClangSyntaxOnlyAdjuster : public ArgumentsAdjuster { - virtual CommandLineArguments Adjust(const CommandLineArguments &Args); + CommandLineArguments Adjust(const CommandLineArguments &Args) override; }; /// \brief An argument adjuster which removes output-related command line /// arguments. class ClangStripOutputAdjuster : public ArgumentsAdjuster { - virtual CommandLineArguments Adjust(const CommandLineArguments &Args); + CommandLineArguments Adjust(const CommandLineArguments &Args) override; }; } // end namespace tooling diff --git a/clang/include/clang/Tooling/CompilationDatabase.h b/clang/include/clang/Tooling/CompilationDatabase.h index 3edd0d164b9..d1e729a88b2 100644 --- a/clang/include/clang/Tooling/CompilationDatabase.h +++ b/clang/include/clang/Tooling/CompilationDatabase.h @@ -190,19 +190,19 @@ public: /// Will always return a vector with one entry that contains the directory /// and command line specified at construction with "clang-tool" as argv[0] /// and 'FilePath' as positional argument. - virtual std::vector<CompileCommand> getCompileCommands( - StringRef FilePath) const; + std::vector<CompileCommand> + getCompileCommands(StringRef FilePath) const override; /// \brief Returns the list of all files available in the compilation database. /// /// Note: This is always an empty list for the fixed compilation database. - virtual std::vector<std::string> getAllFiles() const; + std::vector<std::string> getAllFiles() const override; /// \brief Returns all compile commands for all the files in the compilation /// database. /// /// Note: This is always an empty list for the fixed compilation database. - virtual std::vector<CompileCommand> getAllCompileCommands() const; + std::vector<CompileCommand> getAllCompileCommands() const override; private: /// This is built up to contain a single entry vector to be returned from diff --git a/clang/include/clang/Tooling/JSONCompilationDatabase.h b/clang/include/clang/Tooling/JSONCompilationDatabase.h index dc191e90bae..1b333596859 100644 --- a/clang/include/clang/Tooling/JSONCompilationDatabase.h +++ b/clang/include/clang/Tooling/JSONCompilationDatabase.h @@ -67,17 +67,17 @@ public: /// /// FIXME: Currently FilePath must be an absolute path inside the /// source directory which does not have symlinks resolved. - virtual std::vector<CompileCommand> getCompileCommands( - StringRef FilePath) const; + std::vector<CompileCommand> + getCompileCommands(StringRef FilePath) const override; /// \brief Returns the list of all files available in the compilation database. /// /// These are the 'file' entries of the JSON objects. - virtual std::vector<std::string> getAllFiles() const; + std::vector<std::string> getAllFiles() const override; /// \brief Returns all compile commands for all the files in the compilation /// database. - virtual std::vector<CompileCommand> getAllCompileCommands() const; + std::vector<CompileCommand> getAllCompileCommands() const override; private: /// \brief Constructs a JSON compilation database on a memory buffer. diff --git a/clang/include/clang/Tooling/RefactoringCallbacks.h b/clang/include/clang/Tooling/RefactoringCallbacks.h index c500f356a4d..19f277431a3 100644 --- a/clang/include/clang/Tooling/RefactoringCallbacks.h +++ b/clang/include/clang/Tooling/RefactoringCallbacks.h @@ -52,7 +52,7 @@ protected: class ReplaceStmtWithText : public RefactoringCallback { public: ReplaceStmtWithText(StringRef FromId, StringRef ToText); - virtual void run(const ast_matchers::MatchFinder::MatchResult &Result); + void run(const ast_matchers::MatchFinder::MatchResult &Result) override; private: std::string FromId; @@ -64,7 +64,7 @@ private: class ReplaceStmtWithStmt : public RefactoringCallback { public: ReplaceStmtWithStmt(StringRef FromId, StringRef ToId); - virtual void run(const ast_matchers::MatchFinder::MatchResult &Result); + void run(const ast_matchers::MatchFinder::MatchResult &Result) override; private: std::string FromId; @@ -77,7 +77,7 @@ private: class ReplaceIfStmtWithItsBody : public RefactoringCallback { public: ReplaceIfStmtWithItsBody(StringRef Id, bool PickTrueBranch); - virtual void run(const ast_matchers::MatchFinder::MatchResult &Result); + void run(const ast_matchers::MatchFinder::MatchResult &Result) override; private: std::string Id; diff --git a/clang/include/clang/Tooling/Tooling.h b/clang/include/clang/Tooling/Tooling.h index 19da834900a..88188b613a3 100644 --- a/clang/include/clang/Tooling/Tooling.h +++ b/clang/include/clang/Tooling/Tooling.h @@ -80,7 +80,7 @@ public: /// \brief Invokes the compiler with a FrontendAction created by create(). bool runInvocation(clang::CompilerInvocation *Invocation, FileManager *Files, - DiagnosticConsumer *DiagConsumer); + DiagnosticConsumer *DiagConsumer) override; /// \brief Returns a new clang::FrontendAction. /// @@ -306,7 +306,7 @@ template <typename T> FrontendActionFactory *newFrontendActionFactory() { class SimpleFrontendActionFactory : public FrontendActionFactory { public: - virtual clang::FrontendAction *create() { return new T; } + clang::FrontendAction *create() override { return new T; } }; return new SimpleFrontendActionFactory; @@ -321,7 +321,7 @@ inline FrontendActionFactory *newFrontendActionFactory( SourceFileCallbacks *Callbacks) : ConsumerFactory(ConsumerFactory), Callbacks(Callbacks) {} - virtual clang::FrontendAction *create() { + clang::FrontendAction *create() override { return new ConsumerFactoryAdaptor(ConsumerFactory, Callbacks); } @@ -333,20 +333,20 @@ inline FrontendActionFactory *newFrontendActionFactory( : ConsumerFactory(ConsumerFactory), Callbacks(Callbacks) {} clang::ASTConsumer *CreateASTConsumer(clang::CompilerInstance &, - StringRef) { + StringRef) override { return ConsumerFactory->newASTConsumer(); } protected: - virtual bool BeginSourceFileAction(CompilerInstance &CI, - StringRef Filename) override { + bool BeginSourceFileAction(CompilerInstance &CI, + StringRef Filename) override { if (!clang::ASTFrontendAction::BeginSourceFileAction(CI, Filename)) return false; if (Callbacks != NULL) return Callbacks->handleBeginSource(CI, Filename); return true; } - virtual void EndSourceFileAction() override { + void EndSourceFileAction() override { if (Callbacks != NULL) Callbacks->handleEndSource(); clang::ASTFrontendAction::EndSourceFileAction(); |