1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Verifier: Check wchar_size module flag.

Differential Revision: https://reviews.llvm.org/D32974

llvm-svn: 303460
This commit is contained in:
Matthias Braun 2017-05-19 22:37:01 +00:00
parent 1bad4eeadf
commit 207ce95fd3

View File

@ -1317,6 +1317,15 @@ Verifier::visitModuleFlag(const MDNode *Op,
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.