From 69126392ad8f3e15d3c6e3f434c5d3efd7d20c6b Mon Sep 17 00:00:00 2001 From: June Rhodes Date: Thu, 27 Jun 2024 15:56:10 +1000 Subject: [PATCH] Try to fix GCC parsing bug, and ignore CXXRecordDecls with ClassTemplateDecl parent --- .gitignore | 2 ++ clang/include/clang/ASTMatchers/ASTMatchers.h | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 20c4f52cd37860..361fae3f420e2b 100644 --- a/.gitignore +++ b/.gitignore @@ -70,3 +70,5 @@ pythonenv* /clang/utils/analyzer/projects/*/RefScanBuildResults # automodapi puts generated documentation files here. /lldb/docs/python_api/ +.github/workflows/llvm.msi +.github/workflows/llvm.wixpdb diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index 8e26234b8e2a3b..2320ed9eec7864 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -3946,6 +3946,11 @@ AST_POLYMORPHIC_MATCHER(isMissingDllImportOrExport, VarDecl)) { bool PermittedToExport = false; if (const CXXRecordDecl *CXXD = dyn_cast(&Node)) { + if (isa(CXXD->getParent())) { + // This type declaration is part of a template, and therefore can not be + // exported. + return false; + } if (const VarDecl *CXXDVD = dyn_cast_or_null(CXXD->getNextDeclInContext())) { if (CXXDVD != nullptr && @@ -3974,8 +3979,8 @@ AST_POLYMORPHIC_MATCHER(isMissingDllImportOrExport, PermittedToExport = VD->hasGlobalStorage() && VD->getStorageClass() != SC_Static; } - return PermittedToExport && (!Node.hasAttr()) && - (!Node.hasAttr()); + return PermittedToExport && (!(Node.hasAttr())) && + (!(Node.hasAttr())); } // @unreal: END