Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-decl overhaul (including inline struct fixes) #657

Merged
merged 66 commits into from
Nov 22, 2021

Commits on Sep 14, 2021

  1. Configuration menu
    Copy the full SHA
    eeab8d1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b7a119a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    dcf9da0 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4bf6ff9 View commit details
    Browse the repository at this point in the history
  5. Remove all the old workarounds for unnamed structs.

    Now that we automatically name them:
    
    - When -alltypes is on, we no longer need to warn that the multi-decl
      may be rewritten incorrectly.
    
    - When -alltypes is off, we no longer generate constraints to try to
      avoid the need to rewrite the multi-decl at all.
    
    InlineStructDetector did one thing unrelated to its name: it constrained
    all union fields wild. Move that logic to ProgramInfo::addVariable, make
    the constraint reason message more specific, and update root_cause.c to
    expect the new message.
    mattmccutchen-cci committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    8184556 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c2ea286 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    17de215 View commit details
    Browse the repository at this point in the history
  8. Stop mkString from producing the extra space in int * x[10].

    The problem already affected several regression tests for more complex
    cases (which expected the extra space), and we didn't seem to notice or
    care. But now it is affecting every unchanged variable of that form in a
    multi-decl that gets rewritten, and this broke several other regression
    tests.
    mattmccutchen-cci committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    9dc4968 View commit details
    Browse the repository at this point in the history
  9. Minimal fix to detect inline structs nested in other structs so

    multi-decl rewriting splits them rather than losing them.
    
    Fixes #531
    except for a "declaration does not declare anything" compiler warning
    that will be addressed by de-nesting the inline structs.
    mattmccutchen-cci committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    fb819ef View commit details
    Browse the repository at this point in the history
  10. Use the EndLoc variable like I meant to.

    A fixup to "Get the correct form...".
    mattmccutchen-cci committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    20b23b8 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    9af2fe9 View commit details
    Browse the repository at this point in the history
  12. Multi-decl rewriting should not try to split a struct forward

    declaration as if it were a definition.
    
    Fixes #644.
    mattmccutchen-cci committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    500d870 View commit details
    Browse the repository at this point in the history
  13. New multi-decl detector + typedef multi-decl support.

    The existing regression tests pass, but more testing is needed.
    mattmccutchen-cci committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    52db941 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    a4c4ad1 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    843cad0 View commit details
    Browse the repository at this point in the history
  16. Add some tests of the new features.

    More are still needed.
    mattmccutchen-cci committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    755f651 View commit details
    Browse the repository at this point in the history
  17. Actually lift the constraint of typedef multi-decls to wild: oops.

    Delete the test of "Unable to rewrite a typedef with multiple names"
    from root_cause.c because that case no longer causes wildness. (I think
    it makes sense to just delete the test.)
    mattmccutchen-cci committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    faf5006 View commit details
    Browse the repository at this point in the history
  18. Fix the check for a typedef that exactly matches the inline struct type.

    Now that this case works, add a few tests of it.
    mattmccutchen-cci committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    d3a48d6 View commit details
    Browse the repository at this point in the history
  19. Add tests of typedef multi-decl rewriting without inline structs.

    In the process, fix a bug that I found in the lookup of the type of an
    unchanged typedef.
    mattmccutchen-cci committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    8839ad1 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    6bbf9ca View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    51e777a View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    5f69ae8 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    c91ba7b View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    ff1ae35 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    ccdc611 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    4de64f7 View commit details
    Browse the repository at this point in the history

Commits on Sep 15, 2021

  1. Scribble

    - Dealing with Checked C annotations in rewriteMultiDecl
    - Use mkString only when BaseTypeRenamed, otherwise use Decl::print
    - Factor out buildDeclVar
    mattmccutchen-cci committed Sep 15, 2021
    Configuration menu
    Copy the full SHA
    6032aaf View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6fb03df View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d926bd6 View commit details
    Browse the repository at this point in the history

Commits on Sep 16, 2021

  1. Configuration menu
    Copy the full SHA
    56d7303 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3666d95 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    cd6cccb View commit details
    Browse the repository at this point in the history

Commits on Sep 17, 2021

  1. 3 Configuration menu
    Copy the full SHA
    e8ad64c View commit details
    Browse the repository at this point in the history

Commits on Sep 23, 2021

  1. Comment updates.

    Mainly about possible references to an automatically generated name in a
    multi-decl that wasn't rewritten.
    mattmccutchen-cci committed Sep 23, 2021
    Configuration menu
    Copy the full SHA
    8d1735a View commit details
    Browse the repository at this point in the history
  2. Don't generate a multi-decl of all decls with invalid source locations.

    This wasn't causing a problem yet, but it seems sensible not to do it.
    mattmccutchen-cci committed Sep 23, 2021
    Configuration menu
    Copy the full SHA
    ae9e314 View commit details
    Browse the repository at this point in the history
  3. Comment on the two changes I decided not to make:

    - Using T in `typedef struct T_struct { ... } T`
    
    - DeclReplacement::getSourceRange removal
    
    Other minor changes.
    mattmccutchen-cci committed Sep 23, 2021
    Configuration menu
    Copy the full SHA
    740390e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e6a0d4d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e89ece7 View commit details
    Browse the repository at this point in the history
  6. Remove the mkString fixes from this PR.

    They are no longer important to have in this PR now that I have switched
    unchanged multi-decl members back from mkString to Decl::print in most
    cases. I can submit the fixes in a separate PR if we like, or we can
    hold off and maybe we'll do a broader overhaul of mkString.
    mattmccutchen-cci committed Sep 23, 2021
    Configuration menu
    Copy the full SHA
    d75748f View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    77145eb View commit details
    Browse the repository at this point in the history
  8. Add some tests to itypes_for_extern.c.

    Fix a bug I found that would generate an itype where the unchecked and
    checked sides are identical.
    mattmccutchen-cci committed Sep 23, 2021
    Configuration menu
    Copy the full SHA
    d3220b2 View commit details
    Browse the repository at this point in the history

Commits on Sep 24, 2021

  1. More tests.

    mattmccutchen-cci committed Sep 24, 2021
    Configuration menu
    Copy the full SHA
    86b1acc View commit details
    Browse the repository at this point in the history
  2. Even more tests.

    Also add documentation of the (narrow) circumstances in which
    mkStringForDeclWithUnchangedType interacts with ItypesForExtern to the
    code as well as the tests.
    mattmccutchen-cci committed Sep 24, 2021
    Configuration menu
    Copy the full SHA
    74685c6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2073f33 View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2021

  1. Configuration menu
    Copy the full SHA
    13c0d77 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0d578bc View commit details
    Browse the repository at this point in the history

Commits on Sep 29, 2021

  1. Configuration menu
    Copy the full SHA
    e594faa View commit details
    Browse the repository at this point in the history

Commits on Sep 30, 2021

  1. Configuration menu
    Copy the full SHA
    c9888f2 View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2021

  1. Fix bugs with automatic naming of structs in shared header files.

    3C saved the assigned name but neglected to set BaseTypeRenamed or
    TagDefToSplit correctly in translation units after the first.
    
    TODO: Add regression tests.
    mattmccutchen-cci committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    220234c View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2021

  1. Configuration menu
    Copy the full SHA
    0c2b38c View commit details
    Browse the repository at this point in the history

Commits on Oct 22, 2021

  1. Use PrintingPolicy to exclude any initializer when printing a VarDecl.

    This is much nicer than temporarily mutating the VarDecl to remove the
    initializer.
    mattmccutchen-cci committed Oct 22, 2021
    Configuration menu
    Copy the full SHA
    d3de950 View commit details
    Browse the repository at this point in the history
  2. Minor refactor.

    mattmccutchen-cci committed Oct 22, 2021
    Configuration menu
    Copy the full SHA
    f7ae158 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f18cc23 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d437bad View commit details
    Browse the repository at this point in the history

Commits on Nov 12, 2021

  1. Configuration menu
    Copy the full SHA
    4c85580 View commit details
    Browse the repository at this point in the history

Commits on Nov 15, 2021

  1. Configuration menu
    Copy the full SHA
    5ed5ad3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    eea9b94 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    36e262a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ab2d1a5 View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2021

  1. Configuration menu
    Copy the full SHA
    0bbfe7f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a83daa6 View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2021

  1. Configuration menu
    Copy the full SHA
    bc9f3bc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2a58731 View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2021

  1. Configuration menu
    Copy the full SHA
    31b82a6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    aff9f80 View commit details
    Browse the repository at this point in the history
  3. More comment fixes.

    mattmccutchen-cci committed Nov 19, 2021
    Configuration menu
    Copy the full SHA
    f7ff59f View commit details
    Browse the repository at this point in the history