Detailed preprocessing records break modules
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Repro:
Download and extract [LLVM-21.1.6-macOS-ARM64.tar.xz](https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.6/LLVM-21.1.6-macOS-ARM64.tar.xz) (leave the extracted contents in ~/Downloads)
Execute:
```shell
$ echo '@import Foundation; void not_available() NS_UNAVAILABLE;' | /Users/rolf/Downloads/LLVM-21.1.6-macOS-ARM64/bin/clang -x objective-c -c -Xclang -detailed-preprocessing-record -fmodules -fmodules-cache-path=$TMPDIR/clang/tmpcache -isysroot $(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -
fatal error: malformed or corrupted precompiled file: 'malformed block record in AST file'
note: after modifying system headers, please delete the module cache at '/var/folders/43/c7b5_0ts4yb2ddjvrb6d20b40000gn/T/clang/tmpcache/2660OB5VQO3AR'
1 error generated.
```
Removing `-Xclang -detailed-preprocessing-record` from the command line makes it work.
Contributor guide
Research direction
Start by reproducing the provided Objective-C command with clang, first with and then without -Xclang -detailed-preprocessing-record, using the downloaded LLVM 21.1.6 macOS ARM64 archive. Trace the module-cache and precompiled-file handling involved in the failing command; done means the command succeeds with detailed preprocessing records and no malformed AST error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- objective-c
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100