File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -23,12 +23,10 @@ void ProTypeUnionAccessCheck::registerMatchers(MatchFinder *Finder) {
2323
2424void ProTypeUnionAccessCheck::check (const MatchFinder::MatchResult &Result) {
2525 const auto *Matched = Result.Nodes .getNodeAs <MemberExpr>(" expr" );
26- if (auto MemberLoc = Matched->getMemberLoc (); MemberLoc.isValid ())
27- diag (MemberLoc,
28- " do not access members of unions; use (boost::)variant instead" );
29- else
30- diag (Matched->getBeginLoc (),
31- " do not access members of unions; use (boost::)variant instead" );
26+ SourceLocation Loc = Matched->getMemberLoc ();
27+ if (Loc.isInvalid ())
28+ Loc = Matched->getBeginLoc ();
29+ diag (Loc, " do not access members of unions; use (boost::)variant instead" );
3230}
3331
3432} // namespace clang::tidy::cppcoreguidelines
You can’t perform that action at this time.
0 commit comments