Skip to content
  1. Nov 18, 2021
  2. Nov 11, 2021
  3. Nov 08, 2021
  4. Nov 06, 2021
    • hyeongyukim's avatar
      [Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default · aacfbb95
      hyeongyukim authored
      Turning on `enable_noundef_analysis` flag allows better codegen by removing freeze instructions.
      I modified clang by renaming `enable_noundef_analysis` flag to `disable-noundef-analysis` and turning it off by default.
      
      Test updates are made as a separate patch: D108453
      
      Reviewed By: eugenis
      
      Differential Revision: https://reviews.llvm.org/D105169
      
      [Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default (2)
      
      This patch updates test files after D105169.
      Autogenerated test codes are changed by `utils/update_cc_test_checks.py,` and non-autogenerated test codes are changed as follows:
      
      (1) I wrote a python script that (partially) updates the tests using regex: {F18594904} The script is not perfect, but I believe it gives hints about which patterns are updated to have `noundef` attached.
      
      (2) The remaining tests are updated manually.
      
      Reviewed By: eugenis
      
      Differential Revision: https://reviews.llvm.org/D108453
      
      Resolve lit failures in clang after 8ca4b3ef's land
      
      Fix lit test failures in clang-ppc* and clang-x64-windows-msvc
      
      Fix missing failures in clang-ppc64be* and retry fixing clang-x64-windows-msvc
      
      Fix internal_clone(aarch64) inline assembly
      aacfbb95
    • Juneyoung Lee's avatar
      Revert "[Clang/Test]: Rename enable_noundef_analysis to... · 89ad2822
      Juneyoung Lee authored
      Revert "[Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default"
      
      This reverts commit 7584ef76.
      89ad2822
    • Juneyoung Lee's avatar
      [Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default · 7584ef76
      Juneyoung Lee authored
      Turning on `enable_noundef_analysis` flag allows better codegen by removing freeze instructions.
      I modified clang by renaming `enable_noundef_analysis` flag to `disable-noundef-analysis` and turning it off by default.
      
      Test updates are made as a separate patch: D108453
      
      Reviewed By: eugenis
      
      Differential Revision: https://reviews.llvm.org/D105169
      7584ef76
  5. Nov 04, 2021
    • Volodymyr Sapsai's avatar
      [clang][objc] Speed up populating the global method pool from modules. · 0a35cc40
      Volodymyr Sapsai authored
      For each selector encountered in the source code, we need to load
      selectors from the imported modules and check that we are calling a
      selector with compatible types.
      
      At the moment, for each module we are storing methods declared in the
      headers belonging to this module and methods from the transitive closure
      of imported modules. When a module is imported by a few other modules,
      methods from the shared module are duplicated in each importer. As the
      result, we can end up with lots of identical methods that we try to add
      to the global method pool. Doing this duplicate work is useless and
      relatively expensive.
      
      Avoid processing duplicate methods by storing in each module only its
      own methods and not storing methods from dependencies. Collect methods
      from dependencies by walking the graph of module dependencies.
      
      The issue was discovered and reported by Richard Howell. He has done the
      hard work for this fix as he has investigated and provided a detailed
      explanation of the performance problem.
      
      Differential Revision: https://reviews.llvm.org/D110123
      0a35cc40
  6. Nov 02, 2021
    • David Blaikie's avatar
      DebugInfo: workaround for context-sensitive use of non-type-template-parameter integer suffixes · 8bf12445
      David Blaikie authored
      There's a nuanced check about when to use suffixes on these integer
      non-type-template-parameters, but when rebuilding names for
      -gsimple-template-names there isn't enough data in the DWARF to
      determine when to use suffixes or not. So turn on suffixes always to
      make it easy to match up names in llvm-dwarfdump --verify.
      
      I /think/ if we correctly modelled auto non-type-template parameters
      maybe we could put suffixes only on those. But there's also some logic
      in Clang that puts the suffixes on overloaded functions - at least
      that's what the parameter says (see D77598 and printTemplateArguments
      "TemplOverloaded" parameter) - but I think maybe it's for anything that
      /can/ be overloaded, not necessarily only the things that are overloaded
      (the argument value is hardcoded at the various callsites, doesn't seem
      to depend on overload resolution/searching for overloaded functions). So
      maybe with "auto" modeled more accurately, and differentiating between
      function templates (always using type suffixes there) and class/variable
      templates (only using the suffix for "auto" types) we could correctly
      use integer type suffixes only in the minimal set of cases.
      
      But that seems all too much fuss, so let's just put integer type
      suffixes everywhere always in the debug info of integer non-type
      template parameters in template names.
      
      (more context:
      * https://reviews.llvm.org/D77598#inline-1057607
      * https://groups.google.com/g/llvm-dev/c/ekLMllbLIZg/m/-dhJ0hO1AAAJ )
      
      Differential Revision: https://reviews.llvm.org/D111477
      8bf12445
  7. Nov 01, 2021
  8. Oct 26, 2021
  9. Oct 22, 2021
  10. Oct 21, 2021
    • Volodymyr Sapsai's avatar
      [modules] Fix tracking ObjCInterfaceType decl when there are multiple definitions. · d9eca332
      Volodymyr Sapsai authored
      With the old approach we were updating `ObjCInterfaceType.Decl` to the
      last encountered definition. But during loading modules
      `ASTDeclReader::VisitObjCInterfaceDecl` keeps the *first* encountered
      definition. So with multiple definitions imported there would be a
      disagreement between expected definition in `ObjCInterfaceType.Decl` and
      actual definition `ObjCInterfaceDecl::getDefinition` which can lead to
      incorrect diagnostic.
      
      Fix by not tracking definition in `ObjCInterfaceType` explicitly but by
      getting it from redeclaration chain.
      
      Partially reverted 919fc500 keeping the
      modified test case as the correct behavior is achieved in a different
      way.
      
      Differential Revision: https://reviews.llvm.org/D110452
      d9eca332
    • David Blaikie's avatar
      Recommit: Compress formatting of array type names (int [4] -> int[4]) · aee49255
      David Blaikie authored
      Based on post-commit review discussion on
      2bd84938 with Richard Smith.
      
      Other uses of forcing HasEmptyPlaceHolder to false seem OK to me -
      they're all around pointer/reference types where the pointer/reference
      token will appear at the rightmost side of the left side of the type
      name, so they make nested types (eg: the "int" in "int *") behave as
      though there is a non-empty placeholder (because the "*" is essentially
      the placeholder as far as the "int" is concerned).
      
      This was originally committed in 277623f4
      
      Reverted in f9ad1d1c due to breakages
      outside of clang - lldb seems to have some strange/strong dependence on
      "char [N]" versus "char[N]" when printing strings (not due to that name
      appearing in DWARF, but probably due to using clang to stringify type
      names) that'll need to be addressed, plus a few other odds and ends in
      other subprojects (clang-tools-extra, compiler-rt, etc).
      aee49255
    • Volodymyr Sapsai's avatar
      [modules] While merging ObjCInterfaceDecl definitions, merge them as decl contexts too. · c5931267
      Volodymyr Sapsai authored
      While working on https://reviews.llvm.org/D110280 I've tried to merge
      decl contexts as it seems to be correct and matching our handling of
      decl contexts from different modules. It's not required for the fix in
      https://reviews.llvm.org/D110280 but it revealed a missing diagnostic,
      so separating this change into a separate commit.
      
      Renamed some variables to distinguish diagnostic like "declaration of
      'x' does not match" for different cases.
      
      Differential Revision: https://reviews.llvm.org/D110287
      c5931267
  11. Oct 18, 2021
  12. Oct 16, 2021
  13. Oct 15, 2021
  14. Oct 14, 2021
    • David Blaikie's avatar
      Revert "Compress formatting of array type names (int [4] -> int[4])" · f9ad1d1c
      David Blaikie authored
      Looks like lldb has some issues with this - somehow it causes lldb to
      treat a "char[N]" type as an array of chars (prints them out
      individually) but a "char [N]" is printed as a string. (even though the
      DWARF doesn't have this string in it - it's something to do with the
      string lldb generates for itself using clang)
      
      This reverts commit 277623f4.
      f9ad1d1c
    • David Blaikie's avatar
      Compress formatting of array type names (int [4] -> int[4]) · 277623f4
      David Blaikie authored
      Based on post-commit review discussion on
      2bd84938 with Richard Smith.
      
      Other uses of forcing HasEmptyPlaceHolder to false seem OK to me -
      they're all around pointer/reference types where the pointer/reference
      token will appear at the rightmost side of the left side of the type
      name, so they make nested types (eg: the "int" in "int *") behave as
      though there is a non-empty placeholder (because the "*" is essentially
      the placeholder as far as the "int" is concerned).
      277623f4
  15. Oct 13, 2021
    • Jan Svoboda's avatar
      [clang][modules] Cache loads of modules imported by PCH · 08c8016c
      Jan Svoboda authored
      During explicit modular build, PCM files are typically specified via the `-fmodule-file=<path>` command-line option. Early during the compilation, Clang uses the `ASTReader` to read their contents and caches the result so that the module isn't loaded implicitly later on. A listener is attached to the `ASTReader` to collect names of the modules read from the PCM files. However, if the PCM has already been loaded previously via PCH:
      1. the `ASTReader` doesn't do anything for the second time,
      2. the listener is not invoked at all,
      3. the module load result is not cached,
      4. the compilation fails when attempting to load the module implicitly later on.
      
      This patch solves this problem by attaching the listener to the `ASTReader` for PCH reading as well.
      
      Reviewed By: dexonsmith
      
      Differential Revision: https://reviews.llvm.org/D111560
      08c8016c
  16. Oct 08, 2021
    • Jake Egan's avatar
      [AIX] Disable tests failing due to missing DWARF sections · 8037481c
      Jake Egan authored
      The following tests are failing due to missing DWARF sections. This patch sets these tests as XFAIL/DISABLED on AIX until a more permanent solution is implemented.
      
      Reviewed By: shchenz
      
      Differential Revision: https://reviews.llvm.org/D111336
      8037481c
    • Qiongsi Wu's avatar
      [AIX][ZOS] Excluding merge-objc-interface.m from Tests · 75127bce
      Qiongsi Wu authored
      Objective C is not supported on AIX or ZOS. This patch excludes the newly added `clang/test/Modules/merge-objc-interface.m` (added by https://reviews.llvm.org/D110280) from AIX and ZOS testing.
      
      Many existing tests are already disabled by https://reviews.llvm.org/D109060.
      
      Reviewed By: jsji
      
      Differential Revision: https://reviews.llvm.org/D111406
      75127bce
    • Volodymyr Sapsai's avatar
      [modules] Fix IRGen assertion on accessing ObjC ivar inside a method. · 9fad9de5
      Volodymyr Sapsai authored
      When have ObjCInterfaceDecl with the same name in 2 different modules,
      hitting the assertion
      
      > Assertion failed: (Index < RL->getFieldCount() && "Ivar is not inside record layout!"),
      > function lookupFieldBitOffset, file llvm-project/clang/lib/AST/RecordLayoutBuilder.cpp, line 3434.
      
      on accessing an ivar inside a method. The assertion happens because
      ivar belongs to one module while its containing interface belongs to
      another module and then we fail to find the ivar inside the containing
      interface. We already keep a single ObjCInterfaceDecl definition in
      redecleration chain and in this case containing interface was correct.
      The issue is with ObjCIvarDecl. IVar decl for IRGen is taken from
      ObjCIvarRefExpr that is created in `Sema::BuildIvarRefExpr` using ivar
      decl returned from `Sema::LookupIvarInObjCMethod`. And ivar lookup
      returns a wrong decl because basically we take the first ObjCIvarDecl
      found in `ASTReader::FindExternalVisibleDeclsByName` (called by
      `DeclContext::lookup`). And in `ASTReader.Lookups` lookup table for a
      wrong module comes first because `ASTReader::finishPendingActions`
      processes `PendingUpdateRecords` in reverse order and the first
      encountered ObjCIvarDecl will end up the last in `ASTReader.Lookups`.
      
      Fix by merging ObjCIvarDecl from different modules correctly and by
      using a canonical one in IRGen.
      
      rdar://82854574
      
      Differential Revision: https://reviews.llvm.org/D110280
      9fad9de5
  17. Sep 16, 2021
  18. Aug 31, 2021
    • Volodymyr Sapsai's avatar
      [modules] Fix miscompilation when using two RecordDecl definitions with the same name. · 93764ff6
      Volodymyr Sapsai authored
      When deserializing a RecordDecl we don't enforce that redeclaration
      chain contains only a single definition. So if the canonical decl is not
      a definition itself, `RecordType::getDecl` can return different objects
      before and after an include. It means we can build CGRecordLayout for
      one RecordDecl with its set of FieldDecl but try to use it with
      FieldDecl belonging to a different RecordDecl. With assertions enabled
      it results in
      
      > Assertion failed: (FieldInfo.count(FD) && "Invalid field for record!"),
      > function getLLVMFieldNo, file llvm-project/clang/lib/CodeGen/CGRecordLayout.h, line 199.
      
      and with assertions disabled a bunch of fields are treated as their
      memory is located at offset 0.
      
      Fix by keeping the first encountered RecordDecl definition and marking
      the subsequent ones as non-definitions. Also need to merge FieldDecl
      properly, so that `getPrimaryMergedDecl` works correctly and during name
      lookup we don't treat fields from same-name RecordDecl as ambiguous.
      
      rdar://80184238
      
      Differential Revision: https://reviews.llvm.org/D106994
      93764ff6
  19. Aug 17, 2021
  20. Aug 13, 2021
  21. Aug 06, 2021
    • Jan Svoboda's avatar
      [clang] Remove misleading assertion in FullSourceLoc · 4aafd5f0
      Jan Svoboda authored
      D31709 added an assertion was added to `FullSourceLoc::hasManager()` that ensured a valid `SourceLocation` is always paired with a `SourceManager`, and missing `SourceManager` is always paired with an invalid `SourceLocation`.
      
      This appears to be incorrect, since clients never cared about constructing `FullSourceLoc` to uphold that invariant, or always checking `isValid()` before calling `hasManager()`.
      
      The assertion started failing when serializing diagnostics pointing into an explicit module. Explicit modules don't have valid `SourceLocation` for the `import` statement, since they are "imported" from the command-line argument `-fmodule-name=x.pcm`.
      
      This patch removes the assertion, since `FullSourceLoc` was never intended to uphold any kind of invariants between the validity of `SourceLocation` and presence of `SourceManager`.
      
      Reviewed By: arphaman
      
      Differential Revision: https://reviews.llvm.org/D106862
      4aafd5f0
  22. Aug 04, 2021
  23. Jul 02, 2021
  24. Jun 14, 2021
    • Jan Svoboda's avatar
      [clang][modules][pch] Allow loading PCH with different modules cache path · 78668c82
      Jan Svoboda authored
      It's useful to be able to load explicitly-built PCH files into an implicit build (e.g. during dependency scanning). That's currently impossible, since the explicitly-built PCH has an empty modules cache path, while the current compilation has (and needs to have) a valid path, triggering an error in the `PCHValidator`.
      
      This patch adds a preprocessor option and command-line flag that can be used to omit this check.
      
      Reviewed By: dexonsmith
      
      Differential Revision: https://reviews.llvm.org/D103802
      78668c82
  25. Jun 03, 2021
  26. May 17, 2021
    • Michael Spencer's avatar
      [clang][modules] Build inferred modules · d3676d4b
      Michael Spencer authored
      This patch enables explicitly building inferred modules.
      
      Effectively a cherry-pick of https://github.com/apple/llvm-project/pull/699 authored by @Bigcheese with libclang and dependency scanner changes omitted.
      
      Contains the following changes:
      
      1. [Clang] Fix the header paths in clang::Module for inferred modules.
        * The UmbrellaAsWritten and NameAsWritten fields in clang::Module are a lie for framework modules. For those they actually are the path to the header or umbrella relative to the clang::Module::Directory.
        * The exception to this case is for inferred modules. Here it actually is the name as written, because we print out the module and read it back in when implicitly building modules. This causes a problem when explicitly building an inferred module, as we skip the printing out step.
        * In order to fix this issue this patch adds a new field for the path we want to use in getInputBufferForModule. It also makes NameAsWritten actually be the name written in the module map file (or that would be, in the case of an inferred module).
      
      2. [Clang] Allow explicitly building an inferred module.
        * Building the actual module still fails, but make sure it fails for the right reason.
      
      Split from D100934.
      
      Reviewed By: dexonsmith
      
      Differential Revision: https://reviews.llvm.org/D102491
      d3676d4b
  27. Apr 17, 2021
    • Ben Barham's avatar
      [ASTReader] Only mark module out of date if not already compiled · 1206b95e
      Ben Barham authored
      If a module contains errors (ie. it was built with
      -fallow-pcm-with-compiler-errors and had errors) and was from the module
      cache, it is marked as out of date - see
      a2c1054c.
      
      When a module is imported multiple times in the one compile, this caused
      it to be recompiled each time - removing the existing buffer from the
      module cache and replacing it. This results in various errors further
      down the line.
      
      Instead, only mark the module as out of date if it isn't already
      finalized in the module cache.
      
      Reviewed By: akyrtzi
      
      Differential Revision: https://reviews.llvm.org/D100619
      1206b95e
  28. Apr 12, 2021
Loading