diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2014-12-11 02:10:28 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2014-12-11 02:10:28 +0000 |
commit | dde76ff09c76bde19f4af7992c3ca14e1a69c694 (patch) | |
tree | fce832c5ffe120a26b170cb55d005af8863539a5 /llvm/lib/IR/LLVMContext.cpp | |
parent | 1e3089749721136482b47233fef8f1d045302e25 (diff) | |
download | llvm-dde76ff09c76bde19f4af7992c3ca14e1a69c694.zip llvm-dde76ff09c76bde19f4af7992c3ca14e1a69c694.tar.gz llvm-dde76ff09c76bde19f4af7992c3ca14e1a69c694.tar.bz2 |
Fix LLVMContext to match what MDKind names that the LL parser permits. Fixes PR21799!
llvm-svn: 223995
Diffstat (limited to 'llvm/lib/IR/LLVMContext.cpp')
-rw-r--r-- | llvm/lib/IR/LLVMContext.cpp | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp index c62bc09..b6d95c4f 100644 --- a/llvm/lib/IR/LLVMContext.cpp +++ b/llvm/lib/IR/LLVMContext.cpp @@ -229,28 +229,10 @@ void LLVMContext::emitError(unsigned LocCookie, const Twine &ErrorStr) { // Metadata Kind Uniquing //===----------------------------------------------------------------------===// -#ifndef NDEBUG -/// isValidName - Return true if Name is a valid custom metadata handler name. -static bool isValidName(StringRef MDName) { - if (MDName.empty()) - return false; - - if (!std::isalpha(static_cast<unsigned char>(MDName[0]))) - return false; - - for (StringRef::iterator I = MDName.begin() + 1, E = MDName.end(); I != E; - ++I) { - if (!std::isalnum(static_cast<unsigned char>(*I)) && *I != '_' && - *I != '-' && *I != '.') - return false; - } - return true; -} -#endif - /// getMDKindID - Return a unique non-zero ID for the specified metadata kind. unsigned LLVMContext::getMDKindID(StringRef Name) const { - assert(isValidName(Name) && "Invalid MDNode name"); + 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( |