Skip to content

Commit 24a61b5

Browse files
committed
Merge branch 'master-next'
This merge contains the changes to accompany the switch to the new stable branches of llvm, clang, and compiler-rt that are based on swift-4.0-branch.
2 parents e564bdc + 0f8af4c commit 24a61b5

File tree

80 files changed

+447
-431
lines changed

Some content is hidden

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

80 files changed

+447
-431
lines changed

include/swift/AST/Builtins.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ StringRef getBuiltinBaseName(ASTContext &C, StringRef Name,
8282
/// Given an LLVM IR intrinsic name with argument types remove (e.g. like
8383
/// "bswap") return the LLVM IR IntrinsicID for the intrinsic or 0 if the
8484
/// intrinsic name doesn't match anything.
85-
unsigned getLLVMIntrinsicID(StringRef Name, bool HasArgTypes);
85+
unsigned getLLVMIntrinsicID(StringRef Name);
8686

8787
/// Get the LLVM intrinsic ID that corresponds to the given builtin with
8888
/// overflow.

include/swift/AST/TypeAlignments.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#ifndef SWIFT_TYPEALIGNMENTS_H
2323
#define SWIFT_TYPEALIGNMENTS_H
2424

25-
#include "llvm/Support/AlignOf.h"
25+
#include <cstddef>
2626

2727
namespace swift {
2828
class AbstractStorageDecl;
@@ -101,7 +101,6 @@ LLVM_DECLARE_TYPE_ALIGNMENT(swift::NormalProtocolConformance,
101101
LLVM_DECLARE_TYPE_ALIGNMENT(swift::GenericEnvironment,
102102
swift::DeclAlignInBits)
103103

104-
static_assert(llvm::AlignOf<void*>::Alignment >= 2,
105-
"pointer alignment is too small");
104+
static_assert(alignof(void*) >= 2, "pointer alignment is too small");
106105

107106
#endif

include/swift/Basic/SourceManager.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class SourceManager {
134134
/// Returns the identifier for the buffer with the given ID.
135135
///
136136
/// \p BufferID must be a valid buffer ID.
137-
const char *getIdentifierForBuffer(unsigned BufferID) const;
137+
StringRef getIdentifierForBuffer(unsigned BufferID) const;
138138

139139
/// \brief Returns a SourceRange covering the entire specified buffer.
140140
///
@@ -167,9 +167,9 @@ class SourceManager {
167167
/// location.
168168
///
169169
/// This respects #line directives.
170-
const char *getBufferIdentifierForLoc(SourceLoc Loc) const {
170+
StringRef getBufferIdentifierForLoc(SourceLoc Loc) const {
171171
if (auto VFile = getVirtualFile(Loc))
172-
return VFile->Name.c_str();
172+
return VFile->Name;
173173
else
174174
return getIdentifierForBuffer(findBufferContainingLoc(Loc));
175175
}

include/swift/Basic/Timer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ namespace swift {
3333
public:
3434
explicit SharedTimer(StringRef name) {
3535
if (CompilationTimersEnabled == State::Enabled)
36-
Timer.emplace(name, StringRef("Swift compilation"));
36+
Timer.emplace(name, StringRef("Swift compilation"), StringRef("swift"),
37+
StringRef("swift related timers"));
3738
else
3839
CompilationTimersEnabled = State::Skipped;
3940
}

include/swift/Driver/Action.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "llvm/ADT/ArrayRef.h"
2020
#include "llvm/ADT/Optional.h"
2121
#include "llvm/ADT/StringSwitch.h"
22-
#include "llvm/Support/TimeValue.h"
22+
#include "llvm/Support/Chrono.h"
2323

2424
namespace llvm {
2525
namespace opt {
@@ -138,14 +138,14 @@ class CompileJobAction : public JobAction {
138138
NewlyAdded
139139
};
140140
Status status = UpToDate;
141-
llvm::sys::TimeValue previousModTime;
141+
llvm::sys::TimePoint<> previousModTime;
142142

143143
InputInfo() = default;
144-
InputInfo(Status stat, llvm::sys::TimeValue time)
144+
InputInfo(Status stat, llvm::sys::TimePoint<> time)
145145
: status(stat), previousModTime(time) {}
146146

147147
static InputInfo makeNewlyAdded() {
148-
return InputInfo(Status::NewlyAdded, llvm::sys::TimeValue::MaxTime());
148+
return InputInfo(Status::NewlyAdded, llvm::sys::TimePoint<>::max());
149149
}
150150
};
151151

include/swift/Driver/Compilation.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "swift/Basic/LLVM.h"
2424
#include "llvm/ADT/DenseSet.h"
2525
#include "llvm/ADT/StringRef.h"
26-
#include "llvm/Support/TimeValue.h"
26+
#include "llvm/Support/Chrono.h"
2727

2828
#include <memory>
2929
#include <vector>
@@ -99,12 +99,12 @@ class Compilation {
9999
///
100100
/// This should be as close as possible to when the driver was invoked, since
101101
/// it's used as a lower bound.
102-
llvm::sys::TimeValue BuildStartTime;
102+
llvm::sys::TimePoint<> BuildStartTime;
103103

104104
/// The time of the last build.
105105
///
106106
/// If unknown, this will be some time in the past.
107-
llvm::sys::TimeValue LastBuildTime = llvm::sys::TimeValue::MinTime();
107+
llvm::sys::TimePoint<> LastBuildTime = llvm::sys::TimePoint<>::min();
108108

109109
/// The number of commands which this compilation should attempt to run in
110110
/// parallel.
@@ -145,7 +145,7 @@ class Compilation {
145145
std::unique_ptr<llvm::opt::InputArgList> InputArgs,
146146
std::unique_ptr<llvm::opt::DerivedArgList> TranslatedArgs,
147147
InputFileList InputsWithTypes,
148-
StringRef ArgsHash, llvm::sys::TimeValue StartTime,
148+
StringRef ArgsHash, llvm::sys::TimePoint<> StartTime,
149149
unsigned NumberOfParallelCommands = 1,
150150
bool EnableIncrementalBuild = false,
151151
bool SkipTaskExecution = false,
@@ -199,7 +199,7 @@ class Compilation {
199199
CompilationRecordPath = path;
200200
}
201201

202-
void setLastBuildTime(llvm::sys::TimeValue time) {
202+
void setLastBuildTime(llvm::sys::TimePoint<> time) {
203203
LastBuildTime = time;
204204
}
205205

include/swift/Driver/Job.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "llvm/ADT/PointerIntPair.h"
2424
#include "llvm/ADT/SmallVector.h"
2525
#include "llvm/ADT/StringRef.h"
26-
#include "llvm/Support/TimeValue.h"
26+
#include "llvm/Support/Chrono.h"
2727
#include "llvm/Support/raw_ostream.h"
2828

2929
#include <memory>
@@ -118,7 +118,7 @@ class Job {
118118
FilelistInfo FilelistFileInfo;
119119

120120
/// The modification time of the main input file, if any.
121-
llvm::sys::TimeValue InputModTime = llvm::sys::TimeValue::MaxTime();
121+
llvm::sys::TimePoint<> InputModTime = llvm::sys::TimePoint<>::max();
122122

123123
public:
124124
Job(const JobAction &Source,
@@ -152,11 +152,11 @@ class Job {
152152
SourceAndCondition.setInt(Cond);
153153
}
154154

155-
void setInputModTime(llvm::sys::TimeValue time) {
155+
void setInputModTime(llvm::sys::TimePoint<> time) {
156156
InputModTime = time;
157157
}
158158

159-
llvm::sys::TimeValue getInputModTime() const {
159+
llvm::sys::TimePoint<> getInputModTime() const {
160160
return InputModTime;
161161
}
162162

include/swift/IDE/CodeCompletion.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "llvm/ADT/ArrayRef.h"
1919
#include "llvm/ADT/StringRef.h"
2020
#include "llvm/Support/Allocator.h"
21-
#include "llvm/Support/TimeValue.h"
2221
#include "llvm/Support/TrailingObjects.h"
2322
#include <functional>
2423
#include <memory>

include/swift/IDE/CodeCompletionCache.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "swift/IDE/CodeCompletion.h"
1717
#include "swift/Basic/ThreadSafeRefCounted.h"
1818
#include "llvm/ADT/IntrusiveRefCntPtr.h"
19+
#include "llvm/Support/Chrono.h"
1920
#include <system_error>
2021

2122
namespace swift {
@@ -53,7 +54,7 @@ class CodeCompletionCache {
5354
};
5455

5556
struct Value : public llvm::ThreadSafeRefCountedBase<Value> {
56-
llvm::sys::TimeValue ModuleModificationTime;
57+
llvm::sys::TimePoint<> ModuleModificationTime;
5758
CodeCompletionResultSink Sink;
5859
};
5960
using ValueRefCntPtr = llvm::IntrusiveRefCntPtr<Value>;

include/swift/SIL/CFG.h

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ namespace llvm {
2727
// GraphTraits for SILBasicBlock
2828
//===----------------------------------------------------------------------===//
2929
template <> struct GraphTraits<swift::SILBasicBlock*> {
30-
typedef swift::SILBasicBlock NodeType;
31-
typedef NodeType::SuccessorListTy::iterator ChildIteratorType;
30+
typedef swift::SILBasicBlock::SuccessorListTy::iterator ChildIteratorType;
3231
typedef swift::SILBasicBlock *NodeRef;
3332

3433
static NodeRef getEntryNode(NodeRef BB) { return BB; }
@@ -42,8 +41,7 @@ template <> struct GraphTraits<swift::SILBasicBlock*> {
4241
};
4342

4443
template <> struct GraphTraits<const swift::SILBasicBlock*> {
45-
typedef const swift::SILBasicBlock NodeType;
46-
typedef NodeType::ConstSuccessorListTy::iterator ChildIteratorType;
44+
typedef swift::SILBasicBlock::ConstSuccessorListTy::iterator ChildIteratorType;
4745
typedef const swift::SILBasicBlock *NodeRef;
4846

4947
static NodeRef getEntryNode(NodeRef BB) { return BB; }
@@ -57,8 +55,7 @@ template <> struct GraphTraits<const swift::SILBasicBlock*> {
5755
};
5856

5957
template <> struct GraphTraits<Inverse<swift::SILBasicBlock*> > {
60-
typedef swift::SILBasicBlock NodeType;
61-
typedef NodeType::pred_iterator ChildIteratorType;
58+
typedef swift::SILBasicBlock::pred_iterator ChildIteratorType;
6259
typedef swift::SILBasicBlock *NodeRef;
6360

6461
static NodeRef getEntryNode(Inverse<swift::SILBasicBlock *> G) {
@@ -73,8 +70,7 @@ template <> struct GraphTraits<Inverse<swift::SILBasicBlock*> > {
7370
};
7471

7572
template <> struct GraphTraits<Inverse<const swift::SILBasicBlock*> > {
76-
typedef const swift::SILBasicBlock NodeType;
77-
typedef NodeType::pred_iterator ChildIteratorType;
73+
typedef swift::SILBasicBlock::pred_iterator ChildIteratorType;
7874
typedef const swift::SILBasicBlock *NodeRef;
7975

8076
static NodeRef getEntryNode(Inverse<const swift::SILBasicBlock *> G) {
@@ -95,9 +91,13 @@ template <> struct GraphTraits<swift::SILFunction*>
9591

9692
static NodeRef getEntryNode(GraphType F) { return &F->front(); }
9793

98-
typedef swift::SILFunction::iterator nodes_iterator;
99-
static nodes_iterator nodes_begin(GraphType F) { return F->begin(); }
100-
static nodes_iterator nodes_end(GraphType F) { return F->end(); }
94+
typedef pointer_iterator<swift::SILFunction::iterator> nodes_iterator;
95+
static nodes_iterator nodes_begin(GraphType F) {
96+
return nodes_iterator(F->begin());
97+
}
98+
static nodes_iterator nodes_end(GraphType F) {
99+
return nodes_iterator(F->end());
100+
}
101101
static unsigned size(GraphType F) { return F->size(); }
102102
};
103103

@@ -108,9 +108,13 @@ template <> struct GraphTraits<Inverse<swift::SILFunction*> >
108108

109109
static NodeRef getEntryNode(GraphType F) { return &F.Graph->front(); }
110110

111-
typedef swift::SILFunction::iterator nodes_iterator;
112-
static nodes_iterator nodes_begin(GraphType F) { return F.Graph->begin(); }
113-
static nodes_iterator nodes_end(GraphType F) { return F.Graph->end(); }
111+
typedef pointer_iterator<swift::SILFunction::iterator> nodes_iterator;
112+
static nodes_iterator nodes_begin(GraphType F) {
113+
return nodes_iterator(F.Graph->begin());
114+
}
115+
static nodes_iterator nodes_end(GraphType F) {
116+
return nodes_iterator(F.Graph->end());
117+
}
114118
static unsigned size(GraphType F) { return F.Graph->size(); }
115119
};
116120

include/swift/SIL/Dominance.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ namespace llvm {
171171
/// DominatorTree GraphTraits specialization so the DominatorTree can be
172172
/// iterable by generic graph iterators.
173173
template <> struct GraphTraits<swift::DominanceInfoNode *> {
174-
using NodeType = swift::DominanceInfoNode;
175-
using ChildIteratorType = NodeType::iterator;
174+
using ChildIteratorType = swift::DominanceInfoNode::iterator;
176175
typedef swift::DominanceInfoNode *NodeRef;
177176

178177
static NodeRef getEntryNode(NodeRef N) { return N; }
@@ -181,8 +180,7 @@ template <> struct GraphTraits<swift::DominanceInfoNode *> {
181180
};
182181

183182
template <> struct GraphTraits<const swift::DominanceInfoNode *> {
184-
using NodeType = const swift::DominanceInfoNode;
185-
using ChildIteratorType = NodeType::const_iterator;
183+
using ChildIteratorType = swift::DominanceInfoNode::const_iterator;
186184
typedef const swift::DominanceInfoNode *NodeRef;
187185

188186
static NodeRef getEntryNode(NodeRef N) { return N; }

include/swift/SIL/LoopInfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class SILLoopInfo {
6363
using SILLoopInfoBase = llvm::LoopInfoBase<SILBasicBlock, SILLoop>;
6464

6565
SILLoopInfoBase LI;
66+
DominanceInfo *Dominance;
6667

6768
void operator=(const SILLoopInfo &) = delete;
6869
SILLoopInfo(const SILLoopInfo &) = delete;

include/swift/SIL/SILLocation.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ class SILLocation {
8787
struct DebugLoc {
8888
unsigned Line;
8989
unsigned Column;
90-
const char *Filename;
90+
StringRef Filename;
9191

9292
DebugLoc(unsigned Line = 0, unsigned Column = 0,
93-
const char *Filename = nullptr)
93+
StringRef Filename = StringRef())
9494
: Line(Line), Column(Column), Filename(Filename) {}
9595

9696
inline bool operator==(const DebugLoc &R) const {
9797
return Line == R.Line && Column == R.Column &&
98-
StringRef(Filename).equals(R.Filename);
98+
Filename.equals(R.Filename);
9999
}
100100
};
101101

@@ -265,7 +265,7 @@ class SILLocation {
265265
bool isNull() const {
266266
switch (getStorageKind()) {
267267
case ASTNodeKind: return Loc.ASTNode.Primary.isNull();
268-
case DebugInfoKind: return Loc.DebugInfoLoc.Filename;
268+
case DebugInfoKind: return Loc.DebugInfoLoc.Filename.empty();
269269
case SILFileKind: return Loc.SILFileLoc.isInvalid();
270270
default: return true;
271271
}
@@ -410,7 +410,7 @@ class SILLocation {
410410
}
411411

412412
/// Fingerprint a DebugLoc for use in a DenseMap.
413-
typedef std::pair<std::pair<unsigned, unsigned>, const void *> DebugLocKey;
413+
typedef std::pair<std::pair<unsigned, unsigned>, StringRef> DebugLocKey;
414414
struct DebugLocHash : public DebugLocKey {
415415
DebugLocHash(DebugLoc L) : DebugLocKey({{L.Line, L.Column}, L.Filename}) {}
416416
};

include/swift/Serialization/ModuleFile.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ class ModuleFile : public LazyMemberLoader {
5656
std::unique_ptr<llvm::MemoryBuffer> ModuleInputBuffer;
5757
std::unique_ptr<llvm::MemoryBuffer> ModuleDocInputBuffer;
5858

59-
/// The reader attached to \c ModuleInputBuffer.
60-
llvm::BitstreamReader ModuleInputReader;
61-
62-
/// The reader attached to \c ModuleDocInputBuffer.
63-
llvm::BitstreamReader ModuleDocInputReader;
64-
6559
/// The cursor used to lazily load things from the file.
6660
llvm::BitstreamCursor DeclTypeCursor;
6761

lib/AST/ASTPrinter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,17 +476,17 @@ bool TypeTransformContext::isPrintingSynthesizedExtension() const {
476476
std::string ASTPrinter::sanitizeUtf8(StringRef Text) {
477477
llvm::SmallString<256> Builder;
478478
Builder.reserve(Text.size());
479-
const UTF8* Data = reinterpret_cast<const UTF8*>(Text.begin());
480-
const UTF8* End = reinterpret_cast<const UTF8*>(Text.end());
479+
const llvm::UTF8* Data = reinterpret_cast<const llvm::UTF8*>(Text.begin());
480+
const llvm::UTF8* End = reinterpret_cast<const llvm::UTF8*>(Text.end());
481481
StringRef Replacement = u8"\ufffd";
482482
while (Data < End) {
483-
auto Step = getNumBytesForUTF8(*Data);
483+
auto Step = llvm::getNumBytesForUTF8(*Data);
484484
if (Data + Step > End) {
485485
Builder.append(Replacement);
486486
break;
487487
}
488488

489-
if (isLegalUTF8Sequence(Data, Data + Step)) {
489+
if (llvm::isLegalUTF8Sequence(Data, Data + Step)) {
490490
Builder.append(Data, Data + Step);
491491
} else {
492492

lib/AST/Builtins.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ static const char *const IntrinsicNameTable[] = {
11381138
/// getLLVMIntrinsicID - Given an LLVM IR intrinsic name with argument types
11391139
/// removed (e.g. like "bswap") return the LLVM IR IntrinsicID for the intrinsic
11401140
/// or 0 if the intrinsic name doesn't match anything.
1141-
unsigned swift::getLLVMIntrinsicID(StringRef InName, bool hasArgTypes) {
1141+
unsigned swift::getLLVMIntrinsicID(StringRef InName) {
11421142
using namespace llvm;
11431143

11441144
// Swift intrinsic names start with int_.
@@ -1151,9 +1151,7 @@ unsigned swift::getLLVMIntrinsicID(StringRef InName, bool hasArgTypes) {
11511151
NameS.append("llvm.");
11521152
for (char C : InName)
11531153
NameS.push_back(C == '_' ? '.' : C);
1154-
if (hasArgTypes)
1155-
NameS.push_back('.');
1156-
1154+
11571155
const char *Name = NameS.c_str();
11581156
ArrayRef<const char *> NameTable(&IntrinsicNameTable[1],
11591157
TargetInfos[1].Offset);
@@ -1348,7 +1346,7 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
13481346

13491347
// If this is the name of an LLVM intrinsic, cons up a swift function with a
13501348
// type that matches the IR types.
1351-
if (unsigned ID = getLLVMIntrinsicID(OperationName, !Types.empty())) {
1349+
if (unsigned ID = getLLVMIntrinsicID(OperationName)) {
13521350
SmallVector<Type, 8> ArgElts;
13531351
Type ResultTy;
13541352
FunctionType::ExtInfo Info;

lib/AST/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ add_swift_library(swiftAST STATIC
7676
clangBasic
7777

7878
LLVM_COMPONENT_DEPENDS
79-
bitreader bitwriter coverage irreader debuginfoDWARF
79+
bitreader bitwriter coroutines coverage irreader debuginfoDWARF
8080
profiledata instrumentation object objcarcopts mc mcparser
8181
bitreader bitwriter lto ipo option core support ${LLVM_TARGETS_TO_BUILD}
8282
)

0 commit comments

Comments
 (0)