4 Commits

Author SHA1 Message Date
Mikhail Goncharov
4faa6c6699 [clang][test] Use a physical copy of FS
(missing piece from https://reviews.llvm.org/D152265)
476e7c49ecb762df1d68273696b06c36feb0fd96
2023-06-06 17:36:35 +02:00
Kadir Cetinkaya
476e7c49ec
[clang][test] Use a physical copy of FS
Make use of a physical copy, rather than real FS in unittests that
change working-directory to get rid of the side effect of changing cwd for the
whole process. It's triggering crashes depending on the test order.

Differential Revision: https://reviews.llvm.org/D152265
2023-06-06 15:45:55 +02:00
Sam McCall
499d0b96cb [clang] createInvocationFromCommandLine -> createInvocation, delete former. NFC
(Followup from 40c13720a4b977d4347bbde53c52a4d0703823c2)

Differential Revision: https://reviews.llvm.org/D125012
2022-05-06 16:21:48 +02:00
Ben Barham
766a08df12 [Frontend] Only compile modules if not already finalized
It was possible to re-add a module to a shared in-memory module cache
when search paths are changed. This can eventually cause a crash if the
original module is referenced after this occurs.
  1. Module A depends on B
  2. B exists in two paths C and D
  3. First run only has C on the search path, finds A and B and loads
     them
  4. Second run adds D to the front of the search path. A is loaded and
     contains a reference to the already compiled module from C. But
     searching finds the module from D instead, causing a mismatch
  5. B and the modules that depend on it are considered out of date and
     thus rebuilt
  6. The recompiled module A is added to the in-memory cache, freeing
     the previously inserted one

This can never occur from a regular clang process, but is very easy to
do through the API - whether through the use of a shared case or just
running multiple compilations from a single `CompilerInstance`. Update
the compilation to return early if a module is already finalized so that
the pre-condition in the in-memory module cache holds.

Resolves rdar://78180255

Differential Revision: https://reviews.llvm.org/D105328
2021-07-15 18:27:08 -07:00