alishuja created this revision. alishuja added reviewers: NoQ, steakhal, xazax.hun, ASDenysPetrov. Herald added subscribers: manas, martong, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware. alishuja requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
This is an extension to diff D99260 <https://reviews.llvm.org/D99260>. This adds an additional exception for std::__addressof in InnerPointerChecker. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D109467 Files: clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp Index: clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp =================================================================== --- clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp +++ clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp @@ -34,9 +34,9 @@ class InnerPointerChecker : public Checker<check::DeadSymbols, check::PostCall> { - CallDescription AppendFn, AssignFn, AddressofFn, ClearFn, CStrFn, DataFn, - DataMemberFn, EraseFn, InsertFn, PopBackFn, PushBackFn, ReplaceFn, - ReserveFn, ResizeFn, ShrinkToFitFn, SwapFn; + CallDescription AppendFn, AssignFn, AddressofFn, AddressofFn_, ClearFn, + CStrFn, DataFn, DataMemberFn, EraseFn, InsertFn, PopBackFn, PushBackFn, + ReplaceFn, ReserveFn, ResizeFn, ShrinkToFitFn, SwapFn; public: class InnerPointerBRVisitor : public BugReporterVisitor { @@ -73,7 +73,7 @@ InnerPointerChecker() : AppendFn({"std", "basic_string", "append"}), AssignFn({"std", "basic_string", "assign"}), - AddressofFn({"std", "addressof"}), + AddressofFn({"std", "addressof"}), AddressofFn_({"std", "__addressof"}), ClearFn({"std", "basic_string", "clear"}), CStrFn({"std", "basic_string", "c_str"}), DataFn({"std", "data"}, 1), DataMemberFn({"std", "basic_string", "data"}), @@ -184,7 +184,7 @@ // std::addressof function accepts a non-const reference as an argument, // but doesn't modify it. - if (Call.isCalled(AddressofFn)) + if (Call.isCalled(AddressofFn) || Call.isCalled(AddressofFn_)) continue; markPtrSymbolsReleased(Call, State, ArgRegion, C);
Index: clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp =================================================================== --- clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp +++ clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp @@ -34,9 +34,9 @@ class InnerPointerChecker : public Checker<check::DeadSymbols, check::PostCall> { - CallDescription AppendFn, AssignFn, AddressofFn, ClearFn, CStrFn, DataFn, - DataMemberFn, EraseFn, InsertFn, PopBackFn, PushBackFn, ReplaceFn, - ReserveFn, ResizeFn, ShrinkToFitFn, SwapFn; + CallDescription AppendFn, AssignFn, AddressofFn, AddressofFn_, ClearFn, + CStrFn, DataFn, DataMemberFn, EraseFn, InsertFn, PopBackFn, PushBackFn, + ReplaceFn, ReserveFn, ResizeFn, ShrinkToFitFn, SwapFn; public: class InnerPointerBRVisitor : public BugReporterVisitor { @@ -73,7 +73,7 @@ InnerPointerChecker() : AppendFn({"std", "basic_string", "append"}), AssignFn({"std", "basic_string", "assign"}), - AddressofFn({"std", "addressof"}), + AddressofFn({"std", "addressof"}), AddressofFn_({"std", "__addressof"}), ClearFn({"std", "basic_string", "clear"}), CStrFn({"std", "basic_string", "c_str"}), DataFn({"std", "data"}, 1), DataMemberFn({"std", "basic_string", "data"}), @@ -184,7 +184,7 @@ // std::addressof function accepts a non-const reference as an argument, // but doesn't modify it. - if (Call.isCalled(AddressofFn)) + if (Call.isCalled(AddressofFn) || Call.isCalled(AddressofFn_)) continue; markPtrSymbolsReleased(Call, State, ArgRegion, C);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits