aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-04-12 12:56:57 -0700
committerMark Seaborn <mseaborn@chromium.org>2013-04-12 12:56:57 -0700
commit14551e67a9ac4e521b9dd5f7776bb1a4fdcd7998 (patch)
tree02bce6162fc445f58fcca14515daba3181b5fe69 /lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp
parenteb6ea25e95165fe6467512d759bbcf020e352351 (diff)
PNaCl ABI checker: Disallow ConstantExprs inside functions
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3337 TEST=test/NaCl/PNaClABI/*.ll Review URL: https://codereview.chromium.org/13932023
Diffstat (limited to 'lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp')
-rw-r--r--lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp b/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp
index 54e2e19340..f96b45752b 100644
--- a/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp
+++ b/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp
@@ -173,6 +173,14 @@ bool PNaClABIVerifyFunctions::runOnFunction(Function &F) {
}
}
+ for (User::const_op_iterator OI = BBI->op_begin(), OE = BBI->op_end();
+ OI != OE; OI++) {
+ if (isa<ConstantExpr>(OI)) {
+ Reporter->addError() << "Function " << F.getName() <<
+ " contains disallowed ConstantExpr\n";
+ }
+ }
+
// Get types hiding in metadata attached to the instruction
SmallVector<std::pair<unsigned, MDNode*>, 4> MDForInst;
BBI->getAllMetadataOtherThanDebugLoc(MDForInst);