From 6d0c694ec816c3422efa4d5f973eda3ae4ad6933 Mon Sep 17 00:00:00 2001 From: weiyu Date: Fri, 14 Jun 2019 15:36:53 -0700 Subject: [PATCH] function that returns source line number --- getPosition.hpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 getPosition.hpp 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); +} -- 2.34.1