Skip to content

[Serialization] Remove an unnecessary cast (NFC) #147204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

kazutakahirata
Copy link
Contributor

IndexFromEnd is already of int.

IndexFromEnd is already of int.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:modules C++20 modules and Clang Header Modules labels Jul 6, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 6, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-modules

Author: Kazu Hirata (kazutakahirata)

Changes

IndexFromEnd is already of int.


Full diff: https://github.com/llvm/llvm-project/pull/147204.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 6e03de87e587d..cc2d2ea86ccb7 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -9682,7 +9682,7 @@ ModuleFile *ASTReader::getLocalModuleFile(ModuleFile &M, unsigned ID) const {
     // It's a prefix (preamble, PCH, ...). Look it up by index.
    int IndexFromEnd = static_cast<int>(ID >> 1);
     assert(IndexFromEnd && "got reference to unknown module file");
-    return getModuleManager().pch_modules().end()[-static_cast<int>(IndexFromEnd)];
+    return getModuleManager().pch_modules().end()[-IndexFromEnd];
   }
 }
 

@kazutakahirata kazutakahirata changed the title [Serialization] Remove an unnecessarycast (NFC) [Serialization] Remove an unnecessary cast (NFC) Jul 7, 2025
@kazutakahirata kazutakahirata merged commit 1565310 into llvm:main Jul 7, 2025
12 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250706_cast_clang_Serial branch July 7, 2025 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants