summaryrefslogtreecommitdiffstats
path: root/clang/include/clang/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'clang/include/clang/Analysis')
-rw-r--r--clang/include/clang/Analysis/Analyses/Consumed.h60
-rw-r--r--clang/include/clang/Analysis/Analyses/Dominators.h2
-rw-r--r--clang/include/clang/Analysis/Analyses/FormatString.h2
-rw-r--r--clang/include/clang/Analysis/Analyses/LiveVariables.h34
-rw-r--r--clang/include/clang/Analysis/Analyses/ReachableCode.h2
-rw-r--r--clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h2
-rw-r--r--clang/include/clang/Analysis/AnalysisDeclContext.h12
-rw-r--r--clang/include/clang/Analysis/CloneDetection.h2
-rw-r--r--clang/include/clang/Analysis/DomainSpecific/CocoaConventions.h10
-rw-r--r--clang/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h4
-rw-r--r--clang/include/clang/Analysis/ProgramPoint.h28
-rw-r--r--clang/include/clang/Analysis/Support/BumpVector.h52
12 files changed, 105 insertions, 105 deletions
diff --git a/clang/include/clang/Analysis/Analyses/Consumed.h b/clang/include/clang/Analysis/Analyses/Consumed.h
index 6003d665fd8..5a70989e508 100644
--- a/clang/include/clang/Analysis/Analyses/Consumed.h
+++ b/clang/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/clang/include/clang/Analysis/Analyses/Dominators.h b/clang/include/clang/Analysis/Analyses/Dominators.h
index a9cdc5560bc..021e98dcd88 100644
--- a/clang/include/clang/Analysis/Analyses/Dominators.h
+++ b/clang/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/clang/include/clang/Analysis/Analyses/FormatString.h b/clang/include/clang/Analysis/Analyses/FormatString.h
index 6f8bb9b4095..598d341ac82 100644
--- a/clang/include/clang/Analysis/Analyses/FormatString.h
+++ b/clang/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/clang/include/clang/Analysis/Analyses/LiveVariables.h b/clang/include/clang/Analysis/Analyses/LiveVariables.h
index 21c3ba255c3..0cb500fffb9 100644
--- a/clang/include/clang/Analysis/Analyses/LiveVariables.h
+++ b/clang/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/clang/include/clang/Analysis/Analyses/ReachableCode.h b/clang/include/clang/Analysis/Analyses/ReachableCode.h
index 4c523bfc8b5..d79f1b03df7 100644
--- a/clang/include/clang/Analysis/Analyses/ReachableCode.h
+++ b/clang/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/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h b/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
index 580872e17ef..599c164923c 100644
--- a/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
+++ b/clang/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;
diff --git a/clang/include/clang/Analysis/AnalysisDeclContext.h b/clang/include/clang/Analysis/AnalysisDeclContext.h
index 8c391b5ee1e..19531d92e64 100644
--- a/clang/include/clang/Analysis/AnalysisDeclContext.h
+++ b/clang/include/clang/Analysis/AnalysisDeclContext.h
@@ -111,7 +111,7 @@ public:
AnalysisDeclContextManager *getManager() const {
return Manager;
}
-
+
/// Return the build options used to construct the CFG.
CFG::BuildOptions &getCFGBuildOptions() {
return cfgBuildOptions;
@@ -190,7 +190,7 @@ public:
const Stmt *S,
const CFGBlock *Blk,
unsigned Idx);
-
+
const BlockInvocationContext *
getBlockInvocationContext(const LocationContext *parent,
const BlockDecl *BD,
@@ -359,7 +359,7 @@ class BlockInvocationContext : public LocationContext {
friend class LocationContextManager;
const BlockDecl *BD;
-
+
// FIXME: Come up with a more type-safe way to model context-sensitivity.
const void *ContextData;
@@ -372,7 +372,7 @@ public:
~BlockInvocationContext() override = default;
const BlockDecl *getBlockDecl() const { return BD; }
-
+
const void *getContextData() const { return ContextData; }
void Profile(llvm::FoldingSetNodeID &ID) override;
@@ -403,7 +403,7 @@ public:
const ScopeContext *getScope(AnalysisDeclContext *ctx,
const LocationContext *parent,
const Stmt *s);
-
+
const BlockInvocationContext *
getBlockInvocationContext(AnalysisDeclContext *ctx,
const LocationContext *parent,
@@ -463,7 +463,7 @@ public:
CFG::BuildOptions &getCFGBuildOptions() {
return cfgBuildOptions;
}
-
+
/// Return true if faux bodies should be synthesized for well-known
/// functions.
bool synthesizeBodies() const { return SynthesizeBodies; }
diff --git a/clang/include/clang/Analysis/CloneDetection.h b/clang/include/clang/Analysis/CloneDetection.h
index 955777a11a6..915ec58a514 100644
--- a/clang/include/clang/Analysis/CloneDetection.h
+++ b/clang/include/clang/Analysis/CloneDetection.h
@@ -332,7 +332,7 @@ struct FilenamePatternConstraint {
StringRef IgnoredFilesPattern;
std::shared_ptr<llvm::Regex> IgnoredFilesRegex;
- FilenamePatternConstraint(StringRef IgnoredFilesPattern)
+ FilenamePatternConstraint(StringRef IgnoredFilesPattern)
: IgnoredFilesPattern(IgnoredFilesPattern) {
IgnoredFilesRegex = std::make_shared<llvm::Regex>("^(" +
IgnoredFilesPattern.str() + "$)");
diff --git a/clang/include/clang/Analysis/DomainSpecific/CocoaConventions.h b/clang/include/clang/Analysis/DomainSpecific/CocoaConventions.h
index 8b3fcff52d0..9326d1abbac 100644
--- a/clang/include/clang/Analysis/DomainSpecific/CocoaConventions.h
+++ b/clang/include/clang/Analysis/DomainSpecific/CocoaConventions.h
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements cocoa naming convention analysis.
+// This file implements cocoa naming convention analysis.
//
//===----------------------------------------------------------------------===//
@@ -20,20 +20,20 @@
namespace clang {
class FunctionDecl;
class QualType;
-
+
namespace ento {
namespace cocoa {
-
+
bool isRefType(QualType RetTy, StringRef Prefix,
StringRef Name = StringRef());
-
+
bool isCocoaObjectRef(QualType T);
}
namespace coreFoundation {
bool isCFObjectRef(QualType T);
-
+
bool followsCreateRule(const FunctionDecl *FD);
}
diff --git a/clang/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h b/clang/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h
index f9e800a4a41..e304d83615d 100644
--- a/clang/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h
+++ b/clang/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h
@@ -21,7 +21,7 @@ namespace clang {
class ASTContext;
class ObjCMessageExpr;
-
+
class ObjCNoReturn {
/// Cached "raise" selector.
Selector RaiseSel;
@@ -36,7 +36,7 @@ class ObjCNoReturn {
public:
ObjCNoReturn(ASTContext &C);
-
+
/// Return true if the given message expression is known to never
/// return.
bool isImplicitNoReturn(const ObjCMessageExpr *ME);
diff --git a/clang/include/clang/Analysis/ProgramPoint.h b/clang/include/clang/Analysis/ProgramPoint.h
index e8f0d61617e..25ae93fae6b 100644
--- a/clang/include/clang/Analysis/ProgramPoint.h
+++ b/clang/include/clang/Analysis/ProgramPoint.h
@@ -33,7 +33,7 @@ namespace clang {
class AnalysisDeclContext;
class FunctionDecl;
class LocationContext;
-
+
/// ProgramPoints can be "tagged" as representing points specific to a given
/// analysis entity. Tags are abstract annotations, with an associated
/// description and potentially other information.
@@ -41,12 +41,12 @@ class ProgramPointTag {
public:
ProgramPointTag(void *tagKind = nullptr) : TagKind(tagKind) {}
virtual ~ProgramPointTag();
- virtual StringRef getTagDescription() const = 0;
+ virtual StringRef getTagDescription() const = 0;
protected:
/// Used to implement 'isKind' in subclasses.
const void *getTagKind() { return TagKind; }
-
+
private:
const void *TagKind;
};
@@ -111,7 +111,7 @@ protected:
assert(getLocationContext() == l);
assert(getData1() == P);
}
-
+
ProgramPoint(const void *P1,
const void *P2,
Kind k,
@@ -223,7 +223,7 @@ class BlockEntrance : public ProgramPoint {
public:
BlockEntrance(const CFGBlock *B, const LocationContext *L,
const ProgramPointTag *tag = nullptr)
- : ProgramPoint(B, BlockEntranceKind, L, tag) {
+ : ProgramPoint(B, BlockEntranceKind, L, tag) {
assert(B && "BlockEntrance requires non-null block");
}
@@ -235,7 +235,7 @@ public:
const CFGBlock *B = getBlock();
return B->empty() ? Optional<CFGElement>() : B->front();
}
-
+
private:
friend class ProgramPoint;
BlockEntrance() = default;
@@ -350,7 +350,7 @@ protected:
LocationCheck(const Stmt *S, const LocationContext *L,
ProgramPoint::Kind K, const ProgramPointTag *tag)
: StmtPoint(S, nullptr, K, L, tag) {}
-
+
private:
friend class ProgramPoint;
static bool isKind(const ProgramPoint &location) {
@@ -358,13 +358,13 @@ private:
return k == PreLoadKind || k == PreStoreKind;
}
};
-
+
class PreLoad : public LocationCheck {
public:
PreLoad(const Stmt *S, const LocationContext *L,
const ProgramPointTag *tag = nullptr)
: LocationCheck(S, L, PreLoadKind, tag) {}
-
+
private:
friend class ProgramPoint;
PreLoad() = default;
@@ -378,7 +378,7 @@ public:
PreStore(const Stmt *S, const LocationContext *L,
const ProgramPointTag *tag = nullptr)
: LocationCheck(S, L, PreStoreKind, tag) {}
-
+
private:
friend class ProgramPoint;
PreStore() = default;
@@ -405,7 +405,7 @@ private:
class PostStore : public PostStmt {
public:
/// Construct the post store point.
- /// \param Loc can be used to store the information about the location
+ /// \param Loc can be used to store the information about the location
/// used in the form it was uttered in the code.
PostStore(const Stmt *S, const LocationContext *L, const void *Loc,
const ProgramPointTag *tag = nullptr)
@@ -479,7 +479,7 @@ public:
BlockEdge(const CFGBlock *B1, const CFGBlock *B2, const LocationContext *L)
: ProgramPoint(B1, B2, BlockEdgeKind, L) {
assert(B1 && "BlockEdge: source block must be non-null");
- assert(B2 && "BlockEdge: destination block must be non-null");
+ assert(B2 && "BlockEdge: destination block must be non-null");
}
const CFGBlock *getSrc() const {
@@ -603,7 +603,7 @@ private:
/// CallEnter uses the caller's location context.
class CallEnter : public ProgramPoint {
public:
- CallEnter(const Stmt *stmt, const StackFrameContext *calleeCtx,
+ CallEnter(const Stmt *stmt, const StackFrameContext *calleeCtx,
const LocationContext *callerCtx)
: ProgramPoint(stmt, calleeCtx, CallEnterKind, callerCtx, nullptr) {}
@@ -749,7 +749,7 @@ static bool isEqual(const clang::ProgramPoint &L,
}
};
-
+
template <>
struct isPodLike<clang::ProgramPoint> { static const bool value = true; };
diff --git a/clang/include/clang/Analysis/Support/BumpVector.h b/clang/include/clang/Analysis/Support/BumpVector.h
index 5940520855e..00a7417e20f 100644
--- a/clang/include/clang/Analysis/Support/BumpVector.h
+++ b/clang/include/clang/Analysis/Support/BumpVector.h
@@ -29,7 +29,7 @@
#include <type_traits>
namespace clang {
-
+
class BumpVectorContext {
llvm::PointerIntPair<llvm::BumpPtrAllocator*, 1> Alloc;
@@ -47,15 +47,15 @@ public:
/// BumpPtrAllocator. This BumpPtrAllocator is not destroyed when the
/// BumpVectorContext object is destroyed.
BumpVectorContext(llvm::BumpPtrAllocator &A) : Alloc(&A, 0) {}
-
+
~BumpVectorContext() {
if (Alloc.getInt())
delete Alloc.getPointer();
}
-
+
llvm::BumpPtrAllocator &getAllocator() { return *Alloc.getPointer(); }
};
-
+
template<typename T>
class BumpVector {
T *Begin = nullptr;
@@ -67,34 +67,34 @@ public:
explicit BumpVector(BumpVectorContext &C, unsigned N) {
reserve(C, N);
}
-
+
~BumpVector() {
if (std::is_class<T>::value) {
// Destroy the constructed elements in the vector.
destroy_range(Begin, End);
}
}
-
+
using size_type = size_t;
using difference_type = ptrdiff_t;
using value_type = T;
using iterator = T *;
using const_iterator = const T *;
-
+
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
using reverse_iterator = std::reverse_iterator<iterator>;
-
+
using reference = T &;
using const_reference = const T &;
using pointer = T *;
using const_pointer = const T *;
-
+
// forward iterator creation methods.
iterator begin() { return Begin; }
const_iterator begin() const { return Begin; }
iterator end() { return End; }
const_iterator end() const { return End; }
-
+
// reverse iterator creation methods.
reverse_iterator rbegin() { return reverse_iterator(end()); }
const_reverse_iterator rbegin() const{ return const_reverse_iterator(end()); }
@@ -102,7 +102,7 @@ public:
const_reverse_iterator rend() const {
return const_reverse_iterator(begin());
}
-
+
bool empty() const { return Begin == End; }
size_type size() const { return End-Begin; }
@@ -114,49 +114,49 @@ public:
assert(Begin + idx < End);
return Begin[idx];
}
-
+
reference front() {
return begin()[0];
}
const_reference front() const {
return begin()[0];
}
-
+
reference back() {
return end()[-1];
}
const_reference back() const {
return end()[-1];
}
-
+
void pop_back() {
--End;
End->~T();
}
-
+
T pop_back_val() {
T Result = back();
pop_back();
return Result;
}
-
+
void clear() {
if (std::is_class<T>::value) {
destroy_range(Begin, End);
}
End = Begin;
}
-
+
/// data - Return a pointer to the vector's buffer, even if empty().
pointer data() {
return pointer(Begin);
}
-
+
/// data - Return a pointer to the vector's buffer, even if empty().
const_pointer data() const {
return const_pointer(Begin);
}
-
+
void push_back(const_reference Elt, BumpVectorContext &C) {
if (End < Capacity) {
Retry:
@@ -165,7 +165,7 @@ public:
return;
}
grow(C);
- goto Retry;
+ goto Retry;
}
/// insert - Insert some number of copies of element into a position. Return
@@ -193,18 +193,18 @@ public:
/// capacity - Return the total number of elements in the currently allocated
/// buffer.
- size_t capacity() const { return Capacity - Begin; }
-
+ size_t capacity() const { return Capacity - Begin; }
+
private:
/// grow - double the size of the allocated memory, guaranteeing space for at
/// least one more element or MinSize if specified.
void grow(BumpVectorContext &C, size_type MinSize = 1);
-
+
void construct_range(T *S, T *E, const T &Elt) {
for (; S != E; ++S)
new (S) T(Elt);
}
-
+
void destroy_range(T *S, T *E) {
while (S != E) {
--E;
@@ -220,7 +220,7 @@ private:
}
}
};
-
+
// Define this out-of-line to dissuade the C++ compiler from inlining it.
template <typename T>
void BumpVector<T>::grow(BumpVectorContext &C, size_t MinSize) {
@@ -232,7 +232,7 @@ void BumpVector<T>::grow(BumpVectorContext &C, size_t MinSize) {
// Allocate the memory from the BumpPtrAllocator.
T *NewElts = C.getAllocator().template Allocate<T>(NewCapacity);
-
+
// Copy the elements over.
if (Begin != End) {
if (std::is_class<T>::value) {
OpenPOWER on IntegriCloud