llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Ben Shi (benshi001) <details> <summary>Changes</summary> fixes https://github.com/llvm/llvm-project/issues/236285 --- Full diff: https://github.com/llvm/llvm-project/pull/236752.diff 2 Files Affected: - (modified) clang/lib/CodeGen/CGCXX.cpp (+5-3) - (added) clang/test/CodeGen/avr/issue-236285.cpp (+19) ``````````diff diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index 8112783850bad3..94b625036b99fd 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -176,9 +176,11 @@ bool CodeGenModule::TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D) { // requires explicit comdat support in the IL. if (llvm::GlobalValue::isWeakForLinker(TargetLinkage)) return true; - // Create the alias with no name. - auto *Alias = llvm::GlobalAlias::create(AliasValueType, 0, Linkage, "", - Aliasee, &getModule()); + + // Create the alias with no name, in the same address space as the aliasee. + auto *Alias = + llvm::GlobalAlias::create(AliasValueType, Aliasee->getAddressSpace(), + Linkage, "", Aliasee, &getModule()); // Destructors are always unnamed_addr. Alias->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global); diff --git a/clang/test/CodeGen/avr/issue-236285.cpp b/clang/test/CodeGen/avr/issue-236285.cpp new file mode 100644 index 00000000000000..2c0e3d86c54fd4 --- /dev/null +++ b/clang/test/CodeGen/avr/issue-236285.cpp @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple avr -target-cpu atmega328 -emit-llvm -x c++ < %s | FileCheck %s + +// This test case verifies https://github.com/llvm/llvm-project/issues/236285 . + +struct A {}; +struct B : A { + ~B(); +}; + +B::~B() {} + +struct C : B { + ~C(); +}; + +C::~C() {} + +// CHECK: {{.*}} alias void (ptr), ptr addrspace(1) +// CHECK: {{.*}} alias void (ptr), ptr addrspace(1) `````````` </details> https://github.com/llvm/llvm-project/pull/236752 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
