summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/IR/LLVMContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/lib/IR/LLVMContext.cpp')
-rw-r--r--contrib/llvm/lib/IR/LLVMContext.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/contrib/llvm/lib/IR/LLVMContext.cpp b/contrib/llvm/lib/IR/LLVMContext.cpp
index b6d95c4..7bcd829 100644
--- a/contrib/llvm/lib/IR/LLVMContext.cpp
+++ b/contrib/llvm/lib/IR/LLVMContext.cpp
@@ -88,11 +88,22 @@ LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) {
"mem_parallel_loop_access kind id drifted");
(void)MemParallelLoopAccessID;
-
// Create the 'nonnull' metadata kind.
unsigned NonNullID = getMDKindID("nonnull");
assert(NonNullID == MD_nonnull && "nonnull kind id drifted");
(void)NonNullID;
+
+ // Create the 'dereferenceable' metadata kind.
+ unsigned DereferenceableID = getMDKindID("dereferenceable");
+ assert(DereferenceableID == MD_dereferenceable &&
+ "dereferenceable kind id drifted");
+ (void)DereferenceableID;
+
+ // Create the 'dereferenceable_or_null' metadata kind.
+ unsigned DereferenceableOrNullID = getMDKindID("dereferenceable_or_null");
+ assert(DereferenceableOrNullID == MD_dereferenceable_or_null &&
+ "dereferenceable_or_null kind id drifted");
+ (void)DereferenceableOrNullID;
}
LLVMContext::~LLVMContext() { delete pImpl; }
@@ -229,15 +240,12 @@ void LLVMContext::emitError(unsigned LocCookie, const Twine &ErrorStr) {
// Metadata Kind Uniquing
//===----------------------------------------------------------------------===//
-/// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
+/// Return a unique non-zero ID for the specified metadata kind.
unsigned LLVMContext::getMDKindID(StringRef Name) const {
- assert(!std::isdigit(Name.front()) &&
- "Named metadata may not start with a digit");
-
// If this is new, assign it its ID.
- return pImpl->CustomMDKindNames.insert(std::make_pair(
- Name,
- pImpl->CustomMDKindNames.size()))
+ return pImpl->CustomMDKindNames.insert(
+ std::make_pair(
+ Name, pImpl->CustomMDKindNames.size()))
.first->second;
}
OpenPOWER on IntegriCloud