[llvm] r223995 - Fix LLVMContext to match what MDKind names that the LL parser permits. Fixes PR21799!
Nick Lewycky
nicholas at mxc.ca
Wed Dec 10 18:10:29 PST 2014
Author: nicholas
Date: Wed Dec 10 20:10:28 2014
New Revision: 223995
URL: http://llvm.org/viewvc/llvm-project?rev=223995&view=rev
Log:
Fix LLVMContext to match what MDKind names that the LL parser permits. Fixes PR21799!
Modified:
llvm/trunk/lib/IR/LLVMContext.cpp
llvm/trunk/test/Feature/metadata.ll
Modified: llvm/trunk/lib/IR/LLVMContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContext.cpp?rev=223995&r1=223994&r2=223995&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContext.cpp (original)
+++ llvm/trunk/lib/IR/LLVMContext.cpp Wed Dec 10 20:10:28 2014
@@ -229,28 +229,10 @@ void LLVMContext::emitError(unsigned Loc
// 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(
Modified: llvm/trunk/test/Feature/metadata.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/metadata.ll?rev=223995&r1=223994&r2=223995&view=diff
==============================================================================
--- llvm/trunk/test/Feature/metadata.ll (original)
+++ llvm/trunk/test/Feature/metadata.ll Wed Dec 10 20:10:28 2014
@@ -5,7 +5,7 @@ define void @foo(i32 %x) {
call void @llvm.zonk(metadata !{i32 %x}, i64 0, metadata !1)
store i32 0, i32* null, !whatever !0, !whatever_else !{}, !more !{metadata !"hello"}
store i32 0, i32* null, !whatever !{metadata !"hello", metadata !1, metadata !{}, metadata !2}
- ret void
+ ret void, !_1 !0
}
declare void @llvm.zonk(metadata, i64, metadata) nounwind readnone
More information about the llvm-commits
mailing list