summaryrefslogtreecommitdiff
path: root/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
commit61556e3a946f3814e2166a78667453e9fff17c77 (patch)
treefc275839d66e6fdcdeaaf96f37461ece02831f1d /lib/Analysis/Lint.cpp
parent20d8e4e7aa5645450f3eaedd9f9dbb70423f8ccc (diff)
downloadllvm-61556e3a946f3814e2166a78667453e9fff17c77.tar.gz
llvm-61556e3a946f3814e2166a78667453e9fff17c77.tar.bz2
llvm-61556e3a946f3814e2166a78667453e9fff17c77.tar.xz
Add a lint check for an indirectbr destination which has not
had its address taken. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111058 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/Lint.cpp')
-rw-r--r--lib/Analysis/Lint.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Analysis/Lint.cpp b/lib/Analysis/Lint.cpp
index a9d972435f..5f1cb61dac 100644
--- a/lib/Analysis/Lint.cpp
+++ b/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) {