summaryrefslogtreecommitdiff
path: root/source/slang/slang-ast-base.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-ast-base.cpp
parenta729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff)
format
* format * Minor test fixes * enable checking cpp format in ci
Diffstat (limited to 'source/slang/slang-ast-base.cpp')
-rw-r--r--source/slang/slang-ast-base.cpp63
1 files changed, 32 insertions, 31 deletions
diff --git a/source/slang/slang-ast-base.cpp b/source/slang/slang-ast-base.cpp
index d4904d2de..a1624fcba 100644
--- a/source/slang/slang-ast-base.cpp
+++ b/source/slang/slang-ast-base.cpp
@@ -1,45 +1,46 @@
#include "slang-ast-base.h"
+
#include "slang-ast-builder.h"
namespace Slang
{
- void NodeBase::_initDebug(ASTNodeType inAstNodeType, ASTBuilder* inAstBuilder)
- {
+void NodeBase::_initDebug(ASTNodeType inAstNodeType, ASTBuilder* inAstBuilder)
+{
#ifdef _DEBUG
- SLANG_UNUSED(inAstNodeType);
- static int32_t uidCounter = 0;
- static int32_t breakValue = 0;
- uidCounter++;
- _debugUID = uidCounter;
- if (inAstBuilder->getId() == -1)
- _debugUID = -_debugUID;
- if (breakValue != 0 && _debugUID == breakValue)
- SLANG_BREAKPOINT(0)
+ SLANG_UNUSED(inAstNodeType);
+ static int32_t uidCounter = 0;
+ static int32_t breakValue = 0;
+ uidCounter++;
+ _debugUID = uidCounter;
+ if (inAstBuilder->getId() == -1)
+ _debugUID = -_debugUID;
+ if (breakValue != 0 && _debugUID == breakValue)
+ SLANG_BREAKPOINT(0)
#else
- SLANG_UNUSED(inAstNodeType);
- SLANG_UNUSED(inAstBuilder);
+ SLANG_UNUSED(inAstNodeType);
+ SLANG_UNUSED(inAstBuilder);
#endif
- }
- DeclRefBase* Decl::getDefaultDeclRef()
+}
+DeclRefBase* Decl::getDefaultDeclRef()
+{
+ if (auto astBuilder = getCurrentASTBuilder())
{
- if (auto astBuilder = getCurrentASTBuilder())
+ const Index currentEpoch = astBuilder->getEpoch();
+ if (currentEpoch != m_defaultDeclRefEpoch || !m_defaultDeclRef)
{
- const Index currentEpoch = astBuilder->getEpoch();
- if (currentEpoch != m_defaultDeclRefEpoch || !m_defaultDeclRef)
- {
- m_defaultDeclRef = astBuilder->getOrCreate<DirectDeclRef>(this);
- m_defaultDeclRefEpoch = currentEpoch;
- }
+ m_defaultDeclRef = astBuilder->getOrCreate<DirectDeclRef>(this);
+ m_defaultDeclRefEpoch = currentEpoch;
}
- return m_defaultDeclRef;
- }
-
- bool Decl::isChildOf(Decl* other) const
- {
- for (auto parent = parentDecl; parent; parent = parent->parentDecl)
- if (parent == other)
- return true;
- return false;
}
+ return m_defaultDeclRef;
+}
+bool Decl::isChildOf(Decl* other) const
+{
+ for (auto parent = parentDecl; parent; parent = parent->parentDecl)
+ if (parent == other)
+ return true;
+ return false;
}
+
+} // namespace Slang