r338732 - [analyzer] Make RegionVector use const reference

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 7 13:23:07 PDT 2018


On 2018-08-07, David Blaikie wrote:
>Looks good! Though it may be useful in the future to describe, in the commit
>message, the motivation for a change - how'd you find this? What motivated you
>to make this particular fix just now, etc? ("identified using clang-tidy" or
>"spotted during post-commit review of change rXXXX", etc...)

Thanks for the tip! Will try to do this next time.

>On Thu, Aug 2, 2018 at 9:29 AM Fangrui Song via cfe-commits <
>cfe-commits at lists.llvm.org> wrote:
>
>    Author: maskray
>    Date: Thu Aug  2 09:29:36 2018
>    New Revision: 338732
>
>    URL: http://llvm.org/viewvc/llvm-project?rev=338732&view=rev
>    Log:
>    [analyzer] Make RegionVector use const reference
>
>    Modified:
>        cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
>
>    Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
>    URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/
>    BugReporterVisitors.cpp?rev=338732&r1=338731&r2=338732&view=diff
>    ===========================================================================
>    ===
>    --- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (original)
>    +++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Thu Aug  2
>    09:29:36 2018
>    @@ -395,7 +395,7 @@ private:
>       const Optional<RegionVector>
>       findRegionOfInterestInRecord(const RecordDecl *RD, ProgramStateRef
>    State,
>                                    const MemRegion *R,
>    -                               RegionVector Vec = {},
>    +                               const RegionVector &Vec = {},
>                                    int depth = 0) {
>
>         if (depth == DEREFERENCE_LIMIT) // Limit the recursion depth.
>    @@ -548,14 +548,10 @@ private:
>
>       /// \return Diagnostics piece for region not modified in the current
>    function.
>       std::shared_ptr<PathDiagnosticPiece>
>    -  notModifiedDiagnostics(const LocationContext *Ctx,
>    -                         CallExitBegin &CallExitLoc,
>    -                         CallEventRef<> Call,
>    -                         RegionVector FieldChain,
>    -                         const MemRegion *MatchedRegion,
>    -                         StringRef FirstElement,
>    -                         bool FirstIsReferenceType,
>    -                         unsigned IndirectionLevel) {
>    +  notModifiedDiagnostics(const LocationContext *Ctx, CallExitBegin &
>    CallExitLoc,
>    +                         CallEventRef<> Call, const RegionVector &
>    FieldChain,
>    +                         const MemRegion *MatchedRegion, StringRef
>    FirstElement,
>    +                         bool FirstIsReferenceType, unsigned
>    IndirectionLevel) {
>
>         PathDiagnosticLocation L;
>         if (const ReturnStmt *RS = CallExitLoc.getReturnStmt()) {
>    @@ -579,7 +575,8 @@ private:
>       /// Pretty-print region \p MatchedRegion to \p os.
>       void prettyPrintRegionName(StringRef FirstElement, bool
>    FirstIsReferenceType,
>                                  const MemRegion *MatchedRegion,
>    -                             RegionVector FieldChain, int
>    IndirectionLevel,
>    +                             const RegionVector &FieldChain,
>    +                             int IndirectionLevel,
>                                  llvm::raw_svector_ostream &os) {
>
>         if (FirstIsReferenceType)
>
>    _______________________________________________
>    cfe-commits mailing list
>    cfe-commits at lists.llvm.org
>    http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>

-- 
宋方睿


More information about the cfe-commits mailing list