Author: zer0 Date: Mon Oct 14 11:03:03 2019 New Revision: 374798 URL: http://llvm.org/viewvc/llvm-project?rev=374798&view=rev Log: [clang][IFS] Escape mangled names so MS ABI doesn't break YAML parsing.
Microsoft's ABI mangles names differently than Itanium and this breaks the LLVM yaml parser unless the name is escaped in quotes. Quotes are being added to the mangled names of the IFS file generation so that llvm-ifs doesn't break when Windows triples are passed to the driver. Differential Revision: https://reviews.llvm.org/D68915 Added: cfe/trunk/test/InterfaceStubs/windows.cpp Modified: cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp cfe/trunk/test/InterfaceStubs/inline.c cfe/trunk/test/InterfaceStubs/object.c Modified: cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp?rev=374798&r1=374797&r2=374798&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp (original) +++ cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp Mon Oct 14 11:03:03 2019 @@ -263,11 +263,11 @@ public: 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( Modified: cfe/trunk/test/InterfaceStubs/inline.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/inline.c?rev=374798&r1=374797&r2=374798&view=diff ============================================================================== --- cfe/trunk/test/InterfaceStubs/inline.c (original) +++ cfe/trunk/test/InterfaceStubs/inline.c Mon Oct 14 11:03:03 2019 @@ -56,8 +56,8 @@ INLINE int foo() { // 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" Modified: cfe/trunk/test/InterfaceStubs/object.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object.c?rev=374798&r1=374797&r2=374798&view=diff ============================================================================== --- cfe/trunk/test/InterfaceStubs/object.c (original) +++ cfe/trunk/test/InterfaceStubs/object.c Mon Oct 14 11:03:03 2019 @@ -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; Added: cfe/trunk/test/InterfaceStubs/windows.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/windows.cpp?rev=374798&view=auto ============================================================================== --- cfe/trunk/test/InterfaceStubs/windows.cpp (added) +++ cfe/trunk/test/InterfaceStubs/windows.cpp Mon Oct 14 11:03:03 2019 @@ -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(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits