[PATCH] D32974: Verifier: Check wchar_size module flag.
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 19 15:50:24 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL303460: Verifier: Check wchar_size module flag. (authored by matze).
Changed prior to commit:
https://reviews.llvm.org/D32974?vs=98188&id=99634#toc
Repository:
rL LLVM
https://reviews.llvm.org/D32974
Files:
llvm/trunk/lib/IR/Verifier.cpp
Index: llvm/trunk/lib/IR/Verifier.cpp
===================================================================
--- llvm/trunk/lib/IR/Verifier.cpp
+++ llvm/trunk/lib/IR/Verifier.cpp
@@ -1317,6 +1317,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.99634.patch
Type: text/x-patch
Size: 762 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170519/62e2cfe8/attachment.bin>
More information about the llvm-commits
mailing list