Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 45 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -536,38 +536,59 @@ jobs:
trace-commands: true

- name: Set up llvm-symbolizer
if: ${{ runner.os == 'macOS' }}
if: ${{ runner.os != 'Windows' }}
run: |
set -x

# Step 1: Check if llvm-symbolizer is installed
if ! command -v llvm-symbolizer &> /dev/null; then
echo "llvm-symbolizer is not installed. Installing via Homebrew..."
# Step 2: Install llvm if not installed
if command -v brew &> /dev/null; then
brew install llvm
else
echo "Homebrew is not installed. Please install Homebrew first: https://brew.sh/"
exit 1
fi
fi

# Step 3: Ensure llvm-symbolizer is in your PATH
llvm_bin_path=$(brew --prefix)/opt/llvm/bin
PATH="$PATH:$llvm_bin_path"
LLVM_SYMBOLIZER_PATH=$(which llvm-symbolizer)
if [ -z "$LLVM_SYMBOLIZER_PATH" ]; then
echo "llvm-symbolizer installation failed or it's not in the PATH."
exit 1

if [[ $RUNNER_OS == 'macOS' ]]; then
# Step 1: Check if llvm-symbolizer is installed
if ! command -v llvm-symbolizer &> /dev/null; then
echo "llvm-symbolizer is not installed. Installing via Homebrew..."
# Step 2: Install llvm if not installed
if command -v brew &> /dev/null; then
brew install llvm
else
echo "Homebrew is not installed. Please install Homebrew first: https://brew.sh/"
exit 1
fi
fi

# Step 3: Ensure llvm-symbolizer is in your PATH
llvm_bin_path=$(brew --prefix)/opt/llvm/bin
PATH="$PATH:$llvm_bin_path"
LLVM_SYMBOLIZER_PATH=$(which llvm-symbolizer)
if [ -z "$LLVM_SYMBOLIZER_PATH" ]; then
echo "llvm-symbolizer installation failed or it's not in the PATH."
exit 1
else
echo "llvm-symbolizer found at: $LLVM_SYMBOLIZER_PATH"
fi
elif [[ $RUNNER_OS == 'Linux' ]]; then
# Step 1: Check if llvm-symbolizer is installed
if ! command -v llvm-symbolizer &> /dev/null; then
echo "llvm-symbolizer is not installed. Installing via apt-get..."
apt-get update
apt-get install -y llvm
fi

# Step 2: Ensure llvm-symbolizer is in your PATH
LLVM_SYMBOLIZER_PATH=$(which llvm-symbolizer)
if [ -z "$LLVM_SYMBOLIZER_PATH" ]; then
echo "llvm-symbolizer installation failed or it's not in the PATH."
exit 1
else
echo "llvm-symbolizer found at: $LLVM_SYMBOLIZER_PATH"
fi
else
echo "llvm-symbolizer found at: $LLVM_SYMBOLIZER_PATH"
echo "Unsupported OS: $RUNNER_OS"
exit 1
fi

# Step 4: Export LLVM_SYMBOLIZER_PATH environment variable
export LLVM_SYMBOLIZER_PATH="$LLVM_SYMBOLIZER_PATH"
echo -e "LLVM_SYMBOLIZER_PATH=$LLVM_SYMBOLIZER_PATH" >> $GITHUB_ENV
echo "Environment variable LLVM_SYMBOLIZER_PATH set to: $LLVM_SYMBOLIZER_PATH"

- name: Generate Landing Page
working-directory: docs/website
run: |
Expand Down
3 changes: 2 additions & 1 deletion docs/modules/ROOT/pages/design-notes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ Here are a few constructs MrDocs attempts to understand and document automatical
* Private APIs
* Unspecified Return Types
* Concepts
* Typedef / Aliases
* Typedefs
* Namespace Aliases
* Constants
* Automatic Related Types
* Macros
Expand Down
6 changes: 3 additions & 3 deletions docs/modules/ROOT/pages/generators.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ When the symbol kind is `friend`, the symbol object has the following additional
| The friend type.
|===

When the symbol kind is `alias`, the symbol object has the following additional properties:
When the symbol kind is `namespace-alias`, the symbol object has the following additional properties:

|===
| Property | Type | Description
Expand Down Expand Up @@ -527,14 +527,14 @@ When the symbol kind is `using`, the symbol object has the following additional
| The qualifier of the using declaration.
|===

When the symbol kind is `enumerator`, the symbol object has the following additional properties:
When the symbol kind is `enum-constant`, the symbol object has the following additional properties:

|===
| Property | Type | Description

| `initializer`
| `string`
| The initializer of the enumerator.
| The initializer of the enum-constant.
|===

When the symbol kind is `guide`, the symbol object has the following additional properties:
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/partials/InfoNodes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ INFO(Variable, Variables, VARIABLE, variable, variables,
INFO(Field, Fields, FIELD, field, fields, The symbol is a field)
INFO(Specialization, Specializations, SPECIALIZATION, specialization, specializations, The symbol is a template specialization)
INFO(Friend, Friends, FRIEND, friend, friends, The symbol is a friend declaration)
INFO(Enumerator, Enumerators, ENUMERATOR, enumerator, enumerators, The symbol is an enumerator)
INFO(EnumConstant, EnumConstants, ENUM_CONSTANT, enumerator, enumerators, The symbol is an enumerator)
INFO(Guide, Guides, GUIDE, guide, guides, The symbol is a deduction guide)
INFO(Alias, Aliases, ALIAS, alias, aliases, The symbol is a namespace alias)
INFO(Using, Usings, USING, using, usings, The symbol is a using declaration)
Expand Down
8 changes: 4 additions & 4 deletions docs/mrdocs.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
},
"implementation-defined": {
"default": [],
"description": "Namespaces for symbols rendered as \"implementation-defined\". Symbols in these namespaces are not extracted and are rendered as \"implementation-defined\" in the documentation. This option is used to exclude symbols from the documentation that are considered part of the private API of the project.",
"description": "Namespaces for symbols rendered as \"implementation-defined\". Symbols in these are rendered as \"implementation-defined\" in the documentation. This option is used to exclude symbols from the documentation that are considered part of the private API of the project. An \"implementation-defined\" symbol has no documentation page in the output. If any other symbol refers to it, the reference is rendered as \"implementation-defined\".",
"items": {
"type": "string"
},
Expand All @@ -130,7 +130,7 @@
},
"inaccessible-members": {
"default": "always",
"description": "Determine whether inaccessible members should be extracted. When set to `always`, inaccessible members are always extracted. When set to `dependency`, inaccessible members are extracted only if they are referenced by the source code. When set to `never`, inaccessible members are never extracted.",
"description": "Determine whether inaccessible members, such as private members of records, should be extracted. When set to `always`, inaccessible members are always extracted. When set to `dependency`, inaccessible members are extracted only if they are referenced by the source code. When set to `never`, inaccessible members are never extracted.",
"enum": [
"always",
"dependency",
Expand Down Expand Up @@ -193,7 +193,7 @@
},
"referenced-declarations": {
"default": "dependency",
"description": "Determine whether external declarations should be extracted when they are referenced in the source code. When set to `always`, external declarations are always extracted. When set to `dependency`, external declarations are extracted only if they are referenced by the source code. When set to `never`, external declarations are never extracted.",
"description": "Determine whether external declarations should be extracted when they are referenced in the source code. If this option is not `never`, a second pass happens in the extraction process to extract dependencies in the Corpus. When set to `always`, external declarations are always extracted. When set to `dependency`, external declarations are extracted only if they are referenced by the source code. When set to `never`, external declarations are never extracted.",
"enum": [
"always",
"dependency",
Expand All @@ -211,7 +211,7 @@
},
"see-below": {
"default": [],
"description": "Namespaces for symbols rendered as \"see-below\". Symbols in these namespaces are not extracted and are rendered as \"see-below\" in the documentation. This option is used to exclude symbols from the documentation that are considered part of the private API of the project.",
"description": "Namespaces for symbols rendered as \"see-below\". Symbols in these namespaces are rendered as \"see-below\" in the documentation. This option is used to exclude details about symbols from the documentation that are considered part of the private API of the project. In the documentation page for this symbol, the synopsis of the implementation of a \"see-below\" symbol is rendered as \"see-below\". When the symbol is a scope (such as a namespace or record), its members are not listed. The rest of the documentation is rendered as usual.",
"items": {
"type": "string"
},
Expand Down
5 changes: 5 additions & 0 deletions docs/website/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ if (!fs.existsSync(mrdocsExecutable)) {
// Read panel snippet files and create documentation
const absSnippetsDir = path.join(__dirname, 'snippets')
for (let panel of data.panels) {
console.log(`Generating documentation for panel ${panel.source}`)

// Find source file
const sourcePath = path.join(absSnippetsDir, panel.source)
assert(sourcePath.endsWith('.cpp'))
Expand Down Expand Up @@ -102,6 +104,9 @@ target_compile_features(${sourceBasename} PRIVATE cxx_std_23)
// Delete these temporary files
fs.rmSync(mrdocsOutput, {recursive: true});
fs.unlinkSync(cmakeListsPath);

console.log(`Documentation generated successfully for panel ${panel.source}`)
console.log(`====================================`)
}

// Render the template with the data containing the snippet data
Expand Down
3 changes: 3 additions & 0 deletions docs/website/snippets/mrdocs.yml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
source-root: .
input:
include:
- .
6 changes: 3 additions & 3 deletions include/mrdocs/Metadata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
// All headers related to
// metadata extracted from AST

#include <mrdocs/Metadata/Alias.hpp>
#include <mrdocs/Metadata/Concept.hpp>
#include <mrdocs/Metadata/Enum.hpp>
#include <mrdocs/Metadata/Enumerator.hpp>
#include <mrdocs/Metadata/EnumConstant.hpp>
#include <mrdocs/Metadata/Expression.hpp>
#include <mrdocs/Metadata/Field.hpp>
#include <mrdocs/Metadata/Friend.hpp>
Expand All @@ -31,10 +30,11 @@
#include <mrdocs/Metadata/Javadoc.hpp>
#include <mrdocs/Metadata/Name.hpp>
#include <mrdocs/Metadata/Namespace.hpp>
#include <mrdocs/Metadata/NamespaceAlias.hpp>
#include <mrdocs/Metadata/Overloads.hpp>
#include <mrdocs/Metadata/Record.hpp>
#include <mrdocs/Metadata/Specialization.hpp>
#include <mrdocs/Metadata/Source.hpp>
#include <mrdocs/Metadata/Specialization.hpp>
#include <mrdocs/Metadata/Symbols.hpp>
#include <mrdocs/Metadata/Template.hpp>
#include <mrdocs/Metadata/Type.hpp>
Expand Down
1 change: 1 addition & 0 deletions include/mrdocs/Metadata/Concept.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <mrdocs/Metadata/Info.hpp>
#include <mrdocs/Metadata/Expression.hpp>
#include <mrdocs/Metadata/Source.hpp>
#include <mrdocs/Metadata/Template.hpp>

namespace clang {
namespace mrdocs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// Official repository: https://github.com/cppalliance/mrdocs
//

#ifndef MRDOCS_API_METADATA_ENUMERATOR_HPP
#define MRDOCS_API_METADATA_ENUMERATOR_HPP
#ifndef MRDOCS_API_METADATA_ENUMCONSTANT_HPP
#define MRDOCS_API_METADATA_ENUMCONSTANT_HPP

#include <mrdocs/Platform.hpp>
#include <mrdocs/Metadata/Expression.hpp>
Expand All @@ -21,10 +21,10 @@
namespace clang {
namespace mrdocs {

/** Info for enumerators.
/** Info for enum constants.
*/
struct EnumeratorInfo
: InfoCommonBase<InfoKind::Enumerator>
struct EnumConstantInfo
: InfoCommonBase<InfoKind::EnumConstant>
, SourceInfo
{
/** The initializer expression, if any
Expand All @@ -33,7 +33,7 @@ struct EnumeratorInfo

//--------------------------------------------

explicit EnumeratorInfo(SymbolID ID) noexcept
explicit EnumConstantInfo(SymbolID ID) noexcept
: InfoCommonBase(ID)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// Official repository: https://github.com/cppalliance/mrdocs
//

#ifndef MRDOCS_API_METADATA_ALIAS_HPP
#define MRDOCS_API_METADATA_ALIAS_HPP
#ifndef MRDOCS_API_METADATA_NAMESPACEALIAS_HPP
#define MRDOCS_API_METADATA_NAMESPACEALIAS_HPP

#include <mrdocs/Platform.hpp>
#include <mrdocs/Metadata/Info.hpp>
Expand All @@ -22,16 +22,16 @@ namespace mrdocs {

/** Info for namespace aliases.
*/
struct AliasInfo
: InfoCommonBase<InfoKind::Alias>
struct NamespaceAliasInfo
: InfoCommonBase<InfoKind::NamespaceAlias>
, SourceInfo
{
/** The aliased symbol. */
std::unique_ptr<NameInfo> AliasedSymbol;

//--------------------------------------------

explicit AliasInfo(SymbolID ID) noexcept
explicit NamespaceAliasInfo(SymbolID ID) noexcept
: InfoCommonBase(ID)
{
}
Expand Down
10 changes: 5 additions & 5 deletions include/mrdocs/Metadata/Source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ struct MRDOCS_DECL
//--------------------------------------------

Location(
std::string_view filepath = "",
std::string_view filename = "",
unsigned line = 0,
FileKind kind = FileKind::Source,
bool documented = false)
std::string_view const filepath = {},
std::string_view const filename = {},
unsigned const line = 0,
FileKind const kind = FileKind::Source,
bool const documented = false)
: Path(filepath)
, Filename(filename)
, LineNumber(line)
Expand Down
19 changes: 13 additions & 6 deletions include/mrdocs/Support/Error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ namespace detail

/// Check existing expected-like type
# define MRDOCS_CHECK_VOID(var) \
if (detail::failed(var)) { \
if (detail::failed(var)) { \
return Unexpected(detail::error(var)); \
} \
void(0)
Expand All @@ -585,13 +585,20 @@ namespace detail
# define MRDOCS_CHECK(...) \
MRDOCS_CHECK_GET_MACRO(__VA_ARGS__, MRDOCS_CHECK_MSG, MRDOCS_CHECK_VOID)(__VA_ARGS__)

# define MRDOCS_CHECK_OR(var, expr) \
if (detail::failed(var)) { \
return expr; \
/// Check existing expected-like type and return custom value otherwise
# define MRDOCS_CHECK_OR_VOID(var) \
if (detail::failed(var)) { \
return; \
} \
void(0)


# define MRDOCS_CHECK_OR_VALUE(var, value) \
if (detail::failed(var)) { \
return value; \
} \
void(0)
# define MRDOCS_CHECK_GET_OR_MACRO(_1, _2, NAME, ...) NAME
# define MRDOCS_CHECK_OR(...) \
MRDOCS_CHECK_GET_OR_MACRO(__VA_ARGS__, MRDOCS_CHECK_OR_VALUE, MRDOCS_CHECK_OR_VOID)(__VA_ARGS__)
#endif


Expand Down
8 changes: 4 additions & 4 deletions include/mrdocs/mrdocs.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
<AlternativeType Name="clang::mrdocs::FieldInfo"/>
<AlternativeType Name="clang::mrdocs::SpecializationInfo"/>
<AlternativeType Name="clang::mrdocs::FriendInfo"/>
<AlternativeType Name="clang::mrdocs::EnumeratorInfo"/>
<AlternativeType Name="clang::mrdocs::EnumConstantInfo"/>
<AlternativeType Name="clang::mrdocs::GuideInfo"/>
<AlternativeType Name="clang::mrdocs::AliasInfo"/>
<AlternativeType Name="clang::mrdocs::NamespaceAliasInfo"/>
<AlternativeType Name="clang::mrdocs::UsingInfo"/>

<DisplayString>{Kind,en} {Name} (ID = {id})</DisplayString>
Expand All @@ -49,9 +49,9 @@
<ExpandedItem Condition="Kind == InfoKind::Field">(FieldInfo*)this,view(noinherit)</ExpandedItem>
<ExpandedItem Condition="Kind == InfoKind::Specialization">(SpecializationInfo*)this,view(noinherit)</ExpandedItem>
<ExpandedItem Condition="Kind == InfoKind::Friend">(FriendInfo*)this,view(noinherit)</ExpandedItem>
<ExpandedItem Condition="Kind == InfoKind::Enumerator">(EnumeratorInfo*)this,view(noinherit)</ExpandedItem>
<ExpandedItem Condition="Kind == InfoKind::Enumerator">(EnumConstantInfo*)this,view(noinherit)</ExpandedItem>
<ExpandedItem Condition="Kind == InfoKind::Guide">(GuideInfo*)this,view(noinherit)</ExpandedItem>
<ExpandedItem Condition="Kind == InfoKind::Alias">(AliasInfo*)this,view(noinherit)</ExpandedItem>
<ExpandedItem Condition="Kind == InfoKind::NamespaceAlias">(NamespaceAliasInfo*)this,view(noinherit)</ExpandedItem>
<ExpandedItem Condition="Kind == InfoKind::Using">(UsingInfo*)this,view(noinherit)</ExpandedItem>
</Expand>
</Type>
Expand Down
Loading
Loading