[llvm] [CAS][Modules] Fix LLVM_ENABLE_MODULES build / faulty include (NFC) (PR #164402)

Naveen Seth Hanig via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 21 04:53:43 PDT 2025


https://github.com/naveen-seth created https://github.com/llvm/llvm-project/pull/164402

FileOffset.h uses `uint64_t` but only includes `<cstdlib>`, which is not specified to provide the `uint64_t` type.
This happens to work without `LLVM_ENABLE_MODULES` enabled due to transitive includes from `<cstdlib>`.
With `LLVM_ENABLE_MODULES` enabled, declarations from transitive includes are not visible by default, and the build fails.

This fixes `LLVM_ENABLE_MODULES` builds by including the proper header, `<cstdint>`, instead.

>From 6283e2a05e32738fd9182ff66111caaf0459f6b9 Mon Sep 17 00:00:00 2001
From: Naveen Seth Hanig <naveen.hanig at outlook.com>
Date: Tue, 21 Oct 2025 13:09:10 +0200
Subject: [PATCH] [CAS][Modules] Fix LLVM_ENABLE_MODULES build / faulty include
 (NFC)

FileOffset.h uses uint64_t but only includes <cstdlib>, which is not
specified to provide the uint64_t type.
This happens to work without LLVM_ENABLE_MODULES enabled due to
transitive includes from <cstdlib>.
With LLVM_ENABLE_MODULES enabled, declarations from transitive
includes are not visible by default, and the build fails.

This fixes LLVM_ENABLE_MODULES builds by including the proper header,
<cstdint>, instead.
---
 llvm/include/llvm/CAS/FileOffset.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/CAS/FileOffset.h b/llvm/include/llvm/CAS/FileOffset.h
index 21d045e8c9d78..a3dc06b38e996 100644
--- a/llvm/include/llvm/CAS/FileOffset.h
+++ b/llvm/include/llvm/CAS/FileOffset.h
@@ -15,7 +15,7 @@
 #ifndef LLVM_CAS_FILEOFFSET_H
 #define LLVM_CAS_FILEOFFSET_H
 
-#include <cstdlib>
+#include <cstdint>
 
 namespace llvm::cas {
 



More information about the llvm-commits mailing list