File tree 2 files changed +18
-0
lines changed 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,22 @@ void source_locationt::merge(const source_locationt &from)
71
71
}
72
72
}
73
73
74
+ // / Get a path to the file, including working directory.
75
+ // / \return Full path unless the file name is empty or refers
76
+ // / to a built-in, in which case the empty string is returned.
77
+ std::string source_locationt::full_path () const
78
+ {
79
+ if (get_file ().empty ())
80
+ return std::string ();
81
+
82
+ const auto file = id2string (get_file ());
83
+
84
+ if (is_built_in (file))
85
+ return std::string ();
86
+
87
+ return concat_dir_file (id2string (get_working_directory ()), file);
88
+ }
89
+
74
90
std::ostream &operator << (
75
91
std::ostream &out,
76
92
const source_locationt &source_location)
Original file line number Diff line number Diff line change @@ -185,6 +185,8 @@ class source_locationt:public irept
185
185
return static_cast <const source_locationt &>(get_nil_irep ());
186
186
}
187
187
188
+ std::string full_path () const ;
189
+
188
190
protected:
189
191
std::string as_string (bool print_cwd) const ;
190
192
};
You can’t perform that action at this time.
0 commit comments