aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Analysis/Analyses
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2011-11-09 06:07:30 +0000
committerDavid Blaikie <dblaikie@gmail.com>2011-11-09 06:07:30 +0000
commitba243b59a1074e0962f6abfa3bb9aa984eac1245 (patch)
treedd93c1c4b556f304c7f531289245f049bb7f524d /include/clang/Analysis/Analyses
parenta8fbc053eb08c929174bf519a0e9733e4ef90bfa (diff)
Fixing 80 col violations (& removing any trailing whitespace on files I was touching anyway)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144171 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/Analyses')
-rw-r--r--include/clang/Analysis/Analyses/Dominators.h9
-rw-r--r--include/clang/Analysis/Analyses/FormatString.h56
-rw-r--r--include/clang/Analysis/Analyses/PostOrderCFGView.h36
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafety.h6
-rw-r--r--include/clang/Analysis/Analyses/UninitializedValues.h8
5 files changed, 59 insertions, 56 deletions
diff --git a/include/clang/Analysis/Analyses/Dominators.h b/include/clang/Analysis/Analyses/Dominators.h
index d8299a431e..98a9bf1222 100644
--- a/include/clang/Analysis/Analyses/Dominators.h
+++ b/include/clang/Analysis/Analyses/Dominators.h
@@ -7,7 +7,8 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements a simple, fast dominance algorithm for source-level CFGs.
+// This file implements a simple, fast dominance algorithm for source-level
+// CFGs.
//
//===----------------------------------------------------------------------===//
@@ -27,7 +28,7 @@ class DominatorTree : public ManagedAnalysis {
typedef llvm::DenseMap<const CFGBlock *, CFGBlock*> CFGBlockMapTy;
public:
- DominatorTree(AnalysisDeclContext &ac)
+ DominatorTree(AnalysisDeclContext &ac)
: AC(ac) {}
virtual ~DominatorTree();
@@ -50,7 +51,7 @@ public:
/// Find nearest common dominator for blocks A and B.
/// Common dominator always exists, ex: entry block.
- const CFGBlock *findNearestCommonDominator(const CFGBlock *A,
+ const CFGBlock *findNearestCommonDominator(const CFGBlock *A,
const CFGBlock *B) const;
/// Constructs immediate dominator tree for a given CFG based on the algorithm
@@ -61,7 +62,7 @@ public:
/// Software-Practice and Expreience, 2001;4:1-10.
///
/// This implementation is simple and runs faster in practice than the classis
- /// Lengauer-Tarjan algorithm. For detailed discussions, refer to the paper.
+ /// Lengauer-Tarjan algorithm. For detailed discussions, refer to the paper.
void BuildDominatorTree();
/// Dump the immediate dominance tree
diff --git a/include/clang/Analysis/Analyses/FormatString.h b/include/clang/Analysis/Analyses/FormatString.h
index ac15cfc64d..b2d45e36cb 100644
--- a/include/clang/Analysis/Analyses/FormatString.h
+++ b/include/clang/Analysis/Analyses/FormatString.h
@@ -104,7 +104,7 @@ private:
const char *Position;
Kind kind;
};
-
+
class ConversionSpecifier {
public:
enum Kind {
@@ -113,14 +113,14 @@ public:
cArg,
dArg,
iArg,
- IntArgBeg = cArg, IntArgEnd = iArg,
-
+ IntArgBeg = cArg, IntArgEnd = iArg,
+
oArg,
uArg,
xArg,
XArg,
UIntArgBeg = oArg, UIntArgEnd = XArg,
-
+
fArg,
FArg,
eArg,
@@ -130,44 +130,44 @@ public:
aArg,
AArg,
DoubleArgBeg = fArg, DoubleArgEnd = AArg,
-
+
sArg,
pArg,
nArg,
PercentArg,
CArg,
SArg,
-
+
// ** Printf-specific **
-
+
// Objective-C specific specifiers.
ObjCObjArg, // '@'
ObjCBeg = ObjCObjArg, ObjCEnd = ObjCObjArg,
-
+
// GlibC specific specifiers.
PrintErrno, // 'm'
-
+
PrintfConvBeg = ObjCObjArg, PrintfConvEnd = PrintErrno,
-
- // ** Scanf-specific **
+
+ // ** Scanf-specific **
ScanListArg, // '['
ScanfConvBeg = ScanListArg, ScanfConvEnd = ScanListArg
};
-
+
ConversionSpecifier(bool isPrintf)
: IsPrintf(isPrintf), Position(0), EndScanList(0), kind(InvalidSpecifier) {}
-
+
ConversionSpecifier(bool isPrintf, const char *pos, Kind k)
: IsPrintf(isPrintf), Position(pos), EndScanList(0), kind(k) {}
-
+
const char *getStart() const {
return Position;
}
-
+
StringRef getCharacters() const {
return StringRef(getStart(), getLength());
}
-
+
bool consumesDataArgument() const {
switch (kind) {
case PrintErrno:
@@ -178,15 +178,15 @@ public:
return true;
}
}
-
+
Kind getKind() const { return kind; }
void setKind(Kind k) { kind = k; }
unsigned getLength() const {
return EndScanList ? EndScanList - Position : 1;
}
-
+
const char *toString() const;
-
+
bool isPrintfKind() const { return IsPrintf; }
protected:
@@ -337,7 +337,7 @@ public:
}
bool usesPositionalArg() const { return UsesPositionalArg; }
-
+
bool hasValidLengthModifier() const;
};
@@ -348,7 +348,7 @@ public:
namespace analyze_printf {
-class PrintfConversionSpecifier :
+class PrintfConversionSpecifier :
public analyze_format_string::ConversionSpecifier {
public:
PrintfConversionSpecifier()
@@ -360,7 +360,7 @@ public:
bool isObjCArg() const { return kind >= ObjCBeg && kind <= ObjCEnd; }
bool isIntArg() const { return kind >= IntArgBeg && kind <= IntArgEnd; }
bool isUIntArg() const { return kind >= UIntArgBeg && kind <= UIntArgEnd; }
- bool isDoubleArg() const { return kind >= DoubleArgBeg &&
+ bool isDoubleArg() const { return kind >= DoubleArgBeg &&
kind <= DoubleArgBeg; }
unsigned getLength() const {
// Conversion specifiers currently only are represented by
@@ -438,7 +438,7 @@ public:
const OptionalAmount &getPrecision() const {
return Precision;
}
-
+
bool consumesDataArgument() const {
return getConversionSpecifier().consumesDataArgument();
}
@@ -450,7 +450,7 @@ public:
/// more than one type.
ArgTypeResult getArgType(ASTContext &Ctx) const;
- const OptionalFlag &hasThousandsGrouping() const {
+ const OptionalFlag &hasThousandsGrouping() const {
return HasThousandsGrouping;
}
const OptionalFlag &isLeftJustified() const { return IsLeftJustified; }
@@ -467,7 +467,7 @@ public:
void toString(raw_ostream &os) const;
- // Validation methods - to check if any element results in undefined behavior
+ // Validation methods - to check if any element results in undefined behavior
bool hasValidPlusPrefix() const;
bool hasValidAlternativeForm() const;
bool hasValidLeadingZeros() const;
@@ -495,10 +495,10 @@ public:
: ConversionSpecifier(false, pos, k) {}
void setEndScanList(const char *pos) { EndScanList = pos; }
-
+
static bool classof(const analyze_format_string::ConversionSpecifier *CS) {
return !CS->isPrintfKind();
- }
+ }
};
using analyze_format_string::LengthModifier;
@@ -528,7 +528,7 @@ public:
const ScanfConversionSpecifier &getConversionSpecifier() const {
return cast<ScanfConversionSpecifier>(CS);
}
-
+
bool consumesDataArgument() const {
return CS.consumesDataArgument() && !SuppressAssignment;
}
diff --git a/include/clang/Analysis/Analyses/PostOrderCFGView.h b/include/clang/Analysis/Analyses/PostOrderCFGView.h
index 6c7eaf9014..57db398054 100644
--- a/include/clang/Analysis/Analyses/PostOrderCFGView.h
+++ b/include/clang/Analysis/Analyses/PostOrderCFGView.h
@@ -25,15 +25,15 @@
#include "clang/Analysis/CFG.h"
namespace clang {
-
+
class PostOrderCFGView : public ManagedAnalysis {
public:
/// \brief Implements a set of CFGBlocks using a BitVector.
///
/// This class contains a minimal interface, primarily dictated by the SetType
- /// template parameter of the llvm::po_iterator template, as used with external
- /// storage. We also use this set to keep track of which CFGBlocks we visit
- /// during the analysis.
+ /// template parameter of the llvm::po_iterator template, as used with
+ /// external storage. We also use this set to keep track of which CFGBlocks we
+ /// visit during the analysis.
class CFGBlockSet {
llvm::BitVector VisitedBlockIDs;
public:
@@ -47,8 +47,8 @@ public:
/// \brief Set the bit associated with a particular CFGBlock.
/// This is the important method for the SetType template parameter.
bool insert(const CFGBlock *Block) {
- // Note that insert() is called by po_iterator, which doesn't check to make
- // sure that Block is non-null. Moreover, the CFGBlock iterator will
+ // Note that insert() is called by po_iterator, which doesn't check to
+ // make sure that Block is non-null. Moreover, the CFGBlock iterator will
// occasionally hand out null pointers for pruned edges, so we catch those
// here.
if (Block == 0)
@@ -60,30 +60,30 @@ public:
}
/// \brief Check if the bit for a CFGBlock has been already set.
- /// This method is for tracking visited blocks in the main threadsafety loop.
- /// Block must not be null.
+ /// This method is for tracking visited blocks in the main threadsafety
+ /// loop. Block must not be null.
bool alreadySet(const CFGBlock *Block) {
return VisitedBlockIDs.test(Block->getBlockID());
}
};
private:
- typedef llvm::po_iterator<const CFG*, CFGBlockSet, true> po_iterator;
+ typedef llvm::po_iterator<const CFG*, CFGBlockSet, true> po_iterator;
std::vector<const CFGBlock*> Blocks;
-
+
typedef llvm::DenseMap<const CFGBlock *, unsigned> BlockOrderTy;
BlockOrderTy BlockOrder;
-
+
public:
typedef std::vector<const CFGBlock*>::reverse_iterator iterator;
-
+
PostOrderCFGView(const CFG *cfg);
-
+
iterator begin() { return Blocks.rbegin(); }
iterator end() { return Blocks.rend(); }
-
+
bool empty() { return begin() == end(); }
-
+
struct BlockOrderCompare;
friend struct BlockOrderCompare;
@@ -91,9 +91,9 @@ public:
const PostOrderCFGView &POV;
public:
BlockOrderCompare(const PostOrderCFGView &pov) : POV(pov) {}
- bool operator()(const CFGBlock *b1, const CFGBlock *b2) const;
+ bool operator()(const CFGBlock *b1, const CFGBlock *b2) const;
};
-
+
BlockOrderCompare getComparator() const {
return BlockOrderCompare(*this);
}
@@ -103,7 +103,7 @@ public:
static PostOrderCFGView *create(AnalysisDeclContext &analysisContext);
};
-
+
} // end clang namespace
#endif
diff --git a/include/clang/Analysis/Analyses/ThreadSafety.h b/include/clang/Analysis/Analyses/ThreadSafety.h
index b2e71bca73..6988ec06a8 100644
--- a/include/clang/Analysis/Analyses/ThreadSafety.h
+++ b/include/clang/Analysis/Analyses/ThreadSafety.h
@@ -93,7 +93,8 @@ public:
/// 3. or when a mutex is locked but not unlocked inside a function.
/// \param LockName -- A StringRef name for the lock expression, to be printed
/// in the error message.
- /// \param Loc -- The location of the lock expression where the mutex is locked
+ /// \param Loc -- The location of the lock expression where the mutex is
+ /// locked
/// \param LEK -- which of the three above cases we should warn for
virtual void handleMutexHeldEndOfScope(Name LockName, SourceLocation Loc,
LockErrorKind LEK){}
@@ -143,7 +144,8 @@ public:
/// We traverse the blocks in the CFG, compute the set of mutexes that are held
/// at the end of each block, and issue warnings for thread safety violations.
/// Each block in the CFG is traversed exactly once.
-void runThreadSafetyAnalysis(AnalysisDeclContext &AC, ThreadSafetyHandler &Handler);
+void runThreadSafetyAnalysis(AnalysisDeclContext &AC,
+ ThreadSafetyHandler &Handler);
/// \brief Helper function that returns a LockKind required for the given level
/// of access.
diff --git a/include/clang/Analysis/Analyses/UninitializedValues.h b/include/clang/Analysis/Analyses/UninitializedValues.h
index de057eb4bf..4ee66986be 100644
--- a/include/clang/Analysis/Analyses/UninitializedValues.h
+++ b/include/clang/Analysis/Analyses/UninitializedValues.h
@@ -1,4 +1,4 @@
-//= UninitializedValues.h - Finding uses of uninitialized values --*- C++ -*-==//
+//= UninitializedValues.h - Finding uses of uninitialized values -*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
@@ -18,11 +18,11 @@
namespace clang {
class AnalysisDeclContext;
-class CFG;
+class CFG;
class DeclContext;
class Expr;
class VarDecl;
-
+
class UninitVariablesHandler {
public:
UninitVariablesHandler() {}
@@ -32,7 +32,7 @@ public:
virtual void handleUseOfUninitVariable(const Expr *ex,
const VarDecl *vd,
bool isAlwaysUninit) {}
-
+
/// Called when the uninitialized variable analysis detects the
/// idiom 'int x = x'. All other uses of 'x' within the initializer
/// are handled by handleUseOfUninitVariable.