[clang] [CIR] Add support for initializing classes with multiple vtables (PR #155275)
Amr Hesham via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 25 13:57:25 PDT 2025
================
@@ -126,6 +127,32 @@ static bool isInitializerOfDynamicClass(const CXXCtorInitializer *baseInit) {
return baseClassDecl->isDynamicClass();
}
+namespace {
+/// A visitor which checks whether an initializer uses 'this' in a
+/// way which requires the vtable to be properly set.
+struct DynamicThisUseChecker
+ : ConstEvaluatedExprVisitor<DynamicThisUseChecker> {
+ using super = ConstEvaluatedExprVisitor<DynamicThisUseChecker>;
+
+ bool usesThis = false;
+
+ DynamicThisUseChecker(const ASTContext &c) : super(c) {}
+
+ // Black-list all explicit and implicit references to 'this'.
+ //
+ // Do we need to worry about external references to 'this' derived
+ // from arbitrary code? If so, then anything which runs arbitrary
----------------
AmrDeveloper wrote:
```suggestion
// from arbitrary code? If so, then anything which runs arbitrary
```
https://github.com/llvm/llvm-project/pull/155275
More information about the cfe-commits
mailing list