mozilla
Your Search Results

    Pork Tool Development

    Files and locations

    Most tools are in the "oink" directory. The "renamer" tool is used as an example; tests are in the "oink/renamer_tests" subdirectory.

    Replacement

    For the "renamer" tool, a diff file is generated as the AST is traversed, using the visitor pattern. The diff file is generated using the "Patcher" class.

    source locations AST nodes have a location associated with them; SourceLoc is defined to be an integer corresponding to an string offset. This can be translated to an UnboxedLoc, which has a line and column offset (see renamer.cc:65).

    macro expansion This section refers to macro expansion when using mcpp (see Installing Pork). For the rename_class.cpp test, generate the file with "gcc -E -Wp,-W0,-K rename_class.cpp > rename_class.cc" and run the renamer with "../renamer -rename Foo Bar rename_class.cc".

    For terminology, suppose "MY_FOO" --> "Foo". Then any post-location variables refer to "Foo" and pre-location variables refer to "MY_FOO". CPPSourceLoc wraps SourceLoc, providing information about macro expansion. CPPSourceLoc will change the previously provided location information (in variable cpp_source_loc._loc) from post-location to pre-location. All values from the AST refer to the post-location.

    Notes

    The #static channel on irc.mozilla.org is for discussion of Pork, Dehydra, and other static analysis tools.

    Document Tags and Contributors

    Contributors to this page: gatoatigrado
    Last updated by: gatoatigrado,