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

llvm-svn: 203999
This commit is contained in:
Craig Topper 2014-03-15 04:29:04 +00:00
parent e3bfdc4e14
commit fb6b25b5e4
54 changed files with 551 additions and 557 deletions

View File

@ -35,14 +35,14 @@ protected:
/// otherwise it creates a fresh LLVM context and takes ownership. /// otherwise it creates a fresh LLVM context and takes ownership.
CodeGenAction(unsigned _Act, llvm::LLVMContext *_VMContext = 0); CodeGenAction(unsigned _Act, llvm::LLVMContext *_VMContext = 0);
virtual bool hasIRSupport() const; bool hasIRSupport() const override;
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
StringRef InFile); StringRef InFile) override;
virtual void ExecuteAction(); void ExecuteAction() override;
virtual void EndSourceFileAction(); void EndSourceFileAction() override;
public: public:
~CodeGenAction(); ~CodeGenAction();

View File

@ -112,12 +112,12 @@ public:
/// returns true) indicates whether the diagnostics handled by this /// returns true) indicates whether the diagnostics handled by this
/// DiagnosticConsumer should be included in the number of diagnostics /// DiagnosticConsumer should be included in the number of diagnostics
/// reported by DiagnosticsEngine. /// reported by DiagnosticsEngine.
virtual bool IncludeInDiagnosticCounts() const; bool IncludeInDiagnosticCounts() const override;
/// HandleDiagnostic - Handle this diagnostic, reporting it to the user or /// HandleDiagnostic - Handle this diagnostic, reporting it to the user or
/// capturing it to a log as needed. /// capturing it to a log as needed.
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
const Diagnostic &Info); const Diagnostic &Info) override;
/// \brief Emit a diagnostic via the adapted diagnostic client. /// \brief Emit a diagnostic via the adapted diagnostic client.
void Diag(SourceLocation Loc, unsigned DiagID); void Diag(SourceLocation Loc, unsigned DiagID);

View File

@ -22,8 +22,8 @@ class FixItOptions;
class HTMLPrintAction : public ASTFrontendAction { class HTMLPrintAction : public ASTFrontendAction {
protected: protected:
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
StringRef InFile); StringRef InFile) override;
}; };
class FixItAction : public ASTFrontendAction { class FixItAction : public ASTFrontendAction {
@ -31,15 +31,15 @@ protected:
std::unique_ptr<FixItRewriter> Rewriter; std::unique_ptr<FixItRewriter> Rewriter;
std::unique_ptr<FixItOptions> FixItOpts; std::unique_ptr<FixItOptions> FixItOpts;
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
StringRef InFile); StringRef InFile) override;
virtual bool BeginSourceFileAction(CompilerInstance &CI, bool BeginSourceFileAction(CompilerInstance &CI,
StringRef Filename); StringRef Filename) override;
virtual void EndSourceFileAction(); void EndSourceFileAction() override;
virtual bool hasASTFileSupport() const { return false; } bool hasASTFileSupport() const override { return false; }
public: public:
FixItAction(); FixItAction();
@ -54,28 +54,28 @@ public:
: WrapperFrontendAction(WrappedAction) {} : WrapperFrontendAction(WrappedAction) {}
protected: protected:
virtual bool BeginInvocation(CompilerInstance &CI); bool BeginInvocation(CompilerInstance &CI) override;
}; };
class RewriteObjCAction : public ASTFrontendAction { class RewriteObjCAction : public ASTFrontendAction {
protected: protected:
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
StringRef InFile); StringRef InFile) override;
}; };
class RewriteMacrosAction : public PreprocessorFrontendAction { class RewriteMacrosAction : public PreprocessorFrontendAction {
protected: protected:
void ExecuteAction(); void ExecuteAction() override;
}; };
class RewriteTestAction : public PreprocessorFrontendAction { class RewriteTestAction : public PreprocessorFrontendAction {
protected: protected:
void ExecuteAction(); void ExecuteAction() override;
}; };
class RewriteIncludesAction : public PreprocessorFrontendAction { class RewriteIncludesAction : public PreprocessorFrontendAction {
protected: protected:
void ExecuteAction(); void ExecuteAction() override;
}; };
} // end namespace clang } // end namespace clang

View File

@ -512,9 +512,8 @@ public:
/// ///
/// \return True if the report was valid and a path was generated, /// \return True if the report was valid and a path was generated,
/// false if the reports should be considered invalid. /// false if the reports should be considered invalid.
virtual bool generatePathDiagnostic(PathDiagnostic &PD, bool generatePathDiagnostic(PathDiagnostic &PD, PathDiagnosticConsumer &PC,
PathDiagnosticConsumer &PC, ArrayRef<BugReport*> &bugReports) override;
ArrayRef<BugReport*> &bugReports);
/// classof - Used by isa<>, cast<>, and dyn_cast<>. /// classof - Used by isa<>, cast<>, and dyn_cast<>.
static bool classof(const BugReporter* R) { static bool classof(const BugReporter* R) {

View File

@ -89,7 +89,7 @@ public:
/// will have to provide your own implementation.) /// will have to provide your own implementation.)
template <class DERIVED> template <class DERIVED>
class BugReporterVisitorImpl : public BugReporterVisitor { class BugReporterVisitorImpl : public BugReporterVisitor {
virtual BugReporterVisitor *clone() const { BugReporterVisitor *clone() const override {
return new DERIVED(*static_cast<const DERIVED *>(this)); return new DERIVED(*static_cast<const DERIVED *>(this));
} }
}; };
@ -118,12 +118,12 @@ public:
Satisfied(false), Satisfied(false),
EnableNullFPSuppression(InEnableNullFPSuppression) {} EnableNullFPSuppression(InEnableNullFPSuppression) {}
void Profile(llvm::FoldingSetNodeID &ID) const; void Profile(llvm::FoldingSetNodeID &ID) const override;
PathDiagnosticPiece *VisitNode(const ExplodedNode *N, PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
const ExplodedNode *PrevN, const ExplodedNode *PrevN,
BugReporterContext &BRC, BugReporterContext &BRC,
BugReport &BR); BugReport &BR) override;
}; };
class TrackConstraintBRVisitor class TrackConstraintBRVisitor
@ -144,7 +144,7 @@ public:
IsZeroCheck(!Assumption && Constraint.getAs<Loc>()), IsZeroCheck(!Assumption && Constraint.getAs<Loc>()),
IsTrackingTurnedOn(false) {} 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 /// Return the tag associated with this visitor. This tag will be used
/// to make all PathDiagnosticPieces created by this visitor. /// to make all PathDiagnosticPieces created by this visitor.
@ -153,7 +153,7 @@ public:
PathDiagnosticPiece *VisitNode(const ExplodedNode *N, PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
const ExplodedNode *PrevN, const ExplodedNode *PrevN,
BugReporterContext &BRC, BugReporterContext &BRC,
BugReport &BR); BugReport &BR) override;
private: private:
/// Checks if the constraint is valid in the current state. /// Checks if the constraint is valid in the current state.
@ -166,8 +166,8 @@ private:
class NilReceiverBRVisitor class NilReceiverBRVisitor
: public BugReporterVisitorImpl<NilReceiverBRVisitor> { : public BugReporterVisitorImpl<NilReceiverBRVisitor> {
public: public:
void Profile(llvm::FoldingSetNodeID &ID) const { void Profile(llvm::FoldingSetNodeID &ID) const override {
static int x = 0; static int x = 0;
ID.AddPointer(&x); ID.AddPointer(&x);
} }
@ -175,7 +175,7 @@ public:
PathDiagnosticPiece *VisitNode(const ExplodedNode *N, PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
const ExplodedNode *PrevN, const ExplodedNode *PrevN,
BugReporterContext &BRC, BugReporterContext &BRC,
BugReport &BR); BugReport &BR) override;
/// If the statement is a message send expression with nil receiver, returns /// If the statement is a message send expression with nil receiver, returns
/// the receiver expression. Returns NULL otherwise. /// the receiver expression. Returns NULL otherwise.
@ -185,7 +185,7 @@ public:
/// Visitor that tries to report interesting diagnostics from conditions. /// Visitor that tries to report interesting diagnostics from conditions.
class ConditionBRVisitor : public BugReporterVisitorImpl<ConditionBRVisitor> { class ConditionBRVisitor : public BugReporterVisitorImpl<ConditionBRVisitor> {
public: public:
void Profile(llvm::FoldingSetNodeID &ID) const { void Profile(llvm::FoldingSetNodeID &ID) const override{
static int x = 0; static int x = 0;
ID.AddPointer(&x); ID.AddPointer(&x);
} }
@ -193,11 +193,11 @@ public:
/// Return the tag associated with this visitor. This tag will be used /// Return the tag associated with this visitor. This tag will be used
/// to make all PathDiagnosticPieces created by this visitor. /// to make all PathDiagnosticPieces created by this visitor.
static const char *getTag(); static const char *getTag();
virtual PathDiagnosticPiece *VisitNode(const ExplodedNode *N, PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
const ExplodedNode *Prev, const ExplodedNode *Prev,
BugReporterContext &BRC, BugReporterContext &BRC,
BugReport &BR); BugReport &BR) override;
PathDiagnosticPiece *VisitNodeImpl(const ExplodedNode *N, PathDiagnosticPiece *VisitNodeImpl(const ExplodedNode *N,
const ExplodedNode *Prev, const ExplodedNode *Prev,
@ -257,20 +257,20 @@ public:
return static_cast<void *>(&Tag); return static_cast<void *>(&Tag);
} }
void Profile(llvm::FoldingSetNodeID &ID) const { void Profile(llvm::FoldingSetNodeID &ID) const override {
ID.AddPointer(getTag()); ID.AddPointer(getTag());
} }
virtual PathDiagnosticPiece *VisitNode(const ExplodedNode *N, PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
const ExplodedNode *Prev, const ExplodedNode *Prev,
BugReporterContext &BRC, BugReporterContext &BRC,
BugReport &BR) { BugReport &BR) override {
return 0; return 0;
} }
virtual PathDiagnosticPiece *getEndPath(BugReporterContext &BRC, PathDiagnosticPiece *getEndPath(BugReporterContext &BRC,
const ExplodedNode *N, const ExplodedNode *N,
BugReport &BR); BugReport &BR) override;
}; };
/// \brief When a region containing undefined value or '0' value is passed /// \brief When a region containing undefined value or '0' value is passed
@ -287,7 +287,7 @@ class UndefOrNullArgVisitor
public: public:
UndefOrNullArgVisitor(const MemRegion *InR) : R(InR) {} UndefOrNullArgVisitor(const MemRegion *InR) : R(InR) {}
virtual void Profile(llvm::FoldingSetNodeID &ID) const { void Profile(llvm::FoldingSetNodeID &ID) const override {
static int Tag = 0; static int Tag = 0;
ID.AddPointer(&Tag); ID.AddPointer(&Tag);
ID.AddPointer(R); ID.AddPointer(R);
@ -296,7 +296,7 @@ public:
PathDiagnosticPiece *VisitNode(const ExplodedNode *N, PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
const ExplodedNode *PrevN, const ExplodedNode *PrevN,
BugReporterContext &BRC, BugReporterContext &BRC,
BugReport &BR); BugReport &BR) override;
}; };
class SuppressInlineDefensiveChecksVisitor class SuppressInlineDefensiveChecksVisitor
@ -319,7 +319,7 @@ class SuppressInlineDefensiveChecksVisitor
public: public:
SuppressInlineDefensiveChecksVisitor(DefinedSVal Val, const ExplodedNode *N); 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 /// Return the tag associated with this visitor. This tag will be used
/// to make all PathDiagnosticPieces created by this visitor. /// to make all PathDiagnosticPieces created by this visitor.
@ -328,7 +328,7 @@ public:
PathDiagnosticPiece *VisitNode(const ExplodedNode *Succ, PathDiagnosticPiece *VisitNode(const ExplodedNode *Succ,
const ExplodedNode *Pred, const ExplodedNode *Pred,
BugReporterContext &BRC, BugReporterContext &BRC,
BugReport &BR); BugReport &BR) override;
}; };
namespace bugreporter { namespace bugreporter {

View File

@ -60,7 +60,7 @@ public:
class BuiltinBug : public BugType { class BuiltinBug : public BugType {
const std::string desc; const std::string desc;
virtual void anchor(); void anchor() override;
public: public:
BuiltinBug(class CheckName check, const char *name, const char *description) BuiltinBug(class CheckName check, const char *name, const char *description)
: BugType(check, name, categories::LogicError), desc(description) {} : BugType(check, name, categories::LogicError), desc(description) {}

View File

@ -440,10 +440,10 @@ public:
if (addPosRange && Pos.hasRange()) addRange(Pos.asRange()); if (addPosRange && Pos.hasRange()) addRange(Pos.asRange());
} }
PathDiagnosticLocation getLocation() const { return Pos; } PathDiagnosticLocation getLocation() const override { return Pos; }
virtual void flattenLocations() { Pos.flatten(); } 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) { static bool classof(const PathDiagnosticPiece *P) {
return P->getKind() == Event || P->getKind() == Macro; return P->getKind() == Event || P->getKind() == Macro;
@ -479,7 +479,7 @@ public:
/// \brief Search the call expression for the symbol Sym and dispatch the /// \brief Search the call expression for the symbol Sym and dispatch the
/// 'getMessageForX()' methods to construct a specific message. /// '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: /// Produces the message of the following form:
/// 'Msg via Nth parameter' /// 'Msg via Nth parameter'
@ -534,7 +534,7 @@ public:
return ""; return "";
} }
virtual void dump() const; void dump() const override;
static inline bool classof(const PathDiagnosticPiece *P) { static inline bool classof(const PathDiagnosticPiece *P) {
return P->getKind() == Event; return P->getKind() == Event;
@ -580,7 +580,7 @@ public:
CallStackMessage = st; CallStackMessage = st;
} }
virtual PathDiagnosticLocation getLocation() const { PathDiagnosticLocation getLocation() const override {
return callEnter; return callEnter;
} }
@ -589,7 +589,7 @@ public:
getCallEnterWithinCallerEvent() const; getCallEnterWithinCallerEvent() const;
IntrusiveRefCntPtr<PathDiagnosticEventPiece> getCallExitEvent() const; IntrusiveRefCntPtr<PathDiagnosticEventPiece> getCallExitEvent() const;
virtual void flattenLocations() { void flattenLocations() override {
callEnter.flatten(); callEnter.flatten();
callReturn.flatten(); callReturn.flatten();
for (PathPieces::iterator I = path.begin(), for (PathPieces::iterator I = path.begin(),
@ -602,10 +602,10 @@ public:
static PathDiagnosticCallPiece *construct(PathPieces &pieces, static PathDiagnosticCallPiece *construct(PathPieces &pieces,
const Decl *caller); 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) { static inline bool classof(const PathDiagnosticPiece *P) {
return P->getKind() == Call; return P->getKind() == Call;
@ -652,7 +652,7 @@ public:
void push_back(const PathDiagnosticLocationPair &X) { LPairs.push_back(X); } void push_back(const PathDiagnosticLocationPair &X) { LPairs.push_back(X); }
virtual PathDiagnosticLocation getLocation() const { PathDiagnosticLocation getLocation() const override {
return getStartLocation(); return getStartLocation();
} }
@ -660,7 +660,7 @@ public:
iterator begin() { return LPairs.begin(); } iterator begin() { return LPairs.begin(); }
iterator end() { return LPairs.end(); } iterator end() { return LPairs.end(); }
virtual void flattenLocations() { void flattenLocations() override {
for (iterator I=begin(), E=end(); I!=E; ++I) I->flatten(); for (iterator I=begin(), E=end(); I!=E; ++I) I->flatten();
} }
@ -673,9 +673,9 @@ public:
return P->getKind() == ControlFlow; 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 { class PathDiagnosticMacroPiece : public PathDiagnosticSpotPiece {
@ -689,7 +689,7 @@ public:
bool containsEvent() const; bool containsEvent() const;
virtual void flattenLocations() { void flattenLocations() override {
PathDiagnosticSpotPiece::flattenLocations(); PathDiagnosticSpotPiece::flattenLocations();
for (PathPieces::iterator I = subPieces.begin(), for (PathPieces::iterator I = subPieces.begin(),
E = subPieces.end(); I != E; ++I) (*I)->flattenLocations(); E = subPieces.end(); I != E; ++I) (*I)->flattenLocations();
@ -699,9 +699,9 @@ public:
return P->getKind() == Macro; 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 /// PathDiagnostic - PathDiagnostic objects represent a single path-sensitive

View File

@ -457,7 +457,7 @@ class CheckerBase : public ProgramPointTag {
friend class ::clang::ento::CheckerManager; friend class ::clang::ento::CheckerManager;
public: public:
StringRef getTagDescription() const; StringRef getTagDescription() const override;
CheckName getCheckName() const; CheckName getCheckName() const;
/// See CheckerManager::runCheckersForPrintState. /// See CheckerManager::runCheckersForPrintState.

View File

@ -65,8 +65,8 @@ public:
StoreManagerCreator getStoreManagerCreator() { StoreManagerCreator getStoreManagerCreator() {
return CreateStoreMgr; return CreateStoreMgr;
} }
AnalyzerOptions& getAnalyzerOptions() { AnalyzerOptions& getAnalyzerOptions() override {
return options; return options;
} }
@ -76,15 +76,15 @@ public:
CheckerManager *getCheckerManager() const { return CheckerMgr; } CheckerManager *getCheckerManager() const { return CheckerMgr; }
virtual ASTContext &getASTContext() { ASTContext &getASTContext() override {
return Ctx; return Ctx;
} }
virtual SourceManager &getSourceManager() { SourceManager &getSourceManager() override {
return getASTContext().getSourceManager(); return getASTContext().getSourceManager();
} }
virtual DiagnosticsEngine &getDiagnostic() { DiagnosticsEngine &getDiagnostic() override {
return Diags; return Diags;
} }
@ -92,7 +92,7 @@ public:
return LangOpts; return LangOpts;
} }
ArrayRef<PathDiagnosticConsumer*> getPathDiagnosticConsumers() { ArrayRef<PathDiagnosticConsumer*> getPathDiagnosticConsumers() override {
return PathConsumers; return PathConsumers;
} }

View File

@ -390,11 +390,11 @@ protected:
public: public:
// This function is overridden by subclasses, but they must return // This function is overridden by subclasses, but they must return
// a FunctionDecl. // a FunctionDecl.
virtual const FunctionDecl *getDecl() const { const FunctionDecl *getDecl() const override {
return cast<FunctionDecl>(CallEvent::getDecl()); return cast<FunctionDecl>(CallEvent::getDecl());
} }
virtual RuntimeDefinition getRuntimeDefinition() const { RuntimeDefinition getRuntimeDefinition() const override {
const FunctionDecl *FD = getDecl(); const FunctionDecl *FD = getDecl();
// Note that the AnalysisDeclContext will have the FunctionDecl with // Note that the AnalysisDeclContext will have the FunctionDecl with
// the definition (if one exists). // the definition (if one exists).
@ -409,12 +409,12 @@ public:
return RuntimeDefinition(); return RuntimeDefinition();
} }
virtual bool argumentsMayEscape() const; bool argumentsMayEscape() const override;
virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
BindingsTy &Bindings) const; BindingsTy &Bindings) const override;
virtual ArrayRef<ParmVarDecl *> parameters() const; ArrayRef<ParmVarDecl *> parameters() const override;
static bool classof(const CallEvent *CA) { static bool classof(const CallEvent *CA) {
return CA->getKind() >= CE_BEG_FUNCTION_CALLS && return CA->getKind() >= CE_BEG_FUNCTION_CALLS &&
@ -434,7 +434,7 @@ protected:
: AnyFunctionCall(CE, St, LCtx) {} : AnyFunctionCall(CE, St, LCtx) {}
SimpleFunctionCall(const SimpleFunctionCall &Other) SimpleFunctionCall(const SimpleFunctionCall &Other)
: AnyFunctionCall(Other) {} : AnyFunctionCall(Other) {}
virtual void cloneTo(void *Dest) const { void cloneTo(void *Dest) const override {
new (Dest) SimpleFunctionCall(*this); new (Dest) SimpleFunctionCall(*this);
} }
@ -443,15 +443,15 @@ public:
return cast<CallExpr>(AnyFunctionCall::getOriginExpr()); 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); return getOriginExpr()->getArg(Index);
} }
virtual Kind getKind() const { return CE_Function; } Kind getKind() const override { return CE_Function; }
static bool classof(const CallEvent *CA) { static bool classof(const CallEvent *CA) {
return CA->getKind() == CE_Function; return CA->getKind() == CE_Function;
@ -470,18 +470,18 @@ protected:
: CallEvent(CE, St, LCtx) {} : CallEvent(CE, St, LCtx) {}
BlockCall(const BlockCall &Other) : CallEvent(Other) {} 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: public:
virtual const CallExpr *getOriginExpr() const { virtual const CallExpr *getOriginExpr() const {
return cast<CallExpr>(CallEvent::getOriginExpr()); 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); return getOriginExpr()->getArg(Index);
} }
@ -490,27 +490,27 @@ public:
/// This may be NULL if the block's origin is unknown. /// This may be NULL if the block's origin is unknown.
const BlockDataRegion *getBlockRegion() const; const BlockDataRegion *getBlockRegion() const;
virtual const BlockDecl *getDecl() const { const BlockDecl *getDecl() const override {
const BlockDataRegion *BR = getBlockRegion(); const BlockDataRegion *BR = getBlockRegion();
if (!BR) if (!BR)
return 0; return 0;
return BR->getDecl(); return BR->getDecl();
} }
virtual RuntimeDefinition getRuntimeDefinition() const { RuntimeDefinition getRuntimeDefinition() const override {
return RuntimeDefinition(getDecl()); return RuntimeDefinition(getDecl());
} }
virtual bool argumentsMayEscape() const { bool argumentsMayEscape() const override {
return true; return true;
} }
virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
BindingsTy &Bindings) const; 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) { static bool classof(const CallEvent *CA) {
return CA->getKind() == CE_Block; return CA->getKind() == CE_Block;
@ -521,7 +521,7 @@ public:
/// it is written. /// it is written.
class CXXInstanceCall : public AnyFunctionCall { class CXXInstanceCall : public AnyFunctionCall {
protected: protected:
virtual void getExtraInvalidatedValues(ValueList &Values) const; void getExtraInvalidatedValues(ValueList &Values) const override;
CXXInstanceCall(const CallExpr *CE, ProgramStateRef St, CXXInstanceCall(const CallExpr *CE, ProgramStateRef St,
const LocationContext *LCtx) const LocationContext *LCtx)
@ -540,12 +540,12 @@ public:
/// \brief Returns the value of the implicit 'this' object. /// \brief Returns the value of the implicit 'this' object.
virtual SVal getCXXThisVal() const; 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, void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
BindingsTy &Bindings) const; BindingsTy &Bindings) const override;
static bool classof(const CallEvent *CA) { static bool classof(const CallEvent *CA) {
return CA->getKind() >= CE_BEG_CXX_INSTANCE_CALLS && return CA->getKind() >= CE_BEG_CXX_INSTANCE_CALLS &&
@ -565,28 +565,28 @@ protected:
: CXXInstanceCall(CE, St, LCtx) {} : CXXInstanceCall(CE, St, LCtx) {}
CXXMemberCall(const CXXMemberCall &Other) : CXXInstanceCall(Other) {} 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: public:
virtual const CXXMemberCallExpr *getOriginExpr() const { virtual const CXXMemberCallExpr *getOriginExpr() const {
return cast<CXXMemberCallExpr>(CXXInstanceCall::getOriginExpr()); return cast<CXXMemberCallExpr>(CXXInstanceCall::getOriginExpr());
} }
virtual unsigned getNumArgs() const { unsigned getNumArgs() const override {
if (const CallExpr *CE = getOriginExpr()) if (const CallExpr *CE = getOriginExpr())
return CE->getNumArgs(); return CE->getNumArgs();
return 0; return 0;
} }
virtual const Expr *getArgExpr(unsigned Index) const { const Expr *getArgExpr(unsigned Index) const override {
return getOriginExpr()->getArg(Index); return getOriginExpr()->getArg(Index);
} }
virtual const Expr *getCXXThisExpr() const; const Expr *getCXXThisExpr() const override;
virtual RuntimeDefinition getRuntimeDefinition() const;
virtual Kind getKind() const { return CE_CXXMember; } RuntimeDefinition getRuntimeDefinition() const override;
Kind getKind() const override { return CE_CXXMember; }
static bool classof(const CallEvent *CA) { static bool classof(const CallEvent *CA) {
return CA->getKind() == CE_CXXMember; return CA->getKind() == CE_CXXMember;
@ -607,7 +607,7 @@ protected:
CXXMemberOperatorCall(const CXXMemberOperatorCall &Other) CXXMemberOperatorCall(const CXXMemberOperatorCall &Other)
: CXXInstanceCall(Other) {} : CXXInstanceCall(Other) {}
virtual void cloneTo(void *Dest) const { void cloneTo(void *Dest) const override {
new (Dest) CXXMemberOperatorCall(*this); new (Dest) CXXMemberOperatorCall(*this);
} }
@ -616,16 +616,16 @@ public:
return cast<CXXOperatorCallExpr>(CXXInstanceCall::getOriginExpr()); return cast<CXXOperatorCallExpr>(CXXInstanceCall::getOriginExpr());
} }
virtual unsigned getNumArgs() const { unsigned getNumArgs() const override {
return getOriginExpr()->getNumArgs() - 1; return getOriginExpr()->getNumArgs() - 1;
} }
virtual const Expr *getArgExpr(unsigned Index) const { const Expr *getArgExpr(unsigned Index) const override {
return getOriginExpr()->getArg(Index + 1); 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) { static bool classof(const CallEvent *CA) {
return CA->getKind() == CE_CXXMemberOperator; return CA->getKind() == CE_CXXMemberOperator;
@ -658,23 +658,23 @@ protected:
} }
CXXDestructorCall(const CXXDestructorCall &Other) : CXXInstanceCall(Other) {} 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: public:
virtual SourceRange getSourceRange() const { return Location; } SourceRange getSourceRange() const override { return Location; }
virtual unsigned getNumArgs() const { return 0; } unsigned getNumArgs() const override { return 0; }
virtual RuntimeDefinition getRuntimeDefinition() const; RuntimeDefinition getRuntimeDefinition() const override;
/// \brief Returns the value of the implicit 'this' object. /// \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. /// Returns true if this is a call to a base class destructor.
bool isBaseDestructor() const { bool isBaseDestructor() const {
return DtorDataTy::getFromOpaqueValue(Data).getInt(); 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) { static bool classof(const CallEvent *CA) {
return CA->getKind() == CE_CXXDestructor; return CA->getKind() == CE_CXXDestructor;
@ -702,32 +702,32 @@ protected:
} }
CXXConstructorCall(const CXXConstructorCall &Other) : AnyFunctionCall(Other){} 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: public:
virtual const CXXConstructExpr *getOriginExpr() const { virtual const CXXConstructExpr *getOriginExpr() const {
return cast<CXXConstructExpr>(AnyFunctionCall::getOriginExpr()); return cast<CXXConstructExpr>(AnyFunctionCall::getOriginExpr());
} }
virtual const CXXConstructorDecl *getDecl() const { const CXXConstructorDecl *getDecl() const override {
return getOriginExpr()->getConstructor(); 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); return getOriginExpr()->getArg(Index);
} }
/// \brief Returns the value of the implicit 'this' object. /// \brief Returns the value of the implicit 'this' object.
SVal getCXXThisVal() const; SVal getCXXThisVal() const;
virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
BindingsTy &Bindings) const; BindingsTy &Bindings) const override;
virtual Kind getKind() const { return CE_CXXConstructor; } Kind getKind() const override { return CE_CXXConstructor; }
static bool classof(const CallEvent *CA) { static bool classof(const CallEvent *CA) {
return CA->getKind() == CE_CXXConstructor; return CA->getKind() == CE_CXXConstructor;
@ -746,29 +746,29 @@ protected:
: AnyFunctionCall(E, St, LCtx) {} : AnyFunctionCall(E, St, LCtx) {}
CXXAllocatorCall(const CXXAllocatorCall &Other) : AnyFunctionCall(Other) {} 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: public:
virtual const CXXNewExpr *getOriginExpr() const { virtual const CXXNewExpr *getOriginExpr() const {
return cast<CXXNewExpr>(AnyFunctionCall::getOriginExpr()); return cast<CXXNewExpr>(AnyFunctionCall::getOriginExpr());
} }
virtual const FunctionDecl *getDecl() const { const FunctionDecl *getDecl() const override {
return getOriginExpr()->getOperatorNew(); return getOriginExpr()->getOperatorNew();
} }
virtual unsigned getNumArgs() const { unsigned getNumArgs() const override {
return getOriginExpr()->getNumPlacementArgs() + 1; 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. // The first argument of an allocator call is the size of the allocation.
if (Index == 0) if (Index == 0)
return 0; return 0;
return getOriginExpr()->getPlacementArg(Index - 1); 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) { static bool classof(const CallEvent *CE) {
return CE->getKind() == CE_CXXAllocator; return CE->getKind() == CE_CXXAllocator;
@ -801,9 +801,9 @@ protected:
} }
ObjCMethodCall(const ObjCMethodCall &Other) : CallEvent(Other) {} 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). /// Check if the selector may have multiple definitions (may have overrides).
virtual bool canBeOverridenInSubclass(ObjCInterfaceDecl *IDecl, virtual bool canBeOverridenInSubclass(ObjCInterfaceDecl *IDecl,
@ -813,13 +813,13 @@ public:
virtual const ObjCMessageExpr *getOriginExpr() const { virtual const ObjCMessageExpr *getOriginExpr() const {
return cast<ObjCMessageExpr>(CallEvent::getOriginExpr()); return cast<ObjCMessageExpr>(CallEvent::getOriginExpr());
} }
virtual const ObjCMethodDecl *getDecl() const { const ObjCMethodDecl *getDecl() const override {
return getOriginExpr()->getMethodDecl(); return getOriginExpr()->getMethodDecl();
} }
virtual unsigned getNumArgs() const { unsigned getNumArgs() const override {
return getOriginExpr()->getNumArgs(); return getOriginExpr()->getNumArgs();
} }
virtual const Expr *getArgExpr(unsigned Index) const { const Expr *getArgExpr(unsigned Index) const override {
return getOriginExpr()->getArg(Index); return getOriginExpr()->getArg(Index);
} }
@ -833,7 +833,7 @@ public:
return getOriginExpr()->getSelector(); return getOriginExpr()->getSelector();
} }
virtual SourceRange getSourceRange() const; SourceRange getSourceRange() const override;
/// \brief Returns the value of the receiver at the time of this call. /// \brief Returns the value of the receiver at the time of this call.
SVal getReceiverSVal() const; SVal getReceiverSVal() const;
@ -870,16 +870,16 @@ public:
llvm_unreachable("Unknown message kind"); 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, void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
BindingsTy &Bindings) const; 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) { static bool classof(const CallEvent *CA) {
return CA->getKind() == CE_ObjCMessage; return CA->getKind() == CE_ObjCMessage;

View File

@ -312,7 +312,7 @@ public:
/// \class NodeBuilderWithSinks /// \class NodeBuilderWithSinks
/// \brief This node builder keeps track of the generated sink nodes. /// \brief This node builder keeps track of the generated sink nodes.
class NodeBuilderWithSinks: public NodeBuilder { class NodeBuilderWithSinks: public NodeBuilder {
virtual void anchor(); void anchor() override;
protected: protected:
SmallVector<ExplodedNode*, 2> sinksGenerated; SmallVector<ExplodedNode*, 2> sinksGenerated;
ProgramPoint &Location; ProgramPoint &Location;
@ -399,7 +399,7 @@ public:
/// \brief BranchNodeBuilder is responsible for constructing the nodes /// \brief BranchNodeBuilder is responsible for constructing the nodes
/// corresponding to the two branches of the if statement - true and false. /// corresponding to the two branches of the if statement - true and false.
class BranchNodeBuilder: public NodeBuilder { class BranchNodeBuilder: public NodeBuilder {
virtual void anchor(); void anchor() override;
const CFGBlock *DstT; const CFGBlock *DstT;
const CFGBlock *DstF; const CFGBlock *DstF;

View File

@ -122,7 +122,7 @@ public:
/// getContext - Return the ASTContext associated with this analysis. /// getContext - Return the ASTContext associated with this analysis.
ASTContext &getContext() const { return AMgr.getASTContext(); } ASTContext &getContext() const { return AMgr.getASTContext(); }
virtual AnalysisManager &getAnalysisManager() { return AMgr; } AnalysisManager &getAnalysisManager() override { return AMgr; }
CheckerManager &getCheckerManager() const { CheckerManager &getCheckerManager() const {
return *AMgr.getCheckerManager(); return *AMgr.getCheckerManager();
@ -154,7 +154,7 @@ public:
/// getInitialState - Return the initial state used for the root vertex /// getInitialState - Return the initial state used for the root vertex
/// in the ExplodedGraph. /// in the ExplodedGraph.
ProgramStateRef getInitialState(const LocationContext *InitLoc); ProgramStateRef getInitialState(const LocationContext *InitLoc) override;
ExplodedGraph& getGraph() { return G; } ExplodedGraph& getGraph() { return G; }
const ExplodedGraph& getGraph() const { return G; } const ExplodedGraph& getGraph() const { return G; }
@ -192,7 +192,7 @@ public:
/// processCFGElement - Called by CoreEngine. Used to generate new successor /// processCFGElement - Called by CoreEngine. Used to generate new successor
/// nodes by processing the 'effects' of a CFG element. /// nodes by processing the 'effects' of a CFG element.
void processCFGElement(const CFGElement E, ExplodedNode *Pred, void processCFGElement(const CFGElement E, ExplodedNode *Pred,
unsigned StmtIdx, NodeBuilderContext *Ctx); unsigned StmtIdx, NodeBuilderContext *Ctx) override;
void ProcessStmt(const CFGStmt S, ExplodedNode *Pred); void ProcessStmt(const CFGStmt S, ExplodedNode *Pred);
@ -214,10 +214,10 @@ public:
ExplodedNode *Pred, ExplodedNodeSet &Dst); ExplodedNode *Pred, ExplodedNodeSet &Dst);
/// Called by CoreEngine when processing the entrance of a CFGBlock. /// Called by CoreEngine when processing the entrance of a CFGBlock.
virtual void processCFGBlockEntrance(const BlockEdge &L, void processCFGBlockEntrance(const BlockEdge &L,
NodeBuilderWithSinks &nodeBuilder, NodeBuilderWithSinks &nodeBuilder,
ExplodedNode *Pred); ExplodedNode *Pred) override;
/// ProcessBranch - Called by CoreEngine. Used to generate successor /// ProcessBranch - Called by CoreEngine. Used to generate successor
/// nodes by processing the 'effects' of a branch condition. /// nodes by processing the 'effects' of a branch condition.
void processBranch(const Stmt *Condition, const Stmt *Term, void processBranch(const Stmt *Condition, const Stmt *Term,
@ -225,7 +225,7 @@ public:
ExplodedNode *Pred, ExplodedNode *Pred,
ExplodedNodeSet &Dst, ExplodedNodeSet &Dst,
const CFGBlock *DstT, const CFGBlock *DstT,
const CFGBlock *DstF); const CFGBlock *DstF) override;
/// Called by CoreEngine. Used to processing branching behavior /// Called by CoreEngine. Used to processing branching behavior
/// at static initalizers. /// at static initalizers.
@ -234,20 +234,20 @@ public:
ExplodedNode *Pred, ExplodedNode *Pred,
ExplodedNodeSet &Dst, ExplodedNodeSet &Dst,
const CFGBlock *DstT, const CFGBlock *DstT,
const CFGBlock *DstF); const CFGBlock *DstF) override;
/// processIndirectGoto - Called by CoreEngine. Used to generate successor /// processIndirectGoto - Called by CoreEngine. Used to generate successor
/// nodes by processing the 'effects' of a computed goto jump. /// 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 /// ProcessSwitch - Called by CoreEngine. Used to generate successor
/// nodes by processing the 'effects' of a switch statement. /// 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 /// Called by CoreEngine. Used to generate end-of-path
/// nodes when the control reaches the end of a function. /// nodes when the control reaches the end of a function.
void processEndOfFunction(NodeBuilderContext& BC, void processEndOfFunction(NodeBuilderContext& BC,
ExplodedNode *Pred); ExplodedNode *Pred) override;
/// Remove dead bindings/symbols before exiting a function. /// Remove dead bindings/symbols before exiting a function.
void removeDeadOnEndOfFunction(NodeBuilderContext& BC, void removeDeadOnEndOfFunction(NodeBuilderContext& BC,
@ -255,22 +255,23 @@ public:
ExplodedNodeSet &Dst); ExplodedNodeSet &Dst);
/// Generate the entry node of the callee. /// 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 /// Generate the sequence of nodes that simulate the call exit and the post
/// visit for CallExpr. /// visit for CallExpr.
void processCallExit(ExplodedNode *Pred); void processCallExit(ExplodedNode *Pred) override;
/// Called by CoreEngine when the analysis worklist has terminated. /// 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 /// evalAssume - Callback function invoked by the ConstraintManager when
/// making assumptions about state values. /// 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 /// wantsRegionChangeUpdate - Called by ProgramStateManager to determine if a
/// region change should trigger a processRegionChanges update. /// 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 /// processRegionChanges - Called by ProgramStateManager whenever a change is made
/// to the store. Used to update checkers that track region values. /// to the store. Used to update checkers that track region values.
@ -279,13 +280,13 @@ public:
const InvalidatedSymbols *invalidated, const InvalidatedSymbols *invalidated,
ArrayRef<const MemRegion *> ExplicitRegions, ArrayRef<const MemRegion *> ExplicitRegions,
ArrayRef<const MemRegion *> Regions, ArrayRef<const MemRegion *> Regions,
const CallEvent *Call); const CallEvent *Call) override;
/// printState - Called by ProgramStateManager to print checker-specific data. /// printState - Called by ProgramStateManager to print checker-specific data.
void printState(raw_ostream &Out, ProgramStateRef State, 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(); } StoreManager& getStoreManager() { return StateMgr.getStoreManager(); }
@ -480,17 +481,17 @@ protected:
/// Call PointerEscape callback when a value escapes as a result of bind. /// Call PointerEscape callback when a value escapes as a result of bind.
ProgramStateRef processPointerEscapedOnBind(ProgramStateRef State, ProgramStateRef processPointerEscapedOnBind(ProgramStateRef State,
SVal Loc, SVal Val); SVal Loc, SVal Val) override;
/// Call PointerEscape callback when a value escapes as a result of /// Call PointerEscape callback when a value escapes as a result of
/// region invalidation. /// region invalidation.
/// \param[in] ITraits Specifies invalidation traits for regions/symbols. /// \param[in] ITraits Specifies invalidation traits for regions/symbols.
ProgramStateRef notifyCheckersOfPointerEscape( ProgramStateRef notifyCheckersOfPointerEscape(
ProgramStateRef State, ProgramStateRef State,
const InvalidatedSymbols *Invalidated, const InvalidatedSymbols *Invalidated,
ArrayRef<const MemRegion *> ExplicitRegions, ArrayRef<const MemRegion *> ExplicitRegions,
ArrayRef<const MemRegion *> Regions, ArrayRef<const MemRegion *> Regions,
const CallEvent *Call, const CallEvent *Call,
RegionAndSymbolInvalidationTraits &ITraits); RegionAndSymbolInvalidationTraits &ITraits) override;
public: public:
// FIXME: 'tag' should be removed, and a LocationContext should be used // FIXME: 'tag' should be removed, and a LocationContext should be used

View File

@ -204,12 +204,12 @@ protected:
assert(classof(this)); assert(classof(this));
} }
MemRegionManager* getMemRegionManager() const { return Mgr; } MemRegionManager* getMemRegionManager() const override { return Mgr; }
public: public:
bool isBoundable() const { return false; } bool isBoundable() const override { return false; }
void Profile(llvm::FoldingSetNodeID &ID) const; void Profile(llvm::FoldingSetNodeID &ID) const override;
static bool classof(const MemRegion *R) { static bool classof(const MemRegion *R) {
Kind k = R->getKind(); Kind k = R->getKind();
@ -243,9 +243,9 @@ class StaticGlobalSpaceRegion : public GlobalsSpaceRegion {
: GlobalsSpaceRegion(mgr, StaticGlobalSpaceRegionKind), CR(cr) {} : GlobalsSpaceRegion(mgr, StaticGlobalSpaceRegionKind), CR(cr) {}
public: public:
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 CodeTextRegion *getCodeRegion() const { return CR; } const CodeTextRegion *getCodeRegion() const { return CR; }
@ -286,7 +286,7 @@ class GlobalSystemSpaceRegion : public NonStaticGlobalSpaceRegion {
public: public:
void dumpToStream(raw_ostream &os) const; void dumpToStream(raw_ostream &os) const override;
static bool classof(const MemRegion *R) { static bool classof(const MemRegion *R) {
return R->getKind() == GlobalSystemSpaceRegionKind; return R->getKind() == GlobalSystemSpaceRegionKind;
@ -306,7 +306,7 @@ class GlobalImmutableSpaceRegion : public NonStaticGlobalSpaceRegion {
public: public:
void dumpToStream(raw_ostream &os) const; void dumpToStream(raw_ostream &os) const override;
static bool classof(const MemRegion *R) { static bool classof(const MemRegion *R) {
return R->getKind() == GlobalImmutableSpaceRegionKind; return R->getKind() == GlobalImmutableSpaceRegionKind;
@ -324,7 +324,7 @@ class GlobalInternalSpaceRegion : public NonStaticGlobalSpaceRegion {
public: public:
void dumpToStream(raw_ostream &os) const; void dumpToStream(raw_ostream &os) const override;
static bool classof(const MemRegion *R) { static bool classof(const MemRegion *R) {
return R->getKind() == GlobalInternalSpaceRegionKind; return R->getKind() == GlobalInternalSpaceRegionKind;
@ -339,7 +339,7 @@ class HeapSpaceRegion : public MemSpaceRegion {
: MemSpaceRegion(mgr, HeapSpaceRegionKind) {} : MemSpaceRegion(mgr, HeapSpaceRegionKind) {}
public: public:
void dumpToStream(raw_ostream &os) const; void dumpToStream(raw_ostream &os) const override;
static bool classof(const MemRegion *R) { static bool classof(const MemRegion *R) {
return R->getKind() == HeapSpaceRegionKind; return R->getKind() == HeapSpaceRegionKind;
@ -353,7 +353,7 @@ class UnknownSpaceRegion : public MemSpaceRegion {
: MemSpaceRegion(mgr, UnknownSpaceRegionKind) {} : MemSpaceRegion(mgr, UnknownSpaceRegionKind) {}
public: public:
void dumpToStream(raw_ostream &os) const; void dumpToStream(raw_ostream &os) const override;
static bool classof(const MemRegion *R) { static bool classof(const MemRegion *R) {
return R->getKind() == UnknownSpaceRegionKind; return R->getKind() == UnknownSpaceRegionKind;
@ -373,7 +373,7 @@ protected:
public: public:
const StackFrameContext *getStackFrame() const { return SFC; } 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) { static bool classof(const MemRegion *R) {
Kind k = R->getKind(); Kind k = R->getKind();
@ -389,7 +389,7 @@ class StackLocalsSpaceRegion : public StackSpaceRegion {
: StackSpaceRegion(mgr, StackLocalsSpaceRegionKind, sfc) {} : StackSpaceRegion(mgr, StackLocalsSpaceRegionKind, sfc) {}
public: public:
void dumpToStream(raw_ostream &os) const; void dumpToStream(raw_ostream &os) const override;
static bool classof(const MemRegion *R) { static bool classof(const MemRegion *R) {
return R->getKind() == StackLocalsSpaceRegionKind; return R->getKind() == StackLocalsSpaceRegionKind;
@ -404,7 +404,7 @@ private:
: StackSpaceRegion(mgr, StackArgumentsSpaceRegionKind, sfc) {} : StackSpaceRegion(mgr, StackArgumentsSpaceRegionKind, sfc) {}
public: public:
void dumpToStream(raw_ostream &os) const; void dumpToStream(raw_ostream &os) const override;
static bool classof(const MemRegion *R) { static bool classof(const MemRegion *R) {
return R->getKind() == StackArgumentsSpaceRegionKind; return R->getKind() == StackArgumentsSpaceRegionKind;
@ -430,9 +430,9 @@ public:
return UnknownVal(); 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) { static bool classof(const MemRegion* R) {
return R->getKind() > END_MEMSPACES; return R->getKind() > END_MEMSPACES;
@ -459,16 +459,16 @@ public:
const Expr *getExpr() const { return Ex; } 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, static void ProfileRegion(llvm::FoldingSetNodeID& ID, const Expr *Ex,
unsigned Cnt, const MemRegion *superRegion); unsigned Cnt, const MemRegion *superRegion);
void dumpToStream(raw_ostream &os) const; void dumpToStream(raw_ostream &os) const override;
static bool classof(const MemRegion* R) { static bool classof(const MemRegion* R) {
return R->getKind() == AllocaRegionKind; return R->getKind() == AllocaRegionKind;
@ -478,7 +478,7 @@ public:
/// TypedRegion - An abstract class representing regions that are typed. /// TypedRegion - An abstract class representing regions that are typed.
class TypedRegion : public SubRegion { class TypedRegion : public SubRegion {
public: public:
virtual void anchor(); void anchor() override;
protected: protected:
TypedRegion(const MemRegion* sReg, Kind k) : SubRegion(sReg, k) {} TypedRegion(const MemRegion* sReg, Kind k) : SubRegion(sReg, k) {}
@ -489,7 +489,7 @@ public:
return getLocationType().getDesugaredType(Context); return getLocationType().getDesugaredType(Context);
} }
bool isBoundable() const { return true; } bool isBoundable() const override { return true; }
static bool classof(const MemRegion* R) { static bool classof(const MemRegion* R) {
unsigned k = R->getKind(); unsigned k = R->getKind();
@ -500,14 +500,14 @@ public:
/// TypedValueRegion - An abstract class representing regions having a typed value. /// TypedValueRegion - An abstract class representing regions having a typed value.
class TypedValueRegion : public TypedRegion { class TypedValueRegion : public TypedRegion {
public: public:
virtual void anchor(); void anchor() override;
protected: protected:
TypedValueRegion(const MemRegion* sReg, Kind k) : TypedRegion(sReg, k) {} TypedValueRegion(const MemRegion* sReg, Kind k) : TypedRegion(sReg, k) {}
public: public:
virtual QualType getValueType() const = 0; virtual QualType getValueType() const = 0;
virtual QualType getLocationType() const { QualType getLocationType() const override {
// FIXME: We can possibly optimize this later to cache this value. // FIXME: We can possibly optimize this later to cache this value.
QualType T = getValueType(); QualType T = getValueType();
ASTContext &ctx = getContext(); ASTContext &ctx = getContext();
@ -521,7 +521,7 @@ public:
return T.getTypePtrOrNull() ? T.getDesugaredType(Context) : T; return T.getTypePtrOrNull() ? T.getDesugaredType(Context) : T;
} }
DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const; DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override;
static bool classof(const MemRegion* R) { static bool classof(const MemRegion* R) {
unsigned k = R->getKind(); unsigned k = R->getKind();
@ -532,12 +532,12 @@ public:
class CodeTextRegion : public TypedRegion { class CodeTextRegion : public TypedRegion {
public: public:
virtual void anchor(); void anchor() override;
protected: protected:
CodeTextRegion(const MemRegion *sreg, Kind k) : TypedRegion(sreg, k) {} CodeTextRegion(const MemRegion *sreg, Kind k) : TypedRegion(sreg, k) {}
public: public:
bool isBoundable() const { return false; } bool isBoundable() const override { return false; }
static bool classof(const MemRegion* R) { static bool classof(const MemRegion* R) {
Kind k = R->getKind(); Kind k = R->getKind();
return k >= FunctionTextRegionKind && k <= BlockTextRegionKind; return k >= FunctionTextRegionKind && k <= BlockTextRegionKind;
@ -552,8 +552,8 @@ public:
: CodeTextRegion(sreg, FunctionTextRegionKind), FD(fd) { : CodeTextRegion(sreg, FunctionTextRegionKind), FD(fd) {
assert(isa<ObjCMethodDecl>(fd) || isa<FunctionDecl>(fd)); assert(isa<ObjCMethodDecl>(fd) || isa<FunctionDecl>(fd));
} }
QualType getLocationType() const { QualType getLocationType() const override {
const ASTContext &Ctx = getContext(); const ASTContext &Ctx = getContext();
if (const FunctionDecl *D = dyn_cast<FunctionDecl>(FD)) { if (const FunctionDecl *D = dyn_cast<FunctionDecl>(FD)) {
return Ctx.getPointerType(D->getType()); return Ctx.getPointerType(D->getType());
@ -570,11 +570,11 @@ public:
const NamedDecl *getDecl() const { const NamedDecl *getDecl() const {
return FD; return FD;
} }
virtual 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 void ProfileRegion(llvm::FoldingSetNodeID& ID, const NamedDecl *FD, static void ProfileRegion(llvm::FoldingSetNodeID& ID, const NamedDecl *FD,
const MemRegion*); const MemRegion*);
@ -602,7 +602,7 @@ class BlockTextRegion : public CodeTextRegion {
: CodeTextRegion(sreg, BlockTextRegionKind), BD(bd), AC(ac), locTy(lTy) {} : CodeTextRegion(sreg, BlockTextRegionKind), BD(bd), AC(ac), locTy(lTy) {}
public: public:
QualType getLocationType() const { QualType getLocationType() const override {
return locTy; return locTy;
} }
@ -611,11 +611,11 @@ public:
} }
AnalysisDeclContext *getAnalysisDeclContext() const { return AC; } AnalysisDeclContext *getAnalysisDeclContext() const { return AC; }
virtual void dumpToStream(raw_ostream &os) const; virtual void dumpToStream(raw_ostream &os) const override;
void Profile(llvm::FoldingSetNodeID& ID) const; void Profile(llvm::FoldingSetNodeID& ID) const override;
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const BlockDecl *BD, static void ProfileRegion(llvm::FoldingSetNodeID& ID, const BlockDecl *BD,
CanQualType, const AnalysisDeclContext*, CanQualType, const AnalysisDeclContext*,
const MemRegion*); const MemRegion*);
@ -650,8 +650,8 @@ public:
const BlockDecl *getDecl() const { return BC->getDecl(); } const BlockDecl *getDecl() const { return BC->getDecl(); }
QualType getLocationType() const { return BC->getLocationType(); } QualType getLocationType() const override { return BC->getLocationType(); }
class referenced_vars_iterator { class referenced_vars_iterator {
const MemRegion * const *R; const MemRegion * const *R;
const MemRegion * const *OriginalR; const MemRegion * const *OriginalR;
@ -688,11 +688,11 @@ public:
referenced_vars_iterator referenced_vars_begin() const; referenced_vars_iterator referenced_vars_begin() const;
referenced_vars_iterator referenced_vars_end() const; referenced_vars_iterator referenced_vars_end() const;
virtual 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 void ProfileRegion(llvm::FoldingSetNodeID&, const BlockTextRegion *, static void ProfileRegion(llvm::FoldingSetNodeID&, const BlockTextRegion *,
const LocationContext *, unsigned, const LocationContext *, unsigned,
const MemRegion *); const MemRegion *);
@ -723,17 +723,17 @@ public:
return sym; 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, static void ProfileRegion(llvm::FoldingSetNodeID& ID,
SymbolRef sym, SymbolRef sym,
const MemRegion* superRegion); const MemRegion* superRegion);
void dumpToStream(raw_ostream &os) const; void dumpToStream(raw_ostream &os) const override;
static bool classof(const MemRegion* R) { static bool classof(const MemRegion* R) {
return R->getKind() == SymbolicRegionKind; return R->getKind() == SymbolicRegionKind;
@ -757,19 +757,19 @@ public:
const StringLiteral* getStringLiteral() const { return Str; } const StringLiteral* getStringLiteral() const { return Str; }
QualType getValueType() const { QualType getValueType() const override {
return Str->getType(); 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); ProfileRegion(ID, Str, superRegion);
} }
void dumpToStream(raw_ostream &os) const; void dumpToStream(raw_ostream &os) const override;
static bool classof(const MemRegion* R) { static bool classof(const MemRegion* R) {
return R->getKind() == StringRegionKind; return R->getKind() == StringRegionKind;
@ -792,19 +792,19 @@ protected:
public: public:
const ObjCStringLiteral* getObjCStringLiteral() const { return Str; } const ObjCStringLiteral* getObjCStringLiteral() const { return Str; }
QualType getValueType() const { QualType getValueType() const override {
return Str->getType(); return Str->getType();
} }
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); ProfileRegion(ID, Str, superRegion);
} }
void dumpToStream(raw_ostream &os) const; void dumpToStream(raw_ostream &os) const override;
static bool classof(const MemRegion* R) { static bool classof(const MemRegion* R) {
return R->getKind() == ObjCStringRegionKind; return R->getKind() == ObjCStringRegionKind;
} }
@ -825,15 +825,15 @@ private:
const CompoundLiteralExpr *CL, const CompoundLiteralExpr *CL,
const MemRegion* superRegion); const MemRegion* superRegion);
public: public:
QualType getValueType() const { QualType getValueType() const override {
return CL->getType(); 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; } const CompoundLiteralExpr *getLiteralExpr() const { return CL; }
@ -854,7 +854,7 @@ protected:
public: public:
const Decl *getDecl() const { return D; } 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) { static bool classof(const MemRegion* R) {
unsigned k = R->getKind(); unsigned k = R->getKind();
@ -874,27 +874,27 @@ class VarRegion : public DeclRegion {
DeclRegion::ProfileRegion(ID, VD, superRegion, VarRegionKind); DeclRegion::ProfileRegion(ID, VD, superRegion, VarRegionKind);
} }
void Profile(llvm::FoldingSetNodeID& ID) const; void Profile(llvm::FoldingSetNodeID& ID) const override;
public: public:
const VarDecl *getDecl() const { return cast<VarDecl>(D); } const VarDecl *getDecl() const { return cast<VarDecl>(D); }
const StackFrameContext *getStackFrame() const; const StackFrameContext *getStackFrame() const;
QualType getValueType() const { QualType getValueType() const override {
// FIXME: We can cache this if needed. // FIXME: We can cache this if needed.
return getDecl()->getType(); return getDecl()->getType();
} }
void dumpToStream(raw_ostream &os) const; void dumpToStream(raw_ostream &os) const override;
static bool classof(const MemRegion* R) { static bool classof(const MemRegion* R) {
return R->getKind() == VarRegionKind; 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 /// CXXThisRegion - Represents the region for the implicit 'this' parameter
@ -910,15 +910,15 @@ class CXXThisRegion : public TypedValueRegion {
const PointerType *PT, const PointerType *PT,
const MemRegion *sReg); const MemRegion *sReg);
void Profile(llvm::FoldingSetNodeID &ID) const; void Profile(llvm::FoldingSetNodeID &ID) const override;
public: public:
QualType getValueType() const { QualType getValueType() const override {
return QualType(ThisPointerTy, 0); return QualType(ThisPointerTy, 0);
} }
void dumpToStream(raw_ostream &os) const; void dumpToStream(raw_ostream &os) const override;
static bool classof(const MemRegion* R) { static bool classof(const MemRegion* R) {
return R->getKind() == CXXThisRegionKind; return R->getKind() == CXXThisRegionKind;
} }
@ -936,12 +936,12 @@ class FieldRegion : public DeclRegion {
public: public:
const FieldDecl *getDecl() const { return cast<FieldDecl>(D); } const FieldDecl *getDecl() const { return cast<FieldDecl>(D); }
QualType getValueType() const { QualType getValueType() const override {
// FIXME: We can cache this if needed. // FIXME: We can cache this if needed.
return getDecl()->getType(); return getDecl()->getType();
} }
DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const; DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override;
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const FieldDecl *FD, static void ProfileRegion(llvm::FoldingSetNodeID& ID, const FieldDecl *FD,
const MemRegion* superRegion) { const MemRegion* superRegion) {
@ -952,12 +952,12 @@ public:
return R->getKind() == FieldRegionKind; return R->getKind() == FieldRegionKind;
} }
void dumpToStream(raw_ostream &os) const; void dumpToStream(raw_ostream &os) const override;
bool canPrintPretty() const; bool canPrintPretty() const override;
void printPretty(raw_ostream &os) const; void printPretty(raw_ostream &os) const override;
bool canPrintPrettyAsExpr() const; bool canPrintPrettyAsExpr() const override;
void printPrettyAsExpr(raw_ostream &os) const; void printPrettyAsExpr(raw_ostream &os) const override;
}; };
class ObjCIvarRegion : public DeclRegion { class ObjCIvarRegion : public DeclRegion {
@ -971,12 +971,12 @@ class ObjCIvarRegion : public DeclRegion {
public: public:
const ObjCIvarDecl *getDecl() const; const ObjCIvarDecl *getDecl() const;
QualType getValueType() const; QualType getValueType() const override;
bool canPrintPrettyAsExpr() const; bool canPrintPrettyAsExpr() const override;
void printPrettyAsExpr(raw_ostream &os) const; 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) { static bool classof(const MemRegion* R) {
return R->getKind() == ObjCIvarRegionKind; return R->getKind() == ObjCIvarRegionKind;
@ -1029,7 +1029,7 @@ public:
NonLoc getIndex() const { return Index; } NonLoc getIndex() const { return Index; }
QualType getValueType() const { QualType getValueType() const override {
return ElementType; return ElementType;
} }
@ -1039,9 +1039,9 @@ public:
/// Compute the offset within the array. The array might also be a subobject. /// Compute the offset within the array. The array might also be a subobject.
RegionRawOffset getAsArrayOffset() const; 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) { static bool classof(const MemRegion* R) {
return R->getKind() == ElementRegionKind; return R->getKind() == ElementRegionKind;
@ -1063,13 +1063,13 @@ class CXXTempObjectRegion : public TypedValueRegion {
public: public:
const Expr *getExpr() const { return Ex; } const Expr *getExpr() const { return Ex; }
QualType getValueType() const { QualType getValueType() const override {
return Ex->getType(); 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) { static bool classof(const MemRegion* R) {
return R->getKind() == CXXTempObjectRegionKind; return R->getKind() == CXXTempObjectRegionKind;
@ -1094,19 +1094,19 @@ public:
const CXXRecordDecl *getDecl() const { return Data.getPointer(); } const CXXRecordDecl *getDecl() const { return Data.getPointer(); }
bool isVirtual() const { return Data.getInt(); } 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) { static bool classof(const MemRegion *region) {
return region->getKind() == CXXBaseObjectRegionKind; return region->getKind() == CXXBaseObjectRegionKind;
} }
bool canPrintPrettyAsExpr() const; bool canPrintPrettyAsExpr() const override;
void printPrettyAsExpr(raw_ostream &os) const; void printPrettyAsExpr(raw_ostream &os) const override;
}; };
template<typename RegionTy> template<typename RegionTy>

View File

@ -223,7 +223,7 @@ public:
FindUniqueBinding(SymbolRef sym) : Sym(sym), Binding(0), First(true) {} FindUniqueBinding(SymbolRef sym) : Sym(sym), Binding(0), First(true) {}
bool HandleBinding(StoreManager& SMgr, Store store, const MemRegion* R, bool HandleBinding(StoreManager& SMgr, Store store, const MemRegion* R,
SVal val); SVal val) override;
LLVM_EXPLICIT operator bool() { return First && Binding; } LLVM_EXPLICIT operator bool() { return First && Binding; }
const MemRegion *getRegion() { return Binding; } const MemRegion *getRegion() { return Binding; }
}; };

View File

@ -105,7 +105,7 @@ typedef unsigned SymbolID;
/// \brief A symbol representing data which can be stored in a memory location /// \brief A symbol representing data which can be stored in a memory location
/// (region). /// (region).
class SymbolData : public SymExpr { class SymbolData : public SymExpr {
virtual void anchor(); void anchor() override;
const SymbolID Sym; const SymbolID Sym;
protected: protected:
@ -138,13 +138,13 @@ public:
profile.AddPointer(R); profile.AddPointer(R);
} }
virtual void Profile(llvm::FoldingSetNodeID& profile) { void Profile(llvm::FoldingSetNodeID& profile) override {
Profile(profile, R); 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. // Implement isa<T> support.
static inline bool classof(const SymExpr *SE) { static inline bool classof(const SymExpr *SE) {
@ -173,9 +173,9 @@ public:
unsigned getCount() const { return Count; } unsigned getCount() const { return Count; }
const void *getTag() const { return SymbolTag; } 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, static void Profile(llvm::FoldingSetNodeID& profile, const Stmt *S,
QualType T, unsigned Count, const LocationContext *LCtx, QualType T, unsigned Count, const LocationContext *LCtx,
@ -188,7 +188,7 @@ public:
profile.AddPointer(SymbolTag); profile.AddPointer(SymbolTag);
} }
virtual void Profile(llvm::FoldingSetNodeID& profile) { void Profile(llvm::FoldingSetNodeID& profile) override {
Profile(profile, S, T, Count, LCtx, SymbolTag); Profile(profile, S, T, Count, LCtx, SymbolTag);
} }
@ -211,9 +211,9 @@ public:
SymbolRef getParentSymbol() const { return parentSymbol; } SymbolRef getParentSymbol() const { return parentSymbol; }
const TypedValueRegion *getRegion() const { return R; } 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, static void Profile(llvm::FoldingSetNodeID& profile, SymbolRef parent,
const TypedValueRegion *r) { const TypedValueRegion *r) {
@ -222,7 +222,7 @@ public:
profile.AddPointer(parent); profile.AddPointer(parent);
} }
virtual void Profile(llvm::FoldingSetNodeID& profile) { void Profile(llvm::FoldingSetNodeID& profile) override {
Profile(profile, parentSymbol, R); Profile(profile, parentSymbol, R);
} }
@ -244,16 +244,16 @@ public:
const SubRegion *getRegion() const { return R; } 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) { static void Profile(llvm::FoldingSetNodeID& profile, const SubRegion *R) {
profile.AddInteger((unsigned) ExtentKind); profile.AddInteger((unsigned) ExtentKind);
profile.AddPointer(R); profile.AddPointer(R);
} }
virtual void Profile(llvm::FoldingSetNodeID& profile) { void Profile(llvm::FoldingSetNodeID& profile) override {
Profile(profile, R); Profile(profile, R);
} }
@ -283,9 +283,9 @@ public:
unsigned getCount() const { return Count; } unsigned getCount() const { return Count; }
const void *getTag() const { return Tag; } 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, static void Profile(llvm::FoldingSetNodeID& profile, const MemRegion *R,
const Stmt *S, QualType T, unsigned Count, const Stmt *S, QualType T, unsigned Count,
@ -298,7 +298,7 @@ public:
profile.AddPointer(Tag); profile.AddPointer(Tag);
} }
virtual void Profile(llvm::FoldingSetNodeID& profile) { void Profile(llvm::FoldingSetNodeID& profile) override {
Profile(profile, R, S, T, Count, Tag); Profile(profile, R, S, T, Count, Tag);
} }
@ -320,11 +320,11 @@ public:
SymbolCast(const SymExpr *In, QualType From, QualType To) : SymbolCast(const SymExpr *In, QualType From, QualType To) :
SymExpr(CastSymbolKind), Operand(In), FromTy(From), ToTy(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; } 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, static void Profile(llvm::FoldingSetNodeID& ID,
const SymExpr *In, QualType From, QualType To) { const SymExpr *In, QualType From, QualType To) {
@ -334,7 +334,7 @@ public:
ID.Add(To); ID.Add(To);
} }
void Profile(llvm::FoldingSetNodeID& ID) { void Profile(llvm::FoldingSetNodeID& ID) override {
Profile(ID, Operand, FromTy, ToTy); Profile(ID, Operand, FromTy, ToTy);
} }
@ -356,7 +356,7 @@ protected:
public: public:
// FIXME: We probably need to make this out-of-line to avoid redundant // FIXME: We probably need to make this out-of-line to avoid redundant
// generation of virtual functions. // generation of virtual functions.
QualType getType() const { return T; } QualType getType() const override { return T; }
BinaryOperator::Opcode getOpcode() const { return Op; } BinaryOperator::Opcode getOpcode() const { return Op; }
@ -377,7 +377,7 @@ public:
const llvm::APSInt& rhs, QualType t) const llvm::APSInt& rhs, QualType t)
: BinarySymExpr(SymIntKind, op, t), LHS(lhs), RHS(rhs) {} : 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 SymExpr *getLHS() const { return LHS; }
const llvm::APSInt &getRHS() const { return RHS; } const llvm::APSInt &getRHS() const { return RHS; }
@ -392,7 +392,7 @@ public:
ID.Add(t); ID.Add(t);
} }
void Profile(llvm::FoldingSetNodeID& ID) { void Profile(llvm::FoldingSetNodeID& ID) override {
Profile(ID, LHS, getOpcode(), RHS, getType()); Profile(ID, LHS, getOpcode(), RHS, getType());
} }
@ -412,7 +412,7 @@ public:
const SymExpr *rhs, QualType t) const SymExpr *rhs, QualType t)
: BinarySymExpr(IntSymKind, op, t), LHS(lhs), RHS(rhs) {} : 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 SymExpr *getRHS() const { return RHS; }
const llvm::APSInt &getLHS() const { return LHS; } const llvm::APSInt &getLHS() const { return LHS; }
@ -427,7 +427,7 @@ public:
ID.Add(t); ID.Add(t);
} }
void Profile(llvm::FoldingSetNodeID& ID) { void Profile(llvm::FoldingSetNodeID& ID) override {
Profile(ID, LHS, getOpcode(), RHS, getType()); Profile(ID, LHS, getOpcode(), RHS, getType());
} }
@ -450,7 +450,7 @@ public:
const SymExpr *getLHS() const { return LHS; } const SymExpr *getLHS() const { return LHS; }
const SymExpr *getRHS() const { return RHS; } 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, static void Profile(llvm::FoldingSetNodeID& ID, const SymExpr *lhs,
BinaryOperator::Opcode op, const SymExpr *rhs, QualType t) { BinaryOperator::Opcode op, const SymExpr *rhs, QualType t) {
@ -461,7 +461,7 @@ public:
ID.Add(t); ID.Add(t);
} }
void Profile(llvm::FoldingSetNodeID& ID) { void Profile(llvm::FoldingSetNodeID& ID) override {
Profile(ID, LHS, getOpcode(), RHS, getType()); Profile(ID, LHS, getOpcode(), RHS, getType());
} }

View File

@ -22,8 +22,8 @@ namespace ento {
class AnalysisAction : public ASTFrontendAction { class AnalysisAction : public ASTFrontendAction {
protected: protected:
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
StringRef InFile); StringRef InFile) override;
}; };
void printCheckerHelp(raw_ostream &OS, ArrayRef<std::string> plugins); void printCheckerHelp(raw_ostream &OS, ArrayRef<std::string> plugins);

View File

@ -49,13 +49,13 @@ public:
/// This class implements ArgumentsAdjuster interface and converts input /// This class implements ArgumentsAdjuster interface and converts input
/// command line arguments to the "syntax check only" variant. /// command line arguments to the "syntax check only" variant.
class ClangSyntaxOnlyAdjuster : public ArgumentsAdjuster { 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 /// \brief An argument adjuster which removes output-related command line
/// arguments. /// arguments.
class ClangStripOutputAdjuster : public ArgumentsAdjuster { class ClangStripOutputAdjuster : public ArgumentsAdjuster {
virtual CommandLineArguments Adjust(const CommandLineArguments &Args); CommandLineArguments Adjust(const CommandLineArguments &Args) override;
}; };
} // end namespace tooling } // end namespace tooling

View File

@ -190,19 +190,19 @@ public:
/// Will always return a vector with one entry that contains the directory /// 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 command line specified at construction with "clang-tool" as argv[0]
/// and 'FilePath' as positional argument. /// and 'FilePath' as positional argument.
virtual std::vector<CompileCommand> getCompileCommands( std::vector<CompileCommand>
StringRef FilePath) const; getCompileCommands(StringRef FilePath) const override;
/// \brief Returns the list of all files available in the compilation database. /// \brief Returns the list of all files available in the compilation database.
/// ///
/// Note: This is always an empty list for the fixed 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 /// \brief Returns all compile commands for all the files in the compilation
/// database. /// database.
/// ///
/// Note: This is always an empty list for the fixed 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: private:
/// This is built up to contain a single entry vector to be returned from /// This is built up to contain a single entry vector to be returned from

View File

@ -67,17 +67,17 @@ public:
/// ///
/// FIXME: Currently FilePath must be an absolute path inside the /// FIXME: Currently FilePath must be an absolute path inside the
/// source directory which does not have symlinks resolved. /// source directory which does not have symlinks resolved.
virtual std::vector<CompileCommand> getCompileCommands( std::vector<CompileCommand>
StringRef FilePath) const; getCompileCommands(StringRef FilePath) const override;
/// \brief Returns the list of all files available in the compilation database. /// \brief Returns the list of all files available in the compilation database.
/// ///
/// These are the 'file' entries of the JSON objects. /// 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 /// \brief Returns all compile commands for all the files in the compilation
/// database. /// database.
virtual std::vector<CompileCommand> getAllCompileCommands() const; std::vector<CompileCommand> getAllCompileCommands() const override;
private: private:
/// \brief Constructs a JSON compilation database on a memory buffer. /// \brief Constructs a JSON compilation database on a memory buffer.

View File

@ -52,7 +52,7 @@ protected:
class ReplaceStmtWithText : public RefactoringCallback { class ReplaceStmtWithText : public RefactoringCallback {
public: public:
ReplaceStmtWithText(StringRef FromId, StringRef ToText); ReplaceStmtWithText(StringRef FromId, StringRef ToText);
virtual void run(const ast_matchers::MatchFinder::MatchResult &Result); void run(const ast_matchers::MatchFinder::MatchResult &Result) override;
private: private:
std::string FromId; std::string FromId;
@ -64,7 +64,7 @@ private:
class ReplaceStmtWithStmt : public RefactoringCallback { class ReplaceStmtWithStmt : public RefactoringCallback {
public: public:
ReplaceStmtWithStmt(StringRef FromId, StringRef ToId); ReplaceStmtWithStmt(StringRef FromId, StringRef ToId);
virtual void run(const ast_matchers::MatchFinder::MatchResult &Result); void run(const ast_matchers::MatchFinder::MatchResult &Result) override;
private: private:
std::string FromId; std::string FromId;
@ -77,7 +77,7 @@ private:
class ReplaceIfStmtWithItsBody : public RefactoringCallback { class ReplaceIfStmtWithItsBody : public RefactoringCallback {
public: public:
ReplaceIfStmtWithItsBody(StringRef Id, bool PickTrueBranch); ReplaceIfStmtWithItsBody(StringRef Id, bool PickTrueBranch);
virtual void run(const ast_matchers::MatchFinder::MatchResult &Result); void run(const ast_matchers::MatchFinder::MatchResult &Result) override;
private: private:
std::string Id; std::string Id;

View File

@ -80,7 +80,7 @@ public:
/// \brief Invokes the compiler with a FrontendAction created by create(). /// \brief Invokes the compiler with a FrontendAction created by create().
bool runInvocation(clang::CompilerInvocation *Invocation, FileManager *Files, bool runInvocation(clang::CompilerInvocation *Invocation, FileManager *Files,
DiagnosticConsumer *DiagConsumer); DiagnosticConsumer *DiagConsumer) override;
/// \brief Returns a new clang::FrontendAction. /// \brief Returns a new clang::FrontendAction.
/// ///
@ -306,7 +306,7 @@ template <typename T>
FrontendActionFactory *newFrontendActionFactory() { FrontendActionFactory *newFrontendActionFactory() {
class SimpleFrontendActionFactory : public FrontendActionFactory { class SimpleFrontendActionFactory : public FrontendActionFactory {
public: public:
virtual clang::FrontendAction *create() { return new T; } clang::FrontendAction *create() override { return new T; }
}; };
return new SimpleFrontendActionFactory; return new SimpleFrontendActionFactory;
@ -321,7 +321,7 @@ inline FrontendActionFactory *newFrontendActionFactory(
SourceFileCallbacks *Callbacks) SourceFileCallbacks *Callbacks)
: ConsumerFactory(ConsumerFactory), Callbacks(Callbacks) {} : ConsumerFactory(ConsumerFactory), Callbacks(Callbacks) {}
virtual clang::FrontendAction *create() { clang::FrontendAction *create() override {
return new ConsumerFactoryAdaptor(ConsumerFactory, Callbacks); return new ConsumerFactoryAdaptor(ConsumerFactory, Callbacks);
} }
@ -333,20 +333,20 @@ inline FrontendActionFactory *newFrontendActionFactory(
: ConsumerFactory(ConsumerFactory), Callbacks(Callbacks) {} : ConsumerFactory(ConsumerFactory), Callbacks(Callbacks) {}
clang::ASTConsumer *CreateASTConsumer(clang::CompilerInstance &, clang::ASTConsumer *CreateASTConsumer(clang::CompilerInstance &,
StringRef) { StringRef) override {
return ConsumerFactory->newASTConsumer(); return ConsumerFactory->newASTConsumer();
} }
protected: protected:
virtual bool BeginSourceFileAction(CompilerInstance &CI, bool BeginSourceFileAction(CompilerInstance &CI,
StringRef Filename) override { StringRef Filename) override {
if (!clang::ASTFrontendAction::BeginSourceFileAction(CI, Filename)) if (!clang::ASTFrontendAction::BeginSourceFileAction(CI, Filename))
return false; return false;
if (Callbacks != NULL) if (Callbacks != NULL)
return Callbacks->handleBeginSource(CI, Filename); return Callbacks->handleBeginSource(CI, Filename);
return true; return true;
} }
virtual void EndSourceFileAction() override { void EndSourceFileAction() override {
if (Callbacks != NULL) if (Callbacks != NULL)
Callbacks->handleEndSource(); Callbacks->handleEndSource();
clang::ASTFrontendAction::EndSourceFileAction(); clang::ASTFrontendAction::EndSourceFileAction();

View File

@ -90,10 +90,9 @@ protected:
/// \c getSplit() needs to be implemented by child classes. /// \c getSplit() needs to be implemented by child classes.
class BreakableSingleLineToken : public BreakableToken { class BreakableSingleLineToken : public BreakableToken {
public: public:
virtual unsigned getLineCount() const; unsigned getLineCount() const override;
virtual unsigned getLineLengthAfterSplit(unsigned LineIndex, unsigned getLineLengthAfterSplit(unsigned LineIndex, unsigned TailOffset,
unsigned TailOffset, StringRef::size_type Length) const override;
StringRef::size_type Length) const;
protected: protected:
BreakableSingleLineToken(const FormatToken &Tok, unsigned IndentLevel, BreakableSingleLineToken(const FormatToken &Tok, unsigned IndentLevel,
@ -123,13 +122,12 @@ public:
StringRef Postfix, bool InPPDirective, StringRef Postfix, bool InPPDirective,
encoding::Encoding Encoding, const FormatStyle &Style); encoding::Encoding Encoding, const FormatStyle &Style);
virtual Split getSplit(unsigned LineIndex, unsigned TailOffset, Split getSplit(unsigned LineIndex, unsigned TailOffset,
unsigned ColumnLimit) const; unsigned ColumnLimit) const override;
virtual void insertBreak(unsigned LineIndex, unsigned TailOffset, Split Split, void insertBreak(unsigned LineIndex, unsigned TailOffset, Split Split,
WhitespaceManager &Whitespaces); WhitespaceManager &Whitespaces) override;
virtual void replaceWhitespace(unsigned LineIndex, unsigned TailOffset, void replaceWhitespace(unsigned LineIndex, unsigned TailOffset, Split Split,
Split Split, WhitespaceManager &Whitespaces) override {}
WhitespaceManager &Whitespaces) {}
}; };
class BreakableLineComment : public BreakableSingleLineToken { class BreakableLineComment : public BreakableSingleLineToken {
@ -142,15 +140,14 @@ public:
unsigned StartColumn, bool InPPDirective, unsigned StartColumn, bool InPPDirective,
encoding::Encoding Encoding, const FormatStyle &Style); encoding::Encoding Encoding, const FormatStyle &Style);
virtual Split getSplit(unsigned LineIndex, unsigned TailOffset, Split getSplit(unsigned LineIndex, unsigned TailOffset,
unsigned ColumnLimit) const; unsigned ColumnLimit) const override;
virtual void insertBreak(unsigned LineIndex, unsigned TailOffset, Split Split, void insertBreak(unsigned LineIndex, unsigned TailOffset, Split Split,
WhitespaceManager &Whitespaces); WhitespaceManager &Whitespaces) override;
virtual void replaceWhitespace(unsigned LineIndex, unsigned TailOffset, void replaceWhitespace(unsigned LineIndex, unsigned TailOffset, Split Split,
Split Split, WhitespaceManager &Whitespaces) override;
WhitespaceManager &Whitespaces); void replaceWhitespaceBefore(unsigned LineIndex,
virtual void replaceWhitespaceBefore(unsigned LineIndex, WhitespaceManager &Whitespaces) override;
WhitespaceManager &Whitespaces);
private: private:
// The prefix without an additional space if one was added. // The prefix without an additional space if one was added.
@ -170,19 +167,17 @@ public:
bool FirstInLine, bool InPPDirective, bool FirstInLine, bool InPPDirective,
encoding::Encoding Encoding, const FormatStyle &Style); encoding::Encoding Encoding, const FormatStyle &Style);
virtual unsigned getLineCount() const; unsigned getLineCount() const override;
virtual unsigned getLineLengthAfterSplit(unsigned LineIndex, unsigned getLineLengthAfterSplit(unsigned LineIndex, unsigned TailOffset,
unsigned TailOffset, StringRef::size_type Length) const override;
StringRef::size_type Length) const; Split getSplit(unsigned LineIndex, unsigned TailOffset,
virtual Split getSplit(unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit) const override;
unsigned ColumnLimit) const; void insertBreak(unsigned LineIndex, unsigned TailOffset, Split Split,
virtual void insertBreak(unsigned LineIndex, unsigned TailOffset, Split Split, WhitespaceManager &Whitespaces) override;
WhitespaceManager &Whitespaces); void replaceWhitespace(unsigned LineIndex, unsigned TailOffset, Split Split,
virtual void replaceWhitespace(unsigned LineIndex, unsigned TailOffset, WhitespaceManager &Whitespaces) override;
Split Split, void replaceWhitespaceBefore(unsigned LineIndex,
WhitespaceManager &Whitespaces); WhitespaceManager &Whitespaces) override;
virtual void replaceWhitespaceBefore(unsigned LineIndex,
WhitespaceManager &Whitespaces);
private: private:
// Rearranges the whitespace between Lines[LineIndex-1] and Lines[LineIndex], // Rearranges the whitespace between Lines[LineIndex-1] and Lines[LineIndex],

View File

@ -1651,12 +1651,12 @@ private:
HasBinPackedFunction || !HasOnePerLineFunction; HasBinPackedFunction || !HasOnePerLineFunction;
} }
virtual void consumeUnwrappedLine(const UnwrappedLine &TheLine) { void consumeUnwrappedLine(const UnwrappedLine &TheLine) override {
assert(!UnwrappedLines.empty()); assert(!UnwrappedLines.empty());
UnwrappedLines.back().push_back(TheLine); UnwrappedLines.back().push_back(TheLine);
} }
virtual void finishRun() { void finishRun() override {
UnwrappedLines.push_back(SmallVector<UnwrappedLine, 16>()); UnwrappedLines.push_back(SmallVector<UnwrappedLine, 16>());
} }

View File

@ -432,17 +432,16 @@ public:
CommaSeparatedList(const FormatStyle &Style) CommaSeparatedList(const FormatStyle &Style)
: TokenRole(Style), HasNestedBracedList(false) {} : TokenRole(Style), HasNestedBracedList(false) {}
virtual void precomputeFormattingInfos(const FormatToken *Token); void precomputeFormattingInfos(const FormatToken *Token) override;
virtual unsigned formatAfterToken(LineState &State, unsigned formatAfterToken(LineState &State, ContinuationIndenter *Indenter,
ContinuationIndenter *Indenter, bool DryRun) override;
bool DryRun);
virtual unsigned formatFromToken(LineState &State, unsigned formatFromToken(LineState &State, ContinuationIndenter *Indenter,
ContinuationIndenter *Indenter, bool DryRun); bool DryRun) override;
/// \brief Adds \p Token as the next comma to the \c CommaSeparated list. /// \brief Adds \p Token as the next comma to the \c CommaSeparated list.
virtual void CommaFound(const FormatToken *Token) { Commas.push_back(Token); } void CommaFound(const FormatToken *Token) override { Commas.push_back(Token);}
private: private:
/// \brief A struct that holds information on how to format a given list with /// \brief A struct that holds information on how to format a given list with

View File

@ -74,7 +74,7 @@ public:
StructuralError = PreviousStructuralError; StructuralError = PreviousStructuralError;
} }
virtual FormatToken *getNextToken() { FormatToken *getNextToken() override {
// The \c UnwrappedLineParser guards against this by never calling // The \c UnwrappedLineParser guards against this by never calling
// \c getNextToken() after it has encountered the first eof token. // \c getNextToken() after it has encountered the first eof token.
assert(!eof()); assert(!eof());
@ -84,9 +84,9 @@ public:
return Token; return Token;
} }
virtual unsigned getPosition() { return PreviousTokenSource->getPosition(); } unsigned getPosition() override { return PreviousTokenSource->getPosition(); }
virtual FormatToken *setPosition(unsigned Position) { FormatToken *setPosition(unsigned Position) override {
Token = PreviousTokenSource->setPosition(Position); Token = PreviousTokenSource->setPosition(Position);
return Token; return Token;
} }
@ -180,17 +180,17 @@ public:
IndexedTokenSource(ArrayRef<FormatToken *> Tokens) IndexedTokenSource(ArrayRef<FormatToken *> Tokens)
: Tokens(Tokens), Position(-1) {} : Tokens(Tokens), Position(-1) {}
virtual FormatToken *getNextToken() { FormatToken *getNextToken() override {
++Position; ++Position;
return Tokens[Position]; return Tokens[Position];
} }
virtual unsigned getPosition() { unsigned getPosition() override {
assert(Position >= 0); assert(Position >= 0);
return Position; return Position;
} }
virtual FormatToken *setPosition(unsigned P) { FormatToken *setPosition(unsigned P) override {
Position = P; Position = P;
return Tokens[Position]; return Tokens[Position];
} }

View File

@ -62,10 +62,10 @@ class RewritesReceiver : public edit::EditsReceiver {
public: public:
RewritesReceiver(Rewriter &Rewrite) : Rewrite(Rewrite) { } RewritesReceiver(Rewriter &Rewrite) : Rewrite(Rewrite) { }
virtual void insert(SourceLocation loc, StringRef text) { void insert(SourceLocation loc, StringRef text) override {
Rewrite.InsertText(loc, text); Rewrite.InsertText(loc, text);
} }
virtual void replace(CharSourceRange range, StringRef text) { void replace(CharSourceRange range, StringRef text) override {
Rewrite.ReplaceText(range.getBegin(), Rewrite.getRangeSize(range), text); Rewrite.ReplaceText(range.getBegin(), Rewrite.getRangeSize(range), text);
} }
}; };

View File

@ -48,7 +48,7 @@ ASTConsumer *FixItAction::CreateASTConsumer(CompilerInstance &CI,
namespace { namespace {
class FixItRewriteInPlace : public FixItOptions { class FixItRewriteInPlace : public FixItOptions {
public: public:
std::string RewriteFilename(const std::string &Filename, int &fd) { std::string RewriteFilename(const std::string &Filename, int &fd) override {
fd = -1; fd = -1;
return Filename; return Filename;
} }
@ -63,7 +63,7 @@ public:
this->FixWhatYouCan = FixWhatYouCan; this->FixWhatYouCan = FixWhatYouCan;
} }
std::string RewriteFilename(const std::string &Filename, int &fd) { std::string RewriteFilename(const std::string &Filename, int &fd) override {
fd = -1; fd = -1;
SmallString<128> Path(Filename); SmallString<128> Path(Filename);
llvm::sys::path::replace_extension(Path, llvm::sys::path::replace_extension(Path,
@ -74,7 +74,7 @@ public:
class FixItRewriteToTemp : public FixItOptions { class FixItRewriteToTemp : public FixItOptions {
public: public:
std::string RewriteFilename(const std::string &Filename, int &fd) { std::string RewriteFilename(const std::string &Filename, int &fd) override {
SmallString<128> Path; SmallString<128> Path;
llvm::sys::fs::createTemporaryFile(llvm::sys::path::filename(Filename), llvm::sys::fs::createTemporaryFile(llvm::sys::path::filename(Filename),
llvm::sys::path::extension(Filename), fd, llvm::sys::path::extension(Filename), fd,

View File

@ -42,8 +42,8 @@ namespace {
: Out(OS), PP(pp), SyntaxHighlight(_SyntaxHighlight), : Out(OS), PP(pp), SyntaxHighlight(_SyntaxHighlight),
HighlightMacros(_HighlightMacros) {} HighlightMacros(_HighlightMacros) {}
void Initialize(ASTContext &context); void Initialize(ASTContext &context) override;
void HandleTranslationUnit(ASTContext &Ctx); void HandleTranslationUnit(ASTContext &Ctx) override;
}; };
} }

View File

@ -55,21 +55,16 @@ public:
PredefinesBuffer = Buf; PredefinesBuffer = Buf;
} }
private: private:
virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, void FileChanged(SourceLocation Loc, FileChangeReason Reason,
SrcMgr::CharacteristicKind FileType, SrcMgr::CharacteristicKind FileType,
FileID PrevFID); FileID PrevFID) override;
virtual void FileSkipped(const FileEntry &ParentFile, void FileSkipped(const FileEntry &ParentFile, const Token &FilenameTok,
const Token &FilenameTok, SrcMgr::CharacteristicKind FileType) override;
SrcMgr::CharacteristicKind FileType); void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
virtual void InclusionDirective(SourceLocation HashLoc, StringRef FileName, bool IsAngled,
const Token &IncludeTok, CharSourceRange FilenameRange, const FileEntry *File,
StringRef FileName, StringRef SearchPath, StringRef RelativePath,
bool IsAngled, const Module *Imported) override;
CharSourceRange FilenameRange,
const FileEntry *File,
StringRef SearchPath,
StringRef RelativePath,
const Module *Imported);
void WriteLineInfo(const char *Filename, int Line, void WriteLineInfo(const char *Filename, int Line,
SrcMgr::CharacteristicKind FileType, SrcMgr::CharacteristicKind FileType,
StringRef EOL, StringRef Extra = StringRef()); StringRef EOL, StringRef Extra = StringRef());

View File

@ -185,7 +185,7 @@ namespace {
public: public:
llvm::DenseMap<ObjCMethodDecl*, std::string> MethodInternalNames; llvm::DenseMap<ObjCMethodDecl*, std::string> MethodInternalNames;
// Top Level Driver code. // Top Level Driver code.
virtual bool HandleTopLevelDecl(DeclGroupRef D) { bool HandleTopLevelDecl(DeclGroupRef D) override {
for (DeclGroupRef::iterator I = D.begin(), E = D.end(); I != E; ++I) { for (DeclGroupRef::iterator I = D.begin(), E = D.end(); I != E; ++I) {
if (ObjCInterfaceDecl *Class = dyn_cast<ObjCInterfaceDecl>(*I)) { if (ObjCInterfaceDecl *Class = dyn_cast<ObjCInterfaceDecl>(*I)) {
if (!Class->isThisDeclarationADefinition()) { if (!Class->isThisDeclarationADefinition()) {
@ -221,8 +221,8 @@ namespace {
} }
return true; return true;
} }
virtual void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) { void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) override {
for (DeclGroupRef::iterator I = D.begin(), E = D.end(); I != E; ++I) { for (DeclGroupRef::iterator I = D.begin(), E = D.end(); I != E; ++I) {
if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(*I)) { if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(*I)) {
if (isTopLevelBlockPointerType(TD->getUnderlyingType())) if (isTopLevelBlockPointerType(TD->getUnderlyingType()))
@ -243,8 +243,8 @@ namespace {
bool silenceMacroWarn, bool LineInfo); bool silenceMacroWarn, bool LineInfo);
~RewriteModernObjC() {} ~RewriteModernObjC() {}
virtual void HandleTranslationUnit(ASTContext &C); void HandleTranslationUnit(ASTContext &C) override;
void ReplaceStmt(Stmt *Old, Stmt *New) { void ReplaceStmt(Stmt *Old, Stmt *New) {
Stmt *ReplacingStmt = ReplacedNodes[Old]; Stmt *ReplacingStmt = ReplacedNodes[Old];
@ -414,9 +414,9 @@ namespace {
void RewriteIvarOffsetSymbols(ObjCInterfaceDecl *CDecl, void RewriteIvarOffsetSymbols(ObjCInterfaceDecl *CDecl,
std::string &Result); std::string &Result);
virtual void Initialize(ASTContext &context); void Initialize(ASTContext &context) override;
// Misc. AST transformation routines. Sometimes they end up calling // Misc. AST transformation routines. Sometimes they end up calling
// rewriting routines on the new ASTs. // rewriting routines on the new ASTs.
CallExpr *SynthesizeCallToFunctionDecl(FunctionDecl *FD, CallExpr *SynthesizeCallToFunctionDecl(FunctionDecl *FD,

View File

@ -165,7 +165,7 @@ namespace {
public: public:
// Top Level Driver code. // Top Level Driver code.
virtual bool HandleTopLevelDecl(DeclGroupRef D) { bool HandleTopLevelDecl(DeclGroupRef D) override {
for (DeclGroupRef::iterator I = D.begin(), E = D.end(); I != E; ++I) { for (DeclGroupRef::iterator I = D.begin(), E = D.end(); I != E; ++I) {
if (ObjCInterfaceDecl *Class = dyn_cast<ObjCInterfaceDecl>(*I)) { if (ObjCInterfaceDecl *Class = dyn_cast<ObjCInterfaceDecl>(*I)) {
if (!Class->isThisDeclarationADefinition()) { if (!Class->isThisDeclarationADefinition()) {
@ -193,7 +193,7 @@ namespace {
~RewriteObjC() {} ~RewriteObjC() {}
virtual void HandleTranslationUnit(ASTContext &C); void HandleTranslationUnit(ASTContext &C) override;
void ReplaceStmt(Stmt *Old, Stmt *New) { void ReplaceStmt(Stmt *Old, Stmt *New) {
Stmt *ReplacingStmt = ReplacedNodes[Old]; Stmt *ReplacingStmt = ReplacedNodes[Old];
@ -328,9 +328,9 @@ namespace {
void RewriteObjCInternalStruct(ObjCInterfaceDecl *CDecl, void RewriteObjCInternalStruct(ObjCInterfaceDecl *CDecl,
std::string &Result); std::string &Result);
virtual void Initialize(ASTContext &context) = 0; virtual void Initialize(ASTContext &context) override = 0;
// Metadata Rewriting. // Metadata Rewriting.
virtual void RewriteMetaDataIntoBuffer(std::string &Result) = 0; virtual void RewriteMetaDataIntoBuffer(std::string &Result) = 0;
virtual void RewriteObjCProtocolListMetaData(const ObjCList<ObjCProtocolDecl> &Prots, virtual void RewriteObjCProtocolListMetaData(const ObjCList<ObjCProtocolDecl> &Prots,
@ -521,8 +521,8 @@ namespace {
silenceMacroWarn) {} silenceMacroWarn) {}
~RewriteObjCFragileABI() {} ~RewriteObjCFragileABI() {}
virtual void Initialize(ASTContext &context); virtual void Initialize(ASTContext &context) override;
// Rewriting metadata // Rewriting metadata
template<typename MethodIterator> template<typename MethodIterator>
void RewriteObjCMethodsMetaData(MethodIterator MethodBegin, void RewriteObjCMethodsMetaData(MethodIterator MethodBegin,
@ -531,23 +531,22 @@ namespace {
StringRef prefix, StringRef prefix,
StringRef ClassName, StringRef ClassName,
std::string &Result); std::string &Result);
virtual void RewriteObjCProtocolMetaData(ObjCProtocolDecl *Protocol, void RewriteObjCProtocolMetaData(ObjCProtocolDecl *Protocol,
StringRef prefix, StringRef prefix, StringRef ClassName,
StringRef ClassName, std::string &Result) override;
std::string &Result); void RewriteObjCProtocolListMetaData(
virtual void RewriteObjCProtocolListMetaData( const ObjCList<ObjCProtocolDecl> &Prots,
const ObjCList<ObjCProtocolDecl> &Prots, StringRef prefix, StringRef ClassName, std::string &Result) override;
StringRef prefix, StringRef ClassName, std::string &Result); void RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
virtual void RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, std::string &Result) override;
std::string &Result); void RewriteMetaDataIntoBuffer(std::string &Result) override;
virtual void RewriteMetaDataIntoBuffer(std::string &Result); void RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *CDecl,
virtual void RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *CDecl, std::string &Result) override;
std::string &Result);
// Rewriting ivar // Rewriting ivar
virtual void RewriteIvarOffsetComputation(ObjCIvarDecl *ivar, void RewriteIvarOffsetComputation(ObjCIvarDecl *ivar,
std::string &Result); std::string &Result) override;
virtual Stmt *RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV); Stmt *RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) override;
}; };
} }

View File

@ -255,8 +255,8 @@ public:
return false; return false;
} }
virtual void observeStmt(const Stmt *S, const CFGBlock *block, void observeStmt(const Stmt *S, const CFGBlock *block,
const LiveVariables::LivenessValues &Live) { const LiveVariables::LivenessValues &Live) override {
currentBlock = block; currentBlock = block;

View File

@ -139,7 +139,7 @@ private:
SecKeychainBugVisitor(SymbolRef S) : Sym(S) {} SecKeychainBugVisitor(SymbolRef S) : Sym(S) {}
virtual ~SecKeychainBugVisitor() {} virtual ~SecKeychainBugVisitor() {}
void Profile(llvm::FoldingSetNodeID &ID) const { void Profile(llvm::FoldingSetNodeID &ID) const override {
static int X = 0; static int X = 0;
ID.AddPointer(&X); ID.AddPointer(&X);
ID.AddPointer(Sym); ID.AddPointer(Sym);
@ -148,7 +148,7 @@ private:
PathDiagnosticPiece *VisitNode(const ExplodedNode *N, PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
const ExplodedNode *PrevN, const ExplodedNode *PrevN,
BugReporterContext &BRC, BugReporterContext &BRC,
BugReport &BR); BugReport &BR) override;
}; };
}; };
} }

View File

@ -196,7 +196,7 @@ public:
PointerEscapeKind Kind) const; PointerEscapeKind Kind) const;
void printState(raw_ostream &Out, ProgramStateRef State, void printState(raw_ostream &Out, ProgramStateRef State,
const char *NL, const char *Sep) const; const char *NL, const char *Sep) const override;
private: private:
mutable std::unique_ptr<BugType> BT_DoubleFree[CK_NumCheckKinds]; mutable std::unique_ptr<BugType> BT_DoubleFree[CK_NumCheckKinds];
@ -364,7 +364,7 @@ private:
virtual ~MallocBugVisitor() {} virtual ~MallocBugVisitor() {}
void Profile(llvm::FoldingSetNodeID &ID) const { void Profile(llvm::FoldingSetNodeID &ID) const override {
static int X = 0; static int X = 0;
ID.AddPointer(&X); ID.AddPointer(&X);
ID.AddPointer(Sym); ID.AddPointer(Sym);
@ -406,11 +406,11 @@ private:
PathDiagnosticPiece *VisitNode(const ExplodedNode *N, PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
const ExplodedNode *PrevN, const ExplodedNode *PrevN,
BugReporterContext &BRC, BugReporterContext &BRC,
BugReport &BR); BugReport &BR) override;
PathDiagnosticPiece* getEndPath(BugReporterContext &BRC, PathDiagnosticPiece* getEndPath(BugReporterContext &BRC,
const ExplodedNode *EndPathNode, const ExplodedNode *EndPathNode,
BugReport &BR) { BugReport &BR) override {
if (!IsLeak) if (!IsLeak)
return 0; return 0;
@ -428,7 +428,8 @@ private:
StackHintGeneratorForReallocationFailed(SymbolRef S, StringRef M) StackHintGeneratorForReallocationFailed(SymbolRef S, StringRef M)
: StackHintGeneratorForSymbol(S, M) {} : StackHintGeneratorForSymbol(S, M) {}
virtual std::string getMessageForArg(const Expr *ArgE, unsigned ArgIndex) { std::string getMessageForArg(const Expr *ArgE,
unsigned ArgIndex) override {
// Printed parameters start at 1, not 0. // Printed parameters start at 1, not 0.
++ArgIndex; ++ArgIndex;
@ -441,7 +442,7 @@ private:
return os.str(); return os.str();
} }
virtual std::string getMessageForReturn(const CallExpr *CallExpr) { std::string getMessageForReturn(const CallExpr *CallExpr) override {
return "Reallocation of returned value failed"; return "Reallocation of returned value failed";
} }
}; };
@ -463,7 +464,7 @@ public:
StopTrackingCallback(ProgramStateRef st) : state(st) {} StopTrackingCallback(ProgramStateRef st) : state(st) {}
ProgramStateRef getState() const { return state; } ProgramStateRef getState() const { return state; }
bool VisitSymbol(SymbolRef sym) { bool VisitSymbol(SymbolRef sym) override {
state = state->remove<RegionState>(sym); state = state->remove<RegionState>(sym);
return true; return true;
} }

View File

@ -74,7 +74,7 @@ public:
void checkPostCall(const CallEvent &CE, CheckerContext &C) const; void checkPostCall(const CallEvent &CE, CheckerContext &C) const;
void printState(raw_ostream &Out, ProgramStateRef State, void printState(raw_ostream &Out, ProgramStateRef State,
const char *NL, const char *Sep) const; const char *NL, const char *Sep) const override;
}; };
} // end anonymous namespace } // end anonymous namespace

View File

@ -1563,7 +1563,7 @@ namespace {
UseAfterRelease(const CheckerBase *checker) UseAfterRelease(const CheckerBase *checker)
: CFRefBug(checker, "Use-after-release") {} : CFRefBug(checker, "Use-after-release") {}
const char *getDescription() const { const char *getDescription() const override {
return "Reference-counted object is used after it is released"; return "Reference-counted object is used after it is released";
} }
}; };
@ -1572,7 +1572,7 @@ namespace {
public: public:
BadRelease(const CheckerBase *checker) : CFRefBug(checker, "Bad release") {} BadRelease(const CheckerBase *checker) : CFRefBug(checker, "Bad release") {}
const char *getDescription() const { const char *getDescription() const override {
return "Incorrect decrement of the reference count of an object that is " return "Incorrect decrement of the reference count of an object that is "
"not owned at this point by the caller"; "not owned at this point by the caller";
} }
@ -1583,7 +1583,7 @@ namespace {
DeallocGC(const CheckerBase *checker) DeallocGC(const CheckerBase *checker)
: CFRefBug(checker, "-dealloc called while using garbage collection") {} : CFRefBug(checker, "-dealloc called while using garbage collection") {}
const char *getDescription() const { const char *getDescription() const override {
return "-dealloc called while using garbage collection"; return "-dealloc called while using garbage collection";
} }
}; };
@ -1593,7 +1593,7 @@ namespace {
DeallocNotOwned(const CheckerBase *checker) DeallocNotOwned(const CheckerBase *checker)
: CFRefBug(checker, "-dealloc sent to non-exclusively owned object") {} : CFRefBug(checker, "-dealloc sent to non-exclusively owned object") {}
const char *getDescription() const { const char *getDescription() const override {
return "-dealloc sent to object that may be referenced elsewhere"; return "-dealloc sent to object that may be referenced elsewhere";
} }
}; };
@ -1603,7 +1603,7 @@ namespace {
OverAutorelease(const CheckerBase *checker) OverAutorelease(const CheckerBase *checker)
: CFRefBug(checker, "Object autoreleased too many times") {} : CFRefBug(checker, "Object autoreleased too many times") {}
const char *getDescription() const { const char *getDescription() const override {
return "Object autoreleased too many times"; return "Object autoreleased too many times";
} }
}; };
@ -1613,7 +1613,7 @@ namespace {
ReturnedNotOwnedForOwned(const CheckerBase *checker) ReturnedNotOwnedForOwned(const CheckerBase *checker)
: CFRefBug(checker, "Method should return an owned object") {} : CFRefBug(checker, "Method should return an owned object") {}
const char *getDescription() const { const char *getDescription() const override {
return "Object with a +0 retain count returned to caller where a +1 " return "Object with a +0 retain count returned to caller where a +1 "
"(owning) retain count is expected"; "(owning) retain count is expected";
} }
@ -1626,9 +1626,9 @@ namespace {
setSuppressOnSink(true); setSuppressOnSink(true);
} }
const char *getDescription() const { return ""; } const char *getDescription() const override { return ""; }
bool isLeak() const { return true; } bool isLeak() const override { return true; }
}; };
//===---------===// //===---------===//
@ -1645,20 +1645,20 @@ namespace {
CFRefReportVisitor(SymbolRef sym, bool gcEnabled, const SummaryLogTy &log) CFRefReportVisitor(SymbolRef sym, bool gcEnabled, const SummaryLogTy &log)
: Sym(sym), SummaryLog(log), GCEnabled(gcEnabled) {} : Sym(sym), SummaryLog(log), GCEnabled(gcEnabled) {}
virtual void Profile(llvm::FoldingSetNodeID &ID) const { void Profile(llvm::FoldingSetNodeID &ID) const override {
static int x = 0; static int x = 0;
ID.AddPointer(&x); ID.AddPointer(&x);
ID.AddPointer(Sym); ID.AddPointer(Sym);
} }
virtual PathDiagnosticPiece *VisitNode(const ExplodedNode *N, PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
const ExplodedNode *PrevN, const ExplodedNode *PrevN,
BugReporterContext &BRC, BugReporterContext &BRC,
BugReport &BR); BugReport &BR) override;
virtual PathDiagnosticPiece *getEndPath(BugReporterContext &BRC, PathDiagnosticPiece *getEndPath(BugReporterContext &BRC,
const ExplodedNode *N, const ExplodedNode *N,
BugReport &BR); BugReport &BR) override;
}; };
class CFRefLeakReportVisitor : public CFRefReportVisitor { class CFRefLeakReportVisitor : public CFRefReportVisitor {
@ -1669,9 +1669,9 @@ namespace {
PathDiagnosticPiece *getEndPath(BugReporterContext &BRC, PathDiagnosticPiece *getEndPath(BugReporterContext &BRC,
const ExplodedNode *N, const ExplodedNode *N,
BugReport &BR); BugReport &BR) override;
virtual BugReporterVisitor *clone() const { BugReporterVisitor *clone() const override {
// The curiously-recurring template pattern only works for one level of // The curiously-recurring template pattern only works for one level of
// subclassing. Rather than make a new template base for // subclassing. Rather than make a new template base for
// CFRefReportVisitor, we simply override clone() to do the right thing. // CFRefReportVisitor, we simply override clone() to do the right thing.
@ -1702,7 +1702,7 @@ namespace {
addGCModeDescription(LOpts, GCEnabled); addGCModeDescription(LOpts, GCEnabled);
} }
virtual std::pair<ranges_iterator, ranges_iterator> getRanges() { std::pair<ranges_iterator, ranges_iterator> getRanges() override {
const CFRefBug& BugTy = static_cast<CFRefBug&>(getBugType()); const CFRefBug& BugTy = static_cast<CFRefBug&>(getBugType());
if (!BugTy.isLeak()) if (!BugTy.isLeak())
return BugReport::getRanges(); return BugReport::getRanges();
@ -1719,7 +1719,7 @@ namespace {
CheckerContext &Ctx, CheckerContext &Ctx,
bool IncludeAllocationLine); bool IncludeAllocationLine);
PathDiagnosticLocation getLocation(const SourceManager &SM) const { PathDiagnosticLocation getLocation(const SourceManager &SM) const override {
assert(Location.isValid()); assert(Location.isValid());
return Location; return Location;
} }
@ -2472,7 +2472,7 @@ public:
} }
void printState(raw_ostream &Out, ProgramStateRef State, void printState(raw_ostream &Out, ProgramStateRef State,
const char *NL, const char *Sep) const; const char *NL, const char *Sep) const override;
void checkBind(SVal loc, SVal val, const Stmt *S, CheckerContext &C) const; void checkBind(SVal loc, SVal val, const Stmt *S, CheckerContext &C) const;
void checkPostStmt(const BlockExpr *BE, CheckerContext &C) const; void checkPostStmt(const BlockExpr *BE, CheckerContext &C) const;
@ -2550,7 +2550,7 @@ public:
StopTrackingCallback(ProgramStateRef st) : state(st) {} StopTrackingCallback(ProgramStateRef st) : state(st) {}
ProgramStateRef getState() const { return state; } ProgramStateRef getState() const { return state; }
bool VisitSymbol(SymbolRef sym) { bool VisitSymbol(SymbolRef sym) override {
state = state->remove<RefBindings>(sym); state = state->remove<RefBindings>(sym);
return true; return true;
} }

View File

@ -99,7 +99,7 @@ public:
StopTrackingCallback(ProgramStateRef st) : state(st) {} StopTrackingCallback(ProgramStateRef st) : state(st) {}
ProgramStateRef getState() const { return state; } ProgramStateRef getState() const { return state; }
bool VisitSymbol(SymbolRef sym) { bool VisitSymbol(SymbolRef sym) override {
state = state->remove<StreamMap>(sym); state = state->remove<StreamMap>(sym);
return true; return true;
} }

View File

@ -177,8 +177,8 @@ void StackAddrEscapeChecker::checkEndFunction(CheckerContext &Ctx) const {
{} {}
bool HandleBinding(StoreManager &SMgr, Store store, bool HandleBinding(StoreManager &SMgr, Store store,
const MemRegion *region, SVal val) { const MemRegion *region, SVal val) override {
if (!isa<GlobalsSpaceRegion>(region->getMemorySpace())) if (!isa<GlobalsSpaceRegion>(region->getMemorySpace()))
return true; return true;

View File

@ -311,7 +311,7 @@ class NodeMapClosure : public BugReport::NodeResolver {
public: public:
NodeMapClosure(InterExplodedGraphMap &m) : M(m) {} NodeMapClosure(InterExplodedGraphMap &m) : M(m) {}
const ExplodedNode *getOriginalNode(const ExplodedNode *N) { const ExplodedNode *getOriginalNode(const ExplodedNode *N) override {
return M.lookup(N); return M.lookup(N);
} }
}; };
@ -345,7 +345,7 @@ public:
return getParentMap().getParent(S); return getParentMap().getParent(S);
} }
virtual NodeMapClosure& getNodeResolver() { return NMC; } NodeMapClosure& getNodeResolver() override { return NMC; }
PathDiagnosticLocation getEnclosingStmtLocation(const Stmt *S); PathDiagnosticLocation getEnclosingStmtLocation(const Stmt *S);

View File

@ -156,7 +156,7 @@ public:
return static_cast<void *>(&Tag); return static_cast<void *>(&Tag);
} }
virtual void Profile(llvm::FoldingSetNodeID &ID) const { void Profile(llvm::FoldingSetNodeID &ID) const override {
ID.AddPointer(ReturnVisitor::getTag()); ID.AddPointer(ReturnVisitor::getTag());
ID.AddPointer(StackFrame); ID.AddPointer(StackFrame);
ID.AddBoolean(EnableNullFPSuppression); ID.AddBoolean(EnableNullFPSuppression);
@ -386,7 +386,7 @@ public:
PathDiagnosticPiece *VisitNode(const ExplodedNode *N, PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
const ExplodedNode *PrevN, const ExplodedNode *PrevN,
BugReporterContext &BRC, BugReporterContext &BRC,
BugReport &BR) { BugReport &BR) override {
switch (Mode) { switch (Mode) {
case Initial: case Initial:
return visitNodeInitial(N, PrevN, BRC, BR); return visitNodeInitial(N, PrevN, BRC, BR);
@ -401,7 +401,7 @@ public:
PathDiagnosticPiece *getEndPath(BugReporterContext &BRC, PathDiagnosticPiece *getEndPath(BugReporterContext &BRC,
const ExplodedNode *N, const ExplodedNode *N,
BugReport &BR) { BugReport &BR) override {
if (EnableNullFPSuppression) if (EnableNullFPSuppression)
BR.markInvalid(ReturnVisitor::getTag(), StackFrame); BR.markInvalid(ReturnVisitor::getTag(), StackFrame);
return 0; return 0;

View File

@ -43,22 +43,22 @@ namespace {
class DFS : public WorkList { class DFS : public WorkList {
SmallVector<WorkListUnit,20> Stack; SmallVector<WorkListUnit,20> Stack;
public: public:
virtual bool hasWork() const { bool hasWork() const override {
return !Stack.empty(); return !Stack.empty();
} }
virtual void enqueue(const WorkListUnit& U) { void enqueue(const WorkListUnit& U) override {
Stack.push_back(U); Stack.push_back(U);
} }
virtual WorkListUnit dequeue() { WorkListUnit dequeue() override {
assert (!Stack.empty()); assert (!Stack.empty());
const WorkListUnit& U = Stack.back(); const WorkListUnit& U = Stack.back();
Stack.pop_back(); // This technically "invalidates" U, but we are fine. Stack.pop_back(); // This technically "invalidates" U, but we are fine.
return U; return U;
} }
virtual bool visitItemsInWorkList(Visitor &V) { bool visitItemsInWorkList(Visitor &V) override {
for (SmallVectorImpl<WorkListUnit>::iterator for (SmallVectorImpl<WorkListUnit>::iterator
I = Stack.begin(), E = Stack.end(); I != E; ++I) { I = Stack.begin(), E = Stack.end(); I != E; ++I) {
if (V.visit(*I)) if (V.visit(*I))
@ -71,21 +71,21 @@ public:
class BFS : public WorkList { class BFS : public WorkList {
std::deque<WorkListUnit> Queue; std::deque<WorkListUnit> Queue;
public: public:
virtual bool hasWork() const { bool hasWork() const override {
return !Queue.empty(); return !Queue.empty();
} }
virtual void enqueue(const WorkListUnit& U) { void enqueue(const WorkListUnit& U) override {
Queue.push_back(U); Queue.push_back(U);
} }
virtual WorkListUnit dequeue() { WorkListUnit dequeue() override {
WorkListUnit U = Queue.front(); WorkListUnit U = Queue.front();
Queue.pop_front(); Queue.pop_front();
return U; return U;
} }
virtual bool visitItemsInWorkList(Visitor &V) { bool visitItemsInWorkList(Visitor &V) override {
for (std::deque<WorkListUnit>::iterator for (std::deque<WorkListUnit>::iterator
I = Queue.begin(), E = Queue.end(); I != E; ++I) { I = Queue.begin(), E = Queue.end(); I != E; ++I) {
if (V.visit(*I)) if (V.visit(*I))
@ -109,18 +109,18 @@ namespace {
std::deque<WorkListUnit> Queue; std::deque<WorkListUnit> Queue;
SmallVector<WorkListUnit,20> Stack; SmallVector<WorkListUnit,20> Stack;
public: public:
virtual bool hasWork() const { bool hasWork() const override {
return !Queue.empty() || !Stack.empty(); return !Queue.empty() || !Stack.empty();
} }
virtual void enqueue(const WorkListUnit& U) { void enqueue(const WorkListUnit& U) override {
if (U.getNode()->getLocation().getAs<BlockEntrance>()) if (U.getNode()->getLocation().getAs<BlockEntrance>())
Queue.push_front(U); Queue.push_front(U);
else else
Stack.push_back(U); Stack.push_back(U);
} }
virtual WorkListUnit dequeue() { WorkListUnit dequeue() override {
// Process all basic blocks to completion. // Process all basic blocks to completion.
if (!Stack.empty()) { if (!Stack.empty()) {
const WorkListUnit& U = Stack.back(); const WorkListUnit& U = Stack.back();
@ -135,7 +135,7 @@ namespace {
Queue.pop_front(); Queue.pop_front();
return U; return U;
} }
virtual bool visitItemsInWorkList(Visitor &V) { bool visitItemsInWorkList(Visitor &V) override {
for (SmallVectorImpl<WorkListUnit>::iterator for (SmallVectorImpl<WorkListUnit>::iterator
I = Stack.begin(), E = Stack.end(); I != E; ++I) { I = Stack.begin(), E = Stack.end(); I != E; ++I) {
if (V.visit(*I)) if (V.visit(*I))

View File

@ -123,11 +123,11 @@ class MarkLiveCallback : public SymbolVisitor {
SymbolReaper &SymReaper; SymbolReaper &SymReaper;
public: public:
MarkLiveCallback(SymbolReaper &symreaper) : SymReaper(symreaper) {} MarkLiveCallback(SymbolReaper &symreaper) : SymReaper(symreaper) {}
bool VisitSymbol(SymbolRef sym) { bool VisitSymbol(SymbolRef sym) override {
SymReaper.markLive(sym); SymReaper.markLive(sym);
return true; return true;
} }
bool VisitMemRegion(const MemRegion *R) { bool VisitMemRegion(const MemRegion *R) override {
SymReaper.markLive(R); SymReaper.markLive(R);
return true; return true;
} }

View File

@ -1863,7 +1863,7 @@ public:
CollectReachableSymbolsCallback(ProgramStateRef State) {} CollectReachableSymbolsCallback(ProgramStateRef State) {}
const InvalidatedSymbols &getSymbols() const { return Symbols; } const InvalidatedSymbols &getSymbols() const { return Symbols; }
bool VisitSymbol(SymbolRef Sym) { bool VisitSymbol(SymbolRef Sym) override {
Symbols.insert(Sym); Symbols.insert(Sym);
return true; return true;
} }

View File

@ -44,10 +44,10 @@ public:
virtual ~HTMLDiagnostics() { FlushDiagnostics(NULL); } virtual ~HTMLDiagnostics() { FlushDiagnostics(NULL); }
virtual void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags, void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags,
FilesMade *filesMade); FilesMade *filesMade) override;
virtual StringRef getName() const { StringRef getName() const override {
return "HTMLDiagnostics"; return "HTMLDiagnostics";
} }

View File

@ -40,15 +40,17 @@ namespace {
virtual ~PlistDiagnostics() {} virtual ~PlistDiagnostics() {}
void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags, void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags,
FilesMade *filesMade); FilesMade *filesMade) override;
virtual StringRef getName() const { virtual StringRef getName() const override {
return "PlistDiagnostics"; return "PlistDiagnostics";
} }
PathGenerationScheme getGenerationScheme() const { return Extensive; } PathGenerationScheme getGenerationScheme() const override {
bool supportsLogicalOpControlFlow() const { return true; } return Extensive;
virtual bool supportsCrossFileDiagnostics() const { }
bool supportsLogicalOpControlFlow() const override { return true; }
bool supportsCrossFileDiagnostics() const override {
return SupportsCrossFileDiagnostics; return SupportsCrossFileDiagnostics;
} }
}; };

View File

@ -33,7 +33,7 @@ public:
assert(LCtx); assert(LCtx);
} }
virtual void print(raw_ostream &OS) const { void print(raw_ostream &OS) const override {
OS << "While analyzing stack: \n"; OS << "While analyzing stack: \n";
LCtx->dumpStack(OS, "\t"); LCtx->dumpStack(OS, "\t");
} }

View File

@ -290,35 +290,37 @@ public:
ProgramStateRef assumeSymNE(ProgramStateRef state, SymbolRef sym, ProgramStateRef assumeSymNE(ProgramStateRef state, SymbolRef sym,
const llvm::APSInt& Int, const llvm::APSInt& Int,
const llvm::APSInt& Adjustment); const llvm::APSInt& Adjustment) override;
ProgramStateRef assumeSymEQ(ProgramStateRef state, SymbolRef sym, ProgramStateRef assumeSymEQ(ProgramStateRef state, SymbolRef sym,
const llvm::APSInt& Int, const llvm::APSInt& Int,
const llvm::APSInt& Adjustment); const llvm::APSInt& Adjustment) override;
ProgramStateRef assumeSymLT(ProgramStateRef state, SymbolRef sym, ProgramStateRef assumeSymLT(ProgramStateRef state, SymbolRef sym,
const llvm::APSInt& Int, const llvm::APSInt& Int,
const llvm::APSInt& Adjustment); const llvm::APSInt& Adjustment) override;
ProgramStateRef assumeSymGT(ProgramStateRef state, SymbolRef sym, ProgramStateRef assumeSymGT(ProgramStateRef state, SymbolRef sym,
const llvm::APSInt& Int, const llvm::APSInt& Int,
const llvm::APSInt& Adjustment); const llvm::APSInt& Adjustment) override;
ProgramStateRef assumeSymGE(ProgramStateRef state, SymbolRef sym, ProgramStateRef assumeSymGE(ProgramStateRef state, SymbolRef sym,
const llvm::APSInt& Int, const llvm::APSInt& Int,
const llvm::APSInt& Adjustment); const llvm::APSInt& Adjustment) override;
ProgramStateRef assumeSymLE(ProgramStateRef state, SymbolRef sym, ProgramStateRef assumeSymLE(ProgramStateRef state, SymbolRef sym,
const llvm::APSInt& Int, const llvm::APSInt& Int,
const llvm::APSInt& Adjustment); const llvm::APSInt& Adjustment) override;
const llvm::APSInt* getSymVal(ProgramStateRef St, SymbolRef sym) const; const llvm::APSInt* getSymVal(ProgramStateRef St,
ConditionTruthVal checkNull(ProgramStateRef State, SymbolRef Sym); SymbolRef sym) const override;
ConditionTruthVal checkNull(ProgramStateRef State, SymbolRef Sym) override;
ProgramStateRef removeDeadBindings(ProgramStateRef St, SymbolReaper& SymReaper); ProgramStateRef removeDeadBindings(ProgramStateRef St,
SymbolReaper& SymReaper) override;
void print(ProgramStateRef St, raw_ostream &Out, void print(ProgramStateRef St, raw_ostream &Out,
const char* nl, const char *sep); const char* nl, const char *sep) override;
private: private:
RangeSet::Factory F; RangeSet::Factory F;

View File

@ -372,9 +372,9 @@ public:
/// version of that lvalue (i.e., a pointer to the first element of /// version of that lvalue (i.e., a pointer to the first element of
/// the array). This is called by ExprEngine when evaluating /// the array). This is called by ExprEngine when evaluating
/// casts from arrays to pointers. /// casts from arrays to pointers.
SVal ArrayToPointer(Loc Array, QualType ElementTy); SVal ArrayToPointer(Loc Array, QualType ElementTy) override;
StoreRef getInitialStore(const LocationContext *InitLoc) { StoreRef getInitialStore(const LocationContext *InitLoc) override {
return StoreRef(RBFactory.getEmptyMap().getRootWithoutRetain(), *this); return StoreRef(RBFactory.getEmptyMap().getRootWithoutRetain(), *this);
} }
@ -396,24 +396,24 @@ public:
InvalidatedSymbols &IS, InvalidatedSymbols &IS,
RegionAndSymbolInvalidationTraits &ITraits, RegionAndSymbolInvalidationTraits &ITraits,
InvalidatedRegions *Invalidated, InvalidatedRegions *Invalidated,
InvalidatedRegions *InvalidatedTopLevel); InvalidatedRegions *InvalidatedTopLevel) override;
bool scanReachableSymbols(Store S, const MemRegion *R, bool scanReachableSymbols(Store S, const MemRegion *R,
ScanReachableSymbols &Callbacks); ScanReachableSymbols &Callbacks) override;
RegionBindingsRef removeSubRegionBindings(RegionBindingsConstRef B, RegionBindingsRef removeSubRegionBindings(RegionBindingsConstRef B,
const SubRegion *R); const SubRegion *R);
public: // Part of public interface to class. public: // Part of public interface to class.
virtual StoreRef Bind(Store store, Loc LV, SVal V) { StoreRef Bind(Store store, Loc LV, SVal V) override {
return StoreRef(bind(getRegionBindings(store), LV, V).asStore(), *this); return StoreRef(bind(getRegionBindings(store), LV, V).asStore(), *this);
} }
RegionBindingsRef bind(RegionBindingsConstRef B, Loc LV, SVal V); RegionBindingsRef bind(RegionBindingsConstRef B, Loc LV, SVal V);
// BindDefault is only used to initialize a region with a default value. // BindDefault is only used to initialize a region with a default value.
StoreRef BindDefault(Store store, const MemRegion *R, SVal V) { StoreRef BindDefault(Store store, const MemRegion *R, SVal V) override {
RegionBindingsRef B = getRegionBindings(store); RegionBindingsRef B = getRegionBindings(store);
assert(!B.lookup(R, BindingKey::Direct)); assert(!B.lookup(R, BindingKey::Direct));
@ -467,20 +467,20 @@ public: // Part of public interface to class.
/// \brief Create a new store with the specified binding removed. /// \brief Create a new store with the specified binding removed.
/// \param ST the original store, that is the basis for the new store. /// \param ST the original store, that is the basis for the new store.
/// \param L the location whose binding should be removed. /// \param L the location whose binding should be removed.
virtual StoreRef killBinding(Store ST, Loc L); StoreRef killBinding(Store ST, Loc L) override;
void incrementReferenceCount(Store store) { void incrementReferenceCount(Store store) override {
getRegionBindings(store).manualRetain(); getRegionBindings(store).manualRetain();
} }
/// If the StoreManager supports it, decrement the reference count of /// If the StoreManager supports it, decrement the reference count of
/// the specified Store object. If the reference count hits 0, the memory /// the specified Store object. If the reference count hits 0, the memory
/// associated with the object is recycled. /// associated with the object is recycled.
void decrementReferenceCount(Store store) { void decrementReferenceCount(Store store) override {
getRegionBindings(store).manualRelease(); getRegionBindings(store).manualRelease();
} }
bool includedInBindings(Store store, const MemRegion *region) const; bool includedInBindings(Store store, const MemRegion *region) const override;
/// \brief Return the value bound to specified location in a given state. /// \brief Return the value bound to specified location in a given state.
/// ///
@ -495,7 +495,7 @@ public: // Part of public interface to class.
/// return undefined /// return undefined
/// else /// else
/// return symbolic /// return symbolic
virtual SVal getBinding(Store S, Loc L, QualType T) { SVal getBinding(Store S, Loc L, QualType T) override {
return getBinding(getRegionBindings(S), L, T); return getBinding(getRegionBindings(S), L, T);
} }
@ -560,15 +560,16 @@ public: // Part of public interface to class.
/// removeDeadBindings - Scans the RegionStore of 'state' for dead values. /// removeDeadBindings - Scans the RegionStore of 'state' for dead values.
/// It returns a new Store with these values removed. /// It returns a new Store with these values removed.
StoreRef removeDeadBindings(Store store, const StackFrameContext *LCtx, StoreRef removeDeadBindings(Store store, const StackFrameContext *LCtx,
SymbolReaper& SymReaper); SymbolReaper& SymReaper) override;
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
// Region "extents". // Region "extents".
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
// FIXME: This method will soon be eliminated; see the note in Store.h. // FIXME: This method will soon be eliminated; see the note in Store.h.
DefinedOrUnknownSVal getSizeInElements(ProgramStateRef state, DefinedOrUnknownSVal getSizeInElements(ProgramStateRef state,
const MemRegion* R, QualType EleTy); const MemRegion* R,
QualType EleTy) override;
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
// Utility methods. // Utility methods.
@ -581,9 +582,9 @@ public: // Part of public interface to class.
} }
void print(Store store, raw_ostream &Out, const char* nl, void print(Store store, raw_ostream &Out, const char* nl,
const char *sep); const char *sep) override;
void iterBindings(Store store, BindingsHandler& f) { void iterBindings(Store store, BindingsHandler& f) override {
RegionBindingsRef B = getRegionBindings(store); RegionBindingsRef B = getRegionBindings(store);
for (RegionBindingsRef::iterator I = B.begin(), E = B.end(); I != E; ++I) { for (RegionBindingsRef::iterator I = B.begin(), E = B.end(); I != E; ++I) {
const ClusterBindings &Cluster = I.getData(); const ClusterBindings &Cluster = I.getData();

View File

@ -34,7 +34,7 @@ public:
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
ProgramStateRef assume(ProgramStateRef state, DefinedSVal Cond, ProgramStateRef assume(ProgramStateRef state, DefinedSVal Cond,
bool Assumption); bool Assumption) override;
ProgramStateRef assume(ProgramStateRef state, NonLoc Cond, bool Assumption); ProgramStateRef assume(ProgramStateRef state, NonLoc Cond, bool Assumption);
@ -82,7 +82,7 @@ protected:
BasicValueFactory &getBasicVals() const { return SVB.getBasicValueFactory(); } BasicValueFactory &getBasicVals() const { return SVB.getBasicValueFactory(); }
SymbolManager &getSymbolManager() const { return SVB.getSymbolManager(); } SymbolManager &getSymbolManager() const { return SVB.getSymbolManager(); }
bool canReasonAbout(SVal X) const; bool canReasonAbout(SVal X) const override;
ProgramStateRef assumeAux(ProgramStateRef state, ProgramStateRef assumeAux(ProgramStateRef state,
NonLoc Cond, NonLoc Cond,

View File

@ -21,9 +21,9 @@ using namespace ento;
namespace { namespace {
class SimpleSValBuilder : public SValBuilder { class SimpleSValBuilder : public SValBuilder {
protected: protected:
virtual SVal dispatchCast(SVal val, QualType castTy); SVal dispatchCast(SVal val, QualType castTy) override;
virtual SVal evalCastFromNonLoc(NonLoc val, QualType castTy); SVal evalCastFromNonLoc(NonLoc val, QualType castTy) override;
virtual SVal evalCastFromLoc(Loc val, QualType castTy); SVal evalCastFromLoc(Loc val, QualType castTy) override;
public: public:
SimpleSValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context, SimpleSValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context,
@ -31,19 +31,19 @@ public:
: SValBuilder(alloc, context, stateMgr) {} : SValBuilder(alloc, context, stateMgr) {}
virtual ~SimpleSValBuilder() {} virtual ~SimpleSValBuilder() {}
virtual SVal evalMinus(NonLoc val); SVal evalMinus(NonLoc val) override;
virtual SVal evalComplement(NonLoc val); SVal evalComplement(NonLoc val) override;
virtual SVal evalBinOpNN(ProgramStateRef state, BinaryOperator::Opcode op, SVal evalBinOpNN(ProgramStateRef state, BinaryOperator::Opcode op,
NonLoc lhs, NonLoc rhs, QualType resultTy); NonLoc lhs, NonLoc rhs, QualType resultTy) override;
virtual SVal evalBinOpLL(ProgramStateRef state, BinaryOperator::Opcode op, SVal evalBinOpLL(ProgramStateRef state, BinaryOperator::Opcode op,
Loc lhs, Loc rhs, QualType resultTy); Loc lhs, Loc rhs, QualType resultTy) override;
virtual SVal evalBinOpLN(ProgramStateRef state, BinaryOperator::Opcode op, SVal evalBinOpLN(ProgramStateRef state, BinaryOperator::Opcode op,
Loc lhs, NonLoc rhs, QualType resultTy); Loc lhs, NonLoc rhs, QualType resultTy) override;
/// getKnownValue - evaluates a given SVal. If the SVal has only one possible /// getKnownValue - evaluates a given SVal. If the SVal has only one possible
/// (integer) value, that value is returned. Otherwise, returns NULL. /// (integer) value, that value is returned. Otherwise, returns NULL.
virtual const llvm::APSInt *getKnownValue(ProgramStateRef state, SVal V); const llvm::APSInt *getKnownValue(ProgramStateRef state, SVal V) override;
SVal MakeSymIntVal(const SymExpr *LHS, BinaryOperator::Opcode op, SVal MakeSymIntVal(const SymExpr *LHS, BinaryOperator::Opcode op,
const llvm::APSInt &RHS, QualType resultTy); const llvm::APSInt &RHS, QualType resultTy);
}; };

View File

@ -90,12 +90,12 @@ public:
ClangDiagPathDiagConsumer(DiagnosticsEngine &Diag) ClangDiagPathDiagConsumer(DiagnosticsEngine &Diag)
: Diag(Diag), IncludePath(false) {} : Diag(Diag), IncludePath(false) {}
virtual ~ClangDiagPathDiagConsumer() {} virtual ~ClangDiagPathDiagConsumer() {}
virtual StringRef getName() const { return "ClangDiags"; } StringRef getName() const override { return "ClangDiags"; }
virtual bool supportsLogicalOpControlFlow() const { return true; } bool supportsLogicalOpControlFlow() const override { return true; }
virtual bool supportsCrossFileDiagnostics() const { return true; } bool supportsCrossFileDiagnostics() const override { return true; }
virtual PathGenerationScheme getGenerationScheme() const { PathGenerationScheme getGenerationScheme() const override {
return IncludePath ? Minimal : None; return IncludePath ? Minimal : None;
} }
@ -104,7 +104,7 @@ public:
} }
void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags, void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags,
FilesMade *filesMade) { FilesMade *filesMade) override {
unsigned WarnID = Diag.getCustomDiagID(DiagnosticsEngine::Warning, "%0"); unsigned WarnID = Diag.getCustomDiagID(DiagnosticsEngine::Warning, "%0");
unsigned NoteID = Diag.getCustomDiagID(DiagnosticsEngine::Note, "%0"); unsigned NoteID = Diag.getCustomDiagID(DiagnosticsEngine::Note, "%0");
@ -282,7 +282,7 @@ public:
} }
} }
virtual void Initialize(ASTContext &Context) { void Initialize(ASTContext &Context) override {
Ctx = &Context; Ctx = &Context;
checkerMgr.reset(createCheckerManager(*Opts, PP.getLangOpts(), Plugins, checkerMgr.reset(createCheckerManager(*Opts, PP.getLangOpts(), Plugins,
PP.getDiagnostics())); PP.getDiagnostics()));
@ -298,10 +298,10 @@ public:
/// \brief Store the top level decls in the set to be processed later on. /// \brief Store the top level decls in the set to be processed later on.
/// (Doing this pre-processing avoids deserialization of data from PCH.) /// (Doing this pre-processing avoids deserialization of data from PCH.)
virtual bool HandleTopLevelDecl(DeclGroupRef D); bool HandleTopLevelDecl(DeclGroupRef D) override;
virtual void HandleTopLevelDeclInObjCContainer(DeclGroupRef D); void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) override;
virtual void HandleTranslationUnit(ASTContext &C); void HandleTranslationUnit(ASTContext &C) override;
/// \brief Determine which inlining mode should be used when this function is /// \brief Determine which inlining mode should be used when this function is
/// analyzed. This allows to redefine the default inlining policies when /// analyzed. This allows to redefine the default inlining policies when
@ -716,7 +716,7 @@ public:
~UbigraphViz(); ~UbigraphViz();
virtual void AddEdge(ExplodedNode *Src, ExplodedNode *Dst); void AddEdge(ExplodedNode *Src, ExplodedNode *Dst) override;
}; };
} // end anonymous namespace } // end anonymous namespace

View File

@ -24,7 +24,7 @@ namespace tooling {
/// \brief Default \c PathComparator using \c llvm::sys::fs::equivalent(). /// \brief Default \c PathComparator using \c llvm::sys::fs::equivalent().
struct DefaultPathComparator : public PathComparator { struct DefaultPathComparator : public PathComparator {
virtual ~DefaultPathComparator() {} virtual ~DefaultPathComparator() {}
virtual bool equivalent(StringRef FileA, StringRef FileB) const { bool equivalent(StringRef FileA, StringRef FileB) const override {
return FileA == FileB || llvm::sys::fs::equivalent(FileA, FileB); return FileA == FileB || llvm::sys::fs::equivalent(FileA, FileB);
} }
}; };

View File

@ -118,8 +118,8 @@ std::vector<std::string> unescapeCommandLine(
} }
class JSONCompilationDatabasePlugin : public CompilationDatabasePlugin { class JSONCompilationDatabasePlugin : public CompilationDatabasePlugin {
virtual CompilationDatabase *loadFromDirectory( CompilationDatabase *loadFromDirectory(StringRef Directory,
StringRef Directory, std::string &ErrorMessage) { std::string &ErrorMessage) override {
SmallString<1024> JSONDatabasePath(Directory); SmallString<1024> JSONDatabasePath(Directory);
llvm::sys::path::append(JSONDatabasePath, "compile_commands.json"); llvm::sys::path::append(JSONDatabasePath, "compile_commands.json");
std::unique_ptr<CompilationDatabase> Database( std::unique_ptr<CompilationDatabase> Database(

View File

@ -160,7 +160,7 @@ class SingleFrontendActionFactory : public FrontendActionFactory {
public: public:
SingleFrontendActionFactory(FrontendAction *Action) : Action(Action) {} SingleFrontendActionFactory(FrontendAction *Action) : Action(Action) {}
FrontendAction *create() { return Action; } FrontendAction *create() override { return Action; }
}; };
} }
@ -380,7 +380,7 @@ public:
ASTBuilderAction(std::vector<ASTUnit *> &ASTs) : ASTs(ASTs) {} ASTBuilderAction(std::vector<ASTUnit *> &ASTs) : ASTs(ASTs) {}
bool runInvocation(CompilerInvocation *Invocation, FileManager *Files, bool runInvocation(CompilerInvocation *Invocation, FileManager *Files,
DiagnosticConsumer *DiagConsumer) { DiagnosticConsumer *DiagConsumer) override {
// FIXME: This should use the provided FileManager. // FIXME: This should use the provided FileManager.
ASTUnit *AST = ASTUnit::LoadFromCompilerInvocation( ASTUnit *AST = ASTUnit::LoadFromCompilerInvocation(
Invocation, CompilerInstance::createDiagnostics( Invocation, CompilerInstance::createDiagnostics(