Skip to content

Commit 11febb6

Browse files
committed
chore: warn when corpus is empty
1 parent de75a22 commit 11febb6

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

include/mrdocs/Corpus.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ class MRDOCS_VISIBLE
7878
iterator
7979
end() const noexcept = 0;
8080

81+
/** Whether the corpus contains any symbols.
82+
*/
83+
MRDOCS_DECL
84+
bool
85+
empty() const noexcept;
86+
8187
/** Return the Info with the matching ID, or nullptr.
8288
*/
8389
MRDOCS_DECL

src/lib/Lib/Corpus.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ Corpus::~Corpus() noexcept = default;
2828
//
2929
//------------------------------------------------
3030

31+
bool
32+
Corpus::
33+
empty() const noexcept
34+
{
35+
return begin() == end();
36+
}
37+
3138
/** Return the metadata for the global namespace.
3239
*/
3340
NamespaceInfo const&

src/tool/GenerateAction.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ DoGenerateAction()
114114
CorpusImpl::build(
115115
report::Level::info, config, compilationDatabase));
116116

117+
if(corpus->empty())
118+
{
119+
report::warn("Corpus is empty, not generating docs");
120+
return {};
121+
}
122+
117123
// --------------------------------------------------------------
118124
//
119125
// Generate docs

0 commit comments

Comments
 (0)