aboutsummaryrefslogtreecommitdiffstats
path: root/src/SourceCompatibilityHelpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/SourceCompatibilityHelpers.h')
-rw-r--r--src/SourceCompatibilityHelpers.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/SourceCompatibilityHelpers.h b/src/SourceCompatibilityHelpers.h
index 45539ec8..da46bced 100644
--- a/src/SourceCompatibilityHelpers.h
+++ b/src/SourceCompatibilityHelpers.h
@@ -24,6 +24,7 @@
#define SOURCE_COMPAT_HELPERS
#include <clang/Basic/SourceLocation.h>
+#include <clang/Basic/SourceManager.h>
template <typename T>
inline clang::SourceLocation getLocStart(const T *t)
@@ -45,5 +46,14 @@ inline clang::SourceLocation getLocEnd(const T *t)
#endif
}
+inline clang::CharSourceRange getImmediateExpansionRange(clang::SourceLocation macroLoc, const clang::SourceManager &sm)
+{
+#if LLVM_VERSION_MAJOR >= 7
+ return sm.getImmediateExpansionRange(macroLoc);
+#else
+ auto pair = sm.getImmediateExpansionRange(macroLoc);
+ return clang::CharSourceRange(clang::SourceRange(pair.first, pair.second), false);
+#endif
+}
#endif