Giter Site home page Giter Site logo

propellint's Introduction

PropelLint

The goal of this tool is to detect bad patterns which are not detectable via only dynamic profiling, or only static analysis. To achieve this, the tool uses a profile as input, and then inspects the source code to determine if a warning should be issued.

The current focus is to detect unintentional map inserts with operator[]. In C++, map[key] always inserts a default value. Sometimes, these are not intended and can cause bugs and/or performance regressions.

Warning This project is a work in progress.

How it works

Profile

The profile must be a JSON file with the following format.

[
    {
        "stack_combined": [
            "someFunction@some_source_file.cpp:13",
            "someOtherFunction@some_other_source_file.cpp:31",
            <...>
        ],
        "total_weight": 458188117
    },
    <...>
]

Internally, we use a profiler called Strobelight, and pre-filter the data to only contain stacks with operator[].

Analysis

  1. The profile is parsed, and only operator[] locations that insert are kept. We can find those by looking for specific sub-functions that we know are signs of insertion.
  2. For each file, we need to file the necessary compile commands. The tool is currently based on Buck, which it queries to find the compilation database of each file.
  3. The AST is generated using Clang, and inspected to filter out cases with a high-likelihood of intentional.

Getting started

[~] git clone https://github.com/facebookexperimental/propellint.git
[~] cd propellint
[~/propellint] mkdir build
[~/propellint] cd build
[~/propellint/build] cmake ..
[~/propellint/build] make

License

This work is licensed under the Apache License 2.0.

propellint's People

Contributors

nicovank avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

nicovank

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.