[all-commits] [llvm/llvm-project] 652ae4: [Clang][Sema] Warn when 'exclude_from_explicit_ins...

Krystian Stasiowski via All-commits all-commits at lists.llvm.org
Thu Apr 18 04:48:33 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 652ae4ecadaa972d70ef5cea3b68f2ff103c4af2
      https://github.com/llvm/llvm-project/commit/652ae4ecadaa972d70ef5cea3b68f2ff103c4af2
  Author: Krystian Stasiowski <sdkrystian at gmail.com>
  Date:   2024-04-18 (Thu, 18 Apr 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaDeclAttr.cpp
    A clang/test/SemaCXX/attr-exclude_from_explicit_instantiation.local-class.cpp

  Log Message:
  -----------
  [Clang][Sema] Warn when 'exclude_from_explicit_instantiation' attribute is used on local classes and members thereof (#88777)

A local class and its members declared in a function template are
instantiated alongside the definition of that template. It therefore
does not make sense to apply the `exclude_from_explicit_instantiation`
attribute to such declarations, and this patch adds a warning to
diagnose these cases (in addition to ignoring the attribute).

(The motivation for this patch is to fix a failing test in libc++ for
#84050. In particular, line 199 in `include/__memory/uses_allocator_construction.h`
in libc++ contains the expression `this->__value_` (reduced to 
https://godbolt.org/z/KqEerKWPd) which will be looked up prior
to instantiation once #84050 lands (the lookup context is the 
current instantiation). `_LIBCPP_HIDE_FROM_ABI` includes 
`__attribute__((exclude_from_explicit_instantiation))`, which in the 
reduced example results in `Local` being instantiated with 
`Local::operator A` as its `DeclContext`)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list