[demangler] Document some features that the demangler doesn't yet support, NFC
authorErik Pilkington <erik.pilkington@gmail.com>
Tue, 21 Nov 2017 15:04:08 +0000 (15:04 +0000)
committerErik Pilkington <erik.pilkington@gmail.com>
Tue, 21 Nov 2017 15:04:08 +0000 (15:04 +0000)
llvm-svn: 318765

libcxxabi/src/cxa_demangle.cpp
libcxxabi/test/test_demangle.pass.cpp

index 7d17318..96e41f0 100644 (file)
@@ -7,6 +7,12 @@
 //
 //===----------------------------------------------------------------------===//
 
+// FIXME: (possibly) incomplete list of features that clang mangles that this
+// file does not yet support:
+//   - enable_if attribute
+//   - decomposition declarations
+//   - C++ modules TS
+
 #define _LIBCPP_NO_EXCEPTIONS
 
 #include "__cxxabi_config.h"
index 18bbbba..8be7168 100644 (file)
@@ -29712,7 +29712,7 @@ void test()
     free(buf);
 }
 
-void test2()
+void test_invalid_cases()
 {
     std::size_t len = 0;
     char* buf = nullptr;
@@ -29733,6 +29733,36 @@ void test2()
     free(buf);
 }
 
+const char *xfail_cases[] = {
+    "_Z1fUa9enable_ifIXLi1EEEv", // enable_if attribute
+    "_ZDC2a12a2E", // decomposition decl
+    "_ZW6FooBarE2f3v", // C++ modules TS
+};
+
+const size_t num_xfails = sizeof(xfail_cases) / sizeof(xfail_cases[0]);
+
+void test_xfail_cases()
+{
+    std::size_t len = 0;
+    char* buf = nullptr;
+    for (std::size_t i = 0; i < num_xfails; ++i)
+    {
+        int status;
+        char* demang = __cxxabiv1::__cxa_demangle(xfail_cases[i], buf, &len, &status);
+        if (status != -2)
+        {
+            std::cout << xfail_cases[i] << " was documented as xfail but passed\n"
+                      << "got status = " << status << '\n';
+            assert(status == -2);
+        }
+        else
+        {
+            buf = demang;
+        }
+    }
+    free(buf);
+}
+
 void testFPLiterals()
 {
     std::size_t len = 0;
@@ -29769,7 +29799,8 @@ int main()
     {
         timer t;
         test();
-        test2();
+        test_invalid_cases();
+        test_xfail_cases();
         testFPLiterals();
     }
 #if 0