aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergio Martins <iamsergio@gmail.com>2018-05-05 21:17:32 +0100
committerSergio Martins <smartins@kde.org>2018-05-06 19:14:38 +0100
commit06edd15fdda9155b54366d3887a4fbf25cf1d911 (patch)
treeabdc296c45181aca943916698b2242678590a490 /src
parent731d6425edefc459f095a7a65fc75ed78bd80122 (diff)
Fix build with clang 8.0
BUG: 393745
Diffstat (limited to 'src')
-rw-r--r--src/checks/level2/old-style-connect.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/checks/level2/old-style-connect.cpp b/src/checks/level2/old-style-connect.cpp
index 9633fdc4..3df545ae 100644
--- a/src/checks/level2/old-style-connect.cpp
+++ b/src/checks/level2/old-style-connect.cpp
@@ -64,6 +64,16 @@ static bool classIsOk(StringRef className)
return className != "QDBusInterface";
}
+static CharSourceRange getImmediateExpansionRange(SourceLocation macroLoc, const SourceManager &sm)
+{
+#if LLVM_VERSION_MAJOR >= 8
+ return sm.getImmediateExpansionRange(macroLoc);
+#else
+ auto pair = sm.getImmediateExpansionRange(macroLoc);
+ return CharSourceRange(SourceRange(pair.first, pair.second), false);
+#endif
+}
+
OldStyleConnect::OldStyleConnect(const std::string &name, ClazyContext *context)
: CheckBase(name, context, Option_CanIgnoreIncludes)
{
@@ -228,8 +238,8 @@ string OldStyleConnect::signalOrSlotNameFromMacro(SourceLocation macroLoc)
if (!macroLoc.isMacroID())
return "error";
- auto expansionRange = sm().getImmediateExpansionRange(macroLoc);
- SourceRange range = SourceRange(expansionRange.first, expansionRange.second);
+ CharSourceRange expansionRange = getImmediateExpansionRange(macroLoc, sm());
+ SourceRange range = SourceRange(expansionRange.getBegin(), expansionRange.getEnd());
auto charRange = Lexer::getAsCharRange(range, sm(), lo());
const string text = Lexer::getSourceText(charRange, sm(), lo());
@@ -393,8 +403,8 @@ vector<FixItHint> OldStyleConnect::fixits(int classification, CallExpr *call)
qualifiedName = clazy::getMostNeededQualifiedName(sm(), methodDecl, context, call->getLocStart(), !isInInclude); // (In includes ignore using directives)
}
- auto expansionRange = sm().getImmediateExpansionRange(s);
- SourceRange range = SourceRange(expansionRange.first, expansionRange.second);
+ CharSourceRange expansionRange = getImmediateExpansionRange(s, sm());
+ SourceRange range = SourceRange(expansionRange.getBegin(), expansionRange.getEnd());
const string functionPointer = '&' + qualifiedName;
string replacement = functionPointer;