Skip to content

Commit 156f0de

Browse files
committed
Fixed iteration of invalid ids
1 parent a3bd371 commit 156f0de

5 files changed

Lines changed: 17 additions & 8 deletions

File tree

CMake/LLVM.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ message(STATUS "LLVM_INCLUDE_DIRS: ${LLVM_INCLUDE_DIRS}")
3131
message(STATUS "LLVM_DEFINITIONS: ${LLVM_DEFINITIONS_LIST}")
3232

3333

34-
add_library(LLVM INTERFACE)
35-
target_include_directories(LLVM INTERFACE ${LLVM_INCLUDE_DIRS})
34+
add_library(RiftLLVM INTERFACE)
35+
target_include_directories(RiftLLVM INTERFACE ${LLVM_INCLUDE_DIRS})
3636
llvm_map_components_to_libnames(llvm_libs core x86asmparser x86codegen)
37-
target_link_libraries(LLVM INTERFACE ${LLVM_AVAILABLE_LIBS})
38-
target_compile_definitions(LLVM INTERFACE ${LLVM_DEFINITIONS_LIST} -DNOMINMAX)
37+
target_link_libraries(RiftLLVM INTERFACE ${LLVM_AVAILABLE_LIBS})
38+
target_compile_definitions(RiftLLVM INTERFACE ${LLVM_DEFINITIONS_LIST} -DNOMINMAX)
3939
# rift_target_disable_all_warnings(LLVM INTERFACE)
4040

Libs/Backends/LLVM/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ rift_target_shared_output_directory(RiftBackendLLVM)
1212

1313
target_link_libraries(RiftBackendLLVM PUBLIC Rift::Rift)
1414

15-
target_link_libraries(RiftBackendLLVM PRIVATE LLVM)
15+
target_link_libraries(RiftBackendLLVM PRIVATE RiftLLVM)
1616

1717

1818
install(TARGETS RiftBackendLLVM

Libs/Framework/Include/AST/Pool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ namespace Rift::AST
464464

465465

466466
public:
467-
TPool(AST::Tree& ast) : Pool(ast, DeletionPolicy::Swap) {}
467+
TPool(AST::Tree& ast) : Pool(ast, DeletionPolicy::InPlace) {}
468468
~TPool() override
469469
{
470470
Reset();

Libs/Framework/Include/AST/Types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,5 @@ namespace Rift::AST
126126

127127
constexpr bool IsNone(Rift::AST::Id id)
128128
{
129-
return id == Rift::AST::NoId;
129+
return Rift::AST::GetVersion(id) == Rift::AST::GetVersion(Rift::AST::NoId);
130130
}

Libs/Framework/Src/AST/Filtering.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,16 @@ namespace Rift::AST
186186
pools.RemoveAtSwap(smallestIdx);
187187

188188
ids.Empty(false);
189-
ids.Append(iterablePool->begin(), iterablePool->end());
189+
ids.Reserve(iterablePool->Size());
190+
for (AST::Id id : *iterablePool)
191+
{
192+
if (!IsNone(id)) [[likely]]
193+
{
194+
ids.Add(id);
195+
}
196+
}
197+
// Faster but doesnt exclude invalid ids. TODO: Improve PoolSet
198+
// ids.Append(iterablePool->begin(), iterablePool->end());
190199

191200
for (const Pool* pool : pools)
192201
{

0 commit comments

Comments
 (0)