mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Blocklist] Make sure blocklist config is read through VFS
Make sure block-list file is read through VFS so CASFS can be used to read the configuration to ensure sound caching, and also the path of the blocklist can be canonicalized via path remapping.
This commit is contained in:
@@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
namespace swift {
|
namespace swift {
|
||||||
|
|
||||||
|
class SourceManager;
|
||||||
|
|
||||||
enum class BlockListAction: uint8_t {
|
enum class BlockListAction: uint8_t {
|
||||||
Undefined = 0,
|
Undefined = 0,
|
||||||
#define BLOCKLIST_ACTION(NAME) NAME,
|
#define BLOCKLIST_ACTION(NAME) NAME,
|
||||||
@@ -41,7 +43,7 @@ public:
|
|||||||
void addConfigureFilePath(StringRef path);
|
void addConfigureFilePath(StringRef path);
|
||||||
bool hasBlockListAction(StringRef key, BlockListKeyKind keyKind,
|
bool hasBlockListAction(StringRef key, BlockListKeyKind keyKind,
|
||||||
BlockListAction action);
|
BlockListAction action);
|
||||||
BlockListStore();
|
BlockListStore(SourceManager &SM);
|
||||||
~BlockListStore();
|
~BlockListStore();
|
||||||
private:
|
private:
|
||||||
Implementation &Impl;
|
Implementation &Impl;
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
#include "swift/AST/TypeCheckRequests.h"
|
#include "swift/AST/TypeCheckRequests.h"
|
||||||
#include "swift/Basic/APIntMap.h"
|
#include "swift/Basic/APIntMap.h"
|
||||||
#include "swift/Basic/Assertions.h"
|
#include "swift/Basic/Assertions.h"
|
||||||
|
#include "swift/Basic/BlockList.h"
|
||||||
#include "swift/Basic/Compiler.h"
|
#include "swift/Basic/Compiler.h"
|
||||||
#include "swift/Basic/SourceManager.h"
|
#include "swift/Basic/SourceManager.h"
|
||||||
#include "swift/Basic/Statistic.h"
|
#include "swift/Basic/Statistic.h"
|
||||||
@@ -779,6 +780,7 @@ ASTContext::ASTContext(
|
|||||||
evaluator(Diags, langOpts), TheBuiltinModule(createBuiltinModule(*this)),
|
evaluator(Diags, langOpts), TheBuiltinModule(createBuiltinModule(*this)),
|
||||||
StdlibModuleName(getIdentifier(STDLIB_NAME)),
|
StdlibModuleName(getIdentifier(STDLIB_NAME)),
|
||||||
SwiftShimsModuleName(getIdentifier(SWIFT_SHIMS_NAME)),
|
SwiftShimsModuleName(getIdentifier(SWIFT_SHIMS_NAME)),
|
||||||
|
blockListConfig(SourceMgr),
|
||||||
TheErrorType(new (*this, AllocationArena::Permanent) ErrorType(
|
TheErrorType(new (*this, AllocationArena::Permanent) ErrorType(
|
||||||
*this, Type(), RecursiveTypeProperties::HasError)),
|
*this, Type(), RecursiveTypeProperties::HasError)),
|
||||||
TheUnresolvedType(new(*this, AllocationArena::Permanent)
|
TheUnresolvedType(new(*this, AllocationArena::Permanent)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include "swift/Basic/SourceManager.h"
|
#include "swift/Basic/SourceManager.h"
|
||||||
|
|
||||||
struct swift::BlockListStore::Implementation {
|
struct swift::BlockListStore::Implementation {
|
||||||
SourceManager SM;
|
SourceManager &SM;
|
||||||
llvm::StringMap<std::vector<BlockListAction>> ModuleActionDict;
|
llvm::StringMap<std::vector<BlockListAction>> ModuleActionDict;
|
||||||
llvm::StringMap<std::vector<BlockListAction>> ProjectActionDict;
|
llvm::StringMap<std::vector<BlockListAction>> ProjectActionDict;
|
||||||
void addConfigureFilePath(StringRef path);
|
void addConfigureFilePath(StringRef path);
|
||||||
@@ -44,9 +44,12 @@ struct swift::BlockListStore::Implementation {
|
|||||||
}
|
}
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Implementation(SourceManager &SM) : SM(SM) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
swift::BlockListStore::BlockListStore(): Impl(*new Implementation()) {}
|
swift::BlockListStore::BlockListStore(swift::SourceManager &SM)
|
||||||
|
: Impl(*new Implementation(SM)) {}
|
||||||
|
|
||||||
swift::BlockListStore::~BlockListStore() { delete &Impl; }
|
swift::BlockListStore::~BlockListStore() { delete &Impl; }
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
// RUN: %target-swift-frontend -scan-dependencies -module-name Test -O \
|
// RUN: %target-swift-frontend -scan-dependencies -module-name Test -O \
|
||||||
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
|
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
|
||||||
// RUN: -blocklist-file %t/blocklist.yml -blocklist-file %t/empty.yml \
|
// RUN: -blocklist-file %t/blocklist.yml -blocklist-file %t/empty.yml \
|
||||||
|
// RUN: -scanner-prefix-map %t=/^tmp \
|
||||||
// RUN: %t/main.swift -o %t/deps.json -cache-compile-job -cas-path %t/cas
|
// RUN: %t/main.swift -o %t/deps.json -cache-compile-job -cas-path %t/cas
|
||||||
|
|
||||||
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd
|
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd
|
||||||
@@ -25,10 +26,11 @@
|
|||||||
// RUN: -swift-version 5 -disable-implicit-swift-modules \
|
// RUN: -swift-version 5 -disable-implicit-swift-modules \
|
||||||
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
|
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
|
||||||
// RUN: -module-name Test -explicit-swift-module-map-file @%t/map.casid \
|
// RUN: -module-name Test -explicit-swift-module-map-file @%t/map.casid \
|
||||||
// RUN: -blocklist-file %t/blocklist.yml -blocklist-file %t/empty.yml \
|
// RUN: -blocklist-file /^tmp/blocklist.yml -blocklist-file /^tmp/empty.yml \
|
||||||
// RUN: -enable-layout-string-value-witnesses -enable-layout-string-value-witnesses-instantiation \
|
// RUN: -enable-layout-string-value-witnesses -enable-layout-string-value-witnesses-instantiation \
|
||||||
// RUN: -enable-experimental-feature LayoutStringValueWitnesses -enable-experimental-feature LayoutStringValueWitnessesInstantiation \
|
// RUN: -enable-experimental-feature LayoutStringValueWitnesses -enable-experimental-feature LayoutStringValueWitnessesInstantiation \
|
||||||
// RUN: %t/main.swift @%t/MyApp.cmd 2>&1 | %FileCheck %s --check-prefix CHECK-BLOCKED
|
// RUN: -cache-replay-prefix-map /^tmp=%t \
|
||||||
|
// RUN: /^tmp/main.swift @%t/MyApp.cmd 2>&1 | %FileCheck %s --check-prefix CHECK-BLOCKED
|
||||||
|
|
||||||
// CHECK-BLOCKED: note: Layout string value witnesses have been disabled for module 'Test' through block list entry
|
// CHECK-BLOCKED: note: Layout string value witnesses have been disabled for module 'Test' through block list entry
|
||||||
// CHECK-BLOCKED-NOT: type_layout_string
|
// CHECK-BLOCKED-NOT: type_layout_string
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "swift/AST/SearchPathOptions.h"
|
#include "swift/AST/SearchPathOptions.h"
|
||||||
#include "swift/Basic/Defer.h"
|
#include "swift/Basic/Defer.h"
|
||||||
#include "swift/Basic/BlockList.h"
|
#include "swift/Basic/BlockList.h"
|
||||||
|
#include "swift/Basic/SourceManager.h"
|
||||||
|
|
||||||
using namespace swift;
|
using namespace swift;
|
||||||
|
|
||||||
@@ -46,7 +47,8 @@ TEST(BlocklistTest, testYamlParsing) {
|
|||||||
ASSERT_FALSE(llvm::sys::fs::createUniqueDirectory(
|
ASSERT_FALSE(llvm::sys::fs::createUniqueDirectory(
|
||||||
"BlocklistTest.testYamlParsing", temp));
|
"BlocklistTest.testYamlParsing", temp));
|
||||||
SWIFT_DEFER { llvm::sys::fs::remove_directories(temp); };
|
SWIFT_DEFER { llvm::sys::fs::remove_directories(temp); };
|
||||||
BlockListStore store;
|
SourceManager sm;
|
||||||
|
BlockListStore store(sm);
|
||||||
std::string path1, path2;
|
std::string path1, path2;
|
||||||
ASSERT_FALSE(emitFileWithContents(temp, "block1.yaml",
|
ASSERT_FALSE(emitFileWithContents(temp, "block1.yaml",
|
||||||
"---\n"
|
"---\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user