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

Rewrite Clang interface to use C++ libtooling API instead of libclang #1740

Closed
wants to merge 88 commits into from

Commits on Feb 15, 2020

  1. Initial implementation of clang tooling API

    Bindgen builds and runs now, but does not produce any bindings yet.
    rinon committed Feb 15, 2020
    Configuration menu
    Copy the full SHA
    bd73c08 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    59e2432 View commit details
    Browse the repository at this point in the history

Commits on Feb 17, 2020

  1. Implement Eq correctly for ASTNode

    We need to compare on variant contents, not just on variant equality
    rinon committed Feb 17, 2020
    Configuration menu
    Copy the full SHA
    dea6a70 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d41bb18 View commit details
    Browse the repository at this point in the history
  3. Do not return attributed or paren types from clang

    Bindgen currently assumes that it won't see these types from libclang.
    rinon committed Feb 17, 2020
    Configuration menu
    Copy the full SHA
    d6b1474 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b8926d9 View commit details
    Browse the repository at this point in the history

Commits on Feb 19, 2020

  1. Configuration menu
    Copy the full SHA
    b02deab View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7fb94d1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2652681 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8dd5154 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ecdbf84 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    93b975a View commit details
    Browse the repository at this point in the history
  7. Clean up visitors

    rinon committed Feb 19, 2020
    Configuration menu
    Copy the full SHA
    ad220b0 View commit details
    Browse the repository at this point in the history
  8. Visit templated type locations

    rinon committed Feb 19, 2020
    Configuration menu
    Copy the full SHA
    b42adbd View commit details
    Browse the repository at this point in the history
  9. Correctly report comment kinds

    rinon committed Feb 19, 2020
    Configuration menu
    Copy the full SHA
    6668893 View commit details
    Browse the repository at this point in the history
  10. Visit more TypeLocs

    rinon committed Feb 19, 2020
    Configuration menu
    Copy the full SHA
    a1bdd75 View commit details
    Browse the repository at this point in the history
  11. Visit CXXBaseSpecifier nodes

    rinon committed Feb 19, 2020
    Configuration menu
    Copy the full SHA
    f8dec45 View commit details
    Browse the repository at this point in the history

Commits on Feb 20, 2020

  1. Clean up warning

    rinon committed Feb 20, 2020
    Configuration menu
    Copy the full SHA
    1618ffc View commit details
    Browse the repository at this point in the history
  2. Add Attr to node and track node kinds correctly

    Added some misc CXXBaseSpecifier accessors and fixed visiting CXXBaseSpecifiers
    rinon committed Feb 20, 2020
    Configuration menu
    Copy the full SHA
    9ce7939 View commit details
    Browse the repository at this point in the history
  3. Build stringref from llvm::StringRef

    Needed for compatibility with latest Clang
    rinon committed Feb 20, 2020
    Configuration menu
    Copy the full SHA
    e883c52 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0317bfa View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    832820e View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    3fc7daf View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    7913cbd View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    7e3a4ae View commit details
    Browse the repository at this point in the history
  9. Add type null checks

    rinon committed Feb 20, 2020
    Configuration menu
    Copy the full SHA
    a68c996 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    d0e7d58 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    0446e60 View commit details
    Browse the repository at this point in the history
  12. Clean up traversal

    We should return true to continue traversal at invalid nodes. We should also
    recurse through Stmt nodes that aren't Exprs, since we don't handle them in
    bindgen.
    rinon committed Feb 20, 2020
    Configuration menu
    Copy the full SHA
    fec0814 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    1e3af56 View commit details
    Browse the repository at this point in the history
  14. Rewrite TypeLoc traversal

    Fixes header_const_tparam_hpp
    rinon committed Feb 20, 2020
    Configuration menu
    Copy the full SHA
    7735a89 View commit details
    Browse the repository at this point in the history
  15. Fix logic in Expr_Evaluate

    We weren't returning results for anything but string literals. Fixes
    header_constant_evaluate_h
    rinon committed Feb 20, 2020
    Configuration menu
    Copy the full SHA
    19badfd View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    0362eac View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    3523b23 View commit details
    Browse the repository at this point in the history
  18. Adjust the end of the range given in tokenize

    Clang uses source ranges which start at the first character of the first token
    and end at the first character of the last token, while libclang assumes that
    the end of the range has been adjusted to after the last character of the last
    token. tokenize is the only place we rely on this, so just adjust it here.
    rinon committed Feb 20, 2020
    Configuration menu
    Copy the full SHA
    0e76552 View commit details
    Browse the repository at this point in the history

Commits on Feb 21, 2020

  1. Configuration menu
    Copy the full SHA
    d09a320 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f78bee2 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9dc2346 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    fca9753 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    3e034d1 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ae382f1 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    1ed0781 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    8c0ffe3 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    e0ed47a View commit details
    Browse the repository at this point in the history
  10. Explicitly visit ObjCTypeParamDecls

    RecursiveASTVisitor doesn't call TraverseDecl for these, it calls
    TraverseObjCTypeParamDecl directly, so we need to intercept this at the Visit
    function.
    rinon committed Feb 21, 2020
    Configuration menu
    Copy the full SHA
    137e47e View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    919124d View commit details
    Browse the repository at this point in the history
  12. Fix warning

    rinon committed Feb 21, 2020
    Configuration menu
    Copy the full SHA
    6115d41 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    2c28a58 View commit details
    Browse the repository at this point in the history
  14. Use command-line args to tell preprocessor to keep detailed records

    We used to build a CompilerInvocation and directly set the preprocessor option
    to keep detailed records, but we can just tack on CLI args for the same thing.
    rinon committed Feb 21, 2020
    Configuration menu
    Copy the full SHA
    4ea4609 View commit details
    Browse the repository at this point in the history

Commits on Feb 22, 2020

  1. Clean up build script

    rinon committed Feb 22, 2020
    Configuration menu
    Copy the full SHA
    5c2d4f9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2334ffc View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    272ef10 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9fc9974 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    02cb226 View commit details
    Browse the repository at this point in the history

Commits on Mar 2, 2020

  1. Configuration menu
    Copy the full SHA
    a6ddacd View commit details
    Browse the repository at this point in the history
  2. Build with Clang 7

    rinon committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    8d82749 View commit details
    Browse the repository at this point in the history
  3. Build with Clang 6

    rinon committed Mar 2, 2020
    Configuration menu
    Copy the full SHA
    80fe522 View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2020

  1. Build with Clang 5

    rinon committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    4e6809b View commit details
    Browse the repository at this point in the history
  2. Build with Clang 4

    rinon committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    d6d48c0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2c1444d View commit details
    Browse the repository at this point in the history
  4. Build with Clang 3.9

    rinon committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    7df04f4 View commit details
    Browse the repository at this point in the history
  5. Build with Clang 3.8

    rinon committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    bc57ed1 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    4e3c5dd View commit details
    Browse the repository at this point in the history
  7. Fix expectations for tests that now check struct field offsets

    Before Clang 9 these tests did not emit field offset checks because libclang
    didn't expose information in these cases. This is fixed in the new interface
    now, so we can expect bindgen to emit these checks with all libclang versions.
    rinon committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    d18d554 View commit details
    Browse the repository at this point in the history
  8. Update expectations for clang 3.9

    Several bugs/limitations that existed with clang 3.9 are now gone.
    rinon committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    da05e77 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    deea936 View commit details
    Browse the repository at this point in the history
  10. Move CXEvalResultKind definition for LLVM <= 3.8 into impl header

    I can't easily bindgen clang_interface.hpp if it includes C++ headers, but we
    don't need clang/basic/Version.h in that header anyway if we move this into
    clang_interface_impl.hpp instead.
    rinon committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    9ccb4d1 View commit details
    Browse the repository at this point in the history
  11. Do not visit children of implicit decls unless the decl is base

    The libclang visitor will visit children of an implicit decl only if that decl
    is the top-level parent passed in `Decl_visitChildren`. Otherwise, we should
    skip traversal of implicit decls.
    rinon committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    94db32b View commit details
    Browse the repository at this point in the history
  12. Add doc strings

    rinon committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    40ed73d View commit details
    Browse the repository at this point in the history
  13. Remove completed TODO

    rinon committed Mar 3, 2020
    Configuration menu
    Copy the full SHA
    b7e161d View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    3b16276 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    c11af74 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    35b3d98 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    3b222e1 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    b4c7c2d View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2020

  1. Include missing header

    rinon committed Mar 4, 2020
    Configuration menu
    Copy the full SHA
    22e39c2 View commit details
    Browse the repository at this point in the history

Commits on Mar 15, 2020

  1. Plug memory leaks

    rinon committed Mar 15, 2020
    Configuration menu
    Copy the full SHA
    bf1155a View commit details
    Browse the repository at this point in the history

Commits on Mar 18, 2020

  1. Fix build warning

    rinon committed Mar 18, 2020
    Configuration menu
    Copy the full SHA
    8fa4e6a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    854d663 View commit details
    Browse the repository at this point in the history

Commits on Mar 19, 2020

  1. Make clang interface C only to avoid C++ mangling issues

    Platforms don't mangle C++ the same, so we should avoid depending on C++
    mangling if we're going to embed a bindings file.
    rinon committed Mar 19, 2020
    Configuration menu
    Copy the full SHA
    79f7568 View commit details
    Browse the repository at this point in the history
  2. Remove old CXXFLAG

    rinon committed Mar 19, 2020
    Configuration menu
    Copy the full SHA
    bd1d72a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8a5d6d1 View commit details
    Browse the repository at this point in the history
  4. Support building on Windows

    rinon committed Mar 19, 2020
    Configuration menu
    Copy the full SHA
    d7dacc3 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    86c6cc5 View commit details
    Browse the repository at this point in the history

Commits on Mar 20, 2020

  1. Configuration menu
    Copy the full SHA
    ff7f76f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e1748a7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6dae240 View commit details
    Browse the repository at this point in the history

Commits on Mar 23, 2020

  1. Pass QualTypes to Rust as void* to avoid ABI issues

    We can't pass C++ objects by value from C++ to Rust. QualType has an
    interface for converting back and forth to void*, so we can use that
    instead.
    rinon committed Mar 23, 2020
    Configuration menu
    Copy the full SHA
    1a5821f View commit details
    Browse the repository at this point in the history