[Clang] ensure mangled names are valid identifiers before being suggested in ifunc/alias attributes notes (#118170)
Fixes #112205
---
Commit that introduced this feature -
9306ef9750
This commit is contained in:
parent
97f94af356
commit
071da9261b
@ -762,6 +762,7 @@ Bug Fixes to C++ Support
|
||||
- Fixed a bug where bounds of partially expanded pack indexing expressions were checked too early. (#GH116105)
|
||||
- Fixed an assertion failure caused by using ``consteval`` in condition in consumed analyses. (#GH117385)
|
||||
- Fix a crash caused by incorrect argument position in merging deduced template arguments. (#GH113659)
|
||||
- Fixed an assertion failure caused by mangled names with invalid identifiers. (#GH112205)
|
||||
|
||||
Bug Fixes to AST Handling
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@ -602,7 +602,8 @@ static bool checkAliasedGlobal(
|
||||
// mangled name.
|
||||
for (const auto &[Decl, Name] : MangledDeclNames) {
|
||||
if (const auto *ND = dyn_cast<NamedDecl>(Decl.getDecl())) {
|
||||
if (ND->getName() == GV->getName()) {
|
||||
IdentifierInfo *II = ND->getIdentifier();
|
||||
if (II && II->getName() == GV->getName()) {
|
||||
Diags.Report(Location, diag::note_alias_mangled_name_alternative)
|
||||
<< Name
|
||||
<< FixItHint::CreateReplacement(
|
||||
|
||||
@ -26,6 +26,9 @@ __attribute__((unused, alias("resolver"), deprecated("hahahaha, isn't C great?")
|
||||
void func();
|
||||
// expected-error@-2 {{alias must point to a defined variable or function}}
|
||||
// expected-note@-3 {{must refer to its mangled name}}
|
||||
|
||||
void *operator new(unsigned long) __attribute__((alias("A"))); // expected-error {{alias must point to a defined variable or function}} \
|
||||
// expected-note {{the function or variable specified in an alias must refer to its mangled name}}
|
||||
#endif
|
||||
|
||||
// CHECK: @_ZN4libc4log2Ed ={{.*}} alias double (double), ptr @log2
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user