f26d1721c62787f0784cc828eb5c74e564b08b4c
[c11llvm.git] / getPosition.hpp
1 #pragma once
2
3 #include <llvm/IR/DebugLoc.h>
4 //#include <llvm/IR/Constant.h>
5 //#include <llvm/IR/Instruction.h>
6 //#include <llvm/IR/IRBuilder.h>
7 //#include <llvm/Support/raw_ostream.h>
8
9 Value *getPosition( Instruction * I, IRBuilder <> IRB)
10 {
11         const DebugLoc & debug_location = I->getDebugLoc ();
12         std::string position_string;
13         {
14                 llvm::raw_string_ostream position_stream (position_string);
15                 debug_location . print (position_stream);
16         }
17
18         return IRB . CreateGlobalStringPtr (position_string);
19 }