[clang] [clang] Fix crash 'Cannot get layout of forward declarations' during CTU static analysis (PR #156056)

via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 29 16:44:18 PDT 2025


=?utf-8?q?Balázs_Kéri?= <balazs.keri at ericsson.com>,
=?utf-8?q?Balázs_Kéri?= <balazs.keri at ericsson.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/156056 at github.com>


================
@@ -0,0 +1,43 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+
+// RUN: %clang_cc1 -emit-pch -o %t/import.c.ast %t/import.c
+
+// RUN: %clang_extdef_map -- -x c %t/import.c >> %t/externalDefMap.txt
+// RUN: sed -i'' 's/$/.ast/' %t/externalDefMap.txt
----------------
dyung wrote:

>From [this](https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failing-on-mac-but-works-on-linux) page it might not be able to make a portable command line that replaces the file in-place with no backup that works on linux and MacOS.

If you are okay with creating an extra file in the test directory, one of the suggestions on that page seems to work:
```
// RUN: sed -i='' -e 's/$/.ast/' %t/externalDefMap.txt
```
This creates a file `externalDefMap.txt=`, but does seem to work on linux and MacOS.

https://github.com/llvm/llvm-project/pull/156056


More information about the cfe-commits mailing list