[PATCH] D121959: [clang] Add missing diagnostics for invalid overloads of multiversion functions in C.

Tom Honermann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 17 14:52:25 PDT 2022


tahonermann created this revision.
tahonermann added reviewers: erichkeane, aaron.ballman.
Herald added a project: All.
tahonermann published this revision for review.
tahonermann added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This change resolves both LLVM issue https://github.com/llvm/llvm-project/issues/50192 and Intel issue CMPLRLLVM-28177.


Previously, an attempt to declare an overload of a multiversion function
in C was not properly diagnosed. In some cases, diagnostics were simply
missing. In other cases the following assertion failure occured...

  Assertion `(Previous.empty() || llvm::any_of(Previous, [](const NamedDecl *ND) { return ND->hasAttr(); })) && "Non-redecls shouldn't happen without overloadable present"' failed.

... or the following diagnostic was spuriously issued.

  error: at most one overload for a given name may lack the 'overloadable' attribute

The diagnostics issued in some cases could be improved. When the function
type of a redeclaration does not match the prior declaration, it would be
preferable to diagnose the type mismatch before diagnosing mismatched
attributes. Diagnostics are also missing for some cases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121959

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Sema/attr-cpuspecific.c
  clang/test/Sema/attr-target-clones.c
  clang/test/Sema/attr-target-mv.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121959.416324.patch
Type: text/x-patch
Size: 7696 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220317/7b5152de/attachment.bin>


More information about the cfe-commits mailing list