[PATCH] D121961: [clang] Produce a "multiversion" annotation in textual AST output.
Tom Honermann via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 18 22:31:40 PDT 2022
tahonermann updated this revision to Diff 416668.
tahonermann added a comment.
Rebase to acquire fixes from parent commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121961/new/
https://reviews.llvm.org/D121961
Files:
clang/lib/AST/TextNodeDumper.cpp
clang/test/AST/ast-dump-funcs-multiversion.c
Index: clang/test/AST/ast-dump-funcs-multiversion.c
===================================================================
--- /dev/null
+++ clang/test/AST/ast-dump-funcs-multiversion.c
@@ -0,0 +1,23 @@
+// Test without serialization:
+// RUN: %clang_cc1 -triple x86_64-pc-linux -ast-dump -ast-dump-filter Test %s \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -triple x86_64-pc-linux -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -triple x86_64-pc-linux -include-pch %t \
+// RUN: -ast-dump-all -ast-dump-filter Test /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck --strict-whitespace %s
+
+void TestUnattributedMVF(void);
+// CHECK: FunctionDecl 0x{{[^ ]*}} <{{.*}}> col:{{[0-9]*}} multiversion TestUnattributedMVF
+__attribute__((target("default"))) void TestUnattributedMVF(void);
+// CHECK: FunctionDecl 0x{{[^ ]*}} prev 0x{{[^ ]*}} <{{.*}}> col:{{[0-9]*}} multiversion TestUnattributedMVF
+
+__attribute__((target("mmx"))) void TestNonMVF(void);
+// CHECK: FunctionDecl 0x{{[^ ]*}} <{{.*}}> col:{{[0-9]*}} TestNonMVF
+
+__attribute__((target("mmx"))) void TestRetroMVF(void);
+// CHECK: FunctionDecl 0x{{[^ ]*}} <{{.*}}> col:{{[0-9]*}} multiversion TestRetroMVF
+__attribute__((target("sse"))) void TestRetroMVF(void);
+// CHECK: FunctionDecl 0x{{[^ ]*}} <{{.*}}> col:{{[0-9]*}} multiversion TestRetroMVF
Index: clang/lib/AST/TextNodeDumper.cpp
===================================================================
--- clang/lib/AST/TextNodeDumper.cpp
+++ clang/lib/AST/TextNodeDumper.cpp
@@ -283,6 +283,8 @@
OS << " constexpr";
if (FD->isConsteval())
OS << " consteval";
+ if (FD->isMultiVersion())
+ OS << " multiversion";
}
if (!isa<FunctionDecl>(*D)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121961.416668.patch
Type: text/x-patch
Size: 1840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220319/961b2451/attachment.bin>
More information about the cfe-commits
mailing list