From 426855739d0ff2cd89714de8f73f530007b413c3 Mon Sep 17 00:00:00 2001 From: Marc Auberer Date: Sun, 6 Oct 2024 14:10:14 +0200 Subject: [PATCH] Cleanup unused vector (#667) --- .github/workflows/publish.yml | 6 +++++- src-bootstrap/ast/ast-nodes.spice | 2 +- src-bootstrap/global/global-resource-manager.spice | 1 - src-bootstrap/parser/parser.spice | 1 - src/ast/ASTBuilder.cpp | 1 - src/global/GlobalResourceManager.cpp | 4 ++-- src/global/GlobalResourceManager.h | 1 - 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a6fc11d64..a55b40f38 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -28,7 +28,7 @@ jobs: uses: hendrikmuhs/ccache-action@v1 - name: Setup Dependencies - run: sudo apt-get install ninja-build pipx uuid-dev + run: sudo apt-get install ninja-build pipx uuid-dev checksec jq - name: Cache LLVM id: cache-llvm @@ -66,6 +66,10 @@ jobs: mv ./src/spice spice chmod +x spice + - name: Run Checksec + working-directory: bin + run: checksec --file=./spice --output=json | jq + - name: Upload artifact uses: actions/upload-artifact@v4 with: diff --git a/src-bootstrap/ast/ast-nodes.spice b/src-bootstrap/ast/ast-nodes.spice index 39d142f35..d021a73f0 100644 --- a/src-bootstrap/ast/ast-nodes.spice +++ b/src-bootstrap/ast/ast-nodes.spice @@ -45,7 +45,7 @@ p ASTNode.ctor(CodeLoc codeLoc) { assert false; // Please override at child level }*/ -public p ASTNode.addChild(ASTNode *child) { +public p ASTNode.addChild(ASTNode* child) { this.children.pushBack(child); child.parent = this; } diff --git a/src-bootstrap/global/global-resource-manager.spice b/src-bootstrap/global/global-resource-manager.spice index 4c72a2971..fe10de577 100644 --- a/src-bootstrap/global/global-resource-manager.spice +++ b/src-bootstrap/global/global-resource-manager.spice @@ -37,7 +37,6 @@ public type GlobalResourceManager struct : IGlobalResourceManager { public Vector compileTimeStringValues public BlockAllocator astNodeAlloc // Used to allocate all AST nodes public UnorderedMap sourceFiles // The GlobalResourceManager owns all source files - public Vector astNodes public CliOptions& cliOptions public ExternalLinkerInterface linker public CacheManager cacheManager diff --git a/src-bootstrap/parser/parser.spice b/src-bootstrap/parser/parser.spice index a770ce29d..b2d1b0e19 100644 --- a/src-bootstrap/parser/parser.spice +++ b/src-bootstrap/parser/parser.spice @@ -36,7 +36,6 @@ f Parser.createNode() { // Create the new node //T* node = this.resourceManager.astNodeAlloc.allocate(T(this.lexer.getCodeLoc())); T* node = this.astNodeAlloc.allocate(T(this.lexer.getCodeLoc())); - //this.resourceManager.astNodes.pushBack(node); // If this is not the entry node, we need to add the new node to its parent if !isRootNode { diff --git a/src/ast/ASTBuilder.cpp b/src/ast/ASTBuilder.cpp index 11592e308..63fe261f0 100644 --- a/src/ast/ASTBuilder.cpp +++ b/src/ast/ASTBuilder.cpp @@ -1354,7 +1354,6 @@ template T *ASTBuilder::createNode(const ParserRuleContext *ctx) { // Create the new node T *node = resourceManager.astNodeAlloc.allocate(getCodeLoc(ctx)); - resourceManager.astNodes.push_back(node); // If this is not the entry node, we need to add the new node to its parent if constexpr (!std::is_same_v) diff --git a/src/global/GlobalResourceManager.cpp b/src/global/GlobalResourceManager.cpp index e23cd1fcb..f8c572103 100644 --- a/src/global/GlobalResourceManager.cpp +++ b/src/global/GlobalResourceManager.cpp @@ -35,10 +35,10 @@ GlobalResourceManager::GlobalResourceManager(const CliOptions &cliOptions) if (cliOptions.isNativeTarget && cliOptions.useCPUFeatures) { // Retrieve native CPU name and the supported CPU features cpuName = llvm::sys::getHostCPUName(); - for (const llvm::StringMapEntry &feature : llvm::sys::getHostCPUFeatures()) { + for (const auto &[name, enabled] : llvm::sys::getHostCPUFeatures()) { if (featureString.rdbuf()->in_avail() > 0) featureString << ','; - featureString << (feature.second ? '+' : '-') << feature.first().str(); + featureString << (enabled ? '+' : '-') << name.str(); } } cpuFeatures = featureString.str(); diff --git a/src/global/GlobalResourceManager.h b/src/global/GlobalResourceManager.h index 7a39e2452..3d0af672b 100644 --- a/src/global/GlobalResourceManager.h +++ b/src/global/GlobalResourceManager.h @@ -48,7 +48,6 @@ class GlobalResourceManager { std::vector compileTimeStringValues; BlockAllocator astNodeAlloc = BlockAllocator(memoryManager); // Used to allocate all AST nodes std::unordered_map> sourceFiles; // The GlobalResourceManager owns all source files - std::vector astNodes; const CliOptions &cliOptions; ExternalLinkerInterface linker; CacheManager cacheManager;