summaryrefslogtreecommitdiff
path: root/include/clang/Analysis/Analyses
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-08-02 17:33:11 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-08-02 17:33:11 +0000
commitc7e70c433efc6953dc3888b9fbf9f3512d7da2b0 (patch)
tree27425930fc0c91650a7f3527fcac8e0f92907b90 /include/clang/Analysis/Analyses
parent486754660bb926339aefcf012a3f848592babb8b (diff)
Diffstat (limited to 'include/clang/Analysis/Analyses')
-rw-r--r--include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h4
-rw-r--r--include/clang/Analysis/Analyses/Consumed.h60
-rw-r--r--include/clang/Analysis/Analyses/Dominators.h2
-rw-r--r--include/clang/Analysis/Analyses/FormatString.h2
-rw-r--r--include/clang/Analysis/Analyses/LiveVariables.h34
-rw-r--r--include/clang/Analysis/Analyses/ReachableCode.h2
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafetyCommon.h2
7 files changed, 53 insertions, 53 deletions
diff --git a/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h b/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h
index da59514c4fa6..49da6815ace9 100644
--- a/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h
+++ b/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h
@@ -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
diff --git a/include/clang/Analysis/Analyses/Consumed.h b/include/clang/Analysis/Analyses/Consumed.h
index 6003d665fd88..5a70989e5087 100644
--- a/include/clang/Analysis/Analyses/Consumed.h
+++ b/include/clang/Analysis/Analyses/Consumed.h
@@ -38,18 +38,18 @@ class Stmt;
class VarDecl;
namespace consumed {
-
+
class ConsumedStmtVisitor;
enum ConsumedState {
// No state information for the given variable.
CS_None,
-
+
CS_Unknown,
CS_Unconsumed,
CS_Consumed
};
-
+
using OptionalNotes = SmallVector<PartialDiagnosticAt, 1>;
using DelayedDiag = std::pair<PartialDiagnosticAt, OptionalNotes>;
using DiagList = std::list<DelayedDiag>;
@@ -60,7 +60,7 @@ namespace consumed {
/// Emit the warnings and notes left by the analysis.
virtual void emitDiagnostics() {}
-
+
/// Warn that a variable's state doesn't match at the entry and exit
/// of a loop.
///
@@ -70,7 +70,7 @@ namespace consumed {
/// state.
virtual void warnLoopStateMismatch(SourceLocation Loc,
StringRef VariableName) {}
-
+
/// Warn about parameter typestate mismatches upon return.
///
/// \param Loc -- The SourceLocation of the return statement.
@@ -84,22 +84,22 @@ namespace consumed {
StringRef VariableName,
StringRef ExpectedState,
StringRef ObservedState) {}
-
+
// FIXME: Add documentation.
virtual void warnParamTypestateMismatch(SourceLocation LOC,
StringRef ExpectedState,
StringRef ObservedState) {}
-
+
// FIXME: This can be removed when the attr propagation fix for templated
// classes lands.
/// Warn about return typestates set for unconsumable types.
- ///
+ ///
/// \param Loc -- The location of the attributes.
///
/// \param TypeName -- The name of the unconsumable type.
virtual void warnReturnTypestateForUnconsumableType(SourceLocation Loc,
StringRef TypeName) {}
-
+
/// Warn about return typestate mismatches.
///
/// \param Loc -- The SourceLocation of the return statement.
@@ -144,71 +144,71 @@ namespace consumed {
using VarMapType = llvm::DenseMap<const VarDecl *, ConsumedState>;
using TmpMapType =
llvm::DenseMap<const CXXBindTemporaryExpr *, ConsumedState>;
-
+
protected:
bool Reachable = true;
const Stmt *From = nullptr;
VarMapType VarMap;
TmpMapType TmpMap;
-
+
public:
ConsumedStateMap() = default;
ConsumedStateMap(const ConsumedStateMap &Other)
: Reachable(Other.Reachable), From(Other.From), VarMap(Other.VarMap),
TmpMap() {}
-
+
/// Warn if any of the parameters being tracked are not in the state
/// they were declared to be in upon return from a function.
void checkParamsForReturnTypestate(SourceLocation BlameLoc,
ConsumedWarningsHandlerBase &WarningsHandler) const;
-
+
/// Clear the TmpMap.
void clearTemporaries();
-
+
/// Get the consumed state of a given variable.
ConsumedState getState(const VarDecl *Var) const;
-
+
/// Get the consumed state of a given temporary value.
ConsumedState getState(const CXXBindTemporaryExpr *Tmp) const;
-
+
/// Merge this state map with another map.
void intersect(const ConsumedStateMap &Other);
void intersectAtLoopHead(const CFGBlock *LoopHead, const CFGBlock *LoopBack,
const ConsumedStateMap *LoopBackStates,
ConsumedWarningsHandlerBase &WarningsHandler);
-
+
/// Return true if this block is reachable.
bool isReachable() const { return Reachable; }
-
+
/// Mark the block as unreachable.
void markUnreachable();
-
+
/// Set the source for a decision about the branching of states.
/// \param Source -- The statement that was the origin of a branching
/// decision.
void setSource(const Stmt *Source) { this->From = Source; }
-
+
/// Set the consumed state of a given variable.
void setState(const VarDecl *Var, ConsumedState State);
-
+
/// Set the consumed state of a given temporary value.
void setState(const CXXBindTemporaryExpr *Tmp, ConsumedState State);
-
+
/// Remove the temporary value from our state map.
void remove(const CXXBindTemporaryExpr *Tmp);
-
+
/// Tests to see if there is a mismatch in the states stored in two
/// maps.
///
/// \param Other -- The second map to compare against.
bool operator!=(const ConsumedStateMap *Other) const;
};
-
+
class ConsumedBlockInfo {
std::vector<std::unique_ptr<ConsumedStateMap>> StateMapsArray;
std::vector<unsigned int> VisitOrder;
-
+
public:
ConsumedBlockInfo() = default;
@@ -218,7 +218,7 @@ namespace consumed {
for (const auto BI : *SortedGraph)
VisitOrder[BI->getBlockID()] = VisitOrderCounter++;
}
-
+
bool allBackEdgesVisited(const CFGBlock *CurrBlock,
const CFGBlock *TargetBlock);
@@ -228,7 +228,7 @@ namespace consumed {
std::unique_ptr<ConsumedStateMap> StateMap);
ConsumedStateMap* borrowInfo(const CFGBlock *Block);
-
+
void discardInfo(const CFGBlock *Block);
std::unique_ptr<ConsumedStateMap> getInfo(const CFGBlock *Block);
@@ -243,12 +243,12 @@ namespace consumed {
std::unique_ptr<ConsumedStateMap> CurrStates;
ConsumedState ExpectedReturnState;
-
+
void determineExpectedReturnState(AnalysisDeclContext &AC,
const FunctionDecl *D);
bool splitState(const CFGBlock *CurrBlock,
const ConsumedStmtVisitor &Visitor);
-
+
public:
ConsumedWarningsHandlerBase &WarningsHandler;
@@ -256,7 +256,7 @@ namespace consumed {
: WarningsHandler(WarningsHandler) {}
ConsumedState getExpectedReturnState() const { return ExpectedReturnState; }
-
+
/// Check a function's CFG for consumed violations.
///
/// We traverse the blocks in the CFG, keeping track of the state of each
diff --git a/include/clang/Analysis/Analyses/Dominators.h b/include/clang/Analysis/Analyses/Dominators.h
index a9cdc5560bc0..021e98dcd885 100644
--- a/include/clang/Analysis/Analyses/Dominators.h
+++ b/include/clang/Analysis/Analyses/Dominators.h
@@ -20,7 +20,7 @@
#include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/iterator.h"
#include "llvm/Support/GenericDomTree.h"
-#include "llvm/Support/GenericDomTreeConstruction.h"
+#include "llvm/Support/GenericDomTreeConstruction.h"
#include "llvm/Support/raw_ostream.h"
// FIXME: There is no good reason for the domtree to require a print method
diff --git a/include/clang/Analysis/Analyses/FormatString.h b/include/clang/Analysis/Analyses/FormatString.h
index 6f8bb9b4095f..598d341ac829 100644
--- a/include/clang/Analysis/Analyses/FormatString.h
+++ b/include/clang/Analysis/Analyses/FormatString.h
@@ -236,7 +236,7 @@ public:
const char *toString() const;
bool isPrintfKind() const { return IsPrintf; }
-
+
Optional<ConversionSpecifier> getStandardSpecifier() const;
protected:
diff --git a/include/clang/Analysis/Analyses/LiveVariables.h b/include/clang/Analysis/Analyses/LiveVariables.h
index 21c3ba255c36..0cb500fffb95 100644
--- a/include/clang/Analysis/Analyses/LiveVariables.h
+++ b/include/clang/Analysis/Analyses/LiveVariables.h
@@ -25,7 +25,7 @@ class CFGBlock;
class Stmt;
class DeclRefExpr;
class SourceManager;
-
+
class LiveVariables : public ManagedAnalysis {
public:
class LivenessValues {
@@ -34,7 +34,7 @@ public:
llvm::ImmutableSet<const Stmt *> liveStmts;
llvm::ImmutableSet<const VarDecl *> liveDecls;
llvm::ImmutableSet<const BindingDecl *> liveBindings;
-
+
bool equals(const LivenessValues &V) const;
LivenessValues()
@@ -48,21 +48,21 @@ public:
bool isLive(const Stmt *S) const;
bool isLive(const VarDecl *D) const;
-
- friend class LiveVariables;
+
+ friend class LiveVariables;
};
-
+
class Observer {
virtual void anchor();
public:
virtual ~Observer() {}
-
+
/// A callback invoked right before invoking the
/// liveness transfer function on the given statement.
virtual void observeStmt(const Stmt *S,
const CFGBlock *currentBlock,
const LivenessValues& V) {}
-
+
/// Called when the live variables analysis registers
/// that a variable is killed.
virtual void observerKill(const DeclRefExpr *DR) {}
@@ -73,47 +73,47 @@ public:
/// Compute the liveness information for a given CFG.
static LiveVariables *computeLiveness(AnalysisDeclContext &analysisContext,
bool killAtAssign);
-
+
/// Return true if a variable is live at the end of a
/// specified block.
bool isLive(const CFGBlock *B, const VarDecl *D);
-
+
/// Returns true if a variable is live at the beginning of the
/// the statement. This query only works if liveness information
/// has been recorded at the statement level (see runOnAllBlocks), and
/// only returns liveness information for block-level expressions.
bool isLive(const Stmt *S, const VarDecl *D);
-
+
/// Returns true the block-level expression "value" is live
/// before the given block-level expression (see runOnAllBlocks).
bool isLive(const Stmt *Loc, const Stmt *StmtVal);
-
+
/// Print to stderr the liveness information associated with
/// each basic block.
void dumpBlockLiveness(const SourceManager& M);
void runOnAllBlocks(Observer &obs);
-
+
static LiveVariables *create(AnalysisDeclContext &analysisContext) {
return computeLiveness(analysisContext, true);
}
-
+
static const void *getTag();
-
+
private:
LiveVariables(void *impl);
void *impl;
};
-
+
class RelaxedLiveVariables : public LiveVariables {
public:
static LiveVariables *create(AnalysisDeclContext &analysisContext) {
return computeLiveness(analysisContext, false);
}
-
+
static const void *getTag();
};
-
+
} // end namespace clang
#endif
diff --git a/include/clang/Analysis/Analyses/ReachableCode.h b/include/clang/Analysis/Analyses/ReachableCode.h
index 4c523bfc8b56..d79f1b03df7b 100644
--- a/include/clang/Analysis/Analyses/ReachableCode.h
+++ b/include/clang/Analysis/Analyses/ReachableCode.h
@@ -57,7 +57,7 @@ public:
};
/// ScanReachableFromBlock - Mark all blocks reachable from Start.
-/// Returns the total number of blocks that were marked reachable.
+/// Returns the total number of blocks that were marked reachable.
unsigned ScanReachableFromBlock(const CFGBlock *Start,
llvm::BitVector &Reachable);
diff --git a/include/clang/Analysis/Analyses/ThreadSafetyCommon.h b/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
index 580872e17ef4..599c164923cb 100644
--- a/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
+++ b/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
@@ -500,7 +500,7 @@ private:
std::vector<til::BasicBlock *> BlockMap;
// Extra information per BB. Indexed by clang BlockID.
- std::vector<BlockInfo> BBInfo;
+ std::vector<BlockInfo> BBInfo;
LVarDefinitionMap CurrentLVarMap;
std::vector<til::Phi *> CurrentArguments;