Skip to content

Commit db8bf0b

Browse files
authored
Merge pull request #29744 from apple/master-rebranch
Merge master-rebranch into master to support new llvm branch apple/stable/20200108
2 parents 7952f05 + 227485b commit db8bf0b

File tree

326 files changed

+1746
-1317
lines changed

Some content is hidden

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

326 files changed

+1746
-1317
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ endif()
3232

3333
ENABLE_LANGUAGE(C)
3434

35+
# Use C++14.
36+
set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
37+
set(CMAKE_CXX_STANDARD_REQUIRED YES)
38+
set(CMAKE_CXX_EXTENSIONS NO)
39+
3540
# First include general CMake utilities.
3641
include(SwiftUtils)
3742
include(CheckSymbolExists)

cmake/modules/SwiftXcodeSupport.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ macro(swift_common_xcode_cxx_config)
100100
# Force usage of Clang.
101101
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0"
102102
CACHE STRING "Xcode Compiler")
103-
# Use C++'11.
104-
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11"
103+
# Use C++'14.
104+
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14"
105105
CACHE STRING "Xcode C++ Language Standard")
106106
# Use libc++.
107107
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++"

include/swift/ABI/TrailingObjects.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#ifndef SWIFT_ABI_TRAILINGOBJECTS_H
5656
#define SWIFT_ABI_TRAILINGOBJECTS_H
5757

58+
#include "llvm/Support/Alignment.h"
5859
#include "llvm/Support/AlignOf.h"
5960
#include "llvm/Support/Compiler.h"
6061
#include "llvm/Support/MathExtras.h"
@@ -175,7 +176,7 @@ class TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, PrevTy, NextTy,
175176

176177
if (requiresRealignment())
177178
return reinterpret_cast<const NextTy *>(
178-
llvm::alignAddr(Ptr, alignof(NextTy)));
179+
llvm::alignAddr(Ptr, llvm::Align(alignof(NextTy))));
179180
else
180181
return reinterpret_cast<const NextTy *>(Ptr);
181182
}
@@ -189,7 +190,8 @@ class TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, PrevTy, NextTy,
189190
Obj, TrailingObjectsBase::OverloadToken<PrevTy>());
190191

191192
if (requiresRealignment())
192-
return reinterpret_cast<NextTy *>(llvm::alignAddr(Ptr, alignof(NextTy)));
193+
return reinterpret_cast<NextTy *>(
194+
llvm::alignAddr(Ptr, llvm::Align(alignof(NextTy))));
193195
else
194196
return reinterpret_cast<NextTy *>(Ptr);
195197
}

include/swift/ABI/TypeIdentity.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define SWIFT_ABI_TYPEIDENTITY_H
2020

2121
#include "swift/Basic/LLVM.h"
22+
#include <llvm/ADT/StringRef.h>
2223

2324
namespace swift {
2425
template <class> class TargetTypeContextDescriptor;

include/swift/AST/Evaluator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ class Evaluator {
345345
// Check for a cycle.
346346
if (checkDependency(activeReq)) {
347347
return llvm::Error(
348-
llvm::make_unique<CyclicalRequestError<Request>>(request, *this));
348+
std::make_unique<CyclicalRequestError<Request>>(request, *this));
349349
}
350350

351351
// Make sure we remove this from the set of active requests once we're

include/swift/AST/SimpleRequest.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class SimpleRequest<Derived, Output(Inputs...), Caching> {
195195

196196
template<size_t ...Indices>
197197
llvm::Expected<Output>
198-
callDerived(Evaluator &evaluator, llvm::index_sequence<Indices...>) const {
198+
callDerived(Evaluator &evaluator, std::index_sequence<Indices...>) const {
199199
static_assert(sizeof...(Indices) > 0, "Subclass must define evaluate()");
200200
return asDerived().evaluate(evaluator, std::get<Indices>(storage)...);
201201
}
@@ -217,7 +217,7 @@ class SimpleRequest<Derived, Output(Inputs...), Caching> {
217217
static llvm::Expected<OutputType>
218218
evaluateRequest(const Derived &request, Evaluator &evaluator) {
219219
return request.callDerived(evaluator,
220-
llvm::index_sequence_for<Inputs...>());
220+
std::index_sequence_for<Inputs...>());
221221
}
222222

223223
/// Retrieve the nearest source location to which this request applies.

include/swift/Basic/Statistic.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525

2626
#define SWIFT_FUNC_STAT_NAMED(DEBUG_TYPE) \
2727
do { \
28-
static llvm::Statistic FStat = \
29-
{DEBUG_TYPE, __func__, __func__, {0}, {false}}; \
28+
static llvm::Statistic FStat = {DEBUG_TYPE, __func__, __func__}; \
3029
++FStat; \
3130
} while (0)
3231

include/swift/Frontend/Frontend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ class CompilerInstance {
482482

483483
void createDependencyTracker(bool TrackSystemDeps) {
484484
assert(!Context && "must be called before setup()");
485-
DepTracker = llvm::make_unique<DependencyTracker>(TrackSystemDeps);
485+
DepTracker = std::make_unique<DependencyTracker>(TrackSystemDeps);
486486
}
487487
DependencyTracker *getDependencyTracker() { return DepTracker.get(); }
488488
const DependencyTracker *getDependencyTracker() const { return DepTracker.get(); }

include/swift/LLVMPasses/Passes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
#include "swift/LLVMPasses/PassesFwd.h"
1717
#include "llvm/Analysis/AliasAnalysis.h"
18+
#include "llvm/Analysis/Passes.h"
19+
#include "llvm/InitializePasses.h"
1820
#include "llvm/Pass.h"
1921

2022
namespace swift {

include/swift/Reflection/TypeRef.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ class alignas(void *) TypeRef {
150150
void dump() const;
151151
void dump(FILE *file, unsigned Indent = 0) const;
152152

153+
/// Build a demangle tree from this TypeRef.
154+
Demangle::NodePointer getDemangling(Demangle::Demangler &Dem) const;
155+
153156
bool isConcrete() const;
154157
bool isConcreteAfterSubstitutions(const GenericArgumentMap &Subs) const;
155158

include/swift/SIL/PatternMatch.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ namespace detail {
310310
struct GetOperandsFunctor {
311311
template <size_t... Idx>
312312
std::array<SILValue, sizeof...(Idx)>
313-
operator()(SILInstruction *i, llvm::index_sequence<Idx...> seq) const {
313+
operator()(SILInstruction *i, std::index_sequence<Idx...> seq) const {
314314
return {i->getOperand(Idx)...};
315315
}
316316
};
@@ -327,15 +327,15 @@ template <typename... MatcherTys> struct MatcherFunctor {
327327
template <size_t... Idx>
328328
std::array<bool, sizeof...(MatcherTys)>
329329
matchHelper(const std::array<SILValue, sizeof...(MatcherTys)> &operands,
330-
llvm::index_sequence<Idx...> seq) {
330+
std::index_sequence<Idx...> seq) {
331331
return {individual(std::get<Idx>(matchers), std::get<Idx>(operands))...};
332332
}
333333

334334
bool match(SILInstruction *i) {
335335
std::array<SILValue, sizeof...(MatcherTys)> operands =
336-
GetOperandsFunctor{}(i, llvm::index_sequence_for<MatcherTys...>{});
336+
GetOperandsFunctor{}(i, std::index_sequence_for<MatcherTys...>{});
337337
auto tmpResult =
338-
matchHelper(operands, llvm::index_sequence_for<MatcherTys...>{});
338+
matchHelper(operands, std::index_sequence_for<MatcherTys...>{});
339339
for (unsigned i : indices(tmpResult)) {
340340
if (!tmpResult[i])
341341
return false;

include/swift/SIL/SILInstruction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ class MultipleValueInstructionTrailingObjects<Derived, DerivedResult,
999999
MultipleValueInstruction *,
10001000
DerivedResult,
10011001
FinalOtherTrailingTypes...> {
1002-
static_assert(LLVM_IS_FINAL(DerivedResult),
1002+
static_assert(std::is_final<DerivedResult>(),
10031003
"Expected DerivedResult to be final");
10041004
static_assert(
10051005
std::is_base_of<MultipleValueInstructionResult, DerivedResult>::value,

include/swift/SILOptimizer/Analysis/BasicCalleeAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class BasicCalleeAnalysis : public SILAnalysis {
172172

173173
void updateCache() {
174174
if (!Cache)
175-
Cache = llvm::make_unique<CalleeCache>(M);
175+
Cache = std::make_unique<CalleeCache>(M);
176176
}
177177

178178
CalleeList getCalleeList(FullApplySite FAS) {

include/swift/SILOptimizer/Analysis/DominanceAnalysis.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class DominanceAnalysis : public FunctionAnalysisBase<DominanceInfo> {
4242
}
4343

4444
std::unique_ptr<DominanceInfo> newFunctionAnalysis(SILFunction *F) override {
45-
return llvm::make_unique<DominanceInfo>(F);
45+
return std::make_unique<DominanceInfo>(F);
4646
}
4747

4848
virtual bool shouldInvalidate(SILAnalysis::InvalidationKind K) override {
@@ -72,7 +72,7 @@ class PostDominanceAnalysis : public FunctionAnalysisBase<PostDominanceInfo> {
7272

7373
std::unique_ptr<PostDominanceInfo>
7474
newFunctionAnalysis(SILFunction *F) override {
75-
return llvm::make_unique<PostDominanceInfo>(F);
75+
return std::make_unique<PostDominanceInfo>(F);
7676
}
7777

7878
virtual bool shouldInvalidate(SILAnalysis::InvalidationKind K) override {

include/swift/SILOptimizer/Analysis/EpilogueARCAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ class EpilogueARCAnalysis : public FunctionAnalysisBase<EpilogueARCFunctionInfo>
302302

303303
virtual std::unique_ptr<EpilogueARCFunctionInfo>
304304
newFunctionAnalysis(SILFunction *F) override {
305-
return llvm::make_unique<EpilogueARCFunctionInfo>(F, PO, AA, RC);
305+
return std::make_unique<EpilogueARCFunctionInfo>(F, PO, AA, RC);
306306
}
307307

308308
virtual bool shouldInvalidate(SILAnalysis::InvalidationKind K) override {

include/swift/SILOptimizer/Analysis/IVAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class IVAnalysis final : public FunctionAnalysisBase<IVInfo> {
9191
}
9292

9393
std::unique_ptr<IVInfo> newFunctionAnalysis(SILFunction *F) override {
94-
return llvm::make_unique<IVInfo>(*F);
94+
return std::make_unique<IVInfo>(*F);
9595
}
9696

9797
/// For now we always invalidate.

include/swift/SILOptimizer/Analysis/LoopRegionAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ class LoopRegionAnalysis : public FunctionAnalysisBase<LoopRegionFunctionInfo> {
10821082

10831083
virtual std::unique_ptr<LoopRegionFunctionInfo>
10841084
newFunctionAnalysis(SILFunction *F) override {
1085-
return llvm::make_unique<LoopRegionFunctionInfo>(F, POA->get(F),
1085+
return std::make_unique<LoopRegionFunctionInfo>(F, POA->get(F),
10861086
SLA->get(F));
10871087
}
10881088

include/swift/SILOptimizer/Analysis/PostOrderAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class PostOrderAnalysis : public FunctionAnalysisBase<PostOrderFunctionInfo> {
3636
protected:
3737
virtual std::unique_ptr<PostOrderFunctionInfo>
3838
newFunctionAnalysis(SILFunction *F) override {
39-
return llvm::make_unique<PostOrderFunctionInfo>(F);
39+
return std::make_unique<PostOrderFunctionInfo>(F);
4040
}
4141

4242
virtual bool shouldInvalidate(SILAnalysis::InvalidationKind K) override {

include/swift/SILOptimizer/Analysis/RCIdentityAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class RCIdentityAnalysis : public FunctionAnalysisBase<RCIdentityFunctionInfo> {
120120

121121
virtual std::unique_ptr<RCIdentityFunctionInfo>
122122
newFunctionAnalysis(SILFunction *F) override {
123-
return llvm::make_unique<RCIdentityFunctionInfo>(DA);
123+
return std::make_unique<RCIdentityFunctionInfo>(DA);
124124
}
125125

126126
virtual bool shouldInvalidate(SILAnalysis::InvalidationKind K) override {

include/swift/SILOptimizer/Utils/PerformanceInlinerUtils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "swift/SILOptimizer/Utils/ConstantFolding.h"
2121
#include "swift/SILOptimizer/Utils/SILInliner.h"
2222
#include "llvm/ADT/SmallVector.h"
23+
#include "llvm/Support/CommandLine.h"
2324

2425

2526
using namespace swift;

lib/AST/ASTContext.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,8 @@ static ModuleDecl *createBuiltinModule(ASTContext &ctx) {
504504

505505
inline ASTContext::Implementation &ASTContext::getImpl() const {
506506
auto pointer = reinterpret_cast<char*>(const_cast<ASTContext*>(this));
507-
auto offset = llvm::alignAddr((void*)sizeof(*this), alignof(Implementation));
507+
auto offset = llvm::alignAddr((void *)sizeof(*this),
508+
llvm::Align(alignof(Implementation)));
508509
return *reinterpret_cast<Implementation*>(pointer + offset);
509510
}
510511

@@ -524,7 +525,8 @@ ASTContext *ASTContext::get(LangOptions &langOpts,
524525
auto size = llvm::alignTo(sizeof(ASTContext) + sizeof(Implementation), align);
525526
auto mem = AlignedAlloc(size, align);
526527
auto impl = reinterpret_cast<void*>((char*)mem + sizeof(ASTContext));
527-
impl = reinterpret_cast<void*>(llvm::alignAddr(impl,alignof(Implementation)));
528+
impl = reinterpret_cast<void *>(
529+
llvm::alignAddr(impl, llvm::Align(alignof(Implementation))));
528530
new (impl) Implementation();
529531
return new (mem)
530532
ASTContext(langOpts, typeckOpts, SearchPathOpts, SourceMgr, Diags);
@@ -1547,7 +1549,7 @@ void ASTContext::registerGenericSignatureBuilder(
15471549

15481550
++NumRegisteredGenericSignatureBuilders;
15491551
genericSignatureBuilders[canSig] =
1550-
llvm::make_unique<GenericSignatureBuilder>(std::move(builder));
1552+
std::make_unique<GenericSignatureBuilder>(std::move(builder));
15511553
}
15521554

15531555
GenericSignatureBuilder *ASTContext::getOrCreateGenericSignatureBuilder(

lib/AST/Builtins.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,10 +1381,14 @@ Type IntrinsicTypeDecoder::decodeImmediate() {
13811381
case IITDescriptor::ExtendArgument:
13821382
case IITDescriptor::TruncArgument:
13831383
case IITDescriptor::HalfVecArgument:
1384+
case IITDescriptor::ScalableVecArgument:
13841385
case IITDescriptor::VarArg:
13851386
case IITDescriptor::Token:
13861387
case IITDescriptor::VecElementArgument:
13871388
case IITDescriptor::VecOfAnyPtrsToElt:
1389+
case IITDescriptor::VecOfBitcastsToInt:
1390+
case IITDescriptor::Subdivide2Argument:
1391+
case IITDescriptor::Subdivide4Argument:
13881392
// These types cannot be expressed in swift yet.
13891393
return Type();
13901394

lib/AST/ClangTypeConverter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ clang::QualType ClangTypeConverter::visitTupleType(TupleType *type) {
369369
return clang::QualType();
370370

371371
APInt size(32, tupleNumElements);
372-
return ClangASTContext.getConstantArrayType(clangEltTy, size,
372+
return ClangASTContext.getConstantArrayType(clangEltTy, size, nullptr,
373373
clang::ArrayType::Normal, 0);
374374
}
375375

lib/AST/DiagnosticConsumer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ FileSpecificDiagnosticConsumer::consolidateSubconsumers(
7171
if (subconsumers.size() == 1)
7272
return std::move(subconsumers.front()).consumer;
7373
// Cannot use return
74-
// llvm::make_unique<FileSpecificDiagnosticConsumer>(subconsumers); because
74+
// std::make_unique<FileSpecificDiagnosticConsumer>(subconsumers); because
7575
// the constructor is private.
7676
return std::unique_ptr<DiagnosticConsumer>(
7777
new FileSpecificDiagnosticConsumer(subconsumers));

lib/AST/Expr.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -813,13 +813,14 @@ APInt BuiltinIntegerWidth::parse(StringRef text, unsigned radix, bool negate,
813813
static APFloat getFloatLiteralValue(bool IsNegative, StringRef Text,
814814
const llvm::fltSemantics &Semantics) {
815815
APFloat Val(Semantics);
816-
APFloat::opStatus Res =
817-
Val.convertFromString(Text, llvm::APFloat::rmNearestTiesToEven);
818-
assert(Res != APFloat::opInvalidOp && "Sema didn't reject invalid number");
819-
(void)Res;
816+
llvm::Expected<APFloat::opStatus> MaybeRes =
817+
Val.convertFromString(Text, llvm::APFloat::rmNearestTiesToEven);
818+
assert(MaybeRes && *MaybeRes != APFloat::opInvalidOp &&
819+
"Sema didn't reject invalid number");
820+
(void)MaybeRes;
820821
if (IsNegative) {
821822
auto NegVal = APFloat::getZero(Semantics, /*negative*/ true);
822-
Res = NegVal.subtract(Val, llvm::APFloat::rmNearestTiesToEven);
823+
auto Res = NegVal.subtract(Val, llvm::APFloat::rmNearestTiesToEven);
823824
assert(Res != APFloat::opInvalidOp && "Sema didn't reject invalid number");
824825
(void)Res;
825826
return NegVal;

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3208,7 +3208,7 @@ GenericSignatureBuilder::Implementation::getOrCreateRewriteTreeRoot(
32083208
return root;
32093209

32103210
auto &root = RewriteTreeRoots[anchor];
3211-
root = llvm::make_unique<RewriteTreeNode>(nullptr);
3211+
root = std::make_unique<RewriteTreeNode>(nullptr);
32123212
return root.get();
32133213
}
32143214

lib/AST/Module.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ BuiltinUnit::LookupCache &BuiltinUnit::getCache() const {
8383
// FIXME: This leaks. Sticking this into ASTContext isn't enough because then
8484
// the DenseMap will leak.
8585
if (!Cache)
86-
const_cast<BuiltinUnit *>(this)->Cache = llvm::make_unique<LookupCache>();
86+
const_cast<BuiltinUnit *>(this)->Cache = std::make_unique<LookupCache>();
8787
return *Cache;
8888
}
8989

@@ -192,7 +192,7 @@ class swift::SourceLookupCache {
192192
SourceLookupCache &SourceFile::getCache() const {
193193
if (!Cache) {
194194
const_cast<SourceFile *>(this)->Cache =
195-
llvm::make_unique<SourceLookupCache>(*this);
195+
std::make_unique<SourceLookupCache>(*this);
196196
}
197197
return *Cache;
198198
}
@@ -435,7 +435,7 @@ void ModuleDecl::removeFile(FileUnit &existingFile) {
435435
SourceLookupCache &ModuleDecl::getSourceLookupCache() const {
436436
if (!Cache) {
437437
const_cast<ModuleDecl *>(this)->Cache =
438-
llvm::make_unique<SourceLookupCache>(*this);
438+
std::make_unique<SourceLookupCache>(*this);
439439
}
440440
return *Cache;
441441
}

lib/Basic/FileSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,14 @@ swift::areFilesDifferent(const llvm::Twine &source,
214214
// The two files match in size, so we have to compare the bytes to determine
215215
// if they're the same.
216216
std::error_code sourceRegionErr;
217-
fs::mapped_file_region sourceRegion(sourceFile.fd,
217+
fs::mapped_file_region sourceRegion(fs::convertFDToNativeFile(sourceFile.fd),
218218
fs::mapped_file_region::readonly,
219219
size, 0, sourceRegionErr);
220220
if (sourceRegionErr)
221221
return sourceRegionErr;
222222

223223
std::error_code destRegionErr;
224-
fs::mapped_file_region destRegion(destFile.fd,
224+
fs::mapped_file_region destRegion(fs::convertFDToNativeFile(destFile.fd),
225225
fs::mapped_file_region::readonly,
226226
size, 0, destRegionErr);
227227

0 commit comments

Comments
 (0)