aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/BasicBlock.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <florian.hahn@arm.com>2018-04-19 09:48:07 +0000
committerFlorian Hahn <florian.hahn@arm.com>2018-04-19 09:48:07 +0000
commit147fc016e3ce9575545d55837c2e4775c7ca67c9 (patch)
tree839c83dba4183a4f13fd7631f20dde494d7e1ffb /llvm/lib/IR/BasicBlock.cpp
parentfdc052686cb9dd52f5a52bf72eedbd5a58fdf08b (diff)
downloadllvm-147fc016e3ce9575545d55837c2e4775c7ca67c9.zip
llvm-147fc016e3ce9575545d55837c2e4775c7ca67c9.tar.gz
llvm-147fc016e3ce9575545d55837c2e4775c7ca67c9.tar.bz2
[BasicBlock] Add instructionsWithoutDebug methods to skip debug insts.
Reviewers: aprantl, vsk, mattd, chandlerc Reviewed By: aprantl, vsk Differential Revision: https://reviews.llvm.org/D45657 llvm-svn: 330316
Diffstat (limited to 'llvm/lib/IR/BasicBlock.cpp')
-rw-r--r--llvm/lib/IR/BasicBlock.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index 938c401..c103de4 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -90,6 +90,24 @@ void BasicBlock::setParent(Function *parent) {
InstList.setSymTabObject(&Parent, parent);
}
+iterator_range<filter_iterator<BasicBlock::const_iterator,
+ std::function<bool(const Instruction &)>>>
+BasicBlock::instructionsWithoutDebug() const {
+ std::function<bool(const Instruction &)> Fn = [](const Instruction &I) {
+ return !isa<DbgInfoIntrinsic>(I);
+ };
+ return make_filter_range(*this, Fn);
+}
+
+iterator_range<filter_iterator<BasicBlock::iterator,
+ std::function<bool(Instruction &)>>>
+BasicBlock::instructionsWithoutDebug() {
+ std::function<bool(Instruction &)> Fn = [](Instruction &I) {
+ return !isa<DbgInfoIntrinsic>(I);
+ };
+ return make_filter_range(*this, Fn);
+}
+
void BasicBlock::removeFromParent() {
getParent()->getBasicBlockList().remove(getIterator());
}