Skip to content
  1. Sep 30, 2019
  2. Aug 15, 2019
  3. May 15, 2019
    • Gabor Marton's avatar
      [ASTImporter] Use llvm::Expected and Error in the importer API · 5ac6d490
      Gabor Marton authored
      Summary:
      This is the final phase of the refactoring towards using llvm::Expected
      and llvm::Error in the ASTImporter API.
      This involves the following:
      - remove old Import functions which returned with a pointer,
      - use the Import_New functions (which return with Err or Expected) everywhere
        and handle their return value
      - rename Import_New functions to Import
      This affects both Clang and LLDB.
      
      Reviewers: shafik, teemperor, aprantl, a_sidorin, balazske, a.sidorin
      
      Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits, lldb-commits
      
      Tags: #clang, #lldb
      
      Differential Revision: https://reviews.llvm.org/D61438
      
      llvm-svn: 360760
      5ac6d490
  4. Apr 08, 2019
  5. Mar 20, 2019
  6. Jan 19, 2019
    • Chandler Carruth's avatar
      Update the file headers across all of the LLVM projects in the monorepo · 2946cd70
      Chandler Carruth authored
      to reflect the new license.
      
      We understand that people may be surprised that we're moving the header
      entirely to discuss the new license. We checked this carefully with the
      Foundation's lawyer and we believe this is the correct approach.
      
      Essentially, all code in the project is now made available by the LLVM
      project under our new license, so you will see that the license headers
      include that license only. Some of our contributors have contributed
      code under our old license, and accordingly, we have retained a copy of
      our old license notice in the top-level files in each project and
      repository.
      
      llvm-svn: 351636
      2946cd70
  7. Nov 29, 2018
    • Raphael Isemann's avatar
      Set MustBuildLookupTable on PrimaryContext in ExternalASTMerger · ddedf0f9
      Raphael Isemann authored
      Summary:
      `MustBuildLookupTable` must always be called on a primary context as we otherwise
      trigger an assert, but we don't ensure that this will always happen in our code right now.
      
      This patch explicitly requests the primary context when doing this call as this shouldn't break
      anything (as calling `getPrimaryContext` on a context which is its own primary context is a no-op)
      but will catch these rare cases where we somehow operate on a declaration context that is
      not its own primary context.
      
      See also D54863.
      
      Reviewers: martong, a.sidorin, shafik
      
      Reviewed By: martong
      
      Subscribers: davide, rnkovacs, cfe-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D54898
      
      llvm-svn: 347863
      ddedf0f9
  8. Oct 19, 2018
    • Balazs Keri's avatar
      [ASTImporter] Added error handling for AST import. · 3b30d658
      Balazs Keri authored
      Summary:
      The goal of this change is to make the ASTImporter::Import functions return
      llvm::Expected instead of the imported type.
      As first part the ASTNodeImporter visit functions are updated to return with
      llvm::Expected. Various `import` functions are added to ASTNodeImporter to
      simplify the code and have a common place for interface towards ASTImporter
      (from ASTNodeImporter). There is some temporary code that is needed before
      ASTImporter is updated.
      
      Reviewers: a.sidorin, a_sidorin, xazax.hun
      
      Reviewed By: a_sidorin
      
      Subscribers: dkrupp, Szelethus, rnkovacs, martong, jfb, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D51633
      
      llvm-svn: 344783
      3b30d658
  9. Jul 12, 2018
    • Gabor Marton's avatar
      [ASTImporter] Refactor Decl creation · 26f72a96
      Gabor Marton authored
      Summary:
      Generalize the creation of Decl nodes during Import.  With this patch we do the
      same things after and before a new AST node is created (::Create) The import
      logic should be really simple, we create the node, then we mark that as
      imported, then we recursively import the parts for that node and then set them
      on that node.  However, the AST is actually a graph, so we have to handle
      circles.  If we mark something as imported (`MapImported()`) then we return with
      the corresponding `To` decl whenever we want to import that node again, this way
      circles are handled.  In order to make this algorithm work we must ensure
      things, which are handled in the generic CreateDecl<> template:
      * There are no `Import()` calls in between any node creation (::Create)
      and the `MapImported()` call.
      * Before actually creating an AST node (::Create), we must check if
      the Node had been imported already, if yes then return with that one.
      One very important case for this is connected to templates: we may
      start an import both from the templated decl of a template and from
      the template itself.
      
      Now, the virtual `Imported` function is called in `ASTImporter::Impor(Decl *)`,
      but only once, when the `Decl` is imported.  One point of this refactor is to
      separate responsibilities. The original `Imported()` had 3 responsibilities:
      - notify subclasses when an import happened
      - register the decl into `ImportedDecls`
      - initialise the Decl (set attributes, etc)
      Now all of these are in separate functions:
      - `Imported`
      - `MapImported`
      - `InitializeImportedDecl`
      I tried to check all the clients, I executed tests for `ExternalASTMerger.cpp`
      and some unittests for lldb.
      
      Reviewers: a.sidorin, balazske, xazax.hun, r.stahl
      
      Subscribers: rnkovacs, dkrupp, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D47632
      
      llvm-svn: 336896
      26f72a96
  10. Jan 26, 2018
  11. Sep 28, 2017
  12. Sep 27, 2017
    • Sean Callanan's avatar
      Add support for remembering origins to ExternalASTMerger · 967d4384
      Sean Callanan authored
      ExternalASTMerger has hitherto relied on being able to look up 
      any Decl through its named DeclContext chain. This works for 
      many cases, but causes problems for function-local structs, 
      which cannot be looked up in their containing FunctionDecl. An
      example case is
      
      void f() {
        { struct S { int a; }; }
        { struct S { bool b; }; }
      }
      
      It is not possible to lookup either of the two Ses individually 
      (or even to provide enough information to disambiguate) after 
      parsing is over; and there is typically no need to, since they 
      are invisible to the outside world.
      
      However, ExternalASTMerger needs to be able to complete either 
      S on demand. This led to an XFAIL on test/Import/local-struct, 
      which this patch removes. The way the patch works is:
      
      It defines a new data structure, ExternalASTMerger::OriginMap,
      which clients are expected to maintain (default-constructing 
      if the origin does not have an ExternalASTMerger servicing it)
      As DeclContexts are imported, if they cannot be looked up by 
      name they are placed in the OriginMap. This allows 
      ExternalASTMerger to complete them later if necessary.
      As DeclContexts are imported from an origin that already has 
      its own OriginMap, the origins are forwarded – but only for 
      those DeclContexts that are actually used. This keeps the 
      amount of stored data minimal.
      
      The patch also applies several improvements from review:
      
      - Thoroughly documents the interface to ExternalASTMerger;
      - Adds optional logging to help track what's going on; and
      - Cleans up a bunch of braces and dangling elses.
      
      Differential Revision: https://reviews.llvm.org/D38208
      
      llvm-svn: 314336
      967d4384
  13. Jul 25, 2017
  14. Jul 11, 2017
  15. Jun 17, 2017
    • Lang Hames's avatar
      Call setMustBuildLookupTable on TagDecls in ExternalASTMerger · 8ca265f4
      Lang Hames authored
      Summary:
      setMustBuildLookupTable should be called on imported TagDecls otherwise we may fail
      to import their member decls (if they have any).
      
      Not calling the setMustBuildLookupTable method results in a failure in the attached test
      case when lookup for the 'x' member fails on struct S, which hasn't had its decls imported
      elsewhere. (By contrast the member-in-struct testcase hasn't run into this issue
      because the import of its decls is triggered when the struct instance is defined, and the
      member access follows this).
      
      Reviewers: spyffe, rsmith
      
      Reviewed By: spyffe, rsmith
      
      Differential Revision: https://reviews.llvm.org/D34253
      
      llvm-svn: 305619
      8ca265f4
  16. May 13, 2017
    • Sean Callanan's avatar
      [ASTImporter] Improve handling of incomplete types · 9092d479
      Sean Callanan authored
      ASTImporter has some bugs when it's importing types 
      that themselves come from an ExternalASTSource. This 
      is exposed particularly in the behavior when 
      comparing complete TagDecls with forward 
      declarations. This patch does several things:
      
      - Adds a test case making sure that conflicting 
        forward-declarations are resolved correctly;
      - Extends the clang-import-test harness to test 
        two-level importing, so that we make sure we 
        complete types when necessary; and
      - Fixes a few bugs I found this way. Failure to 
        complete types was one; however, I also discovered 
        that complete RecordDecls aren't properly added to 
        the redecls chain for existing forward 
        declarations.
      
      llvm-svn: 302975
      9092d479
  17. Apr 17, 2017
  18. Apr 13, 2017
  19. Apr 12, 2017
  20. Apr 11, 2017
Loading