-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Canonicalize the path provided by -fmodules-cache-path.
This fixes lookup mismatches that could happen when the module cache path contained a '/./' component. <rdar://problem/30413458> Differential Revision: https://reviews.llvm.org/D30915 llvm-svn: 297790
- Loading branch information
1 parent
d3c22f0
commit 0ebdeac
Showing
8 changed files
with
80 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// AppKit | ||
#import "CoreVideo.h" // CoreVideo | ||
struct B { int i; }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Cocoa | ||
#import "Foundation.h" | ||
#import "AppKit.h" | ||
|
||
struct A { int i; }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
struct C { int i; }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// CoreVideo | ||
#import "Foundation.h" // Foundation | ||
struct E { int i; }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Foundation | ||
#import "CoreText.h" | ||
struct D { int i; }; |
19 changes: 19 additions & 0 deletions
19
clang/test/Modules/Inputs/outofdate-rebuild/module.modulemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module Cocoa { | ||
header "Cocoa.h" | ||
} | ||
|
||
module AppKit { | ||
header "AppKit.h" | ||
} | ||
|
||
module CoreText { | ||
header "CoreText.h" | ||
} | ||
|
||
module Foundation { | ||
header "Foundation.h" | ||
} | ||
|
||
module CoreVideo { | ||
header "CoreVideo.h" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// RUN: rm -rf %t/cache %T/rel | ||
|
||
// This testcase reproduces a use-after-free after looking up a PCM in | ||
// a non-canonical modules-cache-path. | ||
// | ||
// Prime the module cache (note the '.' in the path). | ||
// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/./cache \ | ||
// RUN: -fmodules -fimplicit-module-maps -I %S/Inputs/outofdate-rebuild \ | ||
// RUN: %s -fsyntax-only | ||
// | ||
// Force a module to be rebuilt by creating a conflict. | ||
// RUN: echo "@import CoreText;" > %t.m | ||
// RUN: %clang_cc1 -DMISMATCH -Werror -fdisable-module-hash \ | ||
// RUN: -fmodules-cache-path=%t/./cache -fmodules -fimplicit-module-maps \ | ||
// RUN: -I %S/Inputs/outofdate-rebuild %t.m -fsyntax-only | ||
// | ||
// Rebuild. | ||
// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/./cache \ | ||
// RUN: -fmodules -fimplicit-module-maps -I %S/Inputs/outofdate-rebuild \ | ||
// RUN: %s -fsyntax-only | ||
|
||
|
||
// Unrelated to the above: Check that a relative path is resolved correctly. | ||
// | ||
// RUN: %clang_cc1 -working-directory %T/rel -fmodules-cache-path=./cache \ | ||
// RUN: -fmodules -fimplicit-module-maps -I %S/Inputs/outofdate-rebuild \ | ||
// RUN: -fdisable-module-hash %t.m -fsyntax-only -Rmodule-build 2>&1 \ | ||
// RUN: | FileCheck %s | ||
// CHECK: /rel/cache/CoreText.pcm | ||
@import Cocoa; |