summaryrefslogtreecommitdiffstats
path: root/compilerplugins/clang/salcall.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/salcall.cxx')
-rw-r--r--compilerplugins/clang/salcall.cxx34
1 files changed, 18 insertions, 16 deletions
diff --git a/compilerplugins/clang/salcall.cxx b/compilerplugins/clang/salcall.cxx
index a3f5678a3918..c6b8da579c57 100644
--- a/compilerplugins/clang/salcall.cxx
+++ b/compilerplugins/clang/salcall.cxx
@@ -152,7 +152,7 @@ bool SalCall::VisitFunctionDecl(FunctionDecl const* decl)
if (!bCanonicalDeclIsSalCall)
return true;
- if (!decl->isThisDeclarationADefinition() && !(methodDecl && methodDecl->isPure()))
+ if (!decl->isThisDeclarationADefinition() && !(methodDecl && compat::isPureVirtual(methodDecl)))
return true;
m_decls.insert(decl);
@@ -323,7 +323,7 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
// qualified names this will point after the qualifiers, but needlessly including those in
// the search should be harmless---modulo issues with using "SAL_CALL" as the name of a
// function-like macro parameter as discussed below):
- endLoc = compat::getBeginLoc(functionDecl->getNameInfo());
+ endLoc = functionDecl->getNameInfo().getBeginLoc();
while (SM.isMacroArgExpansion(endLoc, &endLoc))
{
}
@@ -371,7 +371,7 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
assert(SM.isMacroBodyExpansion(startLoc));
auto const startLoc2 = compat::getImmediateExpansionRange(SM, startLoc).second;
auto name = Lexer::getImmediateMacroName(startLoc, SM, compiler.getLangOpts());
- while (name.startswith("\\\n"))
+ while (compat::starts_with(name, "\\\n"))
{
name = name.drop_front(2);
while (!name.empty()
@@ -391,7 +391,7 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
endLoc1 = Lexer::getLocForEndOfToken(endLoc1, 0, SM, compiler.getLangOpts());
startLoc = Lexer::getLocForEndOfToken(SM.getSpellingLoc(startLoc), 0, SM,
compiler.getLangOpts());
- if (!compat::isPointWithin(SM, endLoc, startLoc, endLoc1))
+ if (!SM.isPointWithin(endLoc, startLoc, endLoc1))
{
ranges.emplace_back(startLoc, endLoc1);
startLoc = Lexer::getLocForEndOfToken(SM.getSpellingLoc(startLoc2), 0, SM,
@@ -404,7 +404,7 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
// Stop searching for "SAL_CALL" at the start of the function declaration's name (for
// qualified names this will point after the qualifiers, but needlessly including those in
// the search should be harmless):
- endLoc = compat::getBeginLoc(functionDecl->getNameInfo());
+ endLoc = functionDecl->getNameInfo().getBeginLoc();
while (endLoc.isMacroID() && SM.isAtStartOfImmediateMacroExpansion(endLoc, &endLoc))
{
}
@@ -413,7 +413,7 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
if (SM.isMacroBodyExpansion(endLoc))
{
auto name = Lexer::getImmediateMacroName(endLoc, SM, compiler.getLangOpts());
- while (name.startswith("\\\n"))
+ while (compat::starts_with(name, "\\\n"))
{
name = name.drop_front(2);
while (!name.empty()
@@ -447,8 +447,8 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
startLoc = functionDecl->getSourceRange().getBegin();
while (startLoc.isMacroID()
&& !(macroRange.isValid()
- && compat::isPointWithin(SM, SM.getSpellingLoc(startLoc), macroRange.getBegin(),
- macroRange.getEnd()))
+ && SM.isPointWithin(SM.getSpellingLoc(startLoc), macroRange.getBegin(),
+ macroRange.getEnd()))
&& SM.isAtStartOfImmediateMacroExpansion(startLoc, &startLoc))
{
}
@@ -459,7 +459,7 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
#if defined _WIN32
if (macroRange.isValid()
- && !compat::isPointWithin(SM, startLoc, macroRange.getBegin(), macroRange.getEnd()))
+ && !SM.isPointWithin(startLoc, macroRange.getBegin(), macroRange.getEnd()))
{
// endLoc is within a macro body but startLoc is not; two source ranges, first is from
// startLoc to the macro invocation, second is the leading part of the corresponding
@@ -477,9 +477,11 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
if (noReturnType
&& !(functionDecl->isVirtualAsWritten()
|| (isa<CXXConstructorDecl>(functionDecl)
- && compat::isExplicitSpecified(cast<CXXConstructorDecl>(functionDecl)))
+ && cast<CXXConstructorDecl>(functionDecl)->getExplicitSpecifier().isExplicit())
|| (isa<CXXConversionDecl>(functionDecl)
- && compat::isExplicitSpecified(cast<CXXConversionDecl>(functionDecl)))))
+ && cast<CXXConversionDecl>(functionDecl)
+ ->getExplicitSpecifier()
+ .isExplicit())))
{
SourceLocation endLoc1;
if (macroStartLoc.isMacroID()
@@ -504,8 +506,8 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
// in the first line and include the intervening spaces and (part of? looks like an
// error in Clang) "barbaz", so just skip any tokens starting with backslash-newline
// when looking backwards here, without even trying to look at their content:
- if (!(s.empty() || s.startswith("/*") || s.startswith("//")
- || s.startswith("\\\n")))
+ if (!(s.empty() || compat::starts_with(s, "/*") || compat::starts_with(s, "//")
+ || compat::starts_with(s, "\\\n")))
{
break;
}
@@ -530,8 +532,8 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
// in the first line and include the intervening spaces and (part of? looks like an
// error in Clang) "barbaz", so just skip any tokens starting with backslash-newline
// when looking backwards here, without even trying to look at their content:
- if (!(s.empty() || s.startswith("/*") || s.startswith("//")
- || s.startswith("\\\n")))
+ if (!(s.empty() || compat::starts_with(s, "/*") || compat::starts_with(s, "//")
+ || compat::starts_with(s, "\\\n")))
{
break;
}
@@ -566,7 +568,7 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
{
unsigned n = Lexer::MeasureTokenLength(loc, SM, compiler.getLangOpts());
auto s = StringRef(compiler.getSourceManager().getCharacterData(loc), n);
- while (s.startswith("\\\n"))
+ while (compat::starts_with(s, "\\\n"))
{
s = s.drop_front(2);
while (!s.empty()