| 1 | // RUN: rm -rf %t/cache %t/rel |
| 2 | |
| 3 | // This testcase reproduces a use-after-free after looking up a PCM in |
| 4 | // a non-canonical modules-cache-path. |
| 5 | // |
| 6 | // Prime the module cache (note the '.' in the path). |
| 7 | // RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/./cache \ |
| 8 | // RUN: -fmodules -fimplicit-module-maps -I %S/Inputs/outofdate-rebuild \ |
| 9 | // RUN: %s -fsyntax-only |
| 10 | // |
| 11 | // Force a module to be rebuilt by creating a conflict. |
| 12 | // RUN: echo "@import CoreText;" > %t.m |
| 13 | // RUN: %clang_cc1 -DMISMATCH -Werror -fdisable-module-hash \ |
| 14 | // RUN: -fmodules-cache-path=%t/./cache -fmodules -fimplicit-module-maps \ |
| 15 | // RUN: -I %S/Inputs/outofdate-rebuild %t.m -fsyntax-only |
| 16 | // |
| 17 | // Rebuild. |
| 18 | // RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/./cache \ |
| 19 | // RUN: -fmodules -fimplicit-module-maps -I %S/Inputs/outofdate-rebuild \ |
| 20 | // RUN: %s -fsyntax-only |
| 21 | |
| 22 | |
| 23 | // Unrelated to the above: Check that a relative path is resolved correctly. |
| 24 | // |
| 25 | // RUN: %clang_cc1 -working-directory %t/rel -fmodules-cache-path=./cache \ |
| 26 | // RUN: -fmodules -fimplicit-module-maps -I %S/Inputs/outofdate-rebuild \ |
| 27 | // RUN: -fdisable-module-hash %t.m -fsyntax-only -Rmodule-build 2>&1 \ |
| 28 | // RUN: | FileCheck %s |
| 29 | // CHECK: {{/|\\}}rel{{/|\\}}cache{{/|\\}}CoreText.pcm |
| 30 | @import Cocoa; |
| 31 | |