summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/Lint.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-13 23:56:28 +0000
committerDan Gohman <gohman@apple.com>2010-08-13 23:56:28 +0000
commit21e6dc6aa3d52ac7153b6531b919a818cdf9517e (patch)
tree2883c8a0438c475cc420651fd77dc922dddc5e9f /llvm/lib/Analysis/Lint.cpp
parent4577f37d49e43dec44aea0cbed60f16dd29237ca (diff)
downloadbcm5719-llvm-21e6dc6aa3d52ac7153b6531b919a818cdf9517e.tar.gz
bcm5719-llvm-21e6dc6aa3d52ac7153b6531b919a818cdf9517e.zip
Add a lint check for an indirectbr destination which has not
had its address taken. llvm-svn: 111058
Diffstat (limited to 'llvm/lib/Analysis/Lint.cpp')
-rw-r--r--llvm/lib/Analysis/Lint.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/Lint.cpp b/llvm/lib/Analysis/Lint.cpp
index a9d972435f5..5f1cb61dacb 100644
--- a/llvm/lib/Analysis/Lint.cpp
+++ b/llvm/lib/Analysis/Lint.cpp
@@ -521,6 +521,12 @@ void Lint::visitIndirectBrInst(IndirectBrInst &I) {
Assert1(I.getNumDestinations() != 0,
"Undefined behavior: indirectbr with no destinations", &I);
+
+ for (unsigned i = 0, e = I.getNumDestinations(); i != e; ++i)
+ Assert1(I.getDestination(i)->hasAddressTaken(),
+ "Unusual: indirectbr destination has not "
+ "had its address taken",
+ &I);
}
void Lint::visitExtractElementInst(ExtractElementInst &I) {
OpenPOWER on IntegriCloud