summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp b/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp
index b03b546fde0..189130efcae 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp
@@ -91,6 +91,11 @@ void registerMatchersForGetEquals(MatchFinder *Finder,
} // namespace
+void RedundantSmartptrGetCheck::storeOptions(
+ ClangTidyOptions::OptionMap &Opts) {
+ Options.store(Opts, "IgnoreMacros", IgnoreMacros);
+}
+
void RedundantSmartptrGetCheck::registerMatchers(MatchFinder *Finder) {
// Only register the matchers for C++; the functionality currently does not
// provide any benefit to other languages, despite being benign.
@@ -126,6 +131,9 @@ void RedundantSmartptrGetCheck::check(const MatchFinder::MatchResult &Result) {
bool IsPtrToPtr = Result.Nodes.getNodeAs<Decl>("ptr_to_ptr") != nullptr;
bool IsMemberExpr = Result.Nodes.getNodeAs<Expr>("memberExpr") != nullptr;
const auto *GetCall = Result.Nodes.getNodeAs<Expr>("redundant_get");
+ if (GetCall->getBeginLoc().isMacroID() && IgnoreMacros)
+ return;
+
const auto *Smartptr = Result.Nodes.getNodeAs<Expr>("smart_pointer");
if (IsPtrToPtr && IsMemberExpr) {
OpenPOWER on IntegriCloud