Skip to content

Commit

Permalink
Update for LLVM 6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jackanth committed Mar 17, 2018
1 parent 7f1560e commit 10f28a8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/MemoryModel/PointsToDFDS.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class DFPTData : public PTData<Key,Data> {
PTData<Key,Data>::dumpPts(this->ptsMap);
/// dump points-to of address-taken variables
std::error_code ErrInfo;
llvm::tool_output_file F("svfg_pts.data", ErrInfo, llvm::sys::fs::F_None);
llvm::ToolOutputFile F("svfg_pts.data", ErrInfo, llvm::sys::fs::F_None);
if (!ErrInfo) {
llvm::raw_fd_ostream & osm = F.os();
NodeBS locs;
Expand Down
2 changes: 1 addition & 1 deletion include/Util/GraphUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class GraphPrinter {
std::string Filename = GraphName + ".dot";
O << "Writing '" << Filename << "'...";
std::error_code ErrInfo;
tool_output_file F(Filename.c_str(), ErrInfo, sys::fs::F_None);
ToolOutputFile F(Filename.c_str(), ErrInfo, sys::fs::F_None);

if (!ErrInfo) {
// dump the ValueFlowGraph here
Expand Down
2 changes: 1 addition & 1 deletion lib/MemoryModel/PointerAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ void BVDataPTAImpl::writeToFile(const string& filename) {
outs() << "Storing pointer analysis results to '" << filename << "'...";

error_code err;
tool_output_file F(filename.c_str(), err, sys::fs::F_None);
ToolOutputFile F(filename.c_str(), err, sys::fs::F_None);
if (err) {
outs() << " error opening file for writing!\n";
F.os().clear_error();
Expand Down
12 changes: 7 additions & 5 deletions lib/Util/AnalysisUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include "Util/AnalysisUtil.h"

#include <llvm/Transforms/Utils/Local.h> // for FindAllocaDbgDeclare
#include <llvm/Transforms/Utils/Local.h> // for FindDbgAddrUses
#include <llvm/IR/GlobalVariable.h> // for GlobalVariable
#include <llvm/IR/Module.h> // for Module
#include <llvm/IR/InstrTypes.h> // for TerminatorInst
Expand Down Expand Up @@ -300,10 +300,12 @@ std::string analysisUtil::getSourceLoc(const Value* val) {
raw_string_ostream rawstr(str);
if (const Instruction *inst = dyn_cast<Instruction>(val)) {
if (isa<AllocaInst>(inst)) {
DbgDeclareInst* DDI = llvm::FindAllocaDbgDeclare(const_cast<Instruction*>(inst));
if (DDI) {
DIVariable *DIVar = cast<DIVariable>(DDI->getVariable());
rawstr << "ln: " << DIVar->getLine() << " fl: " << DIVar->getFilename();
for (DbgInfoIntrinsic *DII : FindDbgAddrUses(const_cast<Instruction*>(inst))) {
if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(DII)) {
DIVariable *DIVar = cast<DIVariable>(DDI->getVariable());
rawstr << "ln: " << DIVar->getLine() << " fl: " << DIVar->getFilename();
break;
}
}
}
else if (MDNode *N = inst->getMetadata("dbg")) { // Here I is an LLVM instruction
Expand Down
2 changes: 1 addition & 1 deletion tests/runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
################################################

##remember to run ./setup script before running testings
CLANGFLAG='-g -c -emit-llvm -I.'
CLANGFLAG='-Xclang -disable-O0-optnone -g -c -emit-llvm -I.'
LLVMOPTFLAG='-mem2reg -mergereturn'

TESTWITHOPT=$1
Expand Down

0 comments on commit 10f28a8

Please sign in to comment.