Skip to content

Commit 0450629

Browse files
committed
---
yaml --- r: 286423 b: refs/heads/master-next c: 83d6f02 h: refs/heads/master i: 286421: 89b3a81 286419: ff45a43 286415: e0f1874
1 parent 26bc598 commit 0450629

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+304
-426
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: a67ffadd758dfc7a0f10a8afde063b8864663208
3-
refs/heads/master-next: 7714b5e862ec13d0766c91abf0dc4021ab66d761
3+
refs/heads/master-next: 83d6f027f598bab47f5aa21209aa4c2688b150fe
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/include/swift/AST/Decl.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ namespace swift {
9090
class UnboundGenericType;
9191
class ValueDecl;
9292
class VarDecl;
93+
class OpaqueReturnTypeRepr;
9394

9495
enum class DeclKind : uint8_t {
9596
#define DECL(Id, Parent) Id,
@@ -2692,7 +2693,10 @@ class ValueDecl : public Decl {
26922693

26932694
/// Get the decl for this value's opaque result type, if it has one.
26942695
OpaqueTypeDecl *getOpaqueResultTypeDecl() const;
2695-
2696+
2697+
/// Get the representative for this value's opaque result type, if it has one.
2698+
OpaqueReturnTypeRepr *getOpaqueResultTypeRepr() const;
2699+
26962700
/// Set the opaque return type decl for this decl.
26972701
///
26982702
/// `this` must be of a decl type that supports opaque return types, and

branches/master-next/include/swift/AST/Module.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,6 @@ class SourceFile final : public FileUnit {
10001000
llvm::SetVector<TypeDecl *> LocalTypeDecls;
10011001

10021002
/// The set of validated opaque return type decls in the source file.
1003-
llvm::SmallVector<OpaqueTypeDecl *, 4> OpaqueReturnTypes;
10041003
llvm::StringMap<OpaqueTypeDecl *> ValidatedOpaqueReturnTypes;
10051004
/// The set of parsed decls with opaque return types that have not yet
10061005
/// been validated.

branches/master-next/include/swift/LLVMPasses/Passes.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,8 @@ namespace swift {
3030
const llvm::PreservedAnalyses &) { return false; }
3131

3232
using AAResultBase::getModRefInfo;
33-
llvm::ModRefInfo getModRefInfo(const llvm::CallBase *Call,
34-
const llvm::MemoryLocation &Loc) {
35-
llvm::AAQueryInfo AAQI;
36-
return getModRefInfo(Call, Loc, AAQI);
37-
}
38-
llvm::ModRefInfo getModRefInfo(const llvm::CallBase *Call,
39-
const llvm::MemoryLocation &Loc,
40-
llvm::AAQueryInfo &AAQI);
33+
llvm::ModRefInfo getModRefInfo(llvm::ImmutableCallSite CS,
34+
const llvm::MemoryLocation &Loc);
4135
};
4236

4337
class SwiftAAWrapperPass : public llvm::ImmutablePass {

branches/master-next/lib/AST/Decl.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2454,6 +2454,19 @@ void ValueDecl::setOverriddenDecls(ArrayRef<ValueDecl *> overridden) {
24542454
request.cacheResult(overriddenVec);
24552455
}
24562456

2457+
OpaqueReturnTypeRepr *ValueDecl::getOpaqueResultTypeRepr() const {
2458+
TypeLoc returnLoc;
2459+
if (auto *VD = dyn_cast<VarDecl>(this)) {
2460+
returnLoc = VD->getTypeLoc();
2461+
} else if (auto *FD = dyn_cast<FuncDecl>(this)) {
2462+
returnLoc = FD->getBodyResultTypeLoc();
2463+
} else if (auto *SD = dyn_cast<SubscriptDecl>(this)) {
2464+
returnLoc = SD->getElementTypeLoc();
2465+
}
2466+
2467+
return dyn_cast_or_null<OpaqueReturnTypeRepr>(returnLoc.getTypeRepr());
2468+
}
2469+
24572470
OpaqueTypeDecl *ValueDecl::getOpaqueResultTypeDecl() const {
24582471
if (auto func = dyn_cast<FuncDecl>(this)) {
24592472
return func->getOpaqueResultTypeDecl();

branches/master-next/lib/AST/Module.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,11 +1792,8 @@ SourceFile::lookupOpaqueResultType(StringRef MangledName,
17921792
void SourceFile::markDeclWithOpaqueResultTypeAsValidated(ValueDecl *vd) {
17931793
UnvalidatedDeclsWithOpaqueReturnTypes.erase(vd);
17941794
if (auto opaqueDecl = vd->getOpaqueResultTypeDecl()) {
1795-
auto inserted = ValidatedOpaqueReturnTypes.insert(
1795+
ValidatedOpaqueReturnTypes.insert(
17961796
{opaqueDecl->getOpaqueReturnTypeIdentifier().str(), opaqueDecl});
1797-
if (inserted.second) {
1798-
OpaqueReturnTypes.push_back(opaqueDecl);
1799-
}
18001797
}
18011798
}
18021799

branches/master-next/lib/Basic/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ macro(find_first_existing_vc_file out_var path)
3030
)
3131
endmacro()
3232

33-
set(generate_vcs_version_script "${LLVM_MAIN_SRC_DIR}/cmake/modules/GenerateVersionFromVCS.cmake")
33+
set(get_svn_script "${LLVM_MAIN_SRC_DIR}/cmake/modules/GetSVN.cmake")
3434

3535
function(generate_revision_inc revision_inc_var name dir)
3636
find_first_existing_vc_file(dep_file "${dir}")
@@ -39,12 +39,12 @@ function(generate_revision_inc revision_inc_var name dir)
3939
string(TOUPPER ${name} upper_name)
4040
if(DEFINED dep_file)
4141
add_custom_command(OUTPUT "${revision_inc}"
42-
DEPENDS "${dep_file}" "${generate_vcs_version_script}"
42+
DEPENDS "${dep_file}" "${get_svn_script}"
4343
COMMAND
44-
${CMAKE_COMMAND} "-DNAMES=${upper_name}"
45-
"-D${upper_name}_SOURCE_DIR=${dir}"
44+
${CMAKE_COMMAND} "-DFIRST_SOURCE_DIR=${dir}"
45+
"-DFIRST_NAME=${upper_name}"
4646
"-DHEADER_FILE=${revision_inc}"
47-
-P "${generate_vcs_version_script}")
47+
-P "${get_svn_script}")
4848
else()
4949
# Generate an empty Revision.inc file if we are not using git or SVN.
5050
file(WRITE "${revision_inc}" "")

branches/master-next/lib/Basic/Platform.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ StringRef swift::getPlatformNameForTriple(const llvm::Triple &triple) {
122122
case llvm::Triple::Ananas:
123123
case llvm::Triple::CloudABI:
124124
case llvm::Triple::DragonFly:
125-
case llvm::Triple::Emscripten:
126125
case llvm::Triple::Fuchsia:
127126
case llvm::Triple::KFreeBSD:
128127
case llvm::Triple::Lv2:
@@ -143,7 +142,6 @@ StringRef swift::getPlatformNameForTriple(const llvm::Triple &triple) {
143142
case llvm::Triple::AMDPAL:
144143
case llvm::Triple::HermitCore:
145144
case llvm::Triple::Hurd:
146-
case llvm::Triple::WASI:
147145
return "";
148146
case llvm::Triple::Darwin:
149147
case llvm::Triple::MacOSX:

branches/master-next/lib/ClangImporter/ClangImporter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,17 +1010,16 @@ ClangImporter::create(ASTContext &ctx,
10101010

10111011
// Set up the file manager.
10121012
{
1013-
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS;
10141013
if (!ctx.SearchPathOpts.VFSOverlayFiles.empty()) {
10151014
// If the clang instance has overlays it means the user has provided
10161015
// -ivfsoverlay options and swift -vfsoverlay options. We're going to
10171016
// clobber their file system with our own, so warn about it.
10181017
if (!instance.getHeaderSearchOpts().VFSOverlayFiles.empty()) {
10191018
ctx.Diags.diagnose(SourceLoc(), diag::clang_vfs_overlay_is_ignored);
10201019
}
1021-
VFS = ctx.SourceMgr.getFileSystem();
1020+
instance.setVirtualFileSystem(ctx.SourceMgr.getFileSystem());
10221021
}
1023-
instance.createFileManager(std::move(VFS));
1022+
instance.createFileManager();
10241023
}
10251024

10261025
// Don't stop emitting messages if we ever can't load a module.
@@ -1034,7 +1033,8 @@ ClangImporter::create(ASTContext &ctx,
10341033
clangDiags.setSeverity(clang::diag::err_module_not_built,
10351034
clang::diag::Severity::Error,
10361035
clang::SourceLocation());
1037-
clangDiags.setFatalsAsError(ctx.Diags.getShowDiagnosticsAfterFatalError());
1036+
clangDiags.setSuppressAfterFatalError(
1037+
!ctx.Diags.getShowDiagnosticsAfterFatalError());
10381038

10391039

10401040
// Create the associated action.

branches/master-next/lib/ClangImporter/ImportDecl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8103,7 +8103,6 @@ ClangImporter::Implementation::createConstant(Identifier name, DeclContext *dc,
81038103
case clang::APValue::Array:
81048104
case clang::APValue::ComplexFloat:
81058105
case clang::APValue::ComplexInt:
8106-
case clang::APValue::FixedPoint:
81078106
case clang::APValue::LValue:
81088107
case clang::APValue::MemberPointer:
81098108
case clang::APValue::Struct:

branches/master-next/lib/IRGen/GenCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ llvm::CallSite CallEmission::emitCallSite() {
16091609
{ opaqueCallee });
16101610
opaqueCallee =
16111611
IGF.Builder.CreateBitCast(opaqueCallee, origCallee->getType());
1612-
call->setCalledFunction(fn.getFunctionType(), opaqueCallee);
1612+
call->setCalledFunction(opaqueCallee);
16131613

16141614
// Reset the insert point to after the call.
16151615
IGF.Builder.SetInsertPoint(call->getParent());

branches/master-next/lib/IRGen/GenClass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,6 @@ namespace {
19991999
case llvm::Triple::MachO:
20002000
var->setSection("__DATA, __objc_const");
20012001
break;
2002-
case llvm::Triple::XCOFF:
20032002
case llvm::Triple::COFF:
20042003
var->setSection(".data");
20052004
break;

branches/master-next/lib/IRGen/GenDecl.cpp

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "llvm/IR/GlobalAlias.h"
4242
#include "llvm/IR/InlineAsm.h"
4343
#include "llvm/IR/Module.h"
44+
#include "llvm/IR/TypeBuilder.h"
4445
#include "llvm/IR/Value.h"
4546
#include "llvm/Support/Compiler.h"
4647
#include "llvm/Support/ConvertUTF.h"
@@ -435,8 +436,6 @@ void IRGenModule::emitSourceFile(SourceFile &SF) {
435436
emitGlobalDecl(decl);
436437
for (auto *localDecl : SF.LocalTypeDecls)
437438
emitGlobalDecl(localDecl);
438-
for (auto *opaqueDecl : SF.OpaqueReturnTypes)
439-
maybeEmitOpaqueTypeDecl(opaqueDecl);
440439

441440
SF.collectLinkLibraries([this](LinkLibrary linkLib) {
442441
this->addLinkLibrary(linkLib);
@@ -876,7 +875,6 @@ std::string IRGenModule::GetObjCSectionName(StringRef Section,
876875
: ("__DATA," + Section + "," + MachOAttributes).str();
877876
case llvm::Triple::ELF:
878877
return Section.substr(2).str();
879-
case llvm::Triple::XCOFF:
880878
case llvm::Triple::COFF:
881879
return ("." + Section.substr(2) + "$B").str();
882880
case llvm::Triple::Wasm:
@@ -908,7 +906,6 @@ void IRGenModule::SetCStringLiteralSection(llvm::GlobalVariable *GV,
908906
}
909907
case llvm::Triple::ELF:
910908
return;
911-
case llvm::Triple::XCOFF:
912909
case llvm::Triple::COFF:
913910
return;
914911
case llvm::Triple::Wasm:
@@ -1310,7 +1307,6 @@ static std::string getDynamicReplacementSection(IRGenModule &IGM) {
13101307
case llvm::Triple::Wasm:
13111308
sectionName = "swift5_replace";
13121309
break;
1313-
case llvm::Triple::XCOFF:
13141310
case llvm::Triple::COFF:
13151311
sectionName = ".sw5repl$B";
13161312
break;
@@ -1888,10 +1884,17 @@ void IRGenModule::emitGlobalDecl(Decl *D) {
18881884
return;
18891885

18901886
case DeclKind::Var:
1887+
emitAbstractStorageDecl(cast<AbstractStorageDecl>(D));
1888+
return;
1889+
18911890
case DeclKind::Accessor:
1892-
case DeclKind::Func:
18931891
// Handled in SIL.
18941892
return;
1893+
1894+
case DeclKind::Func:
1895+
// The function body itself is lowered to SIL, but there may be associated
1896+
// decls to emit.
1897+
return emitFuncDecl(cast<FuncDecl>(D));
18951898

18961899
case DeclKind::TopLevelCode:
18971900
// All the top-level code will be lowered separately.
@@ -2886,7 +2889,6 @@ llvm::Constant *IRGenModule::emitSwiftProtocols() {
28862889
case llvm::Triple::Wasm:
28872890
sectionName = "swift5_protocols";
28882891
break;
2889-
case llvm::Triple::XCOFF:
28902892
case llvm::Triple::COFF:
28912893
sectionName = ".sw5prt$B";
28922894
break;
@@ -2947,7 +2949,6 @@ llvm::Constant *IRGenModule::emitProtocolConformances() {
29472949
case llvm::Triple::Wasm:
29482950
sectionName = "swift5_protocol_conformances";
29492951
break;
2950-
case llvm::Triple::XCOFF:
29512952
case llvm::Triple::COFF:
29522953
sectionName = ".sw5prtc$B";
29532954
break;
@@ -2973,7 +2974,6 @@ llvm::Constant *IRGenModule::emitTypeMetadataRecords() {
29732974
case llvm::Triple::Wasm:
29742975
sectionName = "swift5_type_metadata";
29752976
break;
2976-
case llvm::Triple::XCOFF:
29772977
case llvm::Triple::COFF:
29782978
sectionName = ".sw5tymd$B";
29792979
break;
@@ -3042,7 +3042,6 @@ llvm::Constant *IRGenModule::emitFieldDescriptors() {
30423042
case llvm::Triple::Wasm:
30433043
sectionName = "swift5_fieldmd";
30443044
break;
3045-
case llvm::Triple::XCOFF:
30463045
case llvm::Triple::COFF:
30473046
sectionName = ".sw5flmd$B";
30483047
break;
@@ -3882,9 +3881,12 @@ void IRGenModule::emitNestedTypeDecls(DeclRange members) {
38823881
continue;
38833882

38843883
case DeclKind::Func:
3884+
emitFuncDecl(cast<FuncDecl>(member));
3885+
continue;
3886+
38853887
case DeclKind::Var:
38863888
case DeclKind::Subscript:
3887-
// Handled in SIL.
3889+
emitAbstractStorageDecl(cast<AbstractStorageDecl>(member));
38883890
continue;
38893891

38903892
case DeclKind::PatternBinding:
@@ -4311,10 +4313,7 @@ IRGenModule::getOrCreateHelperFunction(StringRef fnName, llvm::Type *resultTy,
43114313
llvm::FunctionType *fnTy =
43124314
llvm::FunctionType::get(resultTy, paramTys, false);
43134315

4314-
llvm::Constant *fn =
4315-
cast<llvm::Function>(Module.getOrInsertFunction(fnName, fnTy)
4316-
.getCallee()
4317-
->stripPointerCasts());
4316+
llvm::Constant *fn = Module.getOrInsertFunction(fnName, fnTy);
43184317

43194318
if (llvm::Function *def = shouldDefineHelper(*this, fn, setIsNoInline)) {
43204319
IRGenFunction IGF(*this, def);

branches/master-next/lib/IRGen/GenExistential.cpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -842,11 +842,8 @@ class OpaqueExistentialTypeInfo final :
842842
// Use copy-on-write existentials?
843843
auto fn = getAssignBoxedOpaqueExistentialBufferFunction(
844844
IGF.IGM, getLayout(), objPtrTy);
845-
auto destAddress = IGF.Builder.CreateBitCast(
846-
dest.getAddress(), cast<llvm::Function>(fn)->arg_begin()[0].getType());
847-
auto srcAddress = IGF.Builder.CreateBitCast(
848-
src.getAddress(), cast<llvm::Function>(fn)->arg_begin()[1].getType());
849-
auto call = IGF.Builder.CreateCall(fn, {destAddress, srcAddress});
845+
auto call =
846+
IGF.Builder.CreateCall(fn, {dest.getAddress(), src.getAddress()});
850847
call->setCallingConv(IGF.IGM.DefaultCC);
851848
call->setDoesNotThrow();
852849
return;
@@ -906,10 +903,7 @@ class OpaqueExistentialTypeInfo final :
906903
// Use copy-on-write existentials?
907904
auto fn = getDestroyBoxedOpaqueExistentialBufferFunction(
908905
IGF.IGM, getLayout(), addr.getAddress()->getType());
909-
auto call = IGF.Builder.CreateCall(
910-
fn, {IGF.Builder.CreateBitCast(
911-
addr.getAddress(),
912-
cast<llvm::Function>(fn)->arg_begin()->getType())});
906+
auto call = IGF.Builder.CreateCall(fn, {addr.getAddress()});
913907
call->setCallingConv(IGF.IGM.DefaultCC);
914908
call->setDoesNotThrow();
915909
return;
@@ -2051,11 +2045,8 @@ Address irgen::emitAllocateBoxedOpaqueExistentialBuffer(
20512045
/// Call a function to handle the non-fixed case.
20522046
auto *allocateFun = getAllocateBoxedOpaqueExistentialBufferFunction(
20532047
IGF.IGM, existLayout, existentialContainer.getAddress()->getType());
2054-
auto *call = IGF.Builder.CreateCall(
2055-
allocateFun,
2056-
{IGF.Builder.CreateBitCast(
2057-
existentialContainer.getAddress(),
2058-
cast<llvm::Function>(allocateFun)->arg_begin()->getType())});
2048+
auto *call =
2049+
IGF.Builder.CreateCall(allocateFun, {existentialContainer.getAddress()});
20592050
call->setCallingConv(IGF.IGM.DefaultCC);
20602051
call->setDoesNotThrow();
20612052
auto addressOfValue = IGF.Builder.CreateBitCast(call, valuePointerType);

branches/master-next/lib/IRGen/GenKeyPath.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ emitKeyPathComponent(IRGenModule &IGM,
902902
fnName.append("keypath_get_selector_");
903903
fnName.append(selectorName);
904904
auto fn = cast<llvm::Function>(
905-
IGM.Module.getOrInsertFunction(fnName, fnTy).getCallee());
905+
IGM.Module.getOrInsertFunction(fnName, fnTy));
906906
if (fn->empty()) {
907907
fn->setLinkage(llvm::Function::PrivateLinkage);
908908
IRGenFunction subIGF(IGM, fn);

branches/master-next/lib/IRGen/GenMeta.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ void IRGenModule::setTrueConstGlobal(llvm::GlobalVariable *var) {
115115
case llvm::Triple::ELF:
116116
var->setSection(".rodata");
117117
break;
118-
case llvm::Triple::XCOFF:
119118
case llvm::Triple::COFF:
120119
var->setSection(".rdata");
121120
break;

branches/master-next/lib/IRGen/GenReflection.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,6 @@ static std::string getReflectionSectionName(IRGenModule &IGM,
930930
switch (IGM.TargetInfo.OutputObjectFormat) {
931931
case llvm::Triple::UnknownObjectFormat:
932932
llvm_unreachable("unknown object format");
933-
case llvm::Triple::XCOFF:
934933
case llvm::Triple::COFF:
935934
assert(FourCC.size() <= 4 &&
936935
"COFF section name length must be <= 8 characters");

branches/master-next/lib/IRGen/GenStruct.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,20 @@ void IRGenModule::maybeEmitOpaqueTypeDecl(OpaqueTypeDecl *opaque) {
891891
}
892892
}
893893

894+
void IRGenModule::emitFuncDecl(FuncDecl *fd) {
895+
// If there's an opaque return type for this function, emit its descriptor.
896+
if (auto opaque = fd->getOpaqueResultTypeDecl()) {
897+
maybeEmitOpaqueTypeDecl(opaque);
898+
}
899+
}
900+
901+
void IRGenModule::emitAbstractStorageDecl(AbstractStorageDecl *fd) {
902+
// If there's an opaque return type for this function, emit its descriptor.
903+
if (auto opaque = fd->getOpaqueResultTypeDecl()) {
904+
maybeEmitOpaqueTypeDecl(opaque);
905+
}
906+
}
907+
894908
namespace {
895909
/// A type implementation for resilient struct types. This is not a
896910
/// StructTypeInfoBase at all, since we don't know anything about

0 commit comments

Comments
 (0)