From 67960e5c08629bb78c147bd0a86764967448b33c Mon Sep 17 00:00:00 2001 From: erichkeane Date: Fri, 7 Mar 2025 08:04:02 -0800 Subject: [OpenACC] Ensure decl OpenACC constructs don't crash I initially implemented codegen to be a 'no-op' for these declarations, which I thought was properly implemented. However, when they are a top-level decl, we have a separate switch. This patch makes sure they are properly emitted at top-level as a no-op, and adds a test for both top-level and not top-level. --- clang/lib/CodeGen/CodeGenModule.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index bca0a93..d2c97ce 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -7300,6 +7300,13 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { getHLSLRuntime().addBuffer(cast(D)); break; + case Decl::OpenACCDeclare: + EmitOpenACCDeclare(cast(D)); + break; + case Decl::OpenACCRoutine: + EmitOpenACCRoutine(cast(D)); + break; + default: // Make sure we handled everything we should, every other kind is a // non-top-level decl. FIXME: Would be nice to have an isTopLevelDeclKind -- cgit v1.1