[PATCH] D121961: [clang] Produce a "multiversion" annotation in textual AST output.

Tom Honermann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 21 10:40:31 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG0cceee755992: [clang] Produce a "multiversion" annotation in textual AST output. (authored by tahonermann).

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.417020.patch
Type: text/x-patch
Size: 1840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220321/8169189c/attachment.bin>


More information about the cfe-commits mailing list