ariccio created this revision.
ariccio added a subscriber: cfe-commits.
As discussed in "Code in headers" on llvm-dev, there are lots of headers with
complex code in them. I've moved some complex constructors & destructors to
implementation files, using [[
https://www.chromium.org/developers/coding-style/cpp-dos-and-donts | Chromium's
C++ Dos and Don'ts ]] as a guide.
It's compiling right now, and there're a few errors. I'll update the diff in a
few minutes.
These changes are mostly in the Static Analyzer, as some files there take more
than 30 seconds to compile.
http://reviews.llvm.org/D17130
Files:
llvm/tools/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
llvm/tools/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
llvm/tools/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
llvm/tools/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
llvm/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
llvm/tools/clang/lib/StaticAnalyzer/Core/SVals.cpp
Index: llvm/tools/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
===================================================================
--- llvm/tools/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ llvm/tools/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -2680,6 +2680,30 @@
delete interestingRegions.pop_back_val();
}
+BugReport::BugReport(BugType& bt, StringRef desc, const ExplodedNode *errornode)
+ : BT(bt), DeclWithIssue(nullptr), Description(desc), ErrorNode(errornode),
+ ConfigurationChangeToken(0), DoNotPrunePath(false) {}
+
+BugReport::BugReport(BugType& bt, StringRef shortDesc, StringRef desc,
+ const ExplodedNode *errornode)
+ : BT(bt), DeclWithIssue(nullptr), ShortDescription(shortDesc),
+ Description(desc), ErrorNode(errornode), ConfigurationChangeToken(0),
+ DoNotPrunePath(false) {}
+
+BugReport::BugReport(BugType &bt, StringRef desc, PathDiagnosticLocation l)
+ : BT(bt), DeclWithIssue(nullptr), Description(desc), Location(l),
+ ErrorNode(nullptr), ConfigurationChangeToken(0), DoNotPrunePath(false) {}
+
+BugReport::BugReport(BugType& bt, StringRef desc, const ExplodedNode *errornode,
+ PathDiagnosticLocation LocationToUnique, const Decl *DeclToUnique)
+ : BT(bt), DeclWithIssue(nullptr), Description(desc),
+ UniqueingLocation(LocationToUnique),
+ UniqueingDecl(DeclToUnique),
+ ErrorNode(errornode), ConfigurationChangeToken(0),
+ DoNotPrunePath(false) {}
+
+
+
const Stmt *BugReport::getStmt() const {
if (!ErrorNode)
return nullptr;
Index: llvm/tools/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
===================================================================
--- llvm/tools/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
+++ llvm/tools/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
@@ -143,19 +143,12 @@
void popInterestingSymbolsAndRegions();
public:
- BugReport(BugType& bt, StringRef desc, const ExplodedNode *errornode)
- : BT(bt), DeclWithIssue(nullptr), Description(desc), ErrorNode(errornode),
- ConfigurationChangeToken(0), DoNotPrunePath(false) {}
+ BugReport(BugType& bt, StringRef desc, const ExplodedNode *errornode);
BugReport(BugType& bt, StringRef shortDesc, StringRef desc,
- const ExplodedNode *errornode)
- : BT(bt), DeclWithIssue(nullptr), ShortDescription(shortDesc),
- Description(desc), ErrorNode(errornode), ConfigurationChangeToken(0),
- DoNotPrunePath(false) {}
+ const ExplodedNode *errornode);
- BugReport(BugType &bt, StringRef desc, PathDiagnosticLocation l)
- : BT(bt), DeclWithIssue(nullptr), Description(desc), Location(l),
- ErrorNode(nullptr), ConfigurationChangeToken(0), DoNotPrunePath(false) {}
+ BugReport(BugType &bt, StringRef desc, PathDiagnosticLocation l);
/// \brief Create a BugReport with a custom uniqueing location.
///
@@ -165,12 +158,7 @@
/// for uniquing reports. For example, memory leaks checker, could set this to
/// the allocation site, rather then the location where the bug is reported.
BugReport(BugType& bt, StringRef desc, const ExplodedNode *errornode,
- PathDiagnosticLocation LocationToUnique, const Decl *DeclToUnique)
- : BT(bt), DeclWithIssue(nullptr), Description(desc),
- UniqueingLocation(LocationToUnique),
- UniqueingDecl(DeclToUnique),
- ErrorNode(errornode), ConfigurationChangeToken(0),
- DoNotPrunePath(false) {}
+ PathDiagnosticLocation LocationToUnique, const Decl *DeclToUnique);
virtual ~BugReport();
Index: llvm/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
===================================================================
--- llvm/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ llvm/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -160,6 +160,9 @@
//===----------------------------------------------------------------------===//
// Core analysis engine.
//===----------------------------------------------------------------------===//
+CoreEngine::CoreEngine(SubEngine &subengine, FunctionSummariesTy *FS)
+ : SubEng(subengine), WList(WorkList::makeDFS()),
+ BCounterFactory(G.getAllocator()), FunctionSummaries(FS) {}
/// ExecuteWorkList - Run the worklist algorithm for a maximum number of steps.
bool CoreEngine::ExecuteWorkList(const LocationContext *L, unsigned Steps,
@@ -622,6 +625,23 @@
void NodeBuilder::anchor() { }
+void NodeBuilder::finalizeResults() {}
+
+NodeBuilder::NodeBuilder(ExplodedNode *SrcNode, ExplodedNodeSet &DstSet,
+ const NodeBuilderContext &Ctx, bool F = true)
+ : C(Ctx), Finalized(F), HasGeneratedNodes(false), Frontier(DstSet) {
+ Frontier.Add(SrcNode);
+}
+
+NodeBuilder::NodeBuilder(const ExplodedNodeSet &SrcSet, ExplodedNodeSet &DstSet,
+ const NodeBuilderContext &Ctx, bool F = true)
+ : C(Ctx), Finalized(F), HasGeneratedNodes(false), Frontier(DstSet) {
+ Frontier.insert(SrcSet);
+ assert(hasNoSinksInFrontier());
+}
+
+NodeBuilder::~NodeBuilder() {}
+
ExplodedNode* NodeBuilder::generateNodeImpl(const ProgramPoint &Loc,
ProgramStateRef State,
ExplodedNode *FromN,
@@ -643,6 +663,28 @@
void NodeBuilderWithSinks::anchor() { }
+NodeBuilderWithSinks::NodeBuilderWithSinks(ExplodedNode *Pred, ExplodedNodeSet &DstSet,
+ const NodeBuilderContext &Ctx, ProgramPoint &L)
+ : NodeBuilder(Pred, DstSet, Ctx), Location(L) {}
+
+StmtNodeBuilder::StmtNodeBuilder(ExplodedNode *SrcNode, ExplodedNodeSet &DstSet,
+ const NodeBuilderContext &Ctx,
+ NodeBuilder *Enclosing = nullptr)
+ : NodeBuilder(SrcNode, DstSet, Ctx), EnclosingBldr(Enclosing) {
+ if (EnclosingBldr)
+ EnclosingBldr->takeNodes(SrcNode);
+}
+
+StmtNodeBuilder::StmtNodeBuilder(ExplodedNodeSet &SrcSet, ExplodedNodeSet &DstSet,
+ const NodeBuilderContext &Ctx,
+ NodeBuilder *Enclosing = nullptr)
+ : NodeBuilder(SrcSet, DstSet, Ctx), EnclosingBldr(Enclosing) {
+ if (EnclosingBldr)
+ for (ExplodedNodeSet::iterator I = SrcSet.begin(),
+ E = SrcSet.end(); I != E; ++I )
+ EnclosingBldr->takeNodes(*I);
+}
+
StmtNodeBuilder::~StmtNodeBuilder() {
if (EnclosingBldr)
for (ExplodedNodeSet::iterator I = Frontier.begin(),
@@ -652,6 +694,25 @@
void BranchNodeBuilder::anchor() { }
+BranchNodeBuilder::BranchNodeBuilder(ExplodedNode *SrcNode, ExplodedNodeSet &DstSet,
+ const NodeBuilderContext &C,
+ const CFGBlock *dstT, const CFGBlock *dstF)
+: NodeBuilder(SrcNode, DstSet, C), DstT(dstT), DstF(dstF),
+ InFeasibleTrue(!DstT), InFeasibleFalse(!DstF) {
+ // The branch node builder does not generate autotransitions.
+ // If there are no successors it means that both branches are infeasible.
+ takeNodes(SrcNode);
+}
+
+BranchNodeBuilder::BranchNodeBuilder(const ExplodedNodeSet &SrcSet, ExplodedNodeSet &DstSet,
+ const NodeBuilderContext &C,
+ const CFGBlock *dstT, const CFGBlock *dstF)
+: NodeBuilder(SrcSet, DstSet, C), DstT(dstT), DstF(dstF),
+ InFeasibleTrue(!DstT), InFeasibleFalse(!DstF) {
+ takeNodes(SrcSet);
+}
+
+
ExplodedNode *BranchNodeBuilder::generateNode(ProgramStateRef State,
bool branch,
ExplodedNode *NodePred) {
@@ -665,6 +726,11 @@
return Succ;
}
+IndirectGotoNodeBuilder::IndirectGotoNodeBuilder(ExplodedNode *pred, const CFGBlock *src,
+ const Expr *e, const CFGBlock *dispatch, CoreEngine* eng)
+ : Eng(*eng), Src(src), DispatchBlock(*dispatch), E(e), Pred(pred) {}
+
+
ExplodedNode*
IndirectGotoNodeBuilder::generateNode(const iterator &I,
ProgramStateRef St,
@@ -684,7 +750,11 @@
return Succ;
}
+SwitchNodeBuilder::SwitchNodeBuilder(ExplodedNode *pred, const CFGBlock *src,
+ const Expr *condition, CoreEngine* eng)
+: Eng(*eng), Src(src), Condition(condition), Pred(pred) {}
+
ExplodedNode*
SwitchNodeBuilder::generateCaseStmtNode(const iterator &I,
ProgramStateRef St) {
@@ -728,3 +798,6 @@
return Succ;
}
+
+NodeBuilderContext::NodeBuilderContext(const CoreEngine &E, const CFGBlock *B, ExplodedNode *N)
+ : Eng(E), Block(B), LC(N->getLocationContext()) { assert(B); }
Index: llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
===================================================================
--- llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
+++ llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
@@ -110,9 +110,7 @@
public:
/// Construct a CoreEngine object to analyze the provided CFG.
- CoreEngine(SubEngine &subengine, FunctionSummariesTy *FS)
- : SubEng(subengine), WList(WorkList::makeDFS()),
- BCounterFactory(G.getAllocator()), FunctionSummaries(FS) {}
+ CoreEngine(SubEngine &subengine, FunctionSummariesTy *FS);
/// getGraph - Returns the exploded graph.
ExplodedGraph &getGraph() { return G; }
@@ -142,7 +140,7 @@
/// Inform the CoreEngine that a basic block was aborted because
/// it could not be completely analyzed.
void addAbortedBlock(const ExplodedNode *node, const CFGBlock *block) {
- blocksAborted.push_back(std::make_pair(block, node));
+ blocksAborted.emplace_back(block, node);
}
WorkList *getWorkList() const { return WList.get(); }
@@ -180,8 +178,7 @@
const CoreEngine &Eng;
const CFGBlock *Block;
const LocationContext *LC;
- NodeBuilderContext(const CoreEngine &E, const CFGBlock *B, ExplodedNode *N)
- : Eng(E), Block(B), LC(N->getLocationContext()) { assert(B); }
+ NodeBuilderContext(const CoreEngine &E, const CFGBlock *B, ExplodedNode *N);
/// \brief Return the CFGBlock associated with this builder.
const CFGBlock *getBlock() const { return Block; }
@@ -233,28 +230,21 @@
}
/// Allow subclasses to finalize results before result_begin() is executed.
- virtual void finalizeResults() {}
+ virtual void finalizeResults();
ExplodedNode *generateNodeImpl(const ProgramPoint &PP,
ProgramStateRef State,
ExplodedNode *Pred,
bool MarkAsSink = false);
public:
NodeBuilder(ExplodedNode *SrcNode, ExplodedNodeSet &DstSet,
- const NodeBuilderContext &Ctx, bool F = true)
- : C(Ctx), Finalized(F), HasGeneratedNodes(false), Frontier(DstSet) {
- Frontier.Add(SrcNode);
- }
+ const NodeBuilderContext &Ctx, bool F = true);
NodeBuilder(const ExplodedNodeSet &SrcSet, ExplodedNodeSet &DstSet,
- const NodeBuilderContext &Ctx, bool F = true)
- : C(Ctx), Finalized(F), HasGeneratedNodes(false), Frontier(DstSet) {
- Frontier.insert(SrcSet);
- assert(hasNoSinksInFrontier());
- }
+ const NodeBuilderContext &Ctx, bool F = true);
- virtual ~NodeBuilder() {}
+ virtual ~NodeBuilder();
/// \brief Generates a node in the ExplodedGraph.
ExplodedNode *generateNode(const ProgramPoint &PP,
@@ -314,8 +304,7 @@
public:
NodeBuilderWithSinks(ExplodedNode *Pred, ExplodedNodeSet &DstSet,
- const NodeBuilderContext &Ctx, ProgramPoint &L)
- : NodeBuilder(Pred, DstSet, Ctx), Location(L) {}
+ const NodeBuilderContext &Ctx, ProgramPoint &L);
ExplodedNode *generateNode(ProgramStateRef State,
ExplodedNode *Pred,
@@ -351,21 +340,11 @@
/// Enclosing builder to transfer ownership.
StmtNodeBuilder(ExplodedNode *SrcNode, ExplodedNodeSet &DstSet,
const NodeBuilderContext &Ctx,
- NodeBuilder *Enclosing = nullptr)
- : NodeBuilder(SrcNode, DstSet, Ctx), EnclosingBldr(Enclosing) {
- if (EnclosingBldr)
- EnclosingBldr->takeNodes(SrcNode);
- }
+ NodeBuilder *Enclosing = nullptr);
StmtNodeBuilder(ExplodedNodeSet &SrcSet, ExplodedNodeSet &DstSet,
const NodeBuilderContext &Ctx,
- NodeBuilder *Enclosing = nullptr)
- : NodeBuilder(SrcSet, DstSet, Ctx), EnclosingBldr(Enclosing) {
- if (EnclosingBldr)
- for (ExplodedNodeSet::iterator I = SrcSet.begin(),
- E = SrcSet.end(); I != E; ++I )
- EnclosingBldr->takeNodes(*I);
- }
+ NodeBuilder *Enclosing = nullptr);
~StmtNodeBuilder() override;
@@ -406,21 +385,11 @@
public:
BranchNodeBuilder(ExplodedNode *SrcNode, ExplodedNodeSet &DstSet,
const NodeBuilderContext &C,
- const CFGBlock *dstT, const CFGBlock *dstF)
- : NodeBuilder(SrcNode, DstSet, C), DstT(dstT), DstF(dstF),
- InFeasibleTrue(!DstT), InFeasibleFalse(!DstF) {
- // The branch node builder does not generate autotransitions.
- // If there are no successors it means that both branches are infeasible.
- takeNodes(SrcNode);
- }
+ const CFGBlock *dstT, const CFGBlock *dstF);
BranchNodeBuilder(const ExplodedNodeSet &SrcSet, ExplodedNodeSet &DstSet,
const NodeBuilderContext &C,
- const CFGBlock *dstT, const CFGBlock *dstF)
- : NodeBuilder(SrcSet, DstSet, C), DstT(dstT), DstF(dstF),
- InFeasibleTrue(!DstT), InFeasibleFalse(!DstF) {
- takeNodes(SrcSet);
- }
+ const CFGBlock *dstT, const CFGBlock *dstF);
ExplodedNode *generateNode(ProgramStateRef State, bool branch,
ExplodedNode *Pred);
@@ -450,8 +419,7 @@
public:
IndirectGotoNodeBuilder(ExplodedNode *pred, const CFGBlock *src,
- const Expr *e, const CFGBlock *dispatch, CoreEngine* eng)
- : Eng(*eng), Src(src), DispatchBlock(*dispatch), E(e), Pred(pred) {}
+ const Expr *e, const CFGBlock *dispatch, CoreEngine* eng);
class iterator {
CFGBlock::const_succ_iterator I;
@@ -496,8 +464,7 @@
public:
SwitchNodeBuilder(ExplodedNode *pred, const CFGBlock *src,
- const Expr *condition, CoreEngine* eng)
- : Eng(*eng), Src(src), Condition(condition), Pred(pred) {}
+ const Expr *condition, CoreEngine* eng);
class iterator {
CFGBlock::const_succ_reverse_iterator I;
Index: llvm/tools/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
===================================================================
--- llvm/tools/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
+++ llvm/tools/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
@@ -106,10 +106,7 @@
public:
CheckerManager(const LangOptions &langOpts,
- AnalyzerOptionsRef AOptions)
- : LangOpts(langOpts),
- AOptions(AOptions) {}
-
+ AnalyzerOptionsRef AOptions);
~CheckerManager();
void setCurrentCheckName(CheckName name) { CurrentCheckName = name; }
Index: llvm/tools/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
===================================================================
--- llvm/tools/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
+++ llvm/tools/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
@@ -739,6 +739,12 @@
return Checkers;
}
+CheckerManager::CheckerManager(const LangOptions &langOpts,
+ AnalyzerOptionsRef AOptions)
+ : LangOpts(langOpts),
+ AOptions(AOptions) {}
+
+
CheckerManager::~CheckerManager() {
for (unsigned i = 0, e = CheckerDtors.size(); i != e; ++i)
CheckerDtors[i]();
Index: llvm/tools/clang/lib/StaticAnalyzer/Core/SVals.cpp
===================================================================
--- llvm/tools/clang/lib/StaticAnalyzer/Core/SVals.cpp
+++ llvm/tools/clang/lib/StaticAnalyzer/Core/SVals.cpp
@@ -187,7 +187,76 @@
return isConstant(0);
}
+//===----------------------------------------------------------------------===//
+// Previously inlined functions.
+//===----------------------------------------------------------------------===//
+DefinedSVal::DefinedSVal() {}
+
+DefinedSVal::DefinedSVal(const void *d, bool isLoc, unsigned ValKind)
+ : DefinedOrUnknownSVal(d, isLoc, ValKind) {}
+
+KnownSVal::KnownSVal() {}
+
+KnownSVal::KnownSVal(const DefinedSVal &V) : SVal(V) {}
+
+KnownSVal::KnownSVal(const UndefinedVal &V) : SVal(V) {}
+
+NonLoc::NonLoc() {}
+
+NonLoc::NonLoc(unsigned SubKind, const void *d)
+ : DefinedSVal(d, false, SubKind) {}
+
+Loc::Loc() {}
+
+Loc::Loc(unsigned SubKind, const void *D)
+ : DefinedSVal(D, true, SubKind) {}
+
+inline bool Loc::isLocType(QualType T) {
+ return T->isAnyPointerType() || T->isBlockPointerType() ||
+ T->isReferenceType() || T->isNullPtrType();
+}
+
+nonloc::SymbolVal::SymbolVal(SymbolRef sym) : NonLoc(SymbolValKind, sym) {}
+
+nonloc::SymbolVal::SymbolVal() {}
+
+nonloc::ConcreteInt::ConcreteInt(const llvm::APSInt& V) : NonLoc(ConcreteIntKind, &V) {}
+
+nonloc::ConcreteInt::ConcreteInt() {}
+
+nonloc::LocAsInteger::LocAsInteger(const std::pair<SVal, uintptr_t> &data)
+ : NonLoc(LocAsIntegerKind, &data) {
+ assert (data.first.getAs<Loc>());
+}
+
+nonloc::LocAsInteger::LocAsInteger() {}
+
+nonloc::CompoundVal::CompoundVal(const CompoundValData* D)
+ : NonLoc(CompoundValKind, D) {}
+
+nonloc::CompoundVal::CompoundVal() {}
+
+nonloc::LazyCompoundVal::LazyCompoundVal(const LazyCompoundValData *D)
+ : NonLoc(LazyCompoundValKind, D) {}
+
+nonloc::LazyCompoundVal::LazyCompoundVal() {}
+
+loc::GotoLabel::GotoLabel(LabelDecl *Label) : Loc(GotoLabelKind, Label) {}
+
+loc::GotoLabel::GotoLabel() {}
+
+
+loc::MemRegionVal::MemRegionVal(const MemRegion* r) : Loc(MemRegionValKind, r) {}
+
+loc::MemRegionVal::MemRegionVal() {}
+
+
+loc::ConcreteInt::ConcreteInt(const llvm::APSInt& V)
+ : Loc(ConcreteIntKind, &V) {}
+
+loc::ConcreteInt::ConcreteInt() {}
+
//===----------------------------------------------------------------------===//
// Transfer function dispatch for Non-Locs.
//===----------------------------------------------------------------------===//
@@ -217,7 +286,7 @@
//===----------------------------------------------------------------------===//
// Transfer function dispatch for Locs.
//===----------------------------------------------------------------------===//
-
+
SVal loc::ConcreteInt::evalBinOp(BasicValueFactory& BasicVals,
BinaryOperator::Opcode Op,
const loc::ConcreteInt& R) const {
Index: llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
===================================================================
--- llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
+++ llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
@@ -240,9 +240,9 @@
bool isUnknownOrUndef() const = delete;
bool isValid() const = delete;
protected:
- DefinedSVal() {}
- explicit DefinedSVal(const void *d, bool isLoc, unsigned ValKind)
- : DefinedOrUnknownSVal(d, isLoc, ValKind) {}
+ DefinedSVal();
+ explicit DefinedSVal(const void *d, bool isLoc, unsigned ValKind);
+
private:
friend class SVal;
static bool isKind(const SVal& V) {
@@ -253,21 +253,20 @@
/// \brief Represents an SVal that is guaranteed to not be UnknownVal.
class KnownSVal : public SVal {
- KnownSVal() {}
+ KnownSVal();
friend class SVal;
static bool isKind(const SVal &V) {
return !V.isUnknown();
}
public:
- KnownSVal(const DefinedSVal &V) : SVal(V) {}
- KnownSVal(const UndefinedVal &V) : SVal(V) {}
+ KnownSVal(const DefinedSVal &V);
+ KnownSVal(const UndefinedVal &V);
};
class NonLoc : public DefinedSVal {
protected:
- NonLoc() {}
- explicit NonLoc(unsigned SubKind, const void *d)
- : DefinedSVal(d, false, SubKind) {}
+ NonLoc();
+ explicit NonLoc(unsigned SubKind, const void *d);
public:
void dumpToStream(raw_ostream &Out) const;
@@ -281,17 +280,13 @@
class Loc : public DefinedSVal {
protected:
- Loc() {}
- explicit Loc(unsigned SubKind, const void *D)
- : DefinedSVal(const_cast<void*>(D), true, SubKind) {}
+ Loc();
+ explicit Loc(unsigned SubKind, const void *D);
public:
void dumpToStream(raw_ostream &Out) const;
- static inline bool isLocType(QualType T) {
- return T->isAnyPointerType() || T->isBlockPointerType() ||
- T->isReferenceType() || T->isNullPtrType();
- }
+ static inline bool isLocType(QualType T);
private:
friend class SVal;
@@ -314,19 +309,19 @@
/// \brief Represents symbolic expression.
class SymbolVal : public NonLoc {
public:
- SymbolVal(SymbolRef sym) : NonLoc(SymbolValKind, sym) {}
+ SymbolVal(SymbolRef sym);
SymbolRef getSymbol() const {
- return (const SymExpr*) Data;
+ return static_cast<SymbolRef>(Data);
}
bool isExpression() const {
return !isa<SymbolData>(getSymbol());
}
private:
friend class SVal;
- SymbolVal() {}
+ SymbolVal();
static bool isKind(const SVal& V) {
return V.getBaseKind() == NonLocKind &&
V.getSubKind() == SymbolValKind;
@@ -340,7 +335,7 @@
/// \brief Value representing integer constant.
class ConcreteInt : public NonLoc {
public:
- explicit ConcreteInt(const llvm::APSInt& V) : NonLoc(ConcreteIntKind, &V) {}
+ explicit ConcreteInt(const llvm::APSInt& V);
const llvm::APSInt& getValue() const {
return *static_cast<const llvm::APSInt*>(Data);
@@ -356,7 +351,7 @@
private:
friend class SVal;
- ConcreteInt() {}
+ ConcreteInt();
static bool isKind(const SVal& V) {
return V.getBaseKind() == NonLocKind &&
V.getSubKind() == ConcreteIntKind;
@@ -370,11 +365,7 @@
class LocAsInteger : public NonLoc {
friend class ento::SValBuilder;
- explicit LocAsInteger(const std::pair<SVal, uintptr_t> &data)
- : NonLoc(LocAsIntegerKind, &data) {
- assert (data.first.getAs<Loc>());
- }
-
+ explicit LocAsInteger(const std::pair<SVal, uintptr_t> &data);
public:
Loc getLoc() const {
@@ -398,7 +389,7 @@
private:
friend class SVal;
- LocAsInteger() {}
+ LocAsInteger();
static bool isKind(const SVal& V) {
return V.getBaseKind() == NonLocKind &&
V.getSubKind() == LocAsIntegerKind;
@@ -412,7 +403,7 @@
class CompoundVal : public NonLoc {
friend class ento::SValBuilder;
- explicit CompoundVal(const CompoundValData* D) : NonLoc(CompoundValKind, D) {}
+ explicit CompoundVal(const CompoundValData* D);
public:
const CompoundValData* getValue() const {
@@ -425,7 +416,7 @@
private:
friend class SVal;
- CompoundVal() {}
+ CompoundVal();
static bool isKind(const SVal& V) {
return V.getBaseKind() == NonLocKind && V.getSubKind() == CompoundValKind;
}
@@ -438,8 +429,7 @@
class LazyCompoundVal : public NonLoc {
friend class ento::SValBuilder;
- explicit LazyCompoundVal(const LazyCompoundValData *D)
- : NonLoc(LazyCompoundValKind, D) {}
+ explicit LazyCompoundVal(const LazyCompoundValData *D);
public:
const LazyCompoundValData *getCVData() const {
return static_cast<const LazyCompoundValData*>(Data);
@@ -449,7 +439,7 @@
private:
friend class SVal;
- LazyCompoundVal() {}
+ LazyCompoundVal();
static bool isKind(const SVal& V) {
return V.getBaseKind() == NonLocKind &&
V.getSubKind() == LazyCompoundValKind;
@@ -474,15 +464,15 @@
class GotoLabel : public Loc {
public:
- explicit GotoLabel(LabelDecl *Label) : Loc(GotoLabelKind, Label) {}
+ explicit GotoLabel(LabelDecl *Label);
const LabelDecl *getLabel() const {
return static_cast<const LabelDecl*>(Data);
}
private:
friend class SVal;
- GotoLabel() {}
+ GotoLabel();
static bool isKind(const SVal& V) {
return V.getBaseKind() == LocKind && V.getSubKind() == GotoLabelKind;
}
@@ -495,7 +485,7 @@
class MemRegionVal : public Loc {
public:
- explicit MemRegionVal(const MemRegion* r) : Loc(MemRegionValKind, r) {}
+ explicit MemRegionVal(const MemRegion* r);
/// \brief Get the underlining region.
const MemRegion* getRegion() const {
@@ -520,7 +510,7 @@
private:
friend class SVal;
- MemRegionVal() {}
+ MemRegionVal();
static bool isKind(const SVal& V) {
return V.getBaseKind() == LocKind &&
V.getSubKind() == MemRegionValKind;
@@ -533,7 +523,7 @@
class ConcreteInt : public Loc {
public:
- explicit ConcreteInt(const llvm::APSInt& V) : Loc(ConcreteIntKind, &V) {}
+ explicit ConcreteInt(const llvm::APSInt& V);
const llvm::APSInt& getValue() const {
return *static_cast<const llvm::APSInt*>(Data);
@@ -545,7 +535,7 @@
private:
friend class SVal;
- ConcreteInt() {}
+ ConcreteInt();
static bool isKind(const SVal& V) {
return V.getBaseKind() == LocKind &&
V.getSubKind() == ConcreteIntKind;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits