[llvm-branch-commits] [clang-tools-extra-branch] r321800 - Merging r321762:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jan 4 06:24:01 PST 2018
Author: hans
Date: Thu Jan 4 06:24:01 2018
New Revision: 321800
URL: http://llvm.org/viewvc/llvm-project?rev=321800&view=rev
Log:
Merging r321762:
------------------------------------------------------------------------
r321762 | juliehockett | 2018-01-03 14:10:11 -0800 (Wed, 03 Jan 2018) | 8 lines
[clang-tidy] Update fuchsia-overloaded-operator to check for valid loc
Updating fuchsia-overloaded-operator check to not issue warnings for
invalid locations.
Fixes PR35803.
Differential Revision: https://reviews.llvm.org/D41708
------------------------------------------------------------------------
Modified:
clang-tools-extra/branches/release_60/ (props changed)
clang-tools-extra/branches/release_60/clang-tidy/fuchsia/OverloadedOperatorCheck.cpp
clang-tools-extra/branches/release_60/test/clang-tidy/fuchsia-overloaded-operator.cpp
Propchange: clang-tools-extra/branches/release_60/
------------------------------------------------------------------------------
svn:mergeinfo = /clang-tools-extra/trunk:321762
Modified: clang-tools-extra/branches/release_60/clang-tidy/fuchsia/OverloadedOperatorCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/branches/release_60/clang-tidy/fuchsia/OverloadedOperatorCheck.cpp?rev=321800&r1=321799&r2=321800&view=diff
==============================================================================
--- clang-tools-extra/branches/release_60/clang-tidy/fuchsia/OverloadedOperatorCheck.cpp (original)
+++ clang-tools-extra/branches/release_60/clang-tidy/fuchsia/OverloadedOperatorCheck.cpp Thu Jan 4 06:24:01 2018
@@ -30,8 +30,12 @@ void OverloadedOperatorCheck::registerMa
}
void OverloadedOperatorCheck::check(const MatchFinder::MatchResult &Result) {
- if (const auto *D = Result.Nodes.getNodeAs<FunctionDecl>("decl"))
- diag(D->getLocStart(), "cannot overload %0") << D;
+ const auto *D = Result.Nodes.getNodeAs<FunctionDecl>("decl");
+ assert(D && "No FunctionDecl captured!");
+
+ SourceLocation Loc = D->getLocStart();
+ if (Loc.isValid())
+ diag(Loc, "cannot overload %0") << D;
}
} // namespace fuchsia
Modified: clang-tools-extra/branches/release_60/test/clang-tidy/fuchsia-overloaded-operator.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/branches/release_60/test/clang-tidy/fuchsia-overloaded-operator.cpp?rev=321800&r1=321799&r2=321800&view=diff
==============================================================================
--- clang-tools-extra/branches/release_60/test/clang-tidy/fuchsia-overloaded-operator.cpp (original)
+++ clang-tools-extra/branches/release_60/test/clang-tidy/fuchsia-overloaded-operator.cpp Thu Jan 4 06:24:01 2018
@@ -16,3 +16,6 @@ public:
A operator-(const A &A1, const A &A2);
// CHECK-MESSAGES: [[@LINE-1]]:1: warning: cannot overload 'operator-' [fuchsia-overloaded-operator]
+
+void operator delete(void*, void*) throw();
+// CHECK-MESSAGES: [[@LINE-1]]:1: warning: cannot overload 'operator delete' [fuchsia-overloaded-operator]
More information about the llvm-branch-commits
mailing list