aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CIR/CodeGen/CIRGenModule.cpp
diff options
context:
space:
mode:
authorAndy Kaylor <akaylor@nvidia.com>2025-09-03 12:06:56 -0700
committerGitHub <noreply@github.com>2025-09-03 12:06:56 -0700
commit88c38258891fe7572b1d57b42dea059d422ced6f (patch)
tree855bc471176b538f06326d35519dfbeee20357d7 /clang/lib/CIR/CodeGen/CIRGenModule.cpp
parenta862225813c251c28b085603b7d32d4b111dbc57 (diff)
downloadllvm-88c38258891fe7572b1d57b42dea059d422ced6f.zip
llvm-88c38258891fe7572b1d57b42dea059d422ced6f.tar.gz
llvm-88c38258891fe7572b1d57b42dea059d422ced6f.tar.bz2
[CIR] Add support for constructors with VTT parameters (#156521)
This adds the support for implicit VTT arguments in constructors.
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenModule.cpp')
-rw-r--r--clang/lib/CIR/CodeGen/CIRGenModule.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
index c7f5484..0b3453b 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
@@ -1001,10 +1001,17 @@ cir::GlobalOp CIRGenModule::createOrReplaceCXXRuntimeVariable(
mlir::SymbolTable::lookupSymbolIn(theModule, name));
if (gv) {
- // There should be handling added here to check the type as assert that
- // gv was a declaration if the type doesn't match and handling below
- // to replace the variable if it was a declaration.
- errorNYI(loc, "createOrReplaceCXXRuntimeVariable: already exists");
+ // Check if the variable has the right type.
+ if (gv.getSymType() == ty)
+ return gv;
+
+ // Because of C++ name mangling, the only way we can end up with an already
+ // existing global with the same name is if it has been declared extern
+ // "C".
+ assert(gv.isDeclaration() && "Declaration has wrong type!");
+
+ errorNYI(loc, "createOrReplaceCXXRuntimeVariable: declaration exists with "
+ "wrong type");
return gv;
}