mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 15:41:46 +00:00
Fixed failed assertion w/attribute on anon unions
This amends 304d1304b7
to process the
declaration attributes rather than assert on them; nothing prevents an
attribute from being written on an anonymous union.
Fixes https://github.com/llvm/llvm-project/issues/48512
This commit is contained in:
parent
5421ab4625
commit
82e29c65e3
@ -528,6 +528,9 @@ Bug Fixes in This Version
|
||||
statement expression that appears outside of a function block scope. The
|
||||
assertion was benign outside of asserts builds and would only fire in C.
|
||||
(`#48579 <https://github.com/llvm/llvm-project/issues/48579>_`).
|
||||
- Fixed a failing assertion when applying an attribute to an anonymous union.
|
||||
The assertion was benign outside of asserts builds and would only fire in C++.
|
||||
(`#48512 <https://github.com/llvm/llvm-project/issues/48512>_`).
|
||||
|
||||
Bug Fixes to Compiler Builtins
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -5716,10 +5716,10 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
|
||||
SC = SC_None;
|
||||
}
|
||||
|
||||
assert(DS.getAttributes().empty() && "No attribute expected");
|
||||
Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(),
|
||||
Record->getLocation(), /*IdentifierInfo=*/nullptr,
|
||||
Context.getTypeDeclType(Record), TInfo, SC);
|
||||
ProcessDeclAttributes(S, Anon, Dc);
|
||||
|
||||
// Default-initialize the implicit variable. This initialization will be
|
||||
// trivial in almost all cases, except if a union member has an in-class
|
||||
|
@ -215,3 +215,8 @@ namespace PR16630 {
|
||||
b.y = 0; // expected-error {{'y' is a private member of 'PR16630::A'}}
|
||||
}
|
||||
}
|
||||
|
||||
namespace GH48512 {
|
||||
// This would previously cause an assertion in C++ mode.
|
||||
static __attribute__((a)) union { int a; }; // expected-warning {{unknown attribute 'a' ignored}}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user