[clang] [Clang][TableGen] Add explicit symbol visibility macros to code generated (PR #109362)
Vassil Vassilev via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 14 09:27:18 PDT 2024
https://github.com/vgvassilev updated https://github.com/llvm/llvm-project/pull/109362
>From 12b2bd669a46590247e5bd6ac8c76dc61529f331 Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Mon, 8 Jul 2024 01:48:46 +0100
Subject: [PATCH 1/2] [Clang][TableGen] Add explicit symbol visibility macros
to code generated
Update ClangAttrEmitter tablegen to add explicit symbol visibility macros
to function declarations it creates.
Both AnnotateFunctions and Attribute example plugins require clang::AnnotateAttr
TableGen created functions to be exported from the Clang shared library.
---
clang/utils/TableGen/ClangAttrEmitter.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 4890d249c6d8f7..88ddb567d11b2f 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -2756,7 +2756,7 @@ static void emitAttributes(const RecordKeeper &Records, raw_ostream &OS,
}
if (Header)
- OS << "class " << R.getName() << "Attr : public " << SuperName << " {\n";
+ OS << "class CLANG_ABI " << R.getName() << "Attr : public " << SuperName << " {\n";
else
OS << "\n// " << R.getName() << "Attr implementation\n\n";
@@ -3214,7 +3214,8 @@ void clang::EmitClangAttrClass(const RecordKeeper &Records, raw_ostream &OS) {
emitSourceFileHeader("Attribute classes' definitions", OS, Records);
OS << "#ifndef LLVM_CLANG_ATTR_CLASSES_INC\n";
- OS << "#define LLVM_CLANG_ATTR_CLASSES_INC\n\n";
+ OS << "#define LLVM_CLANG_ATTR_CLASSES_INC\n";
+ OS << "#include \"clang/Support/Compiler.h\"\n\n";
emitAttributes(Records, OS, true);
>From 164b92159030682e47d73f7cd77e7fbcee3aa028 Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Fri, 20 Sep 2024 03:10:15 +0100
Subject: [PATCH 2/2] Fix formatting
---
clang/utils/TableGen/ClangAttrEmitter.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 88ddb567d11b2f..e3f782aa8988df 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -2756,7 +2756,8 @@ static void emitAttributes(const RecordKeeper &Records, raw_ostream &OS,
}
if (Header)
- OS << "class CLANG_ABI " << R.getName() << "Attr : public " << SuperName << " {\n";
+ OS << "class CLANG_ABI " << R.getName() << "Attr : public " << SuperName
+ << " {\n";
else
OS << "\n// " << R.getName() << "Attr implementation\n\n";
More information about the cfe-commits
mailing list