[PATCH] D68915: [clang][IFS] Escape mangled name in-order to not break llvm-ifs with names mangled using MS ABI

Puyan Lotfi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 12 11:04:13 PDT 2019


plotfi updated this revision to Diff 224756.

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68915/new/

https://reviews.llvm.org/D68915

Files:
  lib/Frontend/InterfaceStubFunctionsConsumer.cpp
  test/InterfaceStubs/inline.c
  test/InterfaceStubs/object.c
  test/InterfaceStubs/windows.cpp


Index: test/InterfaceStubs/windows.cpp
===================================================================
--- test/InterfaceStubs/windows.cpp
+++ test/InterfaceStubs/windows.cpp
@@ -0,0 +1,7 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang -target x86_64-windows-msvc -o - %s \
+// RUN: -emit-interface-stubs -emit-merged-ifs | FileCheck %s
+
+// CHECK: Symbols:
+// CHECK-NEXT: ?helloWindowsMsvc@@YAHXZ
+int helloWindowsMsvc();
Index: test/InterfaceStubs/object.c
===================================================================
--- test/InterfaceStubs/object.c
+++ test/InterfaceStubs/object.c
@@ -2,6 +2,6 @@
 // RUN: %clang -fvisibility=default -c -o - -emit-interface-stubs %s | FileCheck -check-prefix=CHECK-SYMBOLS %s
 // RUN: %clang -fvisibility=default -c -o - %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-SYMBOLS %s
 
-// CHECK-TAPI: data: { Type: Object, Size: 4 }
+// CHECK-TAPI: "data" : { Type: Object, Size: 4 }
 // CHECK-SYMBOLS: data
 int data = 42;
Index: test/InterfaceStubs/inline.c
===================================================================
--- test/InterfaceStubs/inline.c
+++ test/InterfaceStubs/inline.c
@@ -56,8 +56,8 @@
 // RUN: -c -std=gnu89 -xc %s | llvm-nm - 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
 
-// CHECK-TAPI-DAG: foo: { Type: Func }
-// CHECK-TAPI-DAG: foo.var: { Type: Object, Size: 4 }
+// CHECK-TAPI-DAG: "foo" : { Type: Func }
+// CHECK-TAPI-DAG: "foo.var" : { Type: Object, Size: 4 }
 // CHECK-SYMBOLS-DAG: foo
 // CHECK-SYMBOLS-DAG: foo.var
 #include "inline.h"
Index: lib/Frontend/InterfaceStubFunctionsConsumer.cpp
===================================================================
--- lib/Frontend/InterfaceStubFunctionsConsumer.cpp
+++ lib/Frontend/InterfaceStubFunctionsConsumer.cpp
@@ -263,11 +263,11 @@
       for (const auto &E : Symbols) {
         const MangledSymbol &Symbol = E.second;
         for (auto Name : Symbol.Names) {
-          OS << "  "
+          OS << "  \""
              << (Symbol.ParentName.empty() || Instance.getLangOpts().CPlusPlus
                      ? ""
                      : (Symbol.ParentName + "."))
-             << Name << ": { Type: ";
+             << Name << "\" : { Type: ";
           switch (Symbol.Type) {
           default:
             llvm_unreachable(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68915.224756.patch
Type: text/x-patch
Size: 2299 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191012/0413990b/attachment-0001.bin>


More information about the cfe-commits mailing list