summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/redundantinline.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/redundantinline.cxx')
-rw-r--r--compilerplugins/clang/redundantinline.cxx19
1 files changed, 10 insertions, 9 deletions
diff --git a/compilerplugins/clang/redundantinline.cxx b/compilerplugins/clang/redundantinline.cxx
index 3bda99e397cb..c9491445b64f 100644
--- a/compilerplugins/clang/redundantinline.cxx
+++ b/compilerplugins/clang/redundantinline.cxx
@@ -10,6 +10,7 @@
#include <cassert>
+#include "compat.hxx"
#include "plugin.hxx"
namespace {
@@ -43,18 +44,18 @@ private:
assert(inlineLoc->isInvalid());
unsigned n = {}; // avoid -Werror=maybe-uninitialized
auto end = Lexer::getLocForEndOfToken(
- compiler.getSourceManager().getExpansionLoc(compat::getEndLoc(decl)), 0,
+ compiler.getSourceManager().getExpansionLoc(decl->getEndLoc()), 0,
compiler.getSourceManager(), compiler.getLangOpts());
assert(end.isValid());
for (auto loc = compiler.getSourceManager().getExpansionLoc(
- compat::getBeginLoc(decl));
+ decl->getBeginLoc());
loc != end; loc = loc.getLocWithOffset(std::max<unsigned>(n, 1)))
{
n = Lexer::MeasureTokenLength(
loc, compiler.getSourceManager(), compiler.getLangOpts());
StringRef s(compiler.getSourceManager().getCharacterData(loc), n);
//TODO: see compilerplugins/clang/override.cxx:
- if (s.startswith("\\\n")) {
+ if (compat::starts_with(s, "\\\n")) {
s = s.drop_front(2);
}
if (s == "inline") {
@@ -86,7 +87,7 @@ private:
StringRef s(
compiler.getSourceManager().getCharacterData(loc), n2);
//TODO: see compilerplugins/clang/override.cxx:
- if (s.startswith("\\\n")) {
+ if (compat::starts_with(s, "\\\n")) {
s = s.drop_front(2);
}
if (!s.empty()) {
@@ -116,8 +117,8 @@ private:
}
bool isInMacroExpansion(FunctionDecl const * decl, StringRef name) {
- auto loc = unwindTo(compat::getBeginLoc(decl), name);
- return loc.isValid() && loc == unwindTo(compat::getEndLoc(decl), name);
+ auto loc = unwindTo(decl->getBeginLoc(), name);
+ return loc.isValid() && loc == unwindTo(decl->getEndLoc(), name);
}
bool handleImplicitInline(FunctionDecl const * decl) {
@@ -134,14 +135,14 @@ private:
report(
DiagnosticsEngine::Warning,
"function definition redundantly declared 'inline'",
- inlineLoc.isValid() ? inlineLoc : compat::getBeginLoc(decl))
+ inlineLoc.isValid() ? inlineLoc : decl->getBeginLoc())
<< decl->getSourceRange();
}
return true;
}
bool handleNonExternalLinkage(FunctionDecl const * decl) {
- if (decl->getLinkageInternal() >= ModuleLinkage) {
+ if (decl->getLinkageInternal() >= compat::Linkage::Module) {
return false;
}
if (!compiler.getSourceManager().isInMainFile(decl->getLocation())) {
@@ -161,7 +162,7 @@ private:
report(
DiagnosticsEngine::Warning,
"function has no external linkage but is explicitly declared 'inline'",
- inlineLoc.isValid() ? inlineLoc : compat::getBeginLoc(decl))
+ inlineLoc.isValid() ? inlineLoc : decl->getBeginLoc())
<< decl->getSourceRange();
}
return true;