diff --git a/clang/include/clang/Frontend/FrontendActions.h b/clang/include/clang/Frontend/FrontendActions.h index 89ac20075fa4..9ca2bfda2138 100644 --- a/clang/include/clang/Frontend/FrontendActions.h +++ b/clang/include/clang/Frontend/FrontendActions.h @@ -119,17 +119,13 @@ protected: bool hasASTFileSupport() const override { return false; } }; -class GenerateInterfaceStubAction : public ASTFrontendAction { -protected: - TranslationUnitKind getTranslationUnitKind() override { return TU_Module; } - - bool hasASTFileSupport() const override { return false; } -}; - -class GenerateInterfaceIfsExpV1Action : public GenerateInterfaceStubAction { +class GenerateInterfaceStubsAction : public ASTFrontendAction { protected: std::unique_ptr CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override; + + TranslationUnitKind getTranslationUnitKind() override { return TU_Module; } + bool hasASTFileSupport() const override { return false; } }; class GenerateModuleFromModuleMapAction : public GenerateModuleAction { diff --git a/clang/include/clang/Frontend/FrontendOptions.h b/clang/include/clang/Frontend/FrontendOptions.h index 66fec6436a40..6069b5eea265 100644 --- a/clang/include/clang/Frontend/FrontendOptions.h +++ b/clang/include/clang/Frontend/FrontendOptions.h @@ -90,7 +90,7 @@ enum ActionKind { GeneratePCH, /// Generate Interface Stub Files. - GenerateInterfaceIfsExpV1, + GenerateInterfaceStubs, /// Only execute frontend initialization. InitOnly, diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 161af89a67e1..4d825301be41 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4184,7 +4184,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, StringRef ArgStr = Args.hasArg(options::OPT_interface_stub_version_EQ) ? Args.getLastArgValue(options::OPT_interface_stub_version_EQ) - : "experimental-ifs-v1"; + : "experimental-ifs-v2"; CmdArgs.push_back("-emit-interface-stubs"); CmdArgs.push_back( Args.MakeArgString(Twine("-interface-stub-version=") + ArgStr.str())); diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index e0567138b782..5d0be3c1f1b0 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1780,25 +1780,26 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, 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 @@ static bool isStrictlyPreprocessorAction(frontend::ActionKind Action) { 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 index 2b7f0f8f9b66..b7c1e693413b 100644 --- a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp +++ b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp @@ -290,7 +290,7 @@ public: 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 @@ public: 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 @@ public: 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 index ab7a1e32e301..7c59ae42d2a2 100644 --- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -65,8 +65,8 @@ CreateFrontendBaseAction(CompilerInstance &CI) { 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 index 4d51ac867eb2..1289067a365a 100644 --- 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 index 927f2bf28869..8e2a01159aab 100644 --- 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 index 4c0edaa2dd8f..b6580861de8b 100644 --- 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 index aaa04775e317..cc6191900a30 100644 --- 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 index d4b85ac73e56..e806cc323ee7 100644 --- 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 index 96425a42b6fc..f9de07d17850 100644 --- 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 index f09b9d929ca3..4d9f24bae5b3 100644 --- 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 index bccd1c9bccd4..a3f3966dbe8f 100644 --- 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 index 000000000000..c68c124e513e --- /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 index d115523bfda4..9de5213de9d6 100644 --- 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 index 19ba579608ec..2219fd5b2e8a 100644 --- 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 index d0e5fd26e4b7..2c30b0ee4005 100644 --- 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 index 0b0ac83726ad..1dec4ae677d7 100644 --- a/clang/test/InterfaceStubs/inline.c +++ b/clang/test/InterfaceStubs/inline.c @@ -55,8 +55,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" diff --git a/clang/test/InterfaceStubs/lambda.cpp b/clang/test/InterfaceStubs/lambda.cpp index e892f1eee11c..a167f6556b94 100644 --- 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 index 6a7f27c9b7b0..a4e05f904701 100644 --- 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 index 1c62346d22fc..ad4db24ff7de 100644 --- 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 index 51176ac0ba0b..6390099dee5f 100644 --- 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 index d6e28c5f884a..45e2d38ba3e9 100644 --- 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 index 7dc1134bac93..3afdf4e65eef 100644 --- 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 index 9a91697d9506..8b7a276bb054 100644 --- 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 index c4c7afa42f1e..f59a55b2bb45 100644 --- 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 index 47788d4a3e0a..68f017c4d5ec 100644 --- 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 index 63883536a816..5451ec6178e2 100644 --- 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 index 57076a097cb5..dac7806926a5 100644 --- 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 index e6afc781412a..d4aad84d7211 100644 --- 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 index 735a040c91dc..2ef83207fcb3 100644 --- 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 index bbb5ae888977..9b67dac9865c 100644 --- 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 index 1581ffa9d5d7..e3c0413b6511 100644 --- 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 index c81c702861e4..73f3ed5d39ac 100644 --- 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 index 9afb08802726..30b7cda9b548 100644 --- 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 index 8fc550a644cb..3f8d54c7e536 100644 --- 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 index 40ae9c0526f2..4e26fb8080e8 100644 --- 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 index 15bddc6a15f7..9ce04b8b3f31 100644 --- 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 index addf9943441b..ecdeb311f860 100644 --- 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 index 173ce268c741..5e0fcafd55db 100644 --- 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 index c518be4e1411..1a10ea79a41c 100644 --- 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 index 823b8f1866c3..23eb73d7535f 100644 --- 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 index 9848f418f58c..c61f29a37976 100644 --- 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 index 000000000000..d237dd7ea10a --- /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 index 000000000000..a294c777bbf9 --- /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 index 496e26241922..d6d85782b2e3 100644 --- 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 index 13671b02c5cb..5b21aedf6500 100644 --- 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 index bd84806fb219..b04828b2a39d 100644 --- 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 index b6328fbc58d9..769f423f328a 100644 --- 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 index 733cc38001d3..c4823c20fce2 100644 --- 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 index bdc930fbaaa3..ccc1f9e5d8b6 100644 --- 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 index 08c8478c1daf..6db01bf6162f 100644 --- 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 index fd150ee77d55..646b8624feb1 100644 --- 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 index 74a9d962a3e0..fcb914265202 100644 --- 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 index 15abc2064cc2..cf45dff8c062 100644 --- 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 index a7441be1c1f2..bf8091050530 100644 --- 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 index 3b0d2ee725ff..0d1a7518dad3 100644 --- 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 @@ using namespace llvm::MachO; #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 @@ std::string getTypeName(IFSSymbolType Type) { } struct IFSSymbol { + IFSSymbol() = default; IFSSymbol(std::string SymbolName) : Name(SymbolName) {} std::string Name; uint64_t Size; @@ -85,6 +87,8 @@ struct IFSSymbol { 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 @@ template <> struct ScalarTraits { /// 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 @@ template <> struct MappingTraits { 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 @@ public: std::string ObjectFileFormat; Optional SOName; std::vector NeededLibs; - std::set Symbols; + std::vector Symbols; IFSStub() = default; IFSStub(const IFSStub &Stub) @@ -186,14 +177,18 @@ namespace yaml { /// 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 @@ static Expected> readInputFile(StringRef FilePath) { 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 @@ int writeTbdStub(const llvm::Triple &T, const std::set &Symbols, 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 @@ int writeIfso(const IFSStub &Stub, bool IsWriteIfs, raw_ostream &Out) { // 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 @@ int main(int argc, char *argv[]) { } for (auto &Entry : SymbolMap) - Stub.Symbols.insert(Entry.second); + Stub.Symbols.push_back(Entry.second); std::error_code SysErr;