Skip to content
  1. Mar 07, 2022
  2. Mar 01, 2022
    • Iain Sandoe's avatar
      [C++20][Modules][8/8] Amend module visibility rules for partitions. · a29f8dbb
      Iain Sandoe authored
      Implementation partitions bring two extra cases where we have
      visibility of module-private data.
      
      1) When we import a module implementation partition.
      2) When a partition implementation imports the primary module intertace.
      
      We maintain a record of direct imports into the current module since
      partition decls from direct imports (but not trasitive ones) are visible.
      
      The rules on decl-reachability are much more relaxed (with the standard
      giving permission for an implementation to load dependent modules and for
      the decls there to be reachable, but not visible).
      
      Differential Revision: https://reviews.llvm.org/D118599
      a29f8dbb
  3. Feb 26, 2022
  4. Feb 25, 2022
    • Iain Sandoe's avatar
      [C++20][Modules][4/8] Handle generation of partition implementation CMIs. · 61144914
      Iain Sandoe authored
      Partition implementations are special, they generate a CMI, but it
      does not have an 'export' line, and we cannot export anything from the
      it [that is it can only make decls available to other members of the
      owning module, not to importers of that].
      
      Add initial testcases for partition handling, derived from the examples in
      Section 10 of the C++20 standard, which identifies what should be accepted
      and/or rejected.
      
      Differential Revision: https://reviews.llvm.org/D118587
      61144914
  5. Feb 24, 2022
    • Aaron Ballman's avatar
      Add -Wno-strict-prototypes to C tests; NFC · 2ceee2f8
      Aaron Ballman authored
      This patch adds -Wno-strict-prototypes to all of the test cases that
      use functions without prototypes, but not as the primary concern of the
      test. e.g., attributes testing whether they can/cannot be applied to a
      function without a prototype, etc.
      
      This is done in preparation for enabling -Wstrict-prototypes by
      default.
      2ceee2f8
    • Iain Sandoe's avatar
      [C++20][Modules][3/8] Initial handling for module partitions. · 69350e56
      Iain Sandoe authored
      This implements the parsing and recognition of module partition CMIs
      and removes the FIXMEs in the parser.
      
      Module partitions are recognised in the base computation of visibility,
      however additional amendments to visibility follow in subsequent patches.
      
      Differential Revision: https://reviews.llvm.org/D118586
      69350e56
  6. Feb 23, 2022
    • Jan Svoboda's avatar
      [clang][modules] Infer framework modules in explicit builds · 27d9a584
      Jan Svoboda authored
      This patch enables inferring framework modules in explicit builds in all contexts. Until now, inferring framework modules only worked with `-fimplicit-module-maps` due to this block of code:
      
      ```
      // HeaderSearch::loadFrameworkModule
        case LMM_InvalidModuleMap:
          // Try to infer a module map from the framework directory.
          if (HSOpts->ImplicitModuleMaps)
            ModMap.inferFrameworkModule(Dir, IsSystem, /*Parent=*/nullptr);
          break;
      ```
      
      Reviewed By: Bigcheese
      
      Differential Revision: https://reviews.llvm.org/D113880
      27d9a584
    • iains's avatar
      [C++20][Modules] Rework testcase to use split file [NFC]. · e0f1dd01
      iains authored
      This switches the testcase committed for initial C++20 modules import tracking to
      use split-file rather than preprocessor directives.
      
      Differential Revision: https://reviews.llvm.org/D120352
      e0f1dd01
    • Iain Sandoe's avatar
      [Modules] Add module structure output to -module-file-info. · 5a74e6a2
      Iain Sandoe authored
      It is useful to be able to visualise the C++20 modules content of a PCM file
      both for inspection and for testing.  In particular, when adding more module
      types to support C++20 Partitions and Header Units, we would like to be able
      to confirm that the output PCM has the intended structure.
      
      The existing scheme for dumping data is restricted to the content of the AST
      file control block, which does not include structural data beyond imports.
      
      The change here makes use of the AST unit that is set up by BeginSourceFile
      to query for the information on the primary and sub-modules.  We can then
      inspect each of these in turn, accounting for Global, Private, Imported and
      Exported modules/fragments and then showing the sub-stucture of the main
      module(s).
      
      The disadvantage of this mechanism is that it has no easy method to control
      the granularity of the output.  Perhaps more detailed inspection would be
      better handled by a stand-alone module inspection tool.
      
      Differential Revision: https://reviews.llvm.org/D119823
      5a74e6a2
  7. Feb 21, 2022
    • Iain Sandoe's avatar
      [C++20][Modules][1/8] Track valid import state. · ab28488e
      Iain Sandoe authored
      In C++20 modules imports must be together and at the start of the module.
      Rather than growing more ad-hoc flags to test state, this keeps track of the
      phase of of a valid module TU (first decl, global module frag, module,
      private module frag).  If the phasing is broken (with some diagnostic) the
      pattern does not conform to a valid C++20 module, and we set the state
      accordingly.
      
      We can thus issue diagnostics when imports appear in the wrong places and
      decouple the C++20 modules state from other module variants (modules-ts and
      clang modules).  Additionally, we attempt to diagnose wrong imports before
      trying to find the module where possible (the latter will generally emit an
      unhelpful diagnostic about the module not being available).
      
      Although this generally simplifies the handling of C++20 module import
      diagnostics, the motivation was that, in particular, it allows detecting
      invalid imports like:
      
      import module A;
      
      int some_decl();
      
      import module B;
      
      where being in a module purview is insufficient to identify them.
      
      Differential Revision: https://reviews.llvm.org/D118893
      ab28488e
  8. Feb 20, 2022
    • Iain Sandoe's avatar
      Revert "[C++20][Modules][1/8] Track valid import state." · 67387924
      Iain Sandoe authored
      This reverts commit 8a3f9a58.
      
      need to investigate build failures that do not show on CI or local
      testing.
      67387924
    • Iain Sandoe's avatar
      [C++20][Modules][1/8] Track valid import state. · 8a3f9a58
      Iain Sandoe authored
      In C++20 modules imports must be together and at the start of the module.
      Rather than growing more ad-hoc flags to test state, this keeps track of the
      phase of of a valid module TU (first decl, global module frag, module,
      private module frag).  If the phasing is broken (with some diagnostic) the
      pattern does not conform to a valid C++20 module, and we set the state
      accordingly.
      
      We can thus issue diagnostics when imports appear in the wrong places and
      decouple the C++20 modules state from other module variants (modules-ts and
      clang modules).  Additionally, we attempt to diagnose wrong imports before
      trying to find the module where possible (the latter will generally emit an
      unhelpful diagnostic about the module not being available).
      
      Although this generally simplifies the handling of C++20 module import
      diagnostics, the motivation was that, in particular, it allows detecting
      invalid imports like:
      
      import module A;
      
      int some_decl();
      
      import module B;
      
      where being in a module purview is insufficient to identify them.
      
      Differential Revision: https://reviews.llvm.org/D118893
      8a3f9a58
  9. Feb 11, 2022
    • ZezhengLi's avatar
      [C++20] [Modules] Check if modulemap exists to avoid crash in implicit used C++ module · d7969012
      ZezhengLi authored
      An impilt used of C++ module without prebuild path may cause crash.
      
      For example:
      
      ```
      // ./dir1/C.cppm
      export module C;
      // ./dir2/B.cppm
      export module B;
      import C;
      // ./A.cpp
      import B;
      import C;
      ```
      
      When we compile A.cpp without the prebuild path of C.pcm, the compiler
      will crash.
      
      ```
      clang++ -std=c++20 --precompile -c ./dir1/C.cppm -o ./dir1/C.pcm
      clang++ -std=c++20 --precompile -fprebuilt-module-path=./dir2  -c
      ./dir2/B.cppm -o ./dir2/B.pcm
      clang++ -std=c++20 -fprebuilt-module-path=./dir2 A.cpp
      
      ```
      
      The prebuilt path of module C is cached when import module B, and in the
      function HeaderSearch::getCachedModuleFileName, the compiler try to get
      the filename by modulemap without check if modulemap exists, and there
      is no modulemap in C++ module.
      
      Reviewed By: ChuanqiXu
      
      Differential review: https://reviews.llvm.org/D119426
      d7969012
  10. Feb 10, 2022
    • Aaron Ballman's avatar
      Use functions with prototypes when appropriate; NFC · e9e55acd
      Aaron Ballman authored
      A significant number of our tests in C accidentally use functions
      without prototypes. This patch converts the function signatures to have
      a prototype for the situations where the test is not specific to K&R C
      declarations. e.g.,
      
        void func();
      
      becomes
      
        void func(void);
      
      This is the seventh batch of tests being updated (there are a
      significant number of other tests left to be updated).
      e9e55acd
  11. Jan 28, 2022
  12. Jan 24, 2022
  13. Jan 17, 2022
  14. Jan 16, 2022
  15. Jan 14, 2022
    • Chuanqi Xu's avatar
      [C++20] [Modules] Exit early if export decl is not valid · 4f8916cf
      Chuanqi Xu authored
      This patch fixes a crash due to following simple program:
      > export struct Unit {
      >    bool operator<(const Unit&);
      > };
      
      It would crash since the compiler would set the module ownership for
      Unit. And the declaration with a module ownership is assumed to own a
      module. But here isn't one. So here is the crash.
      
      This patch fixes this by exiting early if it finds the export decl is
      already invalid.
      
      Reviewed By: aaron.ballman
      
      Differential Revision: https://reviews.llvm.org/D117093
      4f8916cf
  16. Jan 11, 2022
  17. Jan 10, 2022
  18. Dec 23, 2021
  19. Dec 22, 2021
  20. Dec 21, 2021
  21. Dec 17, 2021
  22. Dec 08, 2021
  23. Nov 24, 2021
  24. Nov 18, 2021
  25. Nov 11, 2021
  26. Nov 08, 2021
Loading