diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-13 23:56:28 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-13 23:56:28 +0000 |
commit | 61556e3a946f3814e2166a78667453e9fff17c77 (patch) | |
tree | fc275839d66e6fdcdeaaf96f37461ece02831f1d /lib | |
parent | 20d8e4e7aa5645450f3eaedd9f9dbb70423f8ccc (diff) | |
download | external_llvm-61556e3a946f3814e2166a78667453e9fff17c77.zip external_llvm-61556e3a946f3814e2166a78667453e9fff17c77.tar.gz external_llvm-61556e3a946f3814e2166a78667453e9fff17c77.tar.bz2 |
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')
-rw-r--r-- | lib/Analysis/Lint.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Analysis/Lint.cpp b/lib/Analysis/Lint.cpp index a9d9724..5f1cb61 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) { |