mirror of
https://github.com/YosysHQ/yosys
synced 2026-07-14 11:15:40 +00:00
Fixup help contents source_file
Stop empty source files `""` from being exported to json. Move source path fixing to a separate function. `ContentListing::to_json` now takes the source root, recursively calling the source path fixup function on all source paths in the content listing.
This commit is contained in:
parent
0e763f320b
commit
53d1e7615b
3 changed files with 46 additions and 21 deletions
|
|
@ -22,9 +22,14 @@
|
|||
|
||||
#include "kernel/yosys_common.h"
|
||||
#include "kernel/json.h"
|
||||
#include <filesystem>
|
||||
#include <string_view>
|
||||
|
||||
YOSYS_NAMESPACE_BEGIN
|
||||
|
||||
std::filesystem::path fixup_source_path (const char* source_file,
|
||||
const std::filesystem::path &source_root, bool* skip_source_group = nullptr);
|
||||
|
||||
class ContentListing {
|
||||
vector<ContentListing> _content;
|
||||
public:
|
||||
|
|
@ -49,6 +54,7 @@ public:
|
|||
_content.push_back({type, body, location});
|
||||
}
|
||||
|
||||
bool has_source() const { return strlen(source_file) && strcmp(source_file, "unknown") != 0; }
|
||||
bool has_content() const { return _content.size() != 0; }
|
||||
|
||||
vector<ContentListing>::const_iterator begin() const { return _content.cbegin(); }
|
||||
|
|
@ -90,7 +96,7 @@ public:
|
|||
const source_location location = source_location::current()
|
||||
);
|
||||
|
||||
Json to_json() const;
|
||||
Json to_json(const std::filesystem::path &source_root) const;
|
||||
};
|
||||
|
||||
class PrettyHelp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue