Skip to content

Conversation

@shafik
Copy link
Collaborator

@shafik shafik commented Apr 24, 2025

Static analysis flagged this code b/c we are copying the temp variable back in when we could move it instead.

Static analysis flagged this code b/c we are copying the temp variable back in
when we could move it instead.
@shafik shafik added the clang:frontend Language frontend issues, e.g. anything involving "Sema" label Apr 24, 2025
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:modules C++20 modules and Clang Header Modules labels Apr 24, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 24, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-modules

Author: Shafik Yaghmour (shafik)

Changes

Static analysis flagged this code b/c we are copying the temp variable back in when we could move it instead.


Full diff: https://github.com/llvm/llvm-project/pull/137095.diff

1 Files Affected:

  • (modified) clang/lib/Serialization/ASTReader.cpp (+1-1)
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 70b54b7296882..f13a173ec933e 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -5980,7 +5980,7 @@ bool ASTReader::readASTFileControlBlock(
        }
       }
     }
-    Stream = SavedStream;
+    Stream = std::move(SavedStream);
   }
 
   // Scan for the UNHASHED_CONTROL_BLOCK_ID block.

@shafik shafik merged commit 72cc868 into llvm:main Apr 24, 2025
15 checks passed
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
Static analysis flagged this code b/c we are copying the temp variable
back in when we could move it instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:modules C++20 modules and Clang Header Modules clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants