Skip to content

Commit 72052c7

Browse files
Auxiliary function to check whether source location is in built-in
1 parent 6edd2b3 commit 72052c7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/util/source_location.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Author: Daniel Kroening, [email protected]
1010
#define CPROVER_UTIL_SOURCE_LOCATION_H
1111

1212
#include "irep.h"
13+
#include "prefix.h"
1314

1415
class source_locationt:public irept
1516
{
@@ -138,6 +139,18 @@ class source_locationt:public irept
138139
return get_bool(ID_hide);
139140
}
140141

142+
static bool is_built_in(const std::string &s)
143+
{
144+
std::string built_in1="<built-in-"; // "<built-in-additions>";
145+
std::string built_in2="<builtin-"; // "<builtin-architecture-strings>";
146+
return has_prefix(s, built_in1) || has_prefix(s, built_in2);
147+
}
148+
149+
bool is_built_in() const
150+
{
151+
return is_built_in(id2string(get_file()));
152+
}
153+
141154
static const source_locationt &nil()
142155
{
143156
return static_cast<const source_locationt &>(get_nil_irep());

0 commit comments

Comments
 (0)