Bug 385851 - Allow visiting of implicit code
Summary: Allow visiting of implicit code
Status: RESOLVED FIXED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: Sergio Martins
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-17 11:09 UTC by Richard
Modified: 2017-10-19 17:44 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Minimal patch (405 bytes, patch)
2017-10-17 11:09 UTC, Richard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard 2017-10-17 11:09:54 UTC
Created attachment 108400 [details]
Minimal patch

Right now its not possible to check for actions performed in an implicit constructor. 
Therfore ClazyASTConsumer should override the method shouldVisitImplicitCode. See patch attached.

Perhaps this should be configurable, but I don't know how to incorporate this best.
Comment 1 Sergio Martins 2017-10-17 12:34:51 UTC
By implicit CTORs you mean the compiler-synthesized ones ? Which clazy check would find anything interesting in there ?
Comment 2 Richard 2017-10-17 13:05:34 UTC
We've an in-house check for a 3rdparty library which we cannot control to flag default construction of several types:

//in thirdpartylib.h
class DoNotDefaultConstruct {
//....
}

//in our code
DoNotDefaultConstruct c; // will be flagged as intended
struct SomeStruct {
    DoNotDefaultConstruct c;
} inst; //should be flagged, but won't
Comment 3 Sergio Martins 2017-10-18 08:00:42 UTC
It makes things considerably slower (11m vs 15m to build qtbase), so I'll add an opt-in option to enable it
Comment 4 Sergio Martins 2017-10-19 17:44:15 UTC
commit ec9ec84e7fd73f5a4753973660ad4f301eaa8c0e (HEAD -> master, origin/master)
Author: Sergio Martins <smartins@kde.org>
Date:   Thu Oct 19 18:35:27 2017 +0100

    Minor cleanup to previous commit regarding visit-implicit-code
    
    CCBUG: 385851

commit 4847a25f3fa65744bd7dd23533da6bb8783ca6b6
Author: Richard Oehlinger <r.oehlinger@avibit.com>
Date:   Thu Oct 19 16:00:29 2017 +0200

    Add option to visit implicit code, such as compiler generated CTORs
    
    Although clazy's built-in checks don't need this, some custom user
    checks might
    
    Not enabled by default as it causes a slight slowdown
    
    BUG: 385851