summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/compat.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/compat.hxx')
-rw-r--r--compilerplugins/clang/compat.hxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 5a540b8ef695..e77846ab1166 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -11,6 +11,7 @@
#define INCLUDED_COMPILERPLUGINS_CLANG_COMPAT_HXX
#include <cstddef>
+#include <utility>
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
@@ -49,6 +50,17 @@ inline clang::FunctionDecl::param_const_range parameters(
}
#endif
+inline std::pair<clang::SourceLocation, clang::SourceLocation> getImmediateExpansionRange(
+ clang::SourceManager const & SM, clang::SourceLocation Loc)
+{
+#if CLANG_VERSION >= 70000
+ auto const csr = SM.getImmediateExpansionRange(Loc);
+ if (csr.isCharRange()) { /*TODO*/ }
+ return {csr.getBegin(), csr.getEnd()};
+#else
+ return SM.getImmediateExpansionRange(Loc);
+#endif
+}
inline bool isPointWithin(
clang::SourceManager const & SM, clang::SourceLocation Location, clang::SourceLocation Start,