summaryrefslogtreecommitdiff
path: root/source/slang/slang-doc-ast.cpp
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-10-29 14:49:26 +0800
committerGitHub <noreply@github.com>2024-10-29 14:49:26 +0800
commitf65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 (patch)
treeea1d61342cd29368e19135000ec2948813096205 /source/slang/slang-doc-ast.cpp
parenta729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff)
format
* format * Minor test fixes * enable checking cpp format in ci
Diffstat (limited to 'source/slang/slang-doc-ast.cpp')
-rw-r--r--source/slang/slang-doc-ast.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/source/slang/slang-doc-ast.cpp b/source/slang/slang-doc-ast.cpp
index 4d35f32be..0d4b69895 100644
--- a/source/slang/slang-doc-ast.cpp
+++ b/source/slang/slang-doc-ast.cpp
@@ -2,14 +2,14 @@
#include "slang-doc-ast.h"
#include "../core/slang-string-util.h"
-
#include "slang/slang-ast-support-types.h"
-//#include "slang-ast-builder.h"
-//#include "slang-ast-print.h"
+// #include "slang-ast-builder.h"
+// #include "slang-ast-print.h"
-namespace Slang {
+namespace Slang
+{
-/* static */DocMarkupExtractor::SearchStyle ASTMarkupUtil::getSearchStyle(Decl* decl)
+/* static */ DocMarkupExtractor::SearchStyle ASTMarkupUtil::getSearchStyle(Decl* decl)
{
typedef Extractor::SearchStyle SearchStyle;
@@ -50,7 +50,8 @@ namespace Slang {
bool shouldDocumentDecl(Decl* decl)
{
- return !getText(decl->getName()).startsWith("$__syn") && !decl->hasModifier<SynthesizedModifier>();
+ return !getText(decl->getName()).startsWith("$__syn") &&
+ !decl->hasModifier<SynthesizedModifier>();
}
static void _addDeclRec(Decl* decl, List<Decl*>& outDecls)
@@ -73,8 +74,8 @@ static void _addDeclRec(Decl* decl, List<Decl*>& outDecls)
if (ContainerDecl* containerDecl = as<ContainerDecl>(decl))
{
- // Add the container - which could be a class, struct, enum, namespace, extension, generic etc.
- // Now add what the container contains
+ // Add the container - which could be a class, struct, enum, namespace, extension, generic
+ // etc. Now add what the container contains
for (Decl* childDecl : containerDecl->members)
{
_addDeclRec(childDecl, outDecls);
@@ -82,7 +83,7 @@ static void _addDeclRec(Decl* decl, List<Decl*>& outDecls)
}
}
-/* static */void ASTMarkupUtil::findDecls(ModuleDecl* moduleDecl, List<Decl*>& outDecls)
+/* static */ void ASTMarkupUtil::findDecls(ModuleDecl* moduleDecl, List<Decl*>& outDecls)
{
for (Decl* decl : moduleDecl->members)
{
@@ -90,7 +91,12 @@ static void _addDeclRec(Decl* decl, List<Decl*>& outDecls)
}
}
-SlangResult ASTMarkupUtil::extract(ModuleDecl* moduleDecl, SourceManager* sourceManager, DiagnosticSink* sink, ASTMarkup* outDoc, bool searchOrindaryComments)
+SlangResult ASTMarkupUtil::extract(
+ ModuleDecl* moduleDecl,
+ SourceManager* sourceManager,
+ DiagnosticSink* sink,
+ ASTMarkup* outDoc,
+ bool searchOrindaryComments)
{
List<Decl*> decls;
findDecls(moduleDecl, decls);
@@ -123,7 +129,9 @@ SlangResult ASTMarkupUtil::extract(ModuleDecl* moduleDecl, SourceManager* source
extractor.setSearchInOrdinaryComments(searchOrindaryComments);
List<SourceView*> views;
- SLANG_RETURN_ON_FAIL(extractor.extract(inputItems.getBuffer(), declsCount, sourceManager, sink, views, outItems));
+ SLANG_RETURN_ON_FAIL(
+ extractor
+ .extract(inputItems.getBuffer(), declsCount, sourceManager, sink, views, outItems));
}
// Set back
@@ -136,14 +144,14 @@ SlangResult ASTMarkupUtil::extract(ModuleDecl* moduleDecl, SourceManager* source
if (inputItem.searchStyle != Extractor::SearchStyle::None)
{
Decl* decl = decls[outputItem.inputIndex];
-
+
// Add to the documentation
ASTMarkup::Entry& docEntry = outDoc->addEntry(decl);
docEntry.m_markup = outputItem.text;
docEntry.m_visibility = outputItem.visibilty;
}
}
-
+
return SLANG_OK;
}