下面这段代码中while里面的空报错,应该怎么填?#include "SVF-LLVM/LLVMUtil.h" #include "SVF-LLVM/SVFIRBuilder.h" #include "WPA/Andersen.h" #include "Assignment-3.h" using namespace SVF; using namespace llvm; using namespace std; // TODO: Implement your Andersen's Algorithm here void AndersenPTA::solveWorklist(){ processAllAddr(); // Keep solving until workList is empty. while (!isWorklistEmpty()) { NodeID nodeId = removeFromWorklist(); if (nodeId != AndersNodeFactory::InvalidIdx) { ConstraintNode *node = getNode(nodeId); if (node != nullptr) { processNode(node); }} } } // Process all address constraints to initialize pointers' points-to sets void AndersenPTA::processAllAddr(){ for (ConstraintGraph::const_iterator nodeIt = consCG->begin(), nodeEit = consCG->end(); nodeIt != nodeEit; nodeIt++) { ConstraintNode *cgNode = nodeIt->second; for (ConstraintEdge* edge : cgNode->getAddrInEdges()) { const AddrCGEdge *addr = SVFUtil::cast<AddrCGEdge>(edge); NodeID dst = addr->getDstID(); NodeID src = addr->getSrcID(); if (addPts(dst, src)) pushIntoWorklist(dst); } } }
时间: 2023-06-27 11:06:33 浏览: 95
SVF-specification
你可以尝试在空格中填写一些打印语句,以便在调试时更好地理解程序的行为。例如,你可以在 while 循环中添加以下语句:
```
while (!isWorklistEmpty())
{
NodeID nodeId = removeFromWorklist();
if (nodeId != AndersNodeFactory::InvalidIdx)
{
ConstraintNode *node = getNode(nodeId);
if (node != nullptr)
{
processNode(node);
// print some debugging information
errs() << "Processing node " << nodeId << "\n";
}
}
}
```
这将输出当前处理的节点的 ID,以帮助你更好地理解程序的行为。另外,你还可以添加其他的调试语句,例如打印节点的信息、打印指针的信息等等。
阅读全文