summaryrefslogtreecommitdiff
path: root/src/core/common/Location.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/common/Location.hpp')
-rw-r--r--src/core/common/Location.hpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/core/common/Location.hpp b/src/core/common/Location.hpp
index 4b70619..93e5d8e 100644
--- a/src/core/common/Location.hpp
+++ b/src/core/common/Location.hpp
@@ -345,6 +345,32 @@ public:
{
return SourceRange::isValid() && sourceId != InvalidSourceId;
}
+
+ /**
+ * Calls the getLocation function on the given reference.
+ *
+ * @param obj is the object on which the getLocation function should be
+ * called.
+ * @return the SourceLocation returned by the getLocation function.
+ */
+ template <typename T>
+ static SourceLocation location(const T &obj)
+ {
+ return obj.getLocation();
+ }
+
+ /**
+ * Calls the getLocation function on the given pointer.
+ *
+ * @param obj is the object on which the getLocation function should be
+ * called.
+ * @return the SourceLocation returned by the getLocation function.
+ */
+ template <typename T>
+ static SourceLocation location(const T *obj)
+ {
+ return obj->getLocation();
+ }
};
/**