Skip to content

Commit e50f9ae

Browse files
committed
[CIR] Add diagnostic for NYI AST visitor handlers
A couple of handlers that were missing from the CIRGenerator AST visitor allowed important features to be silently ignored during CIR generation. This change adds these handlers with diagnostics to report that they are not yet handled (except in the case where only debug information is missed).
1 parent 254b90f commit e50f9ae

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

clang/include/clang/CIR/CIRGenerator.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ class CIRGenerator : public clang::ASTConsumer {
7979
void HandleTranslationUnit(clang::ASTContext &astContext) override;
8080
void HandleInlineFunctionDefinition(clang::FunctionDecl *d) override;
8181
void HandleTagDeclDefinition(clang::TagDecl *d) override;
82+
void HandleTagDeclRequiredDefinition(const clang::TagDecl *D) override;
83+
void HandleCXXStaticMemberVarInstantiation(clang::VarDecl *D) override;
8284
void CompleteTentativeDefinition(clang::VarDecl *d) override;
85+
void HandleVTable(clang::CXXRecordDecl *rd) override;
8386

8487
mlir::ModuleOp getModule() const;
8588
mlir::MLIRContext &getMLIRContext() { return *mlirContext; };

clang/lib/CIR/CodeGen/CIRGenerator.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,30 @@ void CIRGenerator::HandleTagDeclDefinition(TagDecl *d) {
152152
cgm->errorNYI(d->getSourceRange(), "HandleTagDeclDefinition: OpenMP");
153153
}
154154

155+
void CIRGenerator::HandleTagDeclRequiredDefinition(const TagDecl *D) {
156+
if (diags.hasErrorOccurred())
157+
return;
158+
159+
assert(!cir::MissingFeatures::generateDebugInfo());
160+
}
161+
162+
void CIRGenerator::HandleCXXStaticMemberVarInstantiation(VarDecl *D) {
163+
if (diags.hasErrorOccurred())
164+
return;
165+
166+
cgm->errorNYI(D->getSourceRange(), "HandleCXXStaticMemberVarInstantiation");
167+
}
168+
155169
void CIRGenerator::CompleteTentativeDefinition(VarDecl *d) {
156170
if (diags.hasErrorOccurred())
157171
return;
158172

159173
cgm->emitTentativeDefinition(d);
160174
}
175+
176+
void CIRGenerator::HandleVTable(CXXRecordDecl *rd) {
177+
if (diags.hasErrorOccurred())
178+
return;
179+
180+
cgm->errorNYI(rd->getSourceRange(), "HandleVTable");
181+
}

0 commit comments

Comments
 (0)