forked from OSchip/llvm-project
[CFG] Remove duplicate function/class names at the beginning of comments
Some functions/classes have renamed while the comments still use the old names. Delete them per coding style. Also some whitespace cleanup. llvm-svn: 338183
This commit is contained in:
parent
8a05b01d13
commit
32fa871547
|
@ -23,7 +23,7 @@ namespace clang {
|
|||
|
||||
class CFG;
|
||||
class CFGBlock;
|
||||
|
||||
|
||||
// A class that performs reachability queries for CFGBlocks. Several internal
|
||||
// checks in this checker require reachability information. The requests all
|
||||
// tend to have a common destination, so we lazily do a predecessor search
|
||||
|
@ -45,7 +45,7 @@ public:
|
|||
private:
|
||||
void mapReachability(const CFGBlock *Dst);
|
||||
};
|
||||
|
||||
|
||||
} // namespace clang
|
||||
|
||||
#endif // LLVM_CLANG_ANALYSIS_ANALYSES_CFGREACHABILITYANALYSIS_H
|
||||
|
|
|
@ -51,7 +51,7 @@ class FieldDecl;
|
|||
class LangOptions;
|
||||
class VarDecl;
|
||||
|
||||
/// CFGElement - Represents a top-level expression in a basic block.
|
||||
/// Represents a top-level expression in a basic block.
|
||||
class CFGElement {
|
||||
public:
|
||||
enum Kind {
|
||||
|
@ -144,9 +144,9 @@ protected:
|
|||
CFGStmt() = default;
|
||||
};
|
||||
|
||||
/// CFGConstructor - Represents C++ constructor call. Maintains information
|
||||
/// necessary to figure out what memory is being initialized by the
|
||||
/// constructor expression. For now this is only used by the analyzer's CFG.
|
||||
/// Represents C++ constructor call. Maintains information necessary to figure
|
||||
/// out what memory is being initialized by the constructor expression. For now
|
||||
/// this is only used by the analyzer's CFG.
|
||||
class CFGConstructor : public CFGStmt {
|
||||
public:
|
||||
explicit CFGConstructor(CXXConstructExpr *CE, const ConstructionContext *C)
|
||||
|
@ -169,12 +169,12 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
/// CFGCXXRecordTypedCall - Represents a function call that returns a C++ object
|
||||
/// by value. This, like constructor, requires a construction context in order
|
||||
/// to understand the storage of the returned object . In C such tracking is not
|
||||
/// necessary because no additional effort is required for destroying the object
|
||||
/// or modeling copy elision. Like CFGConstructor, this element is for now only
|
||||
/// used by the analyzer's CFG.
|
||||
/// Represents a function call that returns a C++ object by value. This, like
|
||||
/// constructor, requires a construction context in order to understand the
|
||||
/// storage of the returned object . In C such tracking is not necessary because
|
||||
/// no additional effort is required for destroying the object or modeling copy
|
||||
/// elision. Like CFGConstructor, this element is for now only used by the
|
||||
/// analyzer's CFG.
|
||||
class CFGCXXRecordTypedCall : public CFGStmt {
|
||||
public:
|
||||
/// Returns true when call expression \p CE needs to be represented
|
||||
|
@ -210,8 +210,8 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
/// CFGInitializer - Represents C++ base or member initializer from
|
||||
/// constructor's initialization list.
|
||||
/// Represents C++ base or member initializer from constructor's initialization
|
||||
/// list.
|
||||
class CFGInitializer : public CFGElement {
|
||||
public:
|
||||
explicit CFGInitializer(CXXCtorInitializer *initializer)
|
||||
|
@ -231,7 +231,7 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
/// CFGNewAllocator - Represents C++ allocator call.
|
||||
/// Represents C++ allocator call.
|
||||
class CFGNewAllocator : public CFGElement {
|
||||
public:
|
||||
explicit CFGNewAllocator(const CXXNewExpr *S)
|
||||
|
@ -349,8 +349,8 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
/// CFGImplicitDtor - Represents C++ object destructor implicitly generated
|
||||
/// by compiler on various occasions.
|
||||
/// Represents C++ object destructor implicitly generated by compiler on various
|
||||
/// occasions.
|
||||
class CFGImplicitDtor : public CFGElement {
|
||||
protected:
|
||||
CFGImplicitDtor() = default;
|
||||
|
@ -373,9 +373,9 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
/// CFGAutomaticObjDtor - Represents C++ object destructor implicitly generated
|
||||
/// for automatic object or temporary bound to const reference at the point
|
||||
/// of leaving its local scope.
|
||||
/// Represents C++ object destructor implicitly generated for automatic object
|
||||
/// or temporary bound to const reference at the point of leaving its local
|
||||
/// scope.
|
||||
class CFGAutomaticObjDtor: public CFGImplicitDtor {
|
||||
public:
|
||||
CFGAutomaticObjDtor(const VarDecl *var, const Stmt *stmt)
|
||||
|
@ -400,8 +400,7 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
/// CFGDeleteDtor - Represents C++ object destructor generated
|
||||
/// from a call to delete.
|
||||
/// Represents C++ object destructor generated from a call to delete.
|
||||
class CFGDeleteDtor : public CFGImplicitDtor {
|
||||
public:
|
||||
CFGDeleteDtor(const CXXRecordDecl *RD, const CXXDeleteExpr *DE)
|
||||
|
@ -426,8 +425,8 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
/// CFGBaseDtor - Represents C++ object destructor implicitly generated for
|
||||
/// base object in destructor.
|
||||
/// Represents C++ object destructor implicitly generated for base object in
|
||||
/// destructor.
|
||||
class CFGBaseDtor : public CFGImplicitDtor {
|
||||
public:
|
||||
CFGBaseDtor(const CXXBaseSpecifier *base)
|
||||
|
@ -447,8 +446,8 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
/// CFGMemberDtor - Represents C++ object destructor implicitly generated for
|
||||
/// member object in destructor.
|
||||
/// Represents C++ object destructor implicitly generated for member object in
|
||||
/// destructor.
|
||||
class CFGMemberDtor : public CFGImplicitDtor {
|
||||
public:
|
||||
CFGMemberDtor(const FieldDecl *field)
|
||||
|
@ -468,8 +467,8 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
/// CFGTemporaryDtor - Represents C++ object destructor implicitly generated
|
||||
/// at the end of full expression for temporary object.
|
||||
/// Represents C++ object destructor implicitly generated at the end of full
|
||||
/// expression for temporary object.
|
||||
class CFGTemporaryDtor : public CFGImplicitDtor {
|
||||
public:
|
||||
CFGTemporaryDtor(CXXBindTemporaryExpr *expr)
|
||||
|
@ -489,7 +488,7 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
/// CFGTerminator - Represents CFGBlock terminator statement.
|
||||
/// Represents CFGBlock terminator statement.
|
||||
///
|
||||
/// TemporaryDtorsBranch bit is set to true if the terminator marks a branch
|
||||
/// in control flow of destructors of temporaries. In this case terminator
|
||||
|
@ -520,7 +519,7 @@ public:
|
|||
explicit operator bool() const { return getStmt(); }
|
||||
};
|
||||
|
||||
/// CFGBlock - Represents a single basic block in a source-level CFG.
|
||||
/// Represents a single basic block in a source-level CFG.
|
||||
/// It consists of:
|
||||
///
|
||||
/// (1) A set of statements/expressions (which may contain subexpressions).
|
||||
|
@ -588,26 +587,24 @@ class CFGBlock {
|
|||
bool empty() const { return Impl.empty(); }
|
||||
};
|
||||
|
||||
/// Stmts - The set of statements in the basic block.
|
||||
/// The set of statements in the basic block.
|
||||
ElementList Elements;
|
||||
|
||||
/// Label - An (optional) label that prefixes the executable
|
||||
/// statements in the block. When this variable is non-NULL, it is
|
||||
/// either an instance of LabelStmt, SwitchCase or CXXCatchStmt.
|
||||
/// An (optional) label that prefixes the executable statements in the block.
|
||||
/// When this variable is non-NULL, it is either an instance of LabelStmt,
|
||||
/// SwitchCase or CXXCatchStmt.
|
||||
Stmt *Label = nullptr;
|
||||
|
||||
/// Terminator - The terminator for a basic block that
|
||||
/// indicates the type of control-flow that occurs between a block
|
||||
/// and its successors.
|
||||
/// The terminator for a basic block that indicates the type of control-flow
|
||||
/// that occurs between a block and its successors.
|
||||
CFGTerminator Terminator;
|
||||
|
||||
/// LoopTarget - Some blocks are used to represent the "loop edge" to
|
||||
/// the start of a loop from within the loop body. This Stmt* will be
|
||||
/// refer to the loop statement for such blocks (and be null otherwise).
|
||||
/// Some blocks are used to represent the "loop edge" to the start of a loop
|
||||
/// from within the loop body. This Stmt* will be refer to the loop statement
|
||||
/// for such blocks (and be null otherwise).
|
||||
const Stmt *LoopTarget = nullptr;
|
||||
|
||||
/// BlockID - A numerical ID assigned to a CFGBlock during construction
|
||||
/// of the CFG.
|
||||
/// A numerical ID assigned to a CFGBlock during construction of the CFG.
|
||||
unsigned BlockID;
|
||||
|
||||
public:
|
||||
|
@ -629,7 +626,7 @@ public:
|
|||
public:
|
||||
/// Construct an AdjacentBlock with a possibly unreachable block.
|
||||
AdjacentBlock(CFGBlock *B, bool IsReachable);
|
||||
|
||||
|
||||
/// Construct an AdjacentBlock with a reachable block and an alternate
|
||||
/// unreachable block.
|
||||
AdjacentBlock(CFGBlock *B, CFGBlock *AlternateBlock);
|
||||
|
@ -665,13 +662,12 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
/// Predecessors/Successors - Keep track of the predecessor / successor
|
||||
/// CFG blocks.
|
||||
/// Keep track of the predecessor / successor CFG blocks.
|
||||
using AdjacentBlocks = BumpVector<AdjacentBlock>;
|
||||
AdjacentBlocks Preds;
|
||||
AdjacentBlocks Succs;
|
||||
|
||||
/// NoReturn - This bit is set when the basic block contains a function call
|
||||
/// This bit is set when the basic block contains a function call
|
||||
/// or implicit destructor that is attributed as 'noreturn'. In that case,
|
||||
/// control cannot technically ever proceed past this block. All such blocks
|
||||
/// will have a single immediate successor: the exit block. This allows them
|
||||
|
@ -682,7 +678,7 @@ private:
|
|||
/// storage if the memory usage of CFGBlock becomes an issue.
|
||||
unsigned HasNoReturnElement : 1;
|
||||
|
||||
/// Parent - The parent CFG that owns this CFGBlock.
|
||||
/// The parent CFG that owns this CFGBlock.
|
||||
CFG *Parent;
|
||||
|
||||
public:
|
||||
|
@ -992,7 +988,7 @@ public:
|
|||
bool isAlwaysTrue) {}
|
||||
};
|
||||
|
||||
/// CFG - Represents a source-level, intra-procedural CFG that represents the
|
||||
/// Represents a source-level, intra-procedural CFG that represents the
|
||||
/// control-flow of a Stmt. The Stmt can represent an entire function body,
|
||||
/// or a single expression. A CFG will always contain one empty block that
|
||||
/// represents the Exit point of the CFG. A CFG will also contain a designated
|
||||
|
@ -1044,21 +1040,21 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/// buildCFG - Builds a CFG from an AST.
|
||||
/// Builds a CFG from an AST.
|
||||
static std::unique_ptr<CFG> buildCFG(const Decl *D, Stmt *AST, ASTContext *C,
|
||||
const BuildOptions &BO);
|
||||
|
||||
/// createBlock - Create a new block in the CFG. The CFG owns the block;
|
||||
/// the caller should not directly free it.
|
||||
/// Create a new block in the CFG. The CFG owns the block; the caller should
|
||||
/// not directly free it.
|
||||
CFGBlock *createBlock();
|
||||
|
||||
/// setEntry - Set the entry block of the CFG. This is typically used
|
||||
/// only during CFG construction. Most CFG clients expect that the
|
||||
/// entry block has no predecessors and contains no statements.
|
||||
/// Set the entry block of the CFG. This is typically used only during CFG
|
||||
/// construction. Most CFG clients expect that the entry block has no
|
||||
/// predecessors and contains no statements.
|
||||
void setEntry(CFGBlock *B) { Entry = B; }
|
||||
|
||||
/// setIndirectGotoBlock - Set the block used for indirect goto jumps.
|
||||
/// This is typically used only during CFG construction.
|
||||
/// Set the block used for indirect goto jumps. This is typically used only
|
||||
/// during CFG construction.
|
||||
void setIndirectGotoBlock(CFGBlock *B) { IndirectGotoBlock = B; }
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
@ -1152,8 +1148,8 @@ public:
|
|||
|
||||
template <typename CALLBACK>
|
||||
void VisitBlockStmts(CALLBACK& O) const {
|
||||
for (const_iterator I=begin(), E=end(); I != E; ++I)
|
||||
for (CFGBlock::const_iterator BI=(*I)->begin(), BE=(*I)->end();
|
||||
for (const_iterator I = begin(), E = end(); I != E; ++I)
|
||||
for (CFGBlock::const_iterator BI = (*I)->begin(), BE = (*I)->end();
|
||||
BI != BE; ++BI) {
|
||||
if (Optional<CFGStmt> stmt = BI->getAs<CFGStmt>())
|
||||
O(const_cast<Stmt*>(stmt->getStmt()));
|
||||
|
@ -1164,13 +1160,12 @@ public:
|
|||
// CFG Introspection.
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
/// getNumBlockIDs - Returns the total number of BlockIDs allocated (which
|
||||
/// start at 0).
|
||||
/// Returns the total number of BlockIDs allocated (which start at 0).
|
||||
unsigned getNumBlockIDs() const { return NumBlockIDs; }
|
||||
|
||||
/// size - Return the total number of CFGBlocks within the CFG
|
||||
/// This is simply a renaming of the getNumBlockIDs(). This is necessary
|
||||
/// because the dominator implementation needs such an interface.
|
||||
/// Return the total number of CFGBlocks within the CFG This is simply a
|
||||
/// renaming of the getNumBlockIDs(). This is necessary because the dominator
|
||||
/// implementation needs such an interface.
|
||||
unsigned size() const { return NumBlockIDs; }
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
|
|
@ -19,20 +19,18 @@
|
|||
|
||||
namespace clang {
|
||||
|
||||
class CFG;
|
||||
class CFGBlock;
|
||||
class ParentMap;
|
||||
class Stmt;
|
||||
|
||||
class CFGStmtMap {
|
||||
ParentMap *PM;
|
||||
void *M;
|
||||
|
||||
|
||||
CFGStmtMap(ParentMap *pm, void *m) : PM(pm), M(m) {}
|
||||
|
||||
|
||||
public:
|
||||
~CFGStmtMap();
|
||||
|
||||
|
||||
/// Returns a new CFGMap for the given CFG. It is the caller's
|
||||
/// responsibility to 'delete' this object when done using it.
|
||||
static CFGStmtMap *Build(CFG* C, ParentMap *PM);
|
||||
|
|
|
@ -27,13 +27,13 @@ CFGReverseBlockReachabilityAnalysis::CFGReverseBlockReachabilityAnalysis(
|
|||
bool CFGReverseBlockReachabilityAnalysis::isReachable(const CFGBlock *Src,
|
||||
const CFGBlock *Dst) {
|
||||
const unsigned DstBlockID = Dst->getBlockID();
|
||||
|
||||
|
||||
// If we haven't analyzed the destination node, run the analysis now
|
||||
if (!analyzed[DstBlockID]) {
|
||||
mapReachability(Dst);
|
||||
analyzed[DstBlockID] = true;
|
||||
}
|
||||
|
||||
|
||||
// Return the cached result
|
||||
return reachable[DstBlockID][Src->getBlockID()];
|
||||
}
|
||||
|
@ -43,10 +43,10 @@ bool CFGReverseBlockReachabilityAnalysis::isReachable(const CFGBlock *Src,
|
|||
void CFGReverseBlockReachabilityAnalysis::mapReachability(const CFGBlock *Dst) {
|
||||
SmallVector<const CFGBlock *, 11> worklist;
|
||||
llvm::BitVector visited(analyzed.size());
|
||||
|
||||
|
||||
ReachableSet &DstReachability = reachable[Dst->getBlockID()];
|
||||
DstReachability.resize(analyzed.size(), false);
|
||||
|
||||
|
||||
// Start searching from the destination node, since we commonly will perform
|
||||
// multiple queries relating to a destination node.
|
||||
worklist.push_back(Dst);
|
||||
|
@ -58,7 +58,7 @@ void CFGReverseBlockReachabilityAnalysis::mapReachability(const CFGBlock *Dst) {
|
|||
if (visited[block->getBlockID()])
|
||||
continue;
|
||||
visited[block->getBlockID()] = true;
|
||||
|
||||
|
||||
// Update reachability information for this node -> Dst
|
||||
if (!firstRun) {
|
||||
// Don't insert Dst -> Dst unless it was a predecessor of itself
|
||||
|
@ -66,7 +66,7 @@ void CFGReverseBlockReachabilityAnalysis::mapReachability(const CFGBlock *Dst) {
|
|||
}
|
||||
else
|
||||
firstRun = false;
|
||||
|
||||
|
||||
// Add the predecessors to the worklist.
|
||||
for (CFGBlock::const_pred_iterator i = block->pred_begin(),
|
||||
e = block->pred_end(); i != e; ++i) {
|
||||
|
|
Loading…
Reference in New Issue