From: weiyu Date: Fri, 14 Jun 2019 22:36:53 +0000 (-0700) Subject: function that returns source line number X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6d0c694ec816c3422efa4d5f973eda3ae4ad6933;p=c11llvm.git function that returns source line number --- diff --git a/getPosition.hpp b/getPosition.hpp new file mode 100644 index 0000000..f26d172 --- /dev/null +++ b/getPosition.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include +//#include +//#include +//#include +//#include + +Value *getPosition( Instruction * I, IRBuilder <> IRB) +{ + const DebugLoc & debug_location = I->getDebugLoc (); + std::string position_string; + { + llvm::raw_string_ostream position_stream (position_string); + debug_location . print (position_stream); + } + + return IRB . CreateGlobalStringPtr (position_string); +}