#define DEBUG_TYPE "debug-ir"
#include "llvm/ADT/ValueMap.h"
-#include "llvm/Assembly/AssemblyAnnotationWriter.h"
-#include "llvm/DebugInfo.h"
+#include "DebugIR.h"
#include "llvm/DIBuilder.h"
-#include "llvm/InstVisitor.h"
+#include "llvm/DebugInfo.h"
+#include "llvm/IR/AssemblyAnnotationWriter.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Instruction.h"
+#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
-#include "llvm/Transforms/Instrumentation.h"
-#include "llvm/Transforms/Utils/Cloning.h"
+#include "llvm/InstVisitor.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/ToolOutputFile.h"
-#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Path.h"
-
-#include "DebugIR.h"
-
+#include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Transforms/Instrumentation.h"
+#include "llvm/Transforms/Utils/Cloning.h"
#include <string>
#define STR_HELPER(x) #x
DICompileUnit(CUNode), F.getName(), MangledName, DIFile(FileNode), Line,
Sig, Local, IsDefinition, ScopeLine, FuncFlags, IsOptimized, &F);
assert(Sub.isSubprogram());
- DEBUG(dbgs() << "create subprogram mdnode " << Sub << ": "
+ DEBUG(dbgs() << "create subprogram mdnode " << *Sub << ": "
<< "\n");
SubprogramDescriptors.insert(std::make_pair(&F, Sub));
"LLVM Version " STR(LLVM_VERSION_MAJOR) "." STR(LLVM_VERSION_MINOR);
}
- Builder.createCompileUnit(dwarf::DW_LANG_C99, Filename, Directory, Producer,
- IsOptimized, Flags, RuntimeVersion);
- CUNode = Builder.getCU();
+ CUNode =
+ Builder.createCompileUnit(dwarf::DW_LANG_C99, Filename, Directory,
+ Producer, IsOptimized, Flags, RuntimeVersion);
if (CUToReplace)
CUToReplace->replaceAllUsesWith(const_cast<MDNode *>(CUNode));
Type *PointeeTy = T->getPointerElementType();
if (!(N = getType(PointeeTy)))
N = Builder.createPointerType(
- getOrCreateType(PointeeTy), Layout.getPointerSizeInBits(),
+ getOrCreateType(PointeeTy), Layout.getPointerTypeSizeInBits(T),
Layout.getPrefTypeAlignment(T), getTypeName(T));
} else if (T->isArrayTy()) {
SmallVector<Value *, 1> Subrange;
}
void DebugIR::generateFilename(OwningPtr<int> &fd) {
- StringRef FileModel("debug-ir-%s%s%s%s.ll");
SmallVector<char, 16> PathVec;
fd.reset(new int);
- sys::fs::unique_file(FileModel, *fd, PathVec);
+ sys::fs::createTemporaryFile("debug-ir", "ll", *fd, PathVec);
StringRef Path(PathVec.data(), PathVec.size());
Filename = sys::path::filename(Path);
sys::path::remove_filename(PathVec);