[PATCH] D32974: Verifier: Check wchar_size module flag.
Matthias Braun via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 8 11:15:39 PDT 2017
MatzeB created this revision.
Herald added a subscriber: mcrosier.
Repository:
rL LLVM
https://reviews.llvm.org/D32974
Files:
lib/IR/Verifier.cpp
Index: lib/IR/Verifier.cpp
===================================================================
--- lib/IR/Verifier.cpp
+++ lib/IR/Verifier.cpp
@@ -1314,6 +1314,15 @@
Assert(Inserted,
"module flag identifiers must be unique (or of 'require' type)", ID);
}
+
+ if (ID->getString() == "wchar_size") {
+ ConstantInt *Value
+ = mdconst::dyn_extract_or_null<ConstantInt>(Op->getOperand(2));
+ Assert(Value, "wchar_size metadata requires constant integer argument");
+ uint64_t WCharSize = Value->getZExtValue();
+ Assert(WCharSize == 0 || WCharSize == 2 || WCharSize == 4,
+ "wchar_size should be 0, 2 or 4");
+ }
}
/// Return true if this attribute kind only applies to functions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32974.98188.patch
Type: text/x-patch
Size: 729 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170508/b0b48d6b/attachment.bin>
More information about the llvm-commits
mailing list