我正在使用 LoopInfoWrapperPass 来生成 Loopinfo,但是我无法使用 Loopinfo 来迭代我的函数中的循环这里是代码。使用 make 命令时出现构建错误
#include "llvm/Pass.h"
#include "llvm/IR/Function.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/IR/Function.h"
#include "llvm/Support/raw_ostream.h"
#include "iostream"
#include "llvm/Pass.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"
使用命名空间 llvm;
namespace {
struct SkeletonPass : public FunctionPass {
static char ID;
SkeletonPass() : FunctionPass(ID) {}
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
AU.addRequired<LoopInfoWrapperPass>();
}
virtual bool runOnFunction(Function &F){
LoopInfo &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
for( LoopInfo::iterator i = LI.begin(), e=LI.end(); i != e; ++i){
//some code here
}
return false;
}
}
}
我在for循环行的程序中收到一个杂散错误'\ 342',任何人都可以提前识别问题