[clang][extract-api] Suppprt for the module name property in SymbolGraph

Adds `--product-name=` flag to the clang driver. This gets forwarded to
cc1 only when we are performing a ExtractAPI Action. This is used to
populate the `name` field of the module object in the generated SymbolGraph.

Differential Revision: https://reviews.llvm.org/D122141
This commit is contained in:
Daniel Grumberg
2022-03-16 13:38:54 +00:00
parent 2da5c5781e
commit 5ef2ec7e4e
8 changed files with 33 additions and 15 deletions

View File

@@ -376,10 +376,9 @@ Object SymbolGraphSerializer::serializeMetadata() const {
Object SymbolGraphSerializer::serializeModule() const {
Object Module;
// FIXME: We might not be building a module, some Clang-based languages might
// not have a "module" concept. Figure out a way to provide a name to
// describe the API set.
Module["name"] = "";
// The user is expected to always pass `--product-name=` on the command line
// to populate this field.
Module["name"] = ProductName;
serializeObject(Module, "platform", serializePlatform(API.getTarget()));
return Module;
}