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

2019-10-14 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi added a comment.

I see what went wrong. Will post a fix shortly.

In D68915#1708297 , @thakis wrote:

> On macOS symbols are prefixed with an underscore:
>
>   Command Output (stderr):
>   --
>   /Users/thakis/src/llvm-project/clang/test/InterfaceStubs/object.c:5:16: 
> error: CHECK-TAPI: expected string not found in input
>   // CHECK-TAPI: "data" : { Type: Object, Size: 4 }
>  ^
>   :1:1: note: scanning from here
>   --- !experimental-ifs-v1
>   ^
>   :6:3: note: possible intended match here
>"_data" : { Type: Object, Size: 4 }
> ^
>  
>   --
>   
>   Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
>   Testing Time: 164.94s
>   
>   Failing Tests (1):
>   Clang :: InterfaceStubs/object.c``





Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68915



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2019-10-14 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

On macOS symbols are prefixed with an underscore:

  Command Output (stderr):
  --
  /Users/thakis/src/llvm-project/clang/test/InterfaceStubs/object.c:5:16: 
error: CHECK-TAPI: expected string not found in input
  // CHECK-TAPI: "data" : { Type: Object, Size: 4 }
 ^
  :1:1: note: scanning from here
  --- !experimental-ifs-v1
  ^
  :6:3: note: possible intended match here
   "_data" : { Type: Object, Size: 4 }
^
  
  --
  
  Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
  Testing Time: 164.94s
  
  Failing Tests (1):
  Clang :: InterfaceStubs/object.c``


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68915



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2019-10-14 Thread Puyan Lotfi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG76f9869bf200: [clang][IFS] Escape mangled names so  MS ABI 
doesnt break YAML parsing. (authored by plotfi).

Changed prior to commit:
  https://reviews.llvm.org/D68915?vs=224756=224879#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68915

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


Index: clang/test/InterfaceStubs/windows.cpp
===
--- /dev/null
+++ clang/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: clang/test/InterfaceStubs/object.c
===
--- clang/test/InterfaceStubs/object.c
+++ clang/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: clang/test/InterfaceStubs/inline.c
===
--- clang/test/InterfaceStubs/inline.c
+++ clang/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: clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
===
--- clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
+++ clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
@@ -263,11 +263,11 @@
   for (const auto  : Symbols) {
 const MangledSymbol  = 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(


Index: clang/test/InterfaceStubs/windows.cpp
===
--- /dev/null
+++ clang/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: clang/test/InterfaceStubs/object.c
===
--- clang/test/InterfaceStubs/object.c
+++ clang/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: clang/test/InterfaceStubs/inline.c
===
--- clang/test/InterfaceStubs/inline.c
+++ clang/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: clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
===
--- clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
+++ clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
@@ -263,11 +263,11 @@
   for (const auto  : Symbols) {
 const MangledSymbol  = E.second;
 for (auto Name : Symbol.Names) {
-  OS << "  "
+  OS << "  \""
  << (Symbol.ParentName.empty() || 

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

2019-10-12 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi created this revision.
plotfi added reviewers: compnerd, cishida.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
plotfi updated this revision to Diff 224756.

Microsoft's ABI mangles names differently than Itanium and this breaks the LLVM 
yaml parser unless the name is escaped in quotes.


Repository:
  rC Clang

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  : Symbols) {
 const MangledSymbol  = 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(


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  : Symbols) {
 const MangledSymbol  = E.second;
 for (auto Name : Symbol.Names) {
-  OS << "  "
+  OS << "  \""
  << (Symbol.ParentName.empty() || Instance.getLangOpts().CPlusPlus
  ? ""
  : (Symbol.ParentName + "."))
- << Name << ": { Type: ";
+  

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

2019-10-12 Thread Puyan Lotfi via Phabricator via cfe-commits
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  : Symbols) {
 const MangledSymbol  = 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(


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  : Symbols) {
 const MangledSymbol  = 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(
___
cfe-commits mailing list