aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
diff options
context:
space:
mode:
authorPuyan Lotfi <puyan@puyan.org>2020-03-28 04:08:27 -0400
committerPuyan Lotfi <puyan@puyan.org>2020-04-01 10:49:06 -0400
commite3033c0ce5517efddbf92a079ad1e0ca4868591f (patch)
tree98ef0cb8c4d7c7ad93346933371f8a43f600ff79 /clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
parenta67cd71acdb0cd636097a74ec80e2f23ef301ada (diff)
downloadllvm-e3033c0ce5517efddbf92a079ad1e0ca4868591f.zip
llvm-e3033c0ce5517efddbf92a079ad1e0ca4868591f.tar.gz
llvm-e3033c0ce5517efddbf92a079ad1e0ca4868591f.tar.bz2
[llvm][clang][IFS] Enhancing the llvm-ifs yaml format for symbol lists.
Prior to this change the clang interface stubs format resembled something ending with a symbol list like this: Symbols: a: { Type: Func } This was problematic because we didn't actually want a map format and also because we didn't like that an empty symbol list required "Symbols: {}". That is to say without the empty {} llvm-ifs would crash on an empty list. With this new format it is much more clear which field is the symbol name, and instead the [] that is used to express an empty symbol vector is optional, ie: Symbols: - { Name: a, Type: Func } or Symbols: [] or Symbols: This further diverges the format from existing llvm-elftapi. This is a good thing because although the format originally came from the same place, they are not the same in any way. Differential Revision: https://reviews.llvm.org/D76979
Diffstat (limited to 'clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp')
-rw-r--r--clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
index 2b7f0f8..b7c1e69 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<ASTConsumer>
-GenerateInterfaceIfsExpV1Action::CreateASTConsumer(CompilerInstance &CI,
- StringRef InFile) {
+GenerateInterfaceStubsAction::CreateASTConsumer(CompilerInstance &CI,
+ StringRef InFile) {
return std::make_unique<InterfaceStubFunctionsConsumer>(
- CI, InFile, "experimental-ifs-v1");
+ CI, InFile, "experimental-ifs-v2");
}