diff --git a/include/slang/syntax/SyntaxTree.h b/include/slang/syntax/SyntaxTree.h index 04ae3e0da..93d667094 100644 --- a/include/slang/syntax/SyntaxTree.h +++ b/include/slang/syntax/SyntaxTree.h @@ -47,7 +47,7 @@ class SLANG_EXPORT SyntaxTree { bool isLibraryUnit = false; SyntaxTree(SyntaxNode* root, SourceManager& sourceManager, BumpAllocator&& alloc, - const SourceLibrary* library, std::shared_ptr parent = nullptr); + const SourceLibrary* library, const std::shared_ptr& parent = nullptr); SyntaxTree(SyntaxTree&& other) = default; ~SyntaxTree(); diff --git a/source/ast/statements/ConditionalStatements.cpp b/source/ast/statements/ConditionalStatements.cpp index 1beb1e476..2b5d7e0c3 100644 --- a/source/ast/statements/ConditionalStatements.cpp +++ b/source/ast/statements/ConditionalStatements.cpp @@ -205,7 +205,7 @@ class CaseTrie { CaseTrie* curr = this; const auto width = value.getBitWidth(); for (uint32_t i = 0; i < width; i++) { - const auto bit = value[i]; + const auto bit = value[(int32_t)i]; const bool isWildcard = wildcardX ? bit.isUnknown() : bit.value == logic_t::Z_VALUE; const auto valueIndex = isWildcard ? 3 : bit.isUnknown() ? 2 : bit.value; @@ -226,7 +226,7 @@ class CaseTrie { private: const Expression* find(const SVInt& value, uint32_t bitIndex, const Expression& expr, bool wildcardX) { - const auto bit = value[bitIndex]; + const auto bit = value[(int32_t)bitIndex]; const bool lastBit = bitIndex == value.getBitWidth() - 1; const bool isWildcard = wildcardX ? bit.isUnknown() : bit.value == logic_t::Z_VALUE; const auto valueIndex = bit.isUnknown() ? 2 : bit.value; diff --git a/source/syntax/SyntaxTree.cpp b/source/syntax/SyntaxTree.cpp index 06707b911..92f0c7819 100644 --- a/source/syntax/SyntaxTree.cpp +++ b/source/syntax/SyntaxTree.cpp @@ -18,7 +18,7 @@ namespace slang::syntax { using namespace parsing; SyntaxTree::SyntaxTree(SyntaxNode* root, SourceManager& sourceManager, BumpAllocator&& alloc, - const SourceLibrary* library, std::shared_ptr parent) : + const SourceLibrary* library, const std::shared_ptr& parent) : rootNode(root), library(library), sourceMan(sourceManager), alloc(std::move(alloc)) { metadata = std::make_unique(ParserMetadata::fromSyntax(*root)); if (parent) { // copy parent's info