aboutsummaryrefslogtreecommitdiffstats
path: root/src/checks/level0/mutable-container-key.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/checks/level0/mutable-container-key.cpp')
-rw-r--r--src/checks/level0/mutable-container-key.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/checks/level0/mutable-container-key.cpp b/src/checks/level0/mutable-container-key.cpp
index 3571150b..d3912b1d 100644
--- a/src/checks/level0/mutable-container-key.cpp
+++ b/src/checks/level0/mutable-container-key.cpp
@@ -25,7 +25,6 @@
#include "QtUtils.h"
#include "TypeUtils.h"
#include "StringUtils.h"
-#include "checkmanager.h"
#include <clang/AST/AST.h>
#include <vector>
@@ -33,14 +32,14 @@
using namespace clang;
using namespace std;
-static bool isInterestingContainer(const string &name)
+static bool isInterestingContainer(StringRef name)
{
- static const vector<string> containers = { "QMap", "QHash" };
- return clazy_std::contains(containers, name);
+ static const vector<StringRef> containers = { "QMap", "QHash" };
+ return clazy::contains(containers, name);
}
MutableContainerKey::MutableContainerKey(const std::string &name, ClazyContext *context)
- : CheckBase(name, context)
+ : CheckBase(name, context, Option_CanIgnoreIncludes)
{
}
@@ -60,13 +59,10 @@ void MutableContainerKey::VisitDecl(clang::Decl *decl)
return;
auto record = t->isRecordType() ? t->getAsCXXRecordDecl() : nullptr;
- if (!StringUtils::classIsOneOf(record, {"QPointer", "QWeakPointer",
- "QPersistentModelIndex", "weak_ptr"}))
+ if (!clazy::classIsOneOf(record, {"QPointer", "QWeakPointer",
+ "QPersistentModelIndex", "weak_ptr"}))
return;
- emitWarning(decl->getLocStart(), "Associative container key might be modified externally");
+ emitWarning(getLocStart(decl), "Associative container key might be modified externally");
}
-
-
-REGISTER_CHECK("mutable-container-key", MutableContainerKey, CheckLevel0)