[clang] [Clang][CodeGen] Start migrating away from assuming the Default AS is 0 (PR #88182)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 9 12:44:12 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 8795822f6ae2e82e23f7fd87a84d6d273e6c04ac 453e96aafd02bd19f44c0383acb74b930d2767c9 -- clang/test/CodeGenCXX/dynamic-cast-nonzero-default-address-space.cpp clang/test/CodeGenCXX/template-param-objects-nonzero-default-address-space.cpp clang/test/CodeGenCXX/throw-expression-typeinfo-in-nonzero-default-address-space.cpp clang/test/CodeGenCXX/try-catch-with-nonzero-default-address-space.cpp clang/test/CodeGenCXX/typeid-cxx11-with-nonzero-default-address-space.cpp clang/test/CodeGenCXX/typeid-with-nonzero-default-address-space.cpp clang/test/CodeGenCXX/typeinfo-with-nonzero-default-address-space.cpp clang/test/CodeGenCXX/vtable-align-nonzero-default-address-space.cpp clang/test/CodeGenCXX/vtable-assume-load-nonzero-default-address-space.cpp clang/test/CodeGenCXX/vtable-consteval-nonzero-default-address-space.cpp clang/test/CodeGenCXX/vtable-constexpr-nonzero-default-address-space.cpp clang/test/CodeGenCXX/vtable-key-function-nonzero-default-address-space.cpp clang/test/CodeGenCXX/vtable-layout-extreme-nonzero-default-address-space.cpp clang/test/CodeGenCXX/vtable-linkage-nonzero-default-address-space.cpp clang/test/CodeGenCXX/vtable-pointer-initialization-nonzero-default-address-space.cpp clang/test/CodeGenCXX/vtt-layout-with-nonzero-default-address-space.cpp clang/test/CodeGenCXX/vtt-nonzero-default-address-space.cpp clang/lib/CodeGen/CGExprCXX.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/CodeGenTypeCache.h clang/lib/CodeGen/ItaniumCXXABI.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 158dca1146..8ed88b34b4 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -3582,10 +3582,10 @@ ConstantAddress CodeGenModule::GetAddrOfTemplateParamObject(
isExternallyVisible(TPO->getLinkageAndVisibility().getLinkage())
? llvm::GlobalValue::LinkOnceODRLinkage
: llvm::GlobalValue::InternalLinkage;
- auto *GV = new llvm::GlobalVariable(getModule(), Init->getType(),
- /*isConstant=*/true, Linkage, Init, Name,
- nullptr, llvm::GlobalValue::NotThreadLocal,
- GlobalsInt8PtrTy->getAddressSpace());
+ auto *GV = new llvm::GlobalVariable(
+ getModule(), Init->getType(),
+ /*isConstant=*/true, Linkage, Init, Name, nullptr,
+ llvm::GlobalValue::NotThreadLocal, GlobalsInt8PtrTy->getAddressSpace());
setGVProperties(GV, TPO);
if (supportsCOMDAT())
GV->setComdat(TheModule.getOrInsertComdat(GV->getName()));
@@ -4552,10 +4552,10 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction(
IsIncompleteFunction = true;
}
- llvm::Function *F = llvm::Function::Create(
- FTy, llvm::Function::ExternalLinkage,
- getDataLayout().getProgramAddressSpace(),
- Entry ? StringRef() : MangledName, &getModule());
+ llvm::Function *F =
+ llvm::Function::Create(FTy, llvm::Function::ExternalLinkage,
+ getDataLayout().getProgramAddressSpace(),
+ Entry ? StringRef() : MangledName, &getModule());
// Store the declaration associated with this function so it is potentially
// updated by further declarations or definitions and emitted at the end.
@@ -5025,10 +5025,9 @@ llvm::GlobalVariable *CodeGenModule::CreateOrReplaceCXXRuntimeVariable(
}
// Create a new variable.
- GV = new llvm::GlobalVariable(getModule(), Ty, /*isConstant=*/true,
- Linkage, nullptr, Name, nullptr,
- llvm::GlobalValue::NotThreadLocal,
- GlobalsInt8PtrTy->getAddressSpace());
+ GV = new llvm::GlobalVariable(
+ getModule(), Ty, /*isConstant=*/true, Linkage, nullptr, Name, nullptr,
+ llvm::GlobalValue::NotThreadLocal, GlobalsInt8PtrTy->getAddressSpace());
if (OldGV) {
// Replace occurrences of the old variable if needed.
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index 942ab4c3a4..5e42e94bf3 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -3680,12 +3680,11 @@ void ItaniumRTTIBuilder::BuildVTablePointer(const Type *Ty) {
llvm::Type *Ty = llvm::ArrayType::get(CGM.GlobalsInt8PtrTy, 0);
// FIXME: External StdLib VTables should be constant as well, but changing
// it *might* constitute a very subtle ABI break.
- VTable = new llvm::GlobalVariable(CGM.getModule(), Ty,
- /*isConstant=*/false,
- llvm::GlobalVariable::ExternalLinkage,
- nullptr, VTableName, nullptr,
- llvm::GlobalValue::NotThreadLocal,
- CGM.GlobalsInt8PtrTy->getAddressSpace());
+ VTable = new llvm::GlobalVariable(
+ CGM.getModule(), Ty,
+ /*isConstant=*/false, llvm::GlobalVariable::ExternalLinkage, nullptr,
+ VTableName, nullptr, llvm::GlobalValue::NotThreadLocal,
+ CGM.GlobalsInt8PtrTy->getAddressSpace());
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/88182
More information about the cfe-commits
mailing list