Skip to content

Commit

Permalink
chore: warn when corpus is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
sdkrystian committed Jan 3, 2024
1 parent de75a22 commit 11febb6
Showing 3 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/mrdocs/Corpus.hpp
Original file line number Diff line number Diff line change
@@ -78,6 +78,12 @@ class MRDOCS_VISIBLE
iterator
end() const noexcept = 0;

/** Whether the corpus contains any symbols.
*/
MRDOCS_DECL
bool
empty() const noexcept;

/** Return the Info with the matching ID, or nullptr.
*/
MRDOCS_DECL
7 changes: 7 additions & 0 deletions src/lib/Lib/Corpus.cpp
Original file line number Diff line number Diff line change
@@ -28,6 +28,13 @@ Corpus::~Corpus() noexcept = default;
//
//------------------------------------------------

bool
Corpus::
empty() const noexcept
{
return begin() == end();
}

/** Return the metadata for the global namespace.
*/
NamespaceInfo const&
6 changes: 6 additions & 0 deletions src/tool/GenerateAction.cpp
Original file line number Diff line number Diff line change
@@ -114,6 +114,12 @@ DoGenerateAction()
CorpusImpl::build(
report::Level::info, config, compilationDatabase));

if(corpus->empty())
{
report::warn("Corpus is empty, not generating docs");
return {};
}

// --------------------------------------------------------------
//
// Generate docs

0 comments on commit 11febb6

Please sign in to comment.