Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Swift:master to work with new stable re-branch from swift-5.1-branch #22699

Merged
merged 30 commits into from
Feb 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
411fae3
[master-next] Add HermitCore OS type for LLVM triples
bob-wilson Aug 27, 2018
b0dd41b
[master-next] Use the new AST getBeginLoc API instead of getLocStart
bob-wilson Aug 27, 2018
6475226
Disable -Wobjc-property-assign-on-object-type in these tests for now.
rjmccall Sep 10, 2018
fb30547
Add trailing space that was accidentally removed in the previous change.
bob-wilson Sep 10, 2018
adcdc39
swift: update for LLVM SVN r344140
compnerd Oct 12, 2018
d023e56
[master-next] Adjust sourcekitd-test PrintHelp call for LLVM r344097
bob-wilson Oct 13, 2018
5f3c2d1
[master-next] Update a test to pass if some calls are tail calls
bob-wilson Oct 13, 2018
4dc2eac
[master-next] After LLVM r344359, Timer names with slashes do not work.
bob-wilson Oct 15, 2018
2c91da5
lib: update for LLVM API change
compnerd Oct 19, 2018
562e6f5
ClangImporter: adjust for SVN r345637
compnerd Oct 31, 2018
db1c894
ClangImporter: update for SVN r345605
compnerd Oct 31, 2018
37f8268
Fix compatibility with upstream clang changes
MaxDesiatov Nov 9, 2018
0dda766
IRGen: adjust for SVN r347239
compnerd Nov 20, 2018
e787906
[test] Update ClangImporter/enum-anon.swift for Clang improvements (#…
jrose-apple Nov 27, 2018
0ac9a7d
Update tests for upstream LLVM IR assembler changes
adrian-prantl Nov 29, 2018
93b29dc
master-next: Add switch case for new Hurd triple in llvm r347832
bob-wilson Nov 29, 2018
5e16a65
master-next: Update DebugInfo tests for llvm r347806
bob-wilson Nov 30, 2018
40e2a7c
master-next: Fix up recent Swift changes to work with newer VFS code.
bob-wilson Nov 30, 2018
437cfa7
IRGen: adjust for SVN r348827
compnerd Dec 12, 2018
8719f52
ClangImporter: adjust for SVN r349901
compnerd Dec 26, 2018
b45ca04
Use the new ObjC retain/release intrinsics in IRGen.
rjmccall Jan 26, 2019
b1be41a
Implement some more LLVM intrinsic type-decoding rules.
rjmccall Jan 26, 2019
9326ef4
[upstream-update] Update LLVMPasses for new objc arc intrinsics.
gottesmm Feb 7, 2019
1b453be
Update radar number in DebugInfo test
bob-wilson Feb 8, 2019
06120c9
More fixes in recent Swift changes to work with newer VFS code.
bob-wilson Feb 9, 2019
213efe0
Merge commit '06120c9d9d1a28275a0ecd7466775b1d71716be7' into stable-u…
bob-wilson Feb 17, 2019
78c8021
swift-5.1: temporarily disable the IRGen/newtype.swift test
bob-wilson Feb 14, 2019
66777f7
Fix test for branch
aschwaighofer Feb 14, 2019
24aa024
Rename lldb-test-depends -> lldb-test-deps
JDevlieghere Feb 14, 2019
868e794
[master-next] Remove workaround for -Wobjc-property-assign-on-object-…
bob-wilson Feb 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/swift/Basic/FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace llvm {
class Twine;
}

namespace clang {
namespace llvm {
namespace vfs {
class FileSystem;
}
Expand Down Expand Up @@ -58,7 +58,7 @@ namespace swift {

namespace vfs {
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
getFileOrSTDIN(clang::vfs::FileSystem &FS,
getFileOrSTDIN(llvm::vfs::FileSystem &FS,
const llvm::Twine &Name, int64_t FileSize = -1,
bool RequiresNullTerminator = true, bool IsVolatile = false);
} // end namespace vfs
Expand Down
12 changes: 6 additions & 6 deletions include/swift/Basic/SourceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace swift {
/// This class manages and owns source buffers.
class SourceManager {
llvm::SourceMgr LLVMSourceMgr;
llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> FileSystem;
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FileSystem;
unsigned CodeCompletionBufferID = 0U;
unsigned CodeCompletionOffset;

Expand All @@ -37,7 +37,7 @@ class SourceManager {
///
/// This is as much a hack to prolong the lifetime of status objects as it is
/// to speed up stats.
mutable llvm::DenseMap<StringRef, clang::vfs::Status> StatusCache;
mutable llvm::DenseMap<StringRef, llvm::vfs::Status> StatusCache;

// \c #sourceLocation directive handling.
struct VirtualFile {
Expand All @@ -49,8 +49,8 @@ class SourceManager {
mutable std::pair<const char *, const VirtualFile*> CachedVFile = {nullptr, nullptr};

public:
SourceManager(llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> FS =
clang::vfs::getRealFileSystem())
SourceManager(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS =
llvm::vfs::getRealFileSystem())
: FileSystem(FS) {}

llvm::SourceMgr &getLLVMSourceMgr() {
Expand All @@ -60,11 +60,11 @@ class SourceManager {
return LLVMSourceMgr;
}

void setFileSystem(llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> FS) {
void setFileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS) {
FileSystem = FS;
}

llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> getFileSystem() {
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> getFileSystem() {
return FileSystem;
}

Expand Down
2 changes: 1 addition & 1 deletion include/swift/Frontend/Frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ class CompilerInstance {

DiagnosticEngine &getDiags() { return Diagnostics; }

clang::vfs::FileSystem &getFileSystem() { return *SourceMgr.getFileSystem(); }
llvm::vfs::FileSystem &getFileSystem() { return *SourceMgr.getFileSystem(); }

ASTContext &getASTContext() {
return *Context;
Expand Down
2 changes: 1 addition & 1 deletion include/swift/Frontend/ParseableInterfaceSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ParseableInterfaceModuleLoader : public SerializedModuleLoaderBase {
CompilerInvocation &SubInvocation, StringRef InPath, StringRef OutPath);

static bool buildSwiftModuleFromSwiftInterface(
clang::vfs::FileSystem &FS, DiagnosticEngine &Diags, SourceLoc DiagLoc,
llvm::vfs::FileSystem &FS, DiagnosticEngine &Diags, SourceLoc DiagLoc,
CompilerInvocation &SubInvocation, StringRef InPath, StringRef OutPath,
StringRef ModuleCachePath, DependencyTracker *OuterTracker,
bool ShouldSerializeDeps);
Expand Down
11 changes: 0 additions & 11 deletions include/swift/Runtime/RuntimeFunctions.def
Original file line number Diff line number Diff line change
Expand Up @@ -1163,17 +1163,6 @@ FUNCTION(InstantiateObjCClass, swift_instantiateObjCClass, C_CC,
ATTRS(NoUnwind))
FUNCTION(ObjCAllocWithZone, objc_allocWithZone, C_CC,
RETURNS(ObjCPtrTy), ARGS(ObjCClassPtrTy), ATTRS(NoUnwind))
FUNCTION(ObjCRetain, objc_retain, C_CC,
RETURNS(ObjCPtrTy), ARGS(ObjCPtrTy), ATTRS(NoUnwind))
FUNCTION(ObjCRelease, objc_release, C_CC,
RETURNS(VoidTy), ARGS(ObjCPtrTy), ATTRS(NoUnwind))
FUNCTION(ObjCAutorelease, objc_autorelease, C_CC,
RETURNS(ObjCPtrTy), ARGS(ObjCPtrTy), ATTRS(NoUnwind))
FUNCTION(ObjCRetainAutoreleasedReturnValue,
objc_retainAutoreleasedReturnValue, C_CC,
RETURNS(Int8PtrTy), ARGS(Int8PtrTy), ATTRS(NoUnwind))
FUNCTION(ObjCAutoreleaseReturnValue, objc_autoreleaseReturnValue, C_CC,
RETURNS(ObjCPtrTy), ARGS(ObjCPtrTy), ATTRS(NoUnwind))
FUNCTION(ObjCMsgSend, objc_msgSend, C_CC,
RETURNS(VoidTy), NO_ARGS, NO_ATTRS)
FUNCTION(ObjCMsgSendStret, objc_msgSend_stret, C_CC,
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ASTPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ class PrintAST : public ASTVisitor<PrintAST> {
bool Invalid;
unsigned StartLocCol =
ClangContext.getSourceManager().getSpellingColumnNumber(
RC->getLocStart(), &Invalid);
RC->getBeginLoc(), &Invalid);
if (Invalid)
StartLocCol = 0;

Expand Down
136 changes: 114 additions & 22 deletions lib/AST/Builtins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1272,46 +1272,138 @@ swift::getLLVMIntrinsicIDForBuiltinWithOverflow(BuiltinValueKind ID) {
llvm_unreachable("Cannot convert the overflow builtin to llvm intrinsic.");
}

static Type DecodeIntrinsicType(ArrayRef<llvm::Intrinsic::IITDescriptor> &Table,
ArrayRef<Type> Tys, ASTContext &Context) {
namespace {

class IntrinsicTypeDecoder {
ArrayRef<llvm::Intrinsic::IITDescriptor> &Table;
ArrayRef<Type> TypeArguments;
ASTContext &Context;
public:
IntrinsicTypeDecoder(ArrayRef<llvm::Intrinsic::IITDescriptor> &table,
ArrayRef<Type> typeArguments, ASTContext &ctx)
: Table(table), TypeArguments(typeArguments), Context(ctx) {}

Type decodeImmediate();

/// Return the type argument at the given index.
Type getTypeArgument(unsigned index) {
if (index >= TypeArguments.size())
return Type();
return TypeArguments[index];
}

/// Create a pointer type.
Type makePointer(Type eltType, unsigned addrspace) {
// Reject non-default address space pointers.
if (addrspace)
return Type();

// For now, always ignore the element type and use RawPointer.
return Context.TheRawPointerType;
}

/// Create a vector type.
Type makeVector(Type eltType, unsigned width) {
return BuiltinVectorType::get(Context, eltType, width);
}

/// Return the first type or, if the second type is a vector type, a vector
/// of the first type of the same length as the second type.
Type maybeMakeVectorized(Type eltType, Type maybeVectorType) {
if (auto vectorType = maybeVectorType->getAs<BuiltinVectorType>()) {
return makeVector(eltType, vectorType->getNumElements());
}
return eltType;
}
};

} // end anonymous namespace

static Type DecodeIntrinsicType(ArrayRef<llvm::Intrinsic::IITDescriptor> &table,
ArrayRef<Type> typeArguments, ASTContext &ctx) {
return IntrinsicTypeDecoder(table, typeArguments, ctx).decodeImmediate();
}

Type IntrinsicTypeDecoder::decodeImmediate() {
typedef llvm::Intrinsic::IITDescriptor IITDescriptor;
IITDescriptor D = Table.front();
Table = Table.slice(1);
switch (D.Kind) {
default:
llvm_unreachable("Unhandled case");
case IITDescriptor::Half:
case IITDescriptor::MMX:
case IITDescriptor::Metadata:
case IITDescriptor::Vector:
case IITDescriptor::ExtendArgument:
case IITDescriptor::TruncArgument:
case IITDescriptor::HalfVecArgument:
case IITDescriptor::VarArg:
case IITDescriptor::Token:
case IITDescriptor::VecOfAnyPtrsToElt:
// These types cannot be expressed in swift yet.
return Type();

case IITDescriptor::Void: return TupleType::getEmpty(Context);
case IITDescriptor::Float: return Context.TheIEEE32Type;
case IITDescriptor::Double: return Context.TheIEEE64Type;

// Fundamental types.
case IITDescriptor::Void:
return TupleType::getEmpty(Context);
case IITDescriptor::Half:
return Context.TheIEEE16Type;
case IITDescriptor::Float:
return Context.TheIEEE32Type;
case IITDescriptor::Double:
return Context.TheIEEE64Type;
case IITDescriptor::Quad:
return Context.TheIEEE128Type;
case IITDescriptor::Integer:
return BuiltinIntegerType::get(D.Integer_Width, Context);
case IITDescriptor::Pointer:
if (D.Pointer_AddressSpace)
return Type(); // Reject non-default address space pointers.

// Decode but ignore the pointee. Just decode all IR pointers to unsafe
// pointer type.
(void)DecodeIntrinsicType(Table, Tys, Context);
return Context.TheRawPointerType;

// A vector of an immediate type.
case IITDescriptor::Vector: {
Type eltType = decodeImmediate();
if (!eltType) return Type();
return makeVector(eltType, D.Vector_Width);
}

// A pointer to an immediate type.
case IITDescriptor::Pointer: {
Type pointeeType = decodeImmediate();
if (!pointeeType) return Type();
return makePointer(pointeeType, D.Pointer_AddressSpace);
}

// A type argument.
case IITDescriptor::Argument:
if (D.getArgumentNumber() >= Tys.size())
return Type();
return Tys[D.getArgumentNumber()];
return getTypeArgument(D.getArgumentNumber());

// A pointer to a type argument.
case IITDescriptor::PtrToArgument: {
Type argType = getTypeArgument(D.getArgumentNumber());
if (!argType) return Type();
unsigned addrspace = 0; // An apparent limitation of LLVM.
return makePointer(argType, addrspace);
}

// A vector of the same width as a type argument.
case IITDescriptor::SameVecWidthArgument: {
Type maybeVectorType = getTypeArgument(D.getArgumentNumber());
if (!maybeVectorType) return Type();
Type eltType = decodeImmediate();
if (!eltType) return Type();
return maybeMakeVectorized(eltType, maybeVectorType);
}

// A pointer to the element type of a type argument, which must be a vector.
case IITDescriptor::PtrToElt: {
Type argType = getTypeArgument(D.getArgumentNumber());
if (!argType) return Type();
auto vecType = argType->getAs<BuiltinVectorType>();
if (!vecType) return Type();
unsigned addrspace = 0; // An apparent limitation of LLVM.
return makePointer(vecType->getElementType(), addrspace);
}

// A struct, which we translate as a tuple.
case IITDescriptor::Struct: {
SmallVector<TupleTypeElt, 5> Elts;
for (unsigned i = 0; i != D.Struct_NumElements; ++i) {
Type T = DecodeIntrinsicType(Table, Tys, Context);
Type T = decodeImmediate();
if (!T) return Type();

Elts.push_back(T);
Expand Down
3 changes: 2 additions & 1 deletion lib/Basic/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/VirtualFileSystem.h"

using namespace swift;

Expand Down Expand Up @@ -223,7 +224,7 @@ std::error_code swift::moveFileIfDifferent(const llvm::Twine &source,
}

llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
swift::vfs::getFileOrSTDIN(clang::vfs::FileSystem &FS,
swift::vfs::getFileOrSTDIN(llvm::vfs::FileSystem &FS,
const llvm::Twine &Filename,
int64_t FileSize,
bool RequiresNullTerminator,
Expand Down
2 changes: 2 additions & 0 deletions lib/Basic/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ StringRef swift::getPlatformNameForTriple(const llvm::Triple &triple) {
case llvm::Triple::Mesa3D:
case llvm::Triple::Contiki:
case llvm::Triple::AMDPAL:
case llvm::Triple::HermitCore:
case llvm::Triple::Hurd:
return "";
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
Expand Down
12 changes: 12 additions & 0 deletions lib/ClangImporter/ClangAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,18 @@ OmissionTypeName importer::getClangTypeNameForOmission(clang::ASTContext &ctx,
case clang::BuiltinType::OCLClkEvent:
case clang::BuiltinType::OCLQueue:
case clang::BuiltinType::OCLReserveID:
case clang::BuiltinType::OCLIntelSubgroupAVCMcePayload:
case clang::BuiltinType::OCLIntelSubgroupAVCImePayload:
case clang::BuiltinType::OCLIntelSubgroupAVCRefPayload:
case clang::BuiltinType::OCLIntelSubgroupAVCSicPayload:
case clang::BuiltinType::OCLIntelSubgroupAVCMceResult:
case clang::BuiltinType::OCLIntelSubgroupAVCImeResult:
case clang::BuiltinType::OCLIntelSubgroupAVCRefResult:
case clang::BuiltinType::OCLIntelSubgroupAVCSicResult:
case clang::BuiltinType::OCLIntelSubgroupAVCImeResultSingleRefStreamout:
case clang::BuiltinType::OCLIntelSubgroupAVCImeResultDualRefStreamout:
case clang::BuiltinType::OCLIntelSubgroupAVCImeSingleRefStreamin:
case clang::BuiltinType::OCLIntelSubgroupAVCImeDualRefStreamin:
return OmissionTypeName();

// OpenMP types that don't have Swift equivalents.
Expand Down
Loading