mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
Fix Clang-tidy modernize-use-nullptr and modernize-use-override warnings; other minor fixes.
Differential revision: reviews.llvm.org/D16568 llvm-svn: 258831
This commit is contained in:
parent
90ba1bcb73
commit
966902f532
@ -16,7 +16,6 @@
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
/// ArrayRef - Represent a constant reference to an array (0 or more elements
|
||||
/// consecutively in memory), i.e. a start pointer and a length. It allows
|
||||
/// various APIs to take consecutive elements easily and conveniently.
|
||||
@ -92,19 +91,20 @@ namespace llvm {
|
||||
/// Construct an ArrayRef<const T*> from ArrayRef<T*>. This uses SFINAE to
|
||||
/// ensure that only ArrayRefs of pointers can be converted.
|
||||
template <typename U>
|
||||
ArrayRef(const ArrayRef<U *> &A,
|
||||
ArrayRef(
|
||||
const ArrayRef<U *> &A,
|
||||
typename std::enable_if<
|
||||
std::is_convertible<U *const *, T const *>::value>::type* = 0)
|
||||
std::is_convertible<U *const *, T const *>::value>::type * = nullptr)
|
||||
: Data(A.data()), Length(A.size()) {}
|
||||
|
||||
/// Construct an ArrayRef<const T*> from a SmallVector<T*>. This is
|
||||
/// templated in order to avoid instantiating SmallVectorTemplateCommon<T>
|
||||
/// whenever we copy-construct an ArrayRef.
|
||||
template<typename U, typename DummyT>
|
||||
/*implicit*/ ArrayRef(const SmallVectorTemplateCommon<U*, DummyT> &Vec,
|
||||
/*implicit*/ ArrayRef(
|
||||
const SmallVectorTemplateCommon<U *, DummyT> &Vec,
|
||||
typename std::enable_if<
|
||||
std::is_convertible<U *const *,
|
||||
T const *>::value>::type* = 0)
|
||||
std::is_convertible<U *const *, T const *>::value>::type * = nullptr)
|
||||
: Data(Vec.data()), Length(Vec.size()) {
|
||||
}
|
||||
|
||||
@ -379,6 +379,6 @@ namespace llvm {
|
||||
template <typename T> hash_code hash_value(ArrayRef<T> S) {
|
||||
return hash_combine_range(S.begin(), S.end());
|
||||
}
|
||||
}
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_ADT_ARRAYREF_H
|
||||
|
@ -66,7 +66,6 @@ namespace llvm {
|
||||
|
||||
bool isPoisoned() const { return (reinterpret_cast<intptr_t>(mi) & 0x1) == 0x1; }
|
||||
#endif // EXPENSIVE_CHECKS
|
||||
|
||||
};
|
||||
|
||||
template <>
|
||||
@ -308,7 +307,6 @@ namespace llvm {
|
||||
SlotIndex getPrevIndex() const {
|
||||
return SlotIndex(&*--listEntry()->getIterator(), getSlot());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <> struct isPodLike<SlotIndex> { static const bool value = true; };
|
||||
@ -382,7 +380,7 @@ namespace llvm {
|
||||
initializeSlotIndexesPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
~SlotIndexes() {
|
||||
~SlotIndexes() override {
|
||||
// The indexList's nodes are all allocated in the BumpPtrAllocator.
|
||||
indexList.clearAndLeakNodesUnsafely();
|
||||
}
|
||||
@ -709,15 +707,13 @@ namespace llvm {
|
||||
indexList.erase(entry);
|
||||
#endif
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Specialize IntervalMapInfo for half-open slot index intervals.
|
||||
template <>
|
||||
struct IntervalMapInfo<SlotIndex> : IntervalMapHalfOpenInfo<SlotIndex> {
|
||||
};
|
||||
|
||||
}
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_CODEGEN_SLOTINDEXES_H
|
||||
|
@ -56,13 +56,14 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
virtual TypeIndex writeRecord(llvm::StringRef Data) override;
|
||||
TypeIndex writeRecord(llvm::StringRef Data) override;
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<Record>> Records;
|
||||
std::unordered_map<llvm::StringRef, TypeIndex, RecordHash> HashedRecords;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace codeview
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_MEMORYTYPETABLEBUILDER_H
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
~RCMemoryManager() {
|
||||
~RCMemoryManager() override {
|
||||
Client.destroyRemoteAllocator(Id);
|
||||
DEBUG(dbgs() << "Destroyed remote allocator " << Id << "\n");
|
||||
}
|
||||
@ -355,7 +355,9 @@ public:
|
||||
ResourceIdMgr::ResourceId Id)
|
||||
: Remote(Remote), Id(Id) {}
|
||||
|
||||
~RCIndirectStubsManager() { Remote.destroyIndirectStubsManager(Id); }
|
||||
~RCIndirectStubsManager() override {
|
||||
Remote.destroyIndirectStubsManager(Id);
|
||||
}
|
||||
|
||||
std::error_code createStub(StringRef StubName, TargetAddress StubAddr,
|
||||
JITSymbolFlags StubFlags) override {
|
||||
@ -479,7 +481,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void grow() {
|
||||
void grow() override {
|
||||
TargetAddress BlockAddr = 0;
|
||||
uint32_t NumTrampolines = 0;
|
||||
auto EC = Remote.emitTrampolineBlock(BlockAddr, NumTrampolines);
|
||||
@ -797,4 +799,4 @@ private:
|
||||
|
||||
#undef DEBUG_TYPE
|
||||
|
||||
#endif
|
||||
#endif // LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETCLIENT_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//=-- InstrProf.h - Instrumented profiling format support ---------*- C++ -*-=//
|
||||
//===-- InstrProf.h - Instrumented profiling format support -----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -13,8 +13,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_PROFILEDATA_INSTRPROF_H_
|
||||
#define LLVM_PROFILEDATA_INSTRPROF_H_
|
||||
#ifndef LLVM_PROFILEDATA_INSTRPROF_H
|
||||
#define LLVM_PROFILEDATA_INSTRPROF_H
|
||||
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
@ -413,10 +413,10 @@ struct InstrProfRecord {
|
||||
/// Return the array of profiled values at \p Site.
|
||||
inline std::unique_ptr<InstrProfValueData[]>
|
||||
getValueForSite(uint32_t ValueKind, uint32_t Site,
|
||||
uint64_t (*ValueMapper)(uint32_t, uint64_t) = 0) const;
|
||||
uint64_t (*ValueMapper)(uint32_t, uint64_t) = nullptr) const;
|
||||
inline void
|
||||
getValueForSite(InstrProfValueData Dest[], uint32_t ValueKind, uint32_t Site,
|
||||
uint64_t (*ValueMapper)(uint32_t, uint64_t) = 0) const;
|
||||
uint64_t (*ValueMapper)(uint32_t, uint64_t) = nullptr) const;
|
||||
/// Reserve space for NumValueSites sites.
|
||||
inline void reserveSites(uint32_t ValueKind, uint32_t NumValueSites);
|
||||
/// Add ValueData for ValueKind at value Site.
|
||||
@ -746,4 +746,4 @@ template <>
|
||||
struct is_error_code_enum<llvm::instrprof_error> : std::true_type {};
|
||||
}
|
||||
|
||||
#endif // LLVM_PROFILEDATA_INSTRPROF_H_
|
||||
#endif // LLVM_PROFILEDATA_INSTRPROF_H
|
||||
|
@ -554,18 +554,18 @@ int initializeValueProfRuntimeRecord(ValueProfRuntimeRecord *RuntimeRecord,
|
||||
for (I = 0; I <= IPVK_Last; I++) {
|
||||
uint16_t N = NumValueSites[I];
|
||||
if (!N) {
|
||||
RuntimeRecord->SiteCountArray[I] = 0;
|
||||
RuntimeRecord->SiteCountArray[I] = nullptr;
|
||||
continue;
|
||||
}
|
||||
NumValueKinds++;
|
||||
RuntimeRecord->SiteCountArray[I] = (uint8_t *)calloc(N, 1);
|
||||
if (!RuntimeRecord->SiteCountArray[I])
|
||||
return 1;
|
||||
RuntimeRecord->NodesKind[I] = Nodes ? &Nodes[S] : NULL;
|
||||
RuntimeRecord->NodesKind[I] = Nodes ? &Nodes[S] : nullptr;
|
||||
for (J = 0; J < N; J++) {
|
||||
/* Compute value count for each site. */
|
||||
uint32_t C = 0;
|
||||
ValueProfNode *Site = Nodes ? RuntimeRecord->NodesKind[I][J] : NULL;
|
||||
ValueProfNode *Site = Nodes ? RuntimeRecord->NodesKind[I][J] : nullptr;
|
||||
while (Site) {
|
||||
C++;
|
||||
Site = Site->Next;
|
||||
@ -606,7 +606,7 @@ uint32_t getNumValueDataForSiteRT(const void *R, uint32_t VK, uint32_t S) {
|
||||
uint32_t getNumValueDataRT(const void *R, uint32_t VK) {
|
||||
unsigned I, S = 0;
|
||||
const ValueProfRuntimeRecord *Record = (const ValueProfRuntimeRecord *)R;
|
||||
if (Record->SiteCountArray[VK] == 0)
|
||||
if (Record->SiteCountArray[VK] == nullptr)
|
||||
return 0;
|
||||
for (I = 0; I < Record->NumValueSites[VK]; I++)
|
||||
S += Record->SiteCountArray[VK][I];
|
||||
@ -631,12 +631,12 @@ ValueProfData *allocValueProfDataRT(size_t TotalSizeInBytes) {
|
||||
return (ValueProfData *)calloc(TotalSizeInBytes, 1);
|
||||
}
|
||||
|
||||
static ValueProfRecordClosure RTRecordClosure = {0,
|
||||
static ValueProfRecordClosure RTRecordClosure = {nullptr,
|
||||
getNumValueKindsRT,
|
||||
getNumValueSitesRT,
|
||||
getNumValueDataRT,
|
||||
getNumValueDataForSiteRT,
|
||||
0,
|
||||
nullptr,
|
||||
getValueForSiteRT,
|
||||
allocValueProfDataRT};
|
||||
|
||||
@ -663,17 +663,15 @@ serializeValueProfDataFromRT(const ValueProfRuntimeRecord *Record,
|
||||
return serializeValueProfDataFrom(&RTRecordClosure, DstData);
|
||||
}
|
||||
|
||||
|
||||
#undef INSTR_PROF_COMMON_API_IMPL
|
||||
#endif /* INSTR_PROF_COMMON_API_IMPL */
|
||||
|
||||
/*============================================================================*/
|
||||
|
||||
|
||||
#ifndef INSTR_PROF_DATA_DEFINED
|
||||
|
||||
#ifndef INSTR_PROF_DATA_INC_
|
||||
#define INSTR_PROF_DATA_INC_
|
||||
#ifndef INSTR_PROF_DATA_INC
|
||||
#define INSTR_PROF_DATA_INC
|
||||
|
||||
/* Helper macros. */
|
||||
#define INSTR_PROF_SIMPLE_QUOTE(x) #x
|
||||
@ -760,7 +758,7 @@ typedef struct ValueProfNode {
|
||||
struct ValueProfNode *Next;
|
||||
} ValueProfNode;
|
||||
|
||||
#endif /* INSTR_PROF_DATA_INC_ */
|
||||
#endif /* INSTR_PROF_DATA_INC */
|
||||
|
||||
#else
|
||||
#undef INSTR_PROF_DATA_DEFINED
|
||||
|
@ -38,7 +38,7 @@ struct AlignmentCalcImpl {
|
||||
#endif
|
||||
T t;
|
||||
private:
|
||||
AlignmentCalcImpl() {} // Never instantiate.
|
||||
AlignmentCalcImpl() = delete;
|
||||
};
|
||||
|
||||
// Abstract base class helper, this will have the minimal alignment and size
|
||||
@ -55,7 +55,7 @@ struct AlignmentCalcImplBase {
|
||||
// of type T.
|
||||
template <typename T>
|
||||
struct AlignmentCalcImpl<T, true> : AlignmentCalcImplBase, T {
|
||||
virtual ~AlignmentCalcImpl() = 0;
|
||||
~AlignmentCalcImpl() override = 0;
|
||||
};
|
||||
|
||||
} // End detail namespace.
|
||||
@ -223,7 +223,7 @@ template <typename T1,
|
||||
class AlignerImpl {
|
||||
T1 t1; T2 t2; T3 t3; T4 t4; T5 t5; T6 t6; T7 t7; T8 t8; T9 t9; T10 t10;
|
||||
|
||||
AlignerImpl(); // Never defined or instantiated.
|
||||
AlignerImpl() = delete;
|
||||
};
|
||||
|
||||
template <typename T1,
|
||||
@ -255,4 +255,5 @@ struct AlignedCharArrayUnion : llvm::AlignedCharArray<
|
||||
T6, T7, T8, T9, T10>)> {
|
||||
};
|
||||
} // end namespace llvm
|
||||
#endif
|
||||
|
||||
#endif // LLVM_SUPPORT_ALIGNOF_H
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
ErrorOr(E ErrorCode,
|
||||
typename std::enable_if<std::is_error_code_enum<E>::value ||
|
||||
std::is_error_condition_enum<E>::value,
|
||||
void *>::type = 0)
|
||||
void *>::type = nullptr)
|
||||
: HasError(true) {
|
||||
new (getErrorStorage()) std::error_code(make_error_code(ErrorCode));
|
||||
}
|
||||
@ -278,7 +278,6 @@ private:
|
||||
return const_cast<ErrorOr<T> *>(this)->getErrorStorage();
|
||||
}
|
||||
|
||||
|
||||
union {
|
||||
AlignedCharArrayUnion<storage_type> TStorage;
|
||||
AlignedCharArrayUnion<std::error_code> ErrorStorage;
|
||||
@ -295,4 +294,4 @@ operator==(const ErrorOr<T> &Err, E Code) {
|
||||
}
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_SUPPORT_ERROROR_H
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <deque>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
@ -497,7 +498,7 @@ private:
|
||||
std::error_code initStreamFromBuffer();
|
||||
std::error_code initLazyStream(std::unique_ptr<DataStreamer> Streamer);
|
||||
};
|
||||
} // namespace
|
||||
} // end anonymous namespace
|
||||
|
||||
BitcodeDiagnosticInfo::BitcodeDiagnosticInfo(std::error_code EC,
|
||||
DiagnosticSeverity Severity,
|
||||
@ -872,7 +873,7 @@ public:
|
||||
/// Provide fast operand accessors
|
||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
// FIXME: can we inherit this from ConstantExpr?
|
||||
template <>
|
||||
@ -880,7 +881,7 @@ struct OperandTraits<ConstantPlaceHolder> :
|
||||
public FixedNumOperandTraits<ConstantPlaceHolder, 1> {
|
||||
};
|
||||
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantPlaceHolder, Value)
|
||||
}
|
||||
} // end namespace llvm
|
||||
|
||||
void BitcodeReaderValueList::assignValue(Value *V, unsigned Idx) {
|
||||
if (Idx == size()) {
|
||||
@ -908,11 +909,8 @@ void BitcodeReaderValueList::assignValue(Value *V, unsigned Idx) {
|
||||
OldV->replaceAllUsesWith(V);
|
||||
delete PrevVal;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Constant *BitcodeReaderValueList::getConstantFwdRef(unsigned Idx,
|
||||
Type *Ty) {
|
||||
if (Idx >= size())
|
||||
@ -1129,7 +1127,6 @@ StructType *BitcodeReader::createIdentifiedStructType(LLVMContext &Context) {
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Functions for parsing blocks from the bitcode file
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -2178,7 +2175,7 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
|
||||
getMDOrNull(Record[9]), getMDOrNull(Record[10]),
|
||||
getMDOrNull(Record[11]), getMDOrNull(Record[12]),
|
||||
getMDOrNull(Record[13]),
|
||||
Record.size() <= 15 ? 0 : getMDOrNull(Record[15]),
|
||||
Record.size() <= 15 ? nullptr : getMDOrNull(Record[15]),
|
||||
Record.size() <= 14 ? 0 : Record[14]),
|
||||
NextMetadataNo++);
|
||||
break;
|
||||
@ -2701,7 +2698,6 @@ std::error_code BitcodeReader::parseConstants() {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case bitc::CST_CODE_CE_BINOP: { // CE_BINOP: [opcode, opval, opval]
|
||||
if (Record.size() < 3)
|
||||
return error("Invalid record");
|
||||
@ -3375,7 +3371,6 @@ std::error_code BitcodeReader::parseModule(uint64_t ResumeBit,
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Read a record.
|
||||
auto BitCode = Stream.readRecord(Entry.ID, Record);
|
||||
switch (BitCode) {
|
||||
@ -5816,7 +5811,7 @@ class BitcodeErrorCategoryType : public std::error_category {
|
||||
llvm_unreachable("Unknown error type!");
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
static ManagedStatic<BitcodeErrorCategoryType> ErrorCategory;
|
||||
|
||||
|
@ -65,7 +65,7 @@ class InstrProfErrorCategoryType : public std::error_category {
|
||||
llvm_unreachable("A value of instrprof_error has no message.");
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
static ManagedStatic<InstrProfErrorCategoryType> ErrorCategory;
|
||||
|
||||
@ -443,12 +443,12 @@ ValueProfData *allocValueProfDataInstrProf(size_t TotalSizeInBytes) {
|
||||
}
|
||||
|
||||
static ValueProfRecordClosure InstrProfRecordClosure = {
|
||||
0,
|
||||
nullptr,
|
||||
getNumValueKindsInstrProf,
|
||||
getNumValueSitesInstrProf,
|
||||
getNumValueDataInstrProf,
|
||||
getNumValueDataForSiteInstrProf,
|
||||
0,
|
||||
nullptr,
|
||||
getValueForSiteInstrProf,
|
||||
allocValueProfDataInstrProf};
|
||||
|
||||
@ -638,7 +638,6 @@ void ProfileSummary::computeDetailedSummary() {
|
||||
ProfileSummaryEntry PSE = {Cutoff, Count, BlocksSeen};
|
||||
DetailedSummary.push_back(PSE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
} // end namespace llvm
|
||||
|
@ -73,7 +73,7 @@ int getPosixProtectionFlags(unsigned Flags) {
|
||||
return PROT_NONE;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // anonymous namespace
|
||||
|
||||
namespace llvm {
|
||||
namespace sys {
|
||||
@ -265,7 +265,7 @@ bool Memory::setWritable (MemoryBlock &M, std::string *ErrMsg) {
|
||||
}
|
||||
|
||||
bool Memory::setExecutable (MemoryBlock &M, std::string *ErrMsg) {
|
||||
if (M.Address == 0 || M.Size == 0) return false;
|
||||
if (M.Address == nullptr || M.Size == 0) return false;
|
||||
Memory::InvalidateInstructionCache(M.Address, M.Size);
|
||||
#if defined(__APPLE__) && (defined(__arm__) || defined(__arm64__))
|
||||
kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)M.Address,
|
||||
|
@ -556,7 +556,7 @@ namespace llvm {
|
||||
// have memop! In fact, starting from ATOMADD64_DAG all opcodes will be
|
||||
// thought as target memory ops!
|
||||
};
|
||||
}
|
||||
} // end namespace X86ISD
|
||||
|
||||
/// Define some predicates that are used for node matching.
|
||||
namespace X86 {
|
||||
@ -608,13 +608,12 @@ namespace llvm {
|
||||
bool isOffsetSuitableForCodeModel(int64_t Offset, CodeModel::Model M,
|
||||
bool hasSymbolicDisplacement = true);
|
||||
|
||||
|
||||
/// Determines whether the callee is required to pop its
|
||||
/// own arguments. Callee pop is necessary to support tail calls.
|
||||
bool isCalleePop(CallingConv::ID CallingConv,
|
||||
bool is64Bit, bool IsVarArg, bool GuaranteeTCO);
|
||||
|
||||
}
|
||||
} // end namespace X86
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// X86 Implementation of the TargetLowering interface
|
||||
@ -685,7 +684,7 @@ namespace llvm {
|
||||
/// and types must exactly match those of the original return values of
|
||||
/// the node), or leaves Results empty, which indicates that the node is not
|
||||
/// to be custom lowered after all.
|
||||
virtual void LowerOperationWrapper(SDNode *N,
|
||||
void LowerOperationWrapper(SDNode *N,
|
||||
SmallVectorImpl<SDValue> &Results,
|
||||
SelectionDAG &DAG) const override;
|
||||
|
||||
@ -695,7 +694,6 @@ namespace llvm {
|
||||
void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results,
|
||||
SelectionDAG &DAG) const override;
|
||||
|
||||
|
||||
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
|
||||
|
||||
/// Return true if the target has native support for
|
||||
@ -1180,7 +1178,7 @@ namespace llvm {
|
||||
namespace X86 {
|
||||
FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
|
||||
const TargetLibraryInfo *libInfo);
|
||||
}
|
||||
}
|
||||
} // end namespace X86
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // X86ISELLOWERING_H
|
||||
#endif // LLVM_LIB_TARGET_X86_X86ISELLOWERING_H
|
||||
|
@ -257,7 +257,7 @@ public:
|
||||
|
||||
if (CreateGlobalVar)
|
||||
FuncNameVar = createPGOFuncNameVar(F, FuncName);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// Compute Hash value for the CFG: the lower 32 bits are CRC32 of the index
|
||||
@ -690,7 +690,7 @@ void PGOUseFunc::setBranchWeights() {
|
||||
const PGOUseEdge *E = BBCountInfo.OutEdges[s];
|
||||
const BasicBlock *SrcBB = E->SrcBB;
|
||||
const BasicBlock *DestBB = E->DestBB;
|
||||
if (DestBB == 0)
|
||||
if (DestBB == nullptr)
|
||||
continue;
|
||||
unsigned SuccNum = GetSuccessorNumber(SrcBB, DestBB);
|
||||
uint64_t EdgeCount = E->CountValue;
|
||||
|
@ -80,7 +80,7 @@ struct AddDiscriminators : public FunctionPass {
|
||||
|
||||
bool runOnFunction(Function &F) override;
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
char AddDiscriminators::ID = 0;
|
||||
INITIALIZE_PASS_BEGIN(AddDiscriminators, "add-discriminators",
|
||||
@ -217,7 +217,7 @@ bool AddDiscriminators::runOnFunction(Function &F) {
|
||||
// Sample base profile needs to distinguish different function calls within
|
||||
// a same source line for correct profile annotation.
|
||||
for (BasicBlock &B : F) {
|
||||
const DILocation *FirstDIL = NULL;
|
||||
const DILocation *FirstDIL = nullptr;
|
||||
for (auto &I : B.getInstList()) {
|
||||
CallInst *Current = dyn_cast<CallInst>(&I);
|
||||
if (!Current || isa<DbgInfoIntrinsic>(&I))
|
||||
|
@ -27,7 +27,7 @@ SanitizerStatReport::SanitizerStatReport(Module *M) : M(M) {
|
||||
EmptyModuleStatsTy = makeModuleStatsTy();
|
||||
|
||||
ModuleStatsGV = new GlobalVariable(*M, EmptyModuleStatsTy, false,
|
||||
GlobalValue::InternalLinkage, 0);
|
||||
GlobalValue::InternalLinkage, nullptr);
|
||||
}
|
||||
|
||||
ArrayType *SanitizerStatReport::makeModuleStatsArrayTy() {
|
||||
|
@ -51,12 +51,12 @@ const char *ReadModule(char SizeofPtr, const char *Begin, const char *End) {
|
||||
while (Begin != End && *Begin)
|
||||
++Begin;
|
||||
if (Begin == End)
|
||||
return 0;
|
||||
return nullptr;
|
||||
StringRef Filename(FilenameBegin, Begin - FilenameBegin);
|
||||
|
||||
++Begin;
|
||||
if (Begin == End)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
symbolize::LLVMSymbolizer::Options SymbolizerOptions;
|
||||
SymbolizerOptions.Demangle = ClDemangle;
|
||||
@ -70,11 +70,11 @@ const char *ReadModule(char SizeofPtr, const char *Begin, const char *End) {
|
||||
Begin += SizeofPtr;
|
||||
|
||||
if (Begin > End)
|
||||
return 0;
|
||||
return nullptr;
|
||||
if (Addr == 0 && Data == 0)
|
||||
return Begin;
|
||||
if (Begin == End)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
ErrorOr<DILineInfo> LineInfo = Symbolizer.symbolizeCode(Filename, Addr);
|
||||
if (LineInfo) {
|
||||
@ -129,7 +129,7 @@ int main(int argc, char **argv) {
|
||||
char SizeofPtr = *Begin++;
|
||||
while (Begin != End) {
|
||||
Begin = ReadModule(SizeofPtr, Begin, End);
|
||||
if (Begin == 0) {
|
||||
if (Begin == nullptr) {
|
||||
errs() << argv[0] << ": " << ClInputFile << ": short read\n";
|
||||
return 1;
|
||||
}
|
||||
|
@ -37,14 +37,13 @@ public:
|
||||
return SectionMemoryManager::needsToReserveAllocationSpace();
|
||||
}
|
||||
|
||||
bool finalizeMemory(std::string *ErrMsg = 0) override {
|
||||
bool finalizeMemory(std::string *ErrMsg = nullptr) override {
|
||||
++FinalizationCount;
|
||||
return SectionMemoryManager::finalizeMemory(ErrMsg);
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ObjectLinkingLayerTest, TestSetProcessAllSections) {
|
||||
|
||||
class SectionMemoryManagerWrapper : public SectionMemoryManager {
|
||||
public:
|
||||
SectionMemoryManagerWrapper(bool &DebugSeen) : DebugSeen(DebugSeen) {}
|
||||
@ -113,9 +112,7 @@ TEST(ObjectLinkingLayerTest, TestSetProcessAllSections) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
|
||||
|
||||
if (!TM)
|
||||
return;
|
||||
|
||||
@ -187,7 +184,6 @@ TEST_F(ObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
|
||||
}
|
||||
|
||||
TEST_F(ObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
|
||||
|
||||
if (!TM)
|
||||
return;
|
||||
|
||||
@ -250,4 +246,4 @@ TEST_F(ObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
|
||||
"(multiple unrelated objects loaded prior to finalization)";
|
||||
}
|
||||
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- llvm/unittest/IR/VerifierTest.cpp - Verifier unit tests ------------===//
|
||||
//===- llvm/unittest/IR/VerifierTest.cpp - Verifier unit tests --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -126,7 +126,8 @@ TEST(VerifierTest, CrossModuleMetadataRef) {
|
||||
Module M2("M2", C);
|
||||
GlobalVariable *newGV =
|
||||
new GlobalVariable(M1, Type::getInt8Ty(C), false,
|
||||
GlobalVariable::ExternalLinkage, NULL, "Some Global");
|
||||
GlobalVariable::ExternalLinkage, nullptr,
|
||||
"Some Global");
|
||||
|
||||
DIBuilder dbuilder(M2);
|
||||
auto CU = dbuilder.createCompileUnit(dwarf::DW_LANG_Julia, "test.jl", ".",
|
||||
@ -143,5 +144,5 @@ TEST(VerifierTest, CrossModuleMetadataRef) {
|
||||
EXPECT_TRUE(StringRef(ErrorOS.str())
|
||||
.startswith("Referencing global in another module!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end anonymous namespace
|
||||
} // end namespace llvm
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "llvm/ProfileData/InstrProfWriter.h"
|
||||
#include "llvm/Support/Compression.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <cstdarg>
|
||||
|
||||
using namespace llvm;
|
||||
@ -490,22 +489,24 @@ ValueProfNode Site1Values[5] = {{{uint64_t("callee1"), 400}, &Site1Values[1]},
|
||||
{{uint64_t("callee2"), 1000}, &Site1Values[2]},
|
||||
{{uint64_t("callee3"), 500}, &Site1Values[3]},
|
||||
{{uint64_t("callee4"), 300}, &Site1Values[4]},
|
||||
{{uint64_t("callee5"), 100}, 0}};
|
||||
{{uint64_t("callee5"), 100}, nullptr}};
|
||||
|
||||
ValueProfNode Site2Values[4] = {{{uint64_t("callee5"), 800}, &Site2Values[1]},
|
||||
{{uint64_t("callee3"), 1000}, &Site2Values[2]},
|
||||
{{uint64_t("callee2"), 2500}, &Site2Values[3]},
|
||||
{{uint64_t("callee1"), 1300}, 0}};
|
||||
{{uint64_t("callee1"), 1300}, nullptr}};
|
||||
|
||||
ValueProfNode Site3Values[3] = {{{uint64_t("callee6"), 800}, &Site3Values[1]},
|
||||
{{uint64_t("callee3"), 1000}, &Site3Values[2]},
|
||||
{{uint64_t("callee4"), 5500}, 0}};
|
||||
{{uint64_t("callee4"), 5500}, nullptr}};
|
||||
|
||||
ValueProfNode Site4Values[2] = {{{uint64_t("callee2"), 1800}, &Site4Values[1]},
|
||||
{{uint64_t("callee3"), 2000}, 0}};
|
||||
{{uint64_t("callee3"), 2000}, nullptr}};
|
||||
|
||||
static ValueProfNode *ValueProfNodes[5] = {&Site1Values[0], &Site2Values[0],
|
||||
&Site3Values[0], &Site4Values[0], 0};
|
||||
&Site3Values[0], &Site4Values[0],
|
||||
nullptr};
|
||||
|
||||
static uint16_t NumValueSites[IPVK_Last + 1] = {5};
|
||||
TEST_F(InstrProfTest, runtime_value_prof_data_read_write) {
|
||||
ValueProfRuntimeRecord RTRecord;
|
||||
@ -516,7 +517,7 @@ TEST_F(InstrProfTest, runtime_value_prof_data_read_write) {
|
||||
|
||||
InstrProfRecord Record("caller", 0x1234, {1ULL << 31, 2});
|
||||
|
||||
VPData->deserializeTo(Record, 0);
|
||||
VPData->deserializeTo(Record, nullptr);
|
||||
|
||||
// Now read data from Record and sanity check the data
|
||||
ASSERT_EQ(5U, Record.getNumValueSites(IPVK_IndirectCallTarget));
|
||||
@ -687,7 +688,7 @@ TEST_F(InstrProfTest, instr_prof_symtab_module_test) {
|
||||
|
||||
for (unsigned I = 0; I < sizeof(Funcs) / sizeof(*Funcs); I++) {
|
||||
Function *F = M->getFunction(Funcs[I]);
|
||||
ASSERT_TRUE(F != NULL);
|
||||
ASSERT_TRUE(F != nullptr);
|
||||
std::string PGOName = getPGOFuncName(*F);
|
||||
uint64_t Key = IndexedInstrProf::ComputeHash(PGOName);
|
||||
ASSERT_EQ(StringRef(PGOName),
|
||||
|
@ -1,4 +1,4 @@
|
||||
//=== - llvm/unittest/Support/AlignOfTest.cpp - Alignment utility tests ----===//
|
||||
//=== - llvm/unittest/Support/AlignOfTest.cpp - Alignment utility tests ---===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -90,14 +90,14 @@ V7::~V7() {}
|
||||
V8::~V8() {}
|
||||
|
||||
struct Abstract1 {
|
||||
virtual ~Abstract1() {}
|
||||
virtual ~Abstract1() = default;
|
||||
virtual void method() = 0;
|
||||
|
||||
char c;
|
||||
};
|
||||
|
||||
struct Abstract2 : Abstract1 {
|
||||
virtual ~Abstract2() {}
|
||||
~Abstract2() override = default;
|
||||
double d;
|
||||
};
|
||||
|
||||
@ -354,4 +354,4 @@ TEST(AlignOfTest, BasicAlignedArray) {
|
||||
EXPECT_EQ(2u, sizeof(AlignedCharArray<2, 2>));
|
||||
EXPECT_EQ(16u, sizeof(AlignedCharArray<2, 16>));
|
||||
}
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- DFAPacketizerEmitter.cpp - Packetization DFA for a VLIW machine-----===//
|
||||
//===- DFAPacketizerEmitter.cpp - Packetization DFA for a VLIW machine ----===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -28,6 +28,7 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <queue>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -73,7 +74,8 @@ namespace {
|
||||
InsnInput = addDFAFuncUnits(InsnInput, U);
|
||||
return InsnInput;
|
||||
}
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef NDEBUG
|
||||
@ -149,7 +151,7 @@ public:
|
||||
|
||||
void run(raw_ostream &OS);
|
||||
};
|
||||
} // End anonymous namespace.
|
||||
} // end anonymous namespace
|
||||
|
||||
//
|
||||
//
|
||||
@ -234,7 +236,7 @@ class State {
|
||||
//
|
||||
bool hasTransition(std::vector<unsigned> InsnClass) const;
|
||||
};
|
||||
} // End anonymous namespace.
|
||||
} // end anonymous namespace
|
||||
|
||||
//
|
||||
// class DFA: deterministic finite automaton for processor resource tracking.
|
||||
@ -262,7 +264,7 @@ public:
|
||||
int numInsnClasses = 0,
|
||||
int maxResources = 0, int numCombos = 0, int maxStages = 0);
|
||||
};
|
||||
} // End anonymous namespace.
|
||||
} // end anonymous namespace
|
||||
|
||||
#ifndef NDEBUG
|
||||
// To enable debugging, run llvm-tblgen with: "-debug-only dfa-emitter".
|
||||
@ -305,7 +307,7 @@ void dbgsIndent(unsigned indent) {
|
||||
DEBUG(dbgs() << " ");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // NDEBUG
|
||||
|
||||
//
|
||||
// Constructors and destructors for State and DFA
|
||||
@ -454,7 +456,6 @@ void State::AddInsnClassStages(std::vector<unsigned> &InsnClass,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// canMaybeAddInsnClass - Quickly verifies if an instruction of type InsnClass
|
||||
// may be a valid transition from this state i.e., can an instruction of type
|
||||
@ -505,7 +506,6 @@ bool State::canMaybeAddInsnClass(std::vector<unsigned> &InsnClass,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const State &DFA::newState() {
|
||||
auto IterPair = states.insert(State());
|
||||
assert(IterPair.second && "State already exists");
|
||||
@ -518,7 +518,6 @@ DFAPacketizerEmitter::DFAPacketizerEmitter(RecordKeeper &R):
|
||||
TargetName(CodeGenTarget(R).getName()),
|
||||
allInsnClasses(), Records(R) {}
|
||||
|
||||
|
||||
//
|
||||
// writeTableAndAPI - Print out a table representing the DFA and the
|
||||
// associated API to create a DFA packetizer.
|
||||
@ -626,7 +625,6 @@ void DFA::writeTableAndAPI(raw_ostream &OS, const std::string &TargetName,
|
||||
OS << "};\n";
|
||||
OS << "} // namespace\n";
|
||||
|
||||
|
||||
//
|
||||
// Emit DFA Packetizer tables if the target is a VLIW machine.
|
||||
//
|
||||
@ -640,7 +638,6 @@ void DFA::writeTableAndAPI(raw_ostream &OS, const std::string &TargetName,
|
||||
OS << "} // End llvm namespace \n";
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// collectAllFuncUnits - Construct a map of function unit names to bits.
|
||||
//
|
||||
@ -735,7 +732,6 @@ int DFAPacketizerEmitter::collectAllComboFuncs(
|
||||
return numCombos;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// collectOneInsnClass - Populate allInsnClasses with one instruction class
|
||||
//
|
||||
@ -940,7 +936,7 @@ void DFAPacketizerEmitter::run(raw_ostream &OS) {
|
||||
//
|
||||
if (!current->hasTransition(InsnClass) &&
|
||||
current->canMaybeAddInsnClass(InsnClass, ComboBitToBitsMap)) {
|
||||
const State *NewState = NULL;
|
||||
const State *NewState = nullptr;
|
||||
current->AddInsnClass(InsnClass, ComboBitToBitsMap, NewStateResources);
|
||||
if (NewStateResources.size() == 0) {
|
||||
DEBUG(dbgs() << " Skipped - no new states generated\n");
|
||||
@ -994,4 +990,4 @@ void EmitDFAPacketizer(RecordKeeper &RK, raw_ostream &OS) {
|
||||
DFAPacketizerEmitter(RK).run(OS);
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
} // end namespaec llvm
|
||||
|
Loading…
Reference in New Issue
Block a user