diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1780,25 +1780,26 @@ StringRef ArgStr = Args.hasArg(OPT_interface_stub_version_EQ) ? Args.getLastArgValue(OPT_interface_stub_version_EQ) - : "experimental-ifs-v1"; + : "experimental-ifs-v2"; if (ArgStr == "experimental-yaml-elf-v1" || + ArgStr == "experimental-ifs-v1" || ArgStr == "experimental-tapi-elf-v1") { std::string ErrorMessage = "Invalid interface stub format: " + ArgStr.str() + " is deprecated."; Diags.Report(diag::err_drv_invalid_value) << "Must specify a valid interface stub format type, ie: " - "-interface-stub-version=experimental-ifs-v1" + "-interface-stub-version=experimental-ifs-v2" << ErrorMessage; - } else if (ArgStr != "experimental-ifs-v1") { + } else if (!ArgStr.startswith("experimental-ifs-")) { std::string ErrorMessage = "Invalid interface stub format: " + ArgStr.str() + "."; Diags.Report(diag::err_drv_invalid_value) << "Must specify a valid interface stub format type, ie: " - "-interface-stub-version=experimental-ifs-v1" + "-interface-stub-version=experimental-ifs-v2" << ErrorMessage; } else { - Opts.ProgramAction = frontend::GenerateInterfaceIfsExpV1; + Opts.ProgramAction = frontend::GenerateInterfaceStubs; } break; } @@ -3367,7 +3368,7 @@ case frontend::GenerateModuleInterface: case frontend::GenerateHeaderModule: case frontend::GeneratePCH: - case frontend::GenerateInterfaceIfsExpV1: + case frontend::GenerateInterfaceStubs: case frontend::ParseSyntaxOnly: case frontend::ModuleFileInfo: case frontend::VerifyPCH: diff --git a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp --- a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp +++ b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp @@ -290,7 +290,7 @@ const ASTContext &context, StringRef Format, raw_ostream &OS) -> void { OS << "--- !" << Format << "\n"; - OS << "IfsVersion: 1.0\n"; + OS << "IfsVersion: 2.0\n"; OS << "Triple: " << T.str() << "\n"; OS << "ObjectFileFormat: " << "ELF" @@ -299,11 +299,11 @@ for (const auto &E : Symbols) { const MangledSymbol &Symbol = E.second; for (auto Name : Symbol.Names) { - OS << " \"" + OS << " - { Name: \"" << (Symbol.ParentName.empty() || Instance.getLangOpts().CPlusPlus ? "" : (Symbol.ParentName + ".")) - << Name << "\" : { Type: "; + << Name << "\", Type: "; switch (Symbol.Type) { default: llvm_unreachable( @@ -330,15 +330,15 @@ OS.flush(); }; - assert(Format == "experimental-ifs-v1" && "Unexpected IFS Format."); + assert(Format == "experimental-ifs-v2" && "Unexpected IFS Format."); writeIfsV1(Instance.getTarget().getTriple(), Symbols, context, Format, *OS); } }; } // namespace std::unique_ptr -GenerateInterfaceIfsExpV1Action::CreateASTConsumer(CompilerInstance &CI, - StringRef InFile) { +GenerateInterfaceStubsAction::CreateASTConsumer(CompilerInstance &CI, + StringRef InFile) { return std::make_unique( - CI, InFile, "experimental-ifs-v1"); + CI, InFile, "experimental-ifs-v2"); } diff --git a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp --- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -65,8 +65,8 @@ case GenerateHeaderModule: return std::make_unique(); case GeneratePCH: return std::make_unique(); - case GenerateInterfaceIfsExpV1: - return std::make_unique(); + case GenerateInterfaceStubs: + return std::make_unique(); case InitOnly: return std::make_unique(); case ParseSyntaxOnly: return std::make_unique(); case ModuleFileInfo: return std::make_unique(); diff --git a/clang/test/InterfaceStubs/bad-format.cpp b/clang/test/InterfaceStubs/bad-format.cpp --- a/clang/test/InterfaceStubs/bad-format.cpp +++ b/clang/test/InterfaceStubs/bad-format.cpp @@ -7,6 +7,9 @@ // RUN: not %clang -emit-interface-stubs -interface-stub-version=experimental-yaml-elf-v1 %s 2>&1 | \ // RUN: FileCheck -check-prefix=CHECK-YAML-DEPRECATED %s +// RUN: not %clang -emit-interface-stubs -interface-stub-version=experimental-ifs-v1 %s 2>&1 | \ +// RUN: FileCheck -check-prefix=CHECK-V1-DEPRECATED %s + // RUN: not %clang -emit-interface-stubs -interface-stub-version=bad-format %s 2>&1 | \ // RUN: FileCheck %s @@ -21,16 +24,22 @@ // CHECK: error: invalid value // CHECK: 'Invalid interface stub format: bad-format.' in 'Must specify a // CHECK: valid interface stub format type, ie: -// CHECK: -interface-stub-version=experimental-ifs-v1' +// CHECK: -interface-stub-version=experimental-ifs-v2' // CHECK-TAPI-DEPRECATED: error: invalid value // CHECK-TAPI-DEPRECATED: 'Invalid interface stub format: // CHECK-TAPI-DEPRECATED: experimental-tapi-elf-v1 is deprecated.' in 'Must // CHECK-TAPI-DEPRECATED: specify a valid interface stub format type, ie: -// CHECK-TAPI-DEPRECATED: -interface-stub-version=experimental-ifs-v1' +// CHECK-TAPI-DEPRECATED: -interface-stub-version=experimental-ifs-v2' // CHECK-YAML-DEPRECATED: error: invalid value // CHECK-YAML-DEPRECATED: 'Invalid interface stub format: // CHECK-YAML-DEPRECATED: experimental-yaml-elf-v1 is deprecated.' in 'Must // CHECK-YAML-DEPRECATED: specify a valid interface stub format type, ie: -// CHECK-YAML-DEPRECATED: -interface-stub-version=experimental-ifs-v1' +// CHECK-YAML-DEPRECATED: -interface-stub-version=experimental-ifs-v2' + +// CHECK-V1-DEPRECATED: error: invalid value +// CHECK-V1-DEPRECATED: 'Invalid interface stub format: +// CHECK-V1-DEPRECATED: experimental-ifs-v1 is deprecated.' in 'Must +// CHECK-V1-DEPRECATED: specify a valid interface stub format type, ie: +// CHECK-V1-DEPRECATED: -interface-stub-version=experimental-ifs-v2' diff --git a/clang/test/InterfaceStubs/blocks.c b/clang/test/InterfaceStubs/blocks.c --- a/clang/test/InterfaceStubs/blocks.c +++ b/clang/test/InterfaceStubs/blocks.c @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -emit-interface-stubs -fblocks -o - %s | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: diff --git a/clang/test/InterfaceStubs/class-template-partial-specialization.cpp b/clang/test/InterfaceStubs/class-template-partial-specialization.cpp --- a/clang/test/InterfaceStubs/class-template-partial-specialization.cpp +++ b/clang/test/InterfaceStubs/class-template-partial-specialization.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: diff --git a/clang/test/InterfaceStubs/conflict-type.ifs b/clang/test/InterfaceStubs/conflict-type.ifs --- a/clang/test/InterfaceStubs/conflict-type.ifs +++ b/clang/test/InterfaceStubs/conflict-type.ifs @@ -7,10 +7,10 @@ # CHECK-IFS-NEXT: Filename: # CHECK-IFS-NEXT: Type Values: Object Func ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-linux-gnu ObjectFileFormat: ELF Symbols: - a: { Type: Object, Size: 1 } + - { Name: a, Type: Object, Size: 1 } ... diff --git a/clang/test/InterfaceStubs/constructor-using-shadow.cpp b/clang/test/InterfaceStubs/constructor-using-shadow.cpp --- a/clang/test/InterfaceStubs/constructor-using-shadow.cpp +++ b/clang/test/InterfaceStubs/constructor-using-shadow.cpp @@ -1,12 +1,12 @@ // RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: // CHECK-NEXT: ... - // ConstructorUsingShadowDecl +// ConstructorUsingShadowDecl struct Base { Base(int); }; struct Derived : public Base { using Base::Base; }; diff --git a/clang/test/InterfaceStubs/cxx-conversion.cpp b/clang/test/InterfaceStubs/cxx-conversion.cpp --- a/clang/test/InterfaceStubs/cxx-conversion.cpp +++ b/clang/test/InterfaceStubs/cxx-conversion.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: diff --git a/clang/test/InterfaceStubs/cxxdeduction-guide.cpp b/clang/test/InterfaceStubs/cxxdeduction-guide.cpp --- a/clang/test/InterfaceStubs/cxxdeduction-guide.cpp +++ b/clang/test/InterfaceStubs/cxxdeduction-guide.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -o - -emit-interface-stubs -std=c++17 %s | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: diff --git a/clang/test/InterfaceStubs/driver-test3.c b/clang/test/InterfaceStubs/driver-test3.c --- a/clang/test/InterfaceStubs/driver-test3.c +++ b/clang/test/InterfaceStubs/driver-test3.c @@ -8,12 +8,12 @@ // CHECK-OBJ: bar -// CHECK-IFS: --- !experimental-ifs-v1 +// CHECK-IFS: --- !experimental-ifs-v2 // CHECK-IFS-NEXT: IfsVersion: // CHECK-IFS-NEXT: Triple: // CHECK-IFS-NEXT: ObjectFileFormat: // CHECK-IFS-NEXT: Symbols: -// CHECK-IFS-NEXT: "bar" : { Type: Func } +// CHECK-IFS-NEXT: - { Name: "bar", Type: Func } // CHECK-IFS-NEXT: ... int bar(int a) { return a; } diff --git a/clang/test/InterfaceStubs/empty.c b/clang/test/InterfaceStubs/empty.c new file mode 100644 --- /dev/null +++ b/clang/test/InterfaceStubs/empty.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s + +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 +// CHECK-NEXT: Triple: +// CHECK-NEXT: ObjectFileFormat: +// CHECK-NEXT: Symbols: +// CHECK-NEXT: ... diff --git a/clang/test/InterfaceStubs/func.ifs b/clang/test/InterfaceStubs/func.ifs --- a/clang/test/InterfaceStubs/func.ifs +++ b/clang/test/InterfaceStubs/func.ifs @@ -7,13 +7,13 @@ # RUN: %clang -emit-interface-stubs -o - %s %s -emit-merged-ifs | \ # RUN: FileCheck %s --check-prefixes=CHECK-MERGE-IFS -# CHECK-IFS: --- !experimental-ifs-v1 -# CHECK-IFS-NEXT: IfsVersion: 1.0 +# CHECK-IFS: --- !experimental-ifs-v2 +# CHECK-IFS-NEXT: IfsVersion: 2.0 # CHECK-IFS-NEXT: Triple: x86_64-linux-gnu # CHECK-IFS-NEXT: ObjectFileFormat: ELF # CHECK-IFS-NEXT: Symbols: -# CHECK-IFS-DAG: a: { Type: Func } -# CHECK-IFS-DAG: b: { Type: Object, Size: 4 } +# CHECK-IFS-DAG: - { Name: a, Type: Func } +# CHECK-IFS-DAG: - { Name: b, Type: Object, Size: 4 } # CHECK-IFS: ... # CHECK-ELF: ELF Header: @@ -23,18 +23,18 @@ # CHECK-ELF: OBJECT GLOBAL DEFAULT 1 b # Here we are testing to see if two identical symbols will merge. -# CHECK-MERGE-IFS: --- !experimental-ifs-v1 -# CHECK-MERGE-IFS-NEXT: IfsVersion: 1.0 +# CHECK-MERGE-IFS: --- !experimental-ifs-v2 +# CHECK-MERGE-IFS-NEXT: IfsVersion: 2.0 # CHECK-MERGE-IFS-NEXT: Triple: x86_64-linux-gnu # CHECK-MERGE-IFS-NEXT: ObjectFileFormat: ELF # CHECK-MERGE-IFS-NEXT: Symbols: -# CHECK-MERGE-IFS-NEXT: a: { Type: Func } +# CHECK-MERGE-IFS-NEXT: - { Name: a, Type: Func } # CHECK-MERGE-IFS-NEXT: ... ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-linux-gnu ObjectFileFormat: ELF Symbols: - a: { Type: Func } + - { Name: a, Type: Func } ... diff --git a/clang/test/InterfaceStubs/hidden-class-inheritance.cpp b/clang/test/InterfaceStubs/hidden-class-inheritance.cpp --- a/clang/test/InterfaceStubs/hidden-class-inheritance.cpp +++ b/clang/test/InterfaceStubs/hidden-class-inheritance.cpp @@ -14,7 +14,7 @@ // RUN: -DPARENT_METHOD_VISIBILITY="" -DCHILD_METHOD_VISIBILITY="" %s | \ // RUN: FileCheck -check-prefix=CHECK-HP %s // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs \ -// RUN: -interface-stub-version=experimental-ifs-v1 \ +// RUN: -interface-stub-version=experimental-ifs-v2 \ // RUN: -DPARENT_CLASS_VISIBILITY=HIDDEN -DCHILD_CLASS_VISIBILITY="" \ // RUN: -DPARENT_METHOD_VISIBILITY="" -DCHILD_METHOD_VISIBILITY="" %s | \ // RUN: FileCheck -check-prefix=CHECK-HP2 %s diff --git a/clang/test/InterfaceStubs/indirect-field-decl.cpp b/clang/test/InterfaceStubs/indirect-field-decl.cpp --- a/clang/test/InterfaceStubs/indirect-field-decl.cpp +++ b/clang/test/InterfaceStubs/indirect-field-decl.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: diff --git a/clang/test/InterfaceStubs/inline.c b/clang/test/InterfaceStubs/inline.c --- a/clang/test/InterfaceStubs/inline.c +++ b/clang/test/InterfaceStubs/inline.c @@ -55,8 +55,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" diff --git a/clang/test/InterfaceStubs/lambda.cpp b/clang/test/InterfaceStubs/lambda.cpp --- a/clang/test/InterfaceStubs/lambda.cpp +++ b/clang/test/InterfaceStubs/lambda.cpp @@ -1,11 +1,11 @@ // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-interface-stubs -o - %s \ // RUN: | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: -// CHECK-NEXT: f" : { Type: Object, Size: 1 } +// CHECK-NEXT: f", Type: Object, Size: 1 } // CHECK-NEXT: ... auto f = [](void* data) { int i; }; diff --git a/clang/test/InterfaceStubs/namespace-alias.cpp b/clang/test/InterfaceStubs/namespace-alias.cpp --- a/clang/test/InterfaceStubs/namespace-alias.cpp +++ b/clang/test/InterfaceStubs/namespace-alias.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: diff --git a/clang/test/InterfaceStubs/namespace.cpp b/clang/test/InterfaceStubs/namespace.cpp --- a/clang/test/InterfaceStubs/namespace.cpp +++ b/clang/test/InterfaceStubs/namespace.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: diff --git a/clang/test/InterfaceStubs/non-type-template-parm-decl.cpp b/clang/test/InterfaceStubs/non-type-template-parm-decl.cpp --- a/clang/test/InterfaceStubs/non-type-template-parm-decl.cpp +++ b/clang/test/InterfaceStubs/non-type-template-parm-decl.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: diff --git a/clang/test/InterfaceStubs/object.c b/clang/test/InterfaceStubs/object.c --- a/clang/test/InterfaceStubs/object.c +++ b/clang/test/InterfaceStubs/object.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fvisibility default -o - -emit-interface-stubs %s | FileCheck -check-prefix=CHECK-TAPI %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; diff --git a/clang/test/InterfaceStubs/object.ifs b/clang/test/InterfaceStubs/object.ifs --- a/clang/test/InterfaceStubs/object.ifs +++ b/clang/test/InterfaceStubs/object.ifs @@ -4,12 +4,12 @@ # RUN: %clang -emit-interface-stubs -o - %s | llvm-readelf --all | \ # RUN: FileCheck %s --check-prefixes=CHECK-ELF -# CHECK-IFS: --- !experimental-ifs-v1 -# CHECK-IFS-NEXT: IfsVersion: 1.0 +# CHECK-IFS: --- !experimental-ifs-v2 +# CHECK-IFS-NEXT: IfsVersion: 2.0 # CHECK-IFS-NEXT: Triple: x86_64-linux-gnu # CHECK-IFS-NEXT: ObjectFileFormat: ELF # CHECK-IFS-NEXT: Symbols: -# CHECK-IFS-NEXT: b: { Type: Object, Size: 4 } +# CHECK-IFS-NEXT: - { Name: b, Type: Object, Size: 4 } # CHECK-IFS-NEXT: ... # CHECK-ELF: ELF Header: @@ -19,10 +19,10 @@ # CHECK-ELF-NOT: FUNC GLOBAL DEFAULT 1 a # CHECK-ELF: OBJECT GLOBAL DEFAULT 1 b ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-linux-gnu ObjectFileFormat: ELF Symbols: - b: { Type: Object, Size: 4 } + - { Name: b, Type: Object, Size: 4 } ... diff --git a/clang/test/InterfaceStubs/ppc.cpp b/clang/test/InterfaceStubs/ppc.cpp --- a/clang/test/InterfaceStubs/ppc.cpp +++ b/clang/test/InterfaceStubs/ppc.cpp @@ -4,11 +4,11 @@ // RUN: -emit-interface-stubs -emit-merged-ifs -S | \ // RUN: FileCheck -check-prefix=CHECK-IFS %s - // CHECK-IFS: --- !experimental-ifs-v1 - // CHECK-IFS: IfsVersion: 1.0 - // CHECK-IFS: Triple: powerpc64le - // CHECK-IFS: Symbols: - // CHECK-IFS: _Z8helloPPCv: { Type: Func } - // CHECK-IFS: ... +// CHECK-IFS: --- !experimental-ifs-v2 +// CHECK-IFS: IfsVersion: 2.0 +// CHECK-IFS: Triple: powerpc64le +// CHECK-IFS: Symbols: +// CHECK-IFS: - { Name: _Z8helloPPCv, Type: Func } +// CHECK-IFS: ... int helloPPC(); diff --git a/clang/test/InterfaceStubs/template-constexpr.cpp b/clang/test/InterfaceStubs/template-constexpr.cpp --- a/clang/test/InterfaceStubs/template-constexpr.cpp +++ b/clang/test/InterfaceStubs/template-constexpr.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: diff --git a/clang/test/InterfaceStubs/template-namespace-function.cpp b/clang/test/InterfaceStubs/template-namespace-function.cpp --- a/clang/test/InterfaceStubs/template-namespace-function.cpp +++ b/clang/test/InterfaceStubs/template-namespace-function.cpp @@ -6,10 +6,10 @@ // RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s // CHECK: Symbols: -// CHECK-DAG: "_ZN3qux3barEii" : { Type: Func } -// CHECK-DAG: "_ZN3baz3addIiEET_S1_S1_" : { Type: Func } -// CHECK-DAG: "_Z4fbarff" : { Type: Func } -// CHECK-DAG: "_ZN3baz3addIfEET_S1_S1_" : { Type: Func } +// CHECK-DAG: - { Name: "_ZN3qux3barEii", Type: Func } +// CHECK-DAG: - { Name: "_ZN3baz3addIiEET_S1_S1_", Type: Func } +// CHECK-DAG: - { Name: "_Z4fbarff", Type: Func } +// CHECK-DAG: - { Name: "_ZN3baz3addIfEET_S1_S1_", Type: Func } // Same symbols just different order. // CHECK-SYMBOLS-DAG: _Z4fbarff diff --git a/clang/test/InterfaceStubs/template-template-parm-decl.cpp b/clang/test/InterfaceStubs/template-template-parm-decl.cpp --- a/clang/test/InterfaceStubs/template-template-parm-decl.cpp +++ b/clang/test/InterfaceStubs/template-template-parm-decl.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: diff --git a/clang/test/InterfaceStubs/trycatch.cpp b/clang/test/InterfaceStubs/trycatch.cpp --- a/clang/test/InterfaceStubs/trycatch.cpp +++ b/clang/test/InterfaceStubs/trycatch.cpp @@ -2,13 +2,12 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -o - -emit-interface-stubs %s | FileCheck %s - -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: x86_64-unknown-linux-gnu // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: -// CHECK-NEXT: "_Z1fv" : { Type: Func } +// CHECK-NEXT: - { Name: "_Z1fv", Type: Func } // CHECK-NEXT: ... class C5 {}; diff --git a/clang/test/InterfaceStubs/unresolved-using-typename.cpp b/clang/test/InterfaceStubs/unresolved-using-typename.cpp --- a/clang/test/InterfaceStubs/unresolved-using-typename.cpp +++ b/clang/test/InterfaceStubs/unresolved-using-typename.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: diff --git a/clang/test/InterfaceStubs/usings.cpp b/clang/test/InterfaceStubs/usings.cpp --- a/clang/test/InterfaceStubs/usings.cpp +++ b/clang/test/InterfaceStubs/usings.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: diff --git a/clang/test/InterfaceStubs/var-template-specialization-decl.cpp b/clang/test/InterfaceStubs/var-template-specialization-decl.cpp --- a/clang/test/InterfaceStubs/var-template-specialization-decl.cpp +++ b/clang/test/InterfaceStubs/var-template-specialization-decl.cpp @@ -1,12 +1,12 @@ // REQUIRES: x86-registered-target // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs %s | FileCheck %s -// CHECK: --- !experimental-ifs-v1 -// CHECK-NEXT: IfsVersion: 1.0 +// CHECK: --- !experimental-ifs-v2 +// CHECK-NEXT: IfsVersion: 2.0 // CHECK-NEXT: Triple: x86_64-unknown-linux-gnu // CHECK-NEXT: ObjectFileFormat: ELF // CHECK-NEXT: Symbols: -// CHECK-NEXT: "a" : { Type: Object, Size: 4 } +// CHECK-NEXT: - { Name: "a", Type: Object, Size: 4 } // CHECK-NEXT: ... template struct S9 { diff --git a/clang/test/InterfaceStubs/weak.cpp b/clang/test/InterfaceStubs/weak.cpp --- a/clang/test/InterfaceStubs/weak.cpp +++ b/clang/test/InterfaceStubs/weak.cpp @@ -1,14 +1,14 @@ // REQUIRES: x86-registered-target // RUN: %clang_cc1 -triple x86_64-linux-gnu -o - -emit-interface-stubs \ -// RUN: -interface-stub-version=experimental-ifs-v1 %s | \ +// RUN: -interface-stub-version=experimental-ifs-v2 %s | \ // RUN: FileCheck %s // RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | llvm-nm - 2>&1 | \ // RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s // CHECK: Symbols: -// CHECK-DAG: "_Z8weakFuncv" : { Type: Func, Weak: true } -// CHECK-DAG: "_Z10strongFuncv" : { Type: Func } +// CHECK-DAG: - { Name: "_Z8weakFuncv", Type: Func, Weak: true } +// CHECK-DAG: - { Name: "_Z10strongFuncv", Type: Func } // CHECK-SYMBOLS-DAG: _Z10strongFuncv // CHECK-SYMBOLS-DAG: _Z8weakFuncv diff --git a/clang/test/InterfaceStubs/windows.cpp b/clang/test/InterfaceStubs/windows.cpp --- a/clang/test/InterfaceStubs/windows.cpp +++ b/clang/test/InterfaceStubs/windows.cpp @@ -6,11 +6,11 @@ // CHECK-CC1: Symbols: // CHECK-CC1-NEXT: ?helloWindowsMsvc@@YAHXZ - // CHECK-IFS: --- !experimental-ifs-v1 - // CHECK-IFS: IfsVersion: 1.0 - // CHECK-IFS: Triple: - // CHECK-IFS: Symbols: - // CHECK-IFS: ?helloWindowsMsvc@@YAHXZ: { Type: Func } - // CHECK-IFS: ... +// CHECK-IFS: --- !experimental-ifs-v2 +// CHECK-IFS: IfsVersion: 2.0 +// CHECK-IFS: Triple: +// CHECK-IFS: Symbols: +// CHECK-IFS: - { Name: '?helloWindowsMsvc@@YAHXZ', Type: Func } +// CHECK-IFS: ... int helloWindowsMsvc(); diff --git a/llvm/test/tools/llvm-ifs/Inputs/strong-mismatch-size.ifs b/llvm/test/tools/llvm-ifs/Inputs/strong-mismatch-size.ifs --- a/llvm/test/tools/llvm-ifs/Inputs/strong-mismatch-size.ifs +++ b/llvm/test/tools/llvm-ifs/Inputs/strong-mismatch-size.ifs @@ -1,8 +1,8 @@ # NOTE: Used by weak-mismatch.ifs ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-unknown-linux-gnu ObjectFileFormat: ELF Symbols: - foobar: { Type: Object, Size: 2 } + - { Name: foobar, Type: Object, Size: 2 } ... diff --git a/llvm/test/tools/llvm-ifs/Inputs/strong-mismatch-type.ifs b/llvm/test/tools/llvm-ifs/Inputs/strong-mismatch-type.ifs --- a/llvm/test/tools/llvm-ifs/Inputs/strong-mismatch-type.ifs +++ b/llvm/test/tools/llvm-ifs/Inputs/strong-mismatch-type.ifs @@ -1,8 +1,8 @@ # NOTE: Used by weak-mismatch.ifs ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-unknown-linux-gnu ObjectFileFormat: ELF Symbols: - foobar: { Type: Func } + - { Name: foobar, Type: Func } ... diff --git a/llvm/test/tools/llvm-ifs/conflict-header-format.ifs b/llvm/test/tools/llvm-ifs/conflict-header-format.ifs --- a/llvm/test/tools/llvm-ifs/conflict-header-format.ifs +++ b/llvm/test/tools/llvm-ifs/conflict-header-format.ifs @@ -5,10 +5,10 @@ # CHECK-IFS-NEXT: Filenames: # CHECK-IFS-NEXT: ObjectFileFormat Values: TBD ELF ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-apple-unknown ObjectFileFormat: TBD Symbols: - a: { Type: Func } + - { Name: a, Type: Func } ... diff --git a/llvm/test/tools/llvm-ifs/conflict-header-triple.ifs b/llvm/test/tools/llvm-ifs/conflict-header-triple.ifs --- a/llvm/test/tools/llvm-ifs/conflict-header-triple.ifs +++ b/llvm/test/tools/llvm-ifs/conflict-header-triple.ifs @@ -5,10 +5,10 @@ # CHECK-IFS-NEXT: Filenames: # CHECK-IFS-NEXT: Triple Values: mips-unknown-linux x86_64-unknown-linux-gnu ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: mips-unknown-linux ObjectFileFormat: ELF Symbols: - a: { Type: Func } + - { Name: a, Type: Func } ... diff --git a/llvm/test/tools/llvm-ifs/conflict-header-version.ifs b/llvm/test/tools/llvm-ifs/conflict-header-version.ifs --- a/llvm/test/tools/llvm-ifs/conflict-header-version.ifs +++ b/llvm/test/tools/llvm-ifs/conflict-header-version.ifs @@ -5,12 +5,12 @@ # RUN: FileCheck %s --check-prefixes=CHECK-IFS2 # CHECK-IFS: error: Interface Stub: IfsVersion Mismatch. -# CHECK-IFS2: error: Interface Stub: Bad IfsVersion: 0.0, llvm-ifs supported version: 1.2. +# CHECK-IFS2: error: Interface Stub: Bad IfsVersion: 0.0, llvm-ifs supported version: 2.0. ---- !experimental-ifs-v1 +--- !experimental-ifs-v2 IfsVersion: 0.0 Triple: x86_64-unknown-linux-gnu ObjectFileFormat: ELF Symbols: - a: { Type: Func } + - { Name: a, Type: Func } ... diff --git a/llvm/test/tools/llvm-ifs/conflict-size.ifs b/llvm/test/tools/llvm-ifs/conflict-size.ifs --- a/llvm/test/tools/llvm-ifs/conflict-size.ifs +++ b/llvm/test/tools/llvm-ifs/conflict-size.ifs @@ -7,10 +7,10 @@ # CHECK-IFS-NEXT: Filename: # CHECK-IFS-NEXT: Size Values: 1 4 ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-unknown-linux-gnu ObjectFileFormat: ELF Symbols: - b: { Type: Object, Size: 1 } + - { Name: b, Type: Object, Size: 1 } ... diff --git a/llvm/test/tools/llvm-ifs/conflict-type.ifs b/llvm/test/tools/llvm-ifs/conflict-type.ifs --- a/llvm/test/tools/llvm-ifs/conflict-type.ifs +++ b/llvm/test/tools/llvm-ifs/conflict-type.ifs @@ -7,10 +7,10 @@ # CHECK-IFS-NEXT: Filename: # CHECK-IFS-NEXT: Type Values: Object Func ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-unknown-linux-gnu ObjectFileFormat: ELF Symbols: - a: { Type: Object, Size: 1 } + - { Name: a, Type: Object, Size: 1 } ... diff --git a/llvm/test/tools/llvm-ifs/conflict-weak.ifs b/llvm/test/tools/llvm-ifs/conflict-weak.ifs --- a/llvm/test/tools/llvm-ifs/conflict-weak.ifs +++ b/llvm/test/tools/llvm-ifs/conflict-weak.ifs @@ -2,12 +2,12 @@ # RUN: FileCheck %s --check-prefixes=CHECK-IFS # CHECK-IFS: Symbols: -# CHECK-IFS-NEXT: a: { Type: Func, Weak: true } +# CHECK-IFS-NEXT: - { Name: a, Type: Func, Weak: true } ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-unknown-linux-gnu ObjectFileFormat: ELF Symbols: - a: { Type: Func, Weak: true } + - { Name: a, Type: Func, Weak: true } ... diff --git a/llvm/test/tools/llvm-ifs/default-empty.ifs b/llvm/test/tools/llvm-ifs/default-empty.ifs --- a/llvm/test/tools/llvm-ifs/default-empty.ifs +++ b/llvm/test/tools/llvm-ifs/default-empty.ifs @@ -1,25 +1,25 @@ # RUN: llvm-ifs -action write-ifs -o - %s | FileCheck --check-prefixes=CHECK-DEFAULT %s # RUN: llvm-ifs -action write-ifs -o - %s %S/weak.ifs | FileCheck --check-prefixes=CHECK-MERGE %s -# CHECK-DEFAULT: --- !experimental-ifs-v1 -# CHECK-DEFAULT-NEXT: IfsVersion: 1.2 +# CHECK-DEFAULT: --- !experimental-ifs-v2 +# CHECK-DEFAULT-NEXT: IfsVersion: 2.0 # CHECK-DEFAULT-NEXT: Triple: '' # CHECK-DEFAULT-NEXT: ObjectFileFormat: ELF -# CHECK-DEFAULT-NEXT: Symbols: {} +# CHECK-DEFAULT-NEXT: Symbols: [] # CHECK-DEFAULT-NEXT: ... -# CHECK-MERGE: --- !experimental-ifs-v1 -# CHECK-MERGE-NEXT: IfsVersion: 1.0 +# CHECK-MERGE: --- !experimental-ifs-v2 +# CHECK-MERGE-NEXT: IfsVersion: 2.0 # CHECK-MERGE-NEXT: Triple: x86_64-unknown-linux-gnu # CHECK-MERGE-NEXT: ObjectFileFormat: ELF # CHECK-MERGE-NEXT: Symbols: -# CHECK-MERGE-DAG: _Z8weakFuncv: { Type: Func, Weak: true } -# CHECK-MERGE-DAG: _Z10strongFuncv: { Type: Func } +# CHECK-MERGE-DAG: - { Name: _Z8weakFuncv, Type: Func, Weak: true } +# CHECK-MERGE-DAG: - { Name: _Z10strongFuncv, Type: Func } # CHECK-MERGE: ... ---- !experimental-ifs-v1 -IfsVersion: 1.2 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: '' ObjectFileFormat: ELF -Symbols: {} +Symbols: [] ... diff --git a/llvm/test/tools/llvm-ifs/empty1.ifs b/llvm/test/tools/llvm-ifs/empty1.ifs new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-ifs/empty1.ifs @@ -0,0 +1,15 @@ +# RUN: llvm-ifs -action write-ifs -o - %s | FileCheck %s + +# CHECK: --- !experimental-ifs-v2 +# CHECK-NEXT: IfsVersion: 2.0 +# CHECK-NEXT: Triple: x86_64-unknown-linux-gnu +# CHECK-NEXT: ObjectFileFormat: ELF +# CHECK-NEXT: Symbols: [] +# CHECK: ... + +--- !experimental-ifs-v2 +IfsVersion: 2.0 +Triple: x86_64-unknown-linux-gnu +ObjectFileFormat: ELF +Symbols: [] +... diff --git a/llvm/test/tools/llvm-ifs/empty2.ifs b/llvm/test/tools/llvm-ifs/empty2.ifs new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-ifs/empty2.ifs @@ -0,0 +1,15 @@ +# RUN: llvm-ifs -action write-ifs -o - %s | FileCheck %s + +# CHECK: --- !experimental-ifs-v2 +# CHECK-NEXT: IfsVersion: 2.0 +# CHECK-NEXT: Triple: x86_64-unknown-linux-gnu +# CHECK-NEXT: ObjectFileFormat: ELF +# CHECK-NEXT: Symbols: [] +# CHECK: ... + +--- !experimental-ifs-v2 +IfsVersion: 2.0 +Triple: x86_64-unknown-linux-gnu +ObjectFileFormat: ELF +Symbols: +... diff --git a/llvm/test/tools/llvm-ifs/func.ifs b/llvm/test/tools/llvm-ifs/func.ifs --- a/llvm/test/tools/llvm-ifs/func.ifs +++ b/llvm/test/tools/llvm-ifs/func.ifs @@ -10,13 +10,13 @@ # RUN: llvm-ifs -action write-ifs -o - %s %s | \ # RUN: FileCheck %s --check-prefixes=CHECK-MERGE-IFS -# CHECK-IFS: --- !experimental-ifs-v1 -# CHECK-IFS-NEXT: IfsVersion: 1.0 +# CHECK-IFS: --- !experimental-ifs-v2 +# CHECK-IFS-NEXT: IfsVersion: 2.0 # CHECK-IFS-NEXT: Triple: x86_64-unknown-linux-gnu # CHECK-IFS-NEXT: ObjectFileFormat: ELF # CHECK-IFS-NEXT: Symbols: -# CHECK-IFS-DAG: a: { Type: Func } -# CHECK-IFS-DAG: b: { Type: Object, Size: 4 } +# CHECK-IFS-DAG: - { Name: a, Type: Func } +# CHECK-IFS-DAG: - { Name: b, Type: Object, Size: 4 } # CHECK-IFS: ... # CHECK-ELF: ELF Header: @@ -39,18 +39,18 @@ # CHECK-DARWIN-TBD3-NEXT: ... # Here we are testing to see if two identical symbols will merge. -# CHECK-MERGE-IFS: --- !experimental-ifs-v1 -# CHECK-MERGE-IFS-NEXT: IfsVersion: 1.0 +# CHECK-MERGE-IFS: --- !experimental-ifs-v2 +# CHECK-MERGE-IFS-NEXT: IfsVersion: 2.0 # CHECK-MERGE-IFS-NEXT: Triple: x86_64-unknown-linux-gnu # CHECK-MERGE-IFS-NEXT: ObjectFileFormat: ELF # CHECK-MERGE-IFS-NEXT: Symbols: -# CHECK-MERGE-IFS-NEXT: a: { Type: Func } +# CHECK-MERGE-IFS-NEXT: - { Name: a, Type: Func } # CHECK-MERGE-IFS-NEXT: ... ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-unknown-linux-gnu ObjectFileFormat: ELF Symbols: - a: { Type: Func } + - { Name: a, Type: Func } ... diff --git a/llvm/test/tools/llvm-ifs/ios-tbd.ifs b/llvm/test/tools/llvm-ifs/ios-tbd.ifs --- a/llvm/test/tools/llvm-ifs/ios-tbd.ifs +++ b/llvm/test/tools/llvm-ifs/ios-tbd.ifs @@ -13,10 +13,10 @@ # CHECK-NEXT: symbols: [ __Z3fooi ] # CHECK-NEXT: ... ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: arm64-apple-ios ObjectFileFormat: TBD Symbols: - __Z3fooi: { Type: Func } + - { Name: __Z3fooi, Type: Func } ... diff --git a/llvm/test/tools/llvm-ifs/macos-tbd.ifs b/llvm/test/tools/llvm-ifs/macos-tbd.ifs --- a/llvm/test/tools/llvm-ifs/macos-tbd.ifs +++ b/llvm/test/tools/llvm-ifs/macos-tbd.ifs @@ -13,10 +13,10 @@ # CHECK-NEXT: symbols: [ __Z3fooi ] # CHECK-NEXT: ... ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: arm64-apple-macosx ObjectFileFormat: TBD Symbols: - __Z3fooi: { Type: Func } + - { Name: __Z3fooi, Type: Func } ... diff --git a/llvm/test/tools/llvm-ifs/object-function-size-weak-combo.ifs b/llvm/test/tools/llvm-ifs/object-function-size-weak-combo.ifs --- a/llvm/test/tools/llvm-ifs/object-function-size-weak-combo.ifs +++ b/llvm/test/tools/llvm-ifs/object-function-size-weak-combo.ifs @@ -4,17 +4,17 @@ # RUN: llvm-ifs -action write-bin -o - %s %S/func.ifs %S/object.ifs %S/weak.ifs | \ # RUN: llvm-readelf --all | FileCheck %s --check-prefixes=CHECK-ELF -# CHECK-IFS: --- !experimental-ifs-v1 -# CHECK-IFS-NEXT: IfsVersion: 1.0 +# CHECK-IFS: --- !experimental-ifs-v2 +# CHECK-IFS-NEXT: IfsVersion: 2.0 # CHECK-IFS-NEXT: Triple: x86_64-unknown-linux-gnu # CHECK-IFS-NEXT: ObjectFileFormat: ELF # CHECK-IFS-NEXT: Symbols: -# CHECK-IFS-DAG: e: { Type: Object, Size: 8 } -# CHECK-IFS-DAG: a: { Type: Func } -# CHECK-IFS-DAG: f: { Type: Object, Size: 2 } -# CHECK-IFS-DAG: _Z10strongFuncv: { Type: Func } -# CHECK-IFS-DAG: _Z8weakFuncv: { Type: Func, Weak: true } -# CHECK-IFS-DAG: b: { Type: Object, Size: 4 } +# CHECK-IFS-DAG: - { Name: e, Type: Object, Size: 8 } +# CHECK-IFS-DAG: - { Name: a, Type: Func } +# CHECK-IFS-DAG: - { Name: f, Type: Object, Size: 2 } +# CHECK-IFS-DAG: - { Name: _Z10strongFuncv, Type: Func } +# CHECK-IFS-DAG: - { Name: _Z8weakFuncv, Type: Func, Weak: true } +# CHECK-IFS-DAG: - { Name: b, Type: Object, Size: 4 } # CHECK-IFS: ... # CHECK-ELF: FUNC GLOBAL DEFAULT 1 _Z10strongFuncv @@ -24,11 +24,11 @@ # CHECK-ELF: OBJECT GLOBAL DEFAULT 1 e # CHECK-ELF: OBJECT GLOBAL DEFAULT 1 f ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-unknown-linux-gnu ObjectFileFormat: ELF Symbols: - e: { Type: Object, Size: 8 } - f: { Type: Object, Size: 2 } + - { Name: e, Type: Object, Size: 8 } + - { Name: f, Type: Object, Size: 2 } ... diff --git a/llvm/test/tools/llvm-ifs/object.ifs b/llvm/test/tools/llvm-ifs/object.ifs --- a/llvm/test/tools/llvm-ifs/object.ifs +++ b/llvm/test/tools/llvm-ifs/object.ifs @@ -4,12 +4,12 @@ # RUN: llvm-ifs -action write-bin -o - %s | \ # RUN: llvm-readelf --all | FileCheck %s --check-prefixes=CHECK-ELF -# CHECK-IFS: --- !experimental-ifs-v1 -# CHECK-IFS-NEXT: IfsVersion: 1.0 +# CHECK-IFS: --- !experimental-ifs-v2 +# CHECK-IFS-NEXT: IfsVersion: 2.0 # CHECK-IFS-NEXT: Triple: x86_64-unknown-linux-gnu # CHECK-IFS-NEXT: ObjectFileFormat: ELF # CHECK-IFS-NEXT: Symbols: -# CHECK-IFS-NEXT: b: { Type: Object, Size: 4 } +# CHECK-IFS-NEXT: - { Name: b, Type: Object, Size: 4 } # CHECK-IFS-NEXT: ... # CHECK-ELF: ELF Header: @@ -19,10 +19,10 @@ # CHECK-ELF-NOT: FUNC GLOBAL DEFAULT 1 a # CHECK-ELF: OBJECT GLOBAL DEFAULT 1 b ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-unknown-linux-gnu ObjectFileFormat: ELF Symbols: - b: { Type: Object, Size: 4 } + - { Name: b, Type: Object, Size: 4 } ... diff --git a/llvm/test/tools/llvm-ifs/strong.ifs b/llvm/test/tools/llvm-ifs/strong.ifs --- a/llvm/test/tools/llvm-ifs/strong.ifs +++ b/llvm/test/tools/llvm-ifs/strong.ifs @@ -1,17 +1,17 @@ # RUN: llvm-ifs -action write-ifs -o - %s %S/strong.ifs | FileCheck %s --check-prefixes=CHECK-IFS -# CHECK-IFS: --- !experimental-ifs-v1 -# CHECK-IFS-NEXT: IfsVersion: 1.0 +# CHECK-IFS: --- !experimental-ifs-v2 +# CHECK-IFS-NEXT: IfsVersion: 2.0 # CHECK-IFS-NEXT: Triple: x86_64-unknown-linux-gnu # CHECK-IFS-NEXT: ObjectFileFormat: ELF # CHECK-IFS-NEXT: Symbols: -# CHECK-IFS-DAG: _Z8weakFuncv: { Type: Func } +# CHECK-IFS-DAG: - { Name: _Z8weakFuncv, Type: Func } # CHECK-IFS: ... ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-unknown-linux-gnu ObjectFileFormat: ELF Symbols: - _Z8weakFuncv: { Type: Func } + - { Name: _Z8weakFuncv, Type: Func } ... diff --git a/llvm/test/tools/llvm-ifs/tvos-tbd.ifs b/llvm/test/tools/llvm-ifs/tvos-tbd.ifs --- a/llvm/test/tools/llvm-ifs/tvos-tbd.ifs +++ b/llvm/test/tools/llvm-ifs/tvos-tbd.ifs @@ -13,10 +13,10 @@ # CHECK-NEXT: symbols: [ __Z3fooi ] # CHECK-NEXT: ... ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: arm64-apple-tvos ObjectFileFormat: TBD Symbols: - __Z3fooi: { Type: Func } + - { Name: __Z3fooi, Type: Func } ... diff --git a/llvm/test/tools/llvm-ifs/version-ok.ifs b/llvm/test/tools/llvm-ifs/version-ok.ifs --- a/llvm/test/tools/llvm-ifs/version-ok.ifs +++ b/llvm/test/tools/llvm-ifs/version-ok.ifs @@ -1,9 +1,9 @@ # RUN: llvm-ifs -action write-ifs -o - %s %S/object.ifs ---- !experimental-ifs-v1 -IfsVersion: 1.1 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-unknown-linux-gnu ObjectFileFormat: ELF Symbols: - a: { Type: Func } + - { Name: a, Type: Func } ... diff --git a/llvm/test/tools/llvm-ifs/watchos-tbd.ifs b/llvm/test/tools/llvm-ifs/watchos-tbd.ifs --- a/llvm/test/tools/llvm-ifs/watchos-tbd.ifs +++ b/llvm/test/tools/llvm-ifs/watchos-tbd.ifs @@ -13,10 +13,10 @@ # CHECK-NEXT: symbols: [ __Z3fooi ] # CHECK-NEXT: ... ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: arm64-apple-watchos ObjectFileFormat: TBD Symbols: - __Z3fooi: { Type: Func } + - { Name: __Z3fooi, Type: Func } ... diff --git a/llvm/test/tools/llvm-ifs/weak-mismatch.ifs b/llvm/test/tools/llvm-ifs/weak-mismatch.ifs --- a/llvm/test/tools/llvm-ifs/weak-mismatch.ifs +++ b/llvm/test/tools/llvm-ifs/weak-mismatch.ifs @@ -10,10 +10,10 @@ # CHECK-TYPE-NEXT: Filename: # CHECK-TYPE-NEXT: Type Values: Object Func ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-unknown-linux-gnu ObjectFileFormat: ELF Symbols: - foobar: { Type: Object, Size: 1, Weak: true } + - { Name: foobar, Type: Object, Size: 1, Weak: true } ... diff --git a/llvm/test/tools/llvm-ifs/weak.ifs b/llvm/test/tools/llvm-ifs/weak.ifs --- a/llvm/test/tools/llvm-ifs/weak.ifs +++ b/llvm/test/tools/llvm-ifs/weak.ifs @@ -1,19 +1,19 @@ # RUN: llvm-ifs -action write-ifs -o - %s | FileCheck %s --check-prefixes=CHECK-IFS -# CHECK-IFS: --- !experimental-ifs-v1 -# CHECK-IFS-NEXT: IfsVersion: 1.0 +# CHECK-IFS: --- !experimental-ifs-v2 +# CHECK-IFS-NEXT: IfsVersion: 2.0 # CHECK-IFS-NEXT: Triple: x86_64-unknown-linux-gnu # CHECK-IFS-NEXT: ObjectFileFormat: ELF # CHECK-IFS-NEXT: Symbols: -# CHECK-IFS-DAG: _Z8weakFuncv: { Type: Func, Weak: true } -# CHECK-IFS-DAG: _Z10strongFuncv: { Type: Func } +# CHECK-IFS-DAG: - { Name: _Z8weakFuncv, Type: Func, Weak: true } +# CHECK-IFS-DAG: - { Name: _Z10strongFuncv, Type: Func } # CHECK-IFS: ... ---- !experimental-ifs-v1 -IfsVersion: 1.0 +--- !experimental-ifs-v2 +IfsVersion: 2.0 Triple: x86_64-unknown-linux-gnu ObjectFileFormat: ELF Symbols: - _Z8weakFuncv: { Type: Func, Weak: true } - _Z10strongFuncv: { Type: Func } + - { Name: _Z8weakFuncv, Type: Func, Weak: true } + - { Name: _Z10strongFuncv, Type: Func } ... diff --git a/llvm/tools/llvm-ifs/llvm-ifs.cpp b/llvm/tools/llvm-ifs/llvm-ifs.cpp --- a/llvm/tools/llvm-ifs/llvm-ifs.cpp +++ b/llvm/tools/llvm-ifs/llvm-ifs.cpp @@ -26,6 +26,7 @@ #include "llvm/TextAPI/MachO/TextAPIWriter.h" #include #include +#include using namespace llvm; using namespace llvm::yaml; @@ -34,8 +35,8 @@ #define DEBUG_TYPE "llvm-ifs" namespace { -const VersionTuple IFSVersionCurrent(1, 2); -} +const VersionTuple IFSVersionCurrent(2, 0); +} // end anonymous namespace static cl::opt Action("action", cl::desc(""), cl::value_desc("write-ifs | write-bin"), @@ -76,6 +77,7 @@ } struct IFSSymbol { + IFSSymbol() = default; IFSSymbol(std::string SymbolName) : Name(SymbolName) {} std::string Name; uint64_t Size; @@ -85,6 +87,8 @@ bool operator<(const IFSSymbol &RHS) const { return Name < RHS.Name; } }; +LLVM_YAML_IS_SEQUENCE_VECTOR(IFSSymbol) + namespace llvm { namespace yaml { /// YAML traits for IFSSymbolType. @@ -124,6 +128,7 @@ /// YAML traits for IFSSymbol. template <> struct MappingTraits { static void mapping(IO &IO, IFSSymbol &Symbol) { + IO.mapRequired("Name", Symbol.Name); IO.mapRequired("Type", Symbol.Type); // The need for symbol size depends on the symbol type. if (Symbol.Type == IFSSymbolType::NoType) @@ -140,20 +145,6 @@ static const bool flow = true; }; -/// YAML traits for set of IFSSymbols. -template <> struct CustomMappingTraits> { - static void inputOne(IO &IO, StringRef Key, std::set &Set) { - std::string Name = Key.str(); - IFSSymbol Sym(Name); - IO.mapRequired(Name.c_str(), Sym); - Set.insert(Sym); - } - - static void output(IO &IO, std::set &Set) { - for (auto &Sym : Set) - IO.mapRequired(Sym.Name.c_str(), const_cast(Sym)); - } -}; } // namespace yaml } // namespace llvm @@ -167,7 +158,7 @@ std::string ObjectFileFormat; Optional SOName; std::vector NeededLibs; - std::set Symbols; + std::vector Symbols; IFSStub() = default; IFSStub(const IFSStub &Stub) @@ -186,14 +177,18 @@ /// YAML traits for IFSStub objects. template <> struct MappingTraits { static void mapping(IO &IO, IFSStub &Stub) { - if (!IO.mapTag("!experimental-ifs-v1", true)) + if (!IO.mapTag("!experimental-ifs-v2", true)) IO.setError("Not a .ifs YAML file."); + + auto oldContext = IO.getContext(); + IO.setContext(&Stub); IO.mapRequired("IfsVersion", Stub.IfsVersion); IO.mapOptional("Triple", Stub.Triple); IO.mapOptional("ObjectFileFormat", Stub.ObjectFileFormat); IO.mapOptional("SOName", Stub.SOName); IO.mapOptional("NeededLibs", Stub.NeededLibs); IO.mapRequired("Symbols", Stub.Symbols); + IO.setContext(&oldContext); } }; } // namespace yaml @@ -218,7 +213,7 @@ return std::move(Stub); } -int writeTbdStub(const llvm::Triple &T, const std::set &Symbols, +int writeTbdStub(const llvm::Triple &T, const std::vector &Symbols, const StringRef Format, raw_ostream &Out) { auto PlatformKindOrError = @@ -280,7 +275,7 @@ return 0; } -int writeElfStub(const llvm::Triple &T, const std::set &Symbols, +int writeElfStub(const llvm::Triple &T, const std::vector &Symbols, const StringRef Format, raw_ostream &Out) { SmallString<0> Storage; Storage.clear(); @@ -387,8 +382,8 @@ // TODO: Drop ObjectFileFormat, it can be subsumed from the triple. // New Interface Stubs Yaml Format: -// --- !experimental-ifs-v1 -// IfsVersion: 1.0 +// --- !experimental-ifs-v2 +// IfsVersion: 2.0 // Triple: // ObjectFileFormat: // Symbols: @@ -517,7 +512,7 @@ } for (auto &Entry : SymbolMap) - Stub.Symbols.insert(Entry.second); + Stub.Symbols.push_back(Entry.second); std::error_code SysErr;