Skip to content

Commit 9102d25

Browse files
authored
---
yaml --- r: 341567 b: refs/heads/rxwei-patch-1 c: 81a69f3 h: refs/heads/master i: 341565: dbeec43 341563: 5af9f96 341559: 488f1ef 341551: 2078fc8 341535: 07dbcef 341503: efde5ca
1 parent ee2d91f commit 9102d25

36 files changed

+477
-128
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: 0316bb1cce2f13058ea853fd152a63e0955f8a33
1018+
refs/heads/rxwei-patch-1: 81a69f3c9e394e2f033ea87e016eeb269e4c5d00
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/docs/WindowsBuild.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ git clone https://gitlab.gnome.org/GNOME/libxml2.git
5252
```
5353

5454
## 3. Acquire ICU
55-
1. Download ICU from [ICU Project](http://site.icu-project.org) for Windows x64 and extract the binaries.
55+
1. Download ICU from [ICU Project](http://site.icu-project.org) for Windows x64 and extract the folder to a new folder called `thirdparty`. In other words, there should be a folder `S:\thirdparty\icu4c-64_2-Win64-MSVC2017` with the ICU.
5656
1. Add the `bin64` folder to your `Path` environment variable.
5757

5858
```cmd
59-
PATH S:\icu\bin64;%PATH%
59+
PATH S:\thirdparty\icu4c-64_2-Win64-MSVC2017\bin64;%PATH%
6060
```
6161

6262
## 4. Fetch SQLite3

branches/rxwei-patch-1/include/swift/ABI/Metadata.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,6 +2485,12 @@ struct TargetContextDescriptor {
24852485
? genericContext->getGenericContextHeader().NumParams
24862486
: 0;
24872487
}
2488+
2489+
#ifndef NDEBUG
2490+
LLVM_ATTRIBUTE_DEPRECATED(void dump() const,
2491+
"only for use in the debugger");
2492+
#endif
2493+
24882494
private:
24892495
TargetContextDescriptor(const TargetContextDescriptor &) = delete;
24902496
TargetContextDescriptor(TargetContextDescriptor &&) = delete;
@@ -3649,11 +3655,6 @@ class TargetTypeContextDescriptor
36493655
return cd->getKind() >= ContextDescriptorKind::Type_First
36503656
&& cd->getKind() <= ContextDescriptorKind::Type_Last;
36513657
}
3652-
3653-
#ifndef NDEBUG
3654-
LLVM_ATTRIBUTE_DEPRECATED(void dump() const,
3655-
"Only meant for use in the debugger");
3656-
#endif
36573658
};
36583659

36593660
using TypeContextDescriptor = TargetTypeContextDescriptor<InProcess>;

branches/rxwei-patch-1/include/swift/Basic/LangOptions.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ namespace swift {
147147
/// configuration options.
148148
bool EnableObjCInterop = true;
149149

150+
/// Enable C++ interop code generation and build configuration
151+
/// options. Disabled by default because there is no way to control the
152+
/// language mode of clang on a per-header or even per-module basis. Also
153+
/// disabled because it is not complete.
154+
bool EnableCXXInterop = false;
155+
150156
/// On Darwin platforms, use the pre-stable ABI's mark bit for Swift
151157
/// classes instead of the stable ABI's bit. This is needed when
152158
/// targeting OSes prior to macOS 10.14.4 and iOS 12.2, where

branches/rxwei-patch-1/include/swift/Option/FrontendOptions.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,11 @@ def emit_sorted_sil : Flag<["-"], "emit-sorted-sil">,
500500
def emit_syntax : Flag<["-"], "emit-syntax">,
501501
HelpText<"Parse input file(s) and emit the Syntax tree(s) as JSON">, ModeOpt;
502502

503+
def enable_cxx_interop :
504+
Flag<["-"], "enable-cxx-interop">,
505+
HelpText<"Enable C++ interop code generation and config directives">,
506+
Flags<[FrontendOption, HelpHidden]>;
507+
503508
def use_malloc : Flag<["-"], "use-malloc">,
504509
HelpText<"Allocate internal data structures using malloc "
505510
"(for memory debugging)">;

branches/rxwei-patch-1/include/swift/Option/Options.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ def serialize_diagnostics_path_EQ: Joined<["-"], "serialize-diagnostics-path=">,
303303
def color_diagnostics : Flag<["-"], "color-diagnostics">,
304304
Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
305305
HelpText<"Print diagnostics in color">;
306+
def no_color_diagnostics : Flag<["-"], "no-color-diagnostics">,
307+
Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
308+
HelpText<"Do not print diagnostics in color">;
306309

307310
def module_cache_path : Separate<["-"], "module-cache-path">,
308311
Flags<[FrontendOption, DoesNotAffectIncrementalBuild, ArgumentIsPath]>,

branches/rxwei-patch-1/lib/AST/Attr.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,17 @@ void DeclAttributes::print(ASTPrinter &Printer, const PrintOptions &Options,
349349
AttributeVector attributes;
350350
AttributeVector modifiers;
351351

352+
CustomAttr *FuncBuilderAttr = nullptr;
353+
if (auto *VD = dyn_cast_or_null<ValueDecl>(D)) {
354+
FuncBuilderAttr = VD->getAttachedFunctionBuilder();
355+
}
352356
for (auto DA : llvm::reverse(FlattenedAttrs)) {
357+
// Always print function builder attribute.
358+
bool isFunctionBuilderAttr = DA == FuncBuilderAttr;
353359
if (!Options.PrintImplicitAttrs && DA->isImplicit())
354360
continue;
355361
if (!Options.PrintUserInaccessibleAttrs &&
362+
!isFunctionBuilderAttr &&
356363
DeclAttribute::isUserInaccessible(DA->getKind()))
357364
continue;
358365
if (Options.excludeAttrKind(DA->getKind()))

branches/rxwei-patch-1/lib/ClangImporter/ClangImporter.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,11 @@ getNormalInvocationArguments(std::vector<std::string> &invocationArgStrs,
498498
"-Werror=non-modular-include-in-framework-module");
499499

500500
if (LangOpts.EnableObjCInterop) {
501-
invocationArgStrs.insert(invocationArgStrs.end(),
502-
{"-x", "objective-c", "-std=gnu11", "-fobjc-arc"});
501+
bool EnableCXXInterop = LangOpts.EnableCXXInterop;
502+
invocationArgStrs.insert(
503+
invocationArgStrs.end(),
504+
{"-x", EnableCXXInterop ? "objective-c++" : "objective-c",
505+
EnableCXXInterop ? "-std=gnu++17" : "-std=gnu11", "-fobjc-arc"});
503506
// TODO: Investigate whether 7.0 is a suitable default version.
504507
if (!triple.isOSDarwin())
505508
invocationArgStrs.insert(invocationArgStrs.end(),
@@ -518,7 +521,10 @@ getNormalInvocationArguments(std::vector<std::string> &invocationArgStrs,
518521
});
519522

520523
} else {
521-
invocationArgStrs.insert(invocationArgStrs.end(), {"-x", "c", "-std=gnu11"});
524+
bool EnableCXXInterop = LangOpts.EnableCXXInterop;
525+
invocationArgStrs.insert(invocationArgStrs.end(),
526+
{"-x", EnableCXXInterop ? "c++" : "c",
527+
EnableCXXInterop ? "-std=gnu++17" : "-std=gnu11"});
522528
}
523529

524530
// Set C language options.

branches/rxwei-patch-1/lib/ClangImporter/ImportDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8399,7 +8399,7 @@ bool ClangImporter::Implementation::addMemberAndAlternatesToExtension(
83998399
// Quickly check the context and bail out if it obviously doesn't
84008400
// belong here.
84018401
if (auto *importDC = newName.getEffectiveContext().getAsDeclContext())
8402-
if (importDC->isTranslationUnit())
8402+
if (importDC->isFileContext())
84038403
return true;
84048404

84058405
// Then try to import the decl under the specified name.

branches/rxwei-patch-1/lib/ClangImporter/ImportName.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,8 +1404,8 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D,
14041404
case clang::DeclarationName::CXXOperatorName:
14051405
case clang::DeclarationName::CXXUsingDirective:
14061406
case clang::DeclarationName::CXXDeductionGuideName:
1407-
// Handling these is part of C++ interoperability.
1408-
llvm_unreachable("unhandled C++ interoperability");
1407+
// TODO: Handling these is part of C++ interoperability.
1408+
return ImportedName();
14091409

14101410
case clang::DeclarationName::Identifier:
14111411
// Map the identifier.

branches/rxwei-patch-1/lib/ClangImporter/SwiftLookupTable.cpp

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ class SwiftLookupTableWriter : public clang::ModuleFileExtensionWriter {
8181
llvm::BitstreamWriter &stream) override;
8282

8383
void populateTable(SwiftLookupTable &table, NameImporter &);
84+
85+
void populateTableWithDecl(SwiftLookupTable &table,
86+
NameImporter &nameImporter, clang::Decl *decl);
8487
};
8588

8689
/// Module file extension reader for the Swift lookup tables.
@@ -1793,21 +1796,35 @@ void importer::finalizeLookupTable(SwiftLookupTable &table,
17931796
}
17941797
}
17951798

1799+
void SwiftLookupTableWriter::populateTableWithDecl(SwiftLookupTable &table,
1800+
NameImporter &nameImporter,
1801+
clang::Decl *decl) {
1802+
// Skip anything from an AST file.
1803+
if (decl->isFromASTFile())
1804+
return;
1805+
1806+
// Iterate into extern "C" {} type declarations.
1807+
if (auto linkageDecl = dyn_cast<clang::LinkageSpecDecl>(decl)) {
1808+
for (auto *decl : linkageDecl->noload_decls()) {
1809+
populateTableWithDecl(table, nameImporter, decl);
1810+
}
1811+
return;
1812+
}
1813+
1814+
// Skip non-named declarations.
1815+
auto named = dyn_cast<clang::NamedDecl>(decl);
1816+
if (!named)
1817+
return;
1818+
1819+
// Add this entry to the lookup table.
1820+
addEntryToLookupTable(table, named, nameImporter);
1821+
}
1822+
17961823
void SwiftLookupTableWriter::populateTable(SwiftLookupTable &table,
17971824
NameImporter &nameImporter) {
17981825
auto &sema = nameImporter.getClangSema();
17991826
for (auto decl : sema.Context.getTranslationUnitDecl()->noload_decls()) {
1800-
// Skip anything from an AST file.
1801-
if (decl->isFromASTFile())
1802-
continue;
1803-
1804-
// Skip non-named declarations.
1805-
auto named = dyn_cast<clang::NamedDecl>(decl);
1806-
if (!named)
1807-
continue;
1808-
1809-
// Add this entry to the lookup table.
1810-
addEntryToLookupTable(table, named, nameImporter);
1827+
populateTableWithDecl(table, nameImporter, decl);
18111828
}
18121829

18131830
// Add macros to the lookup table.

branches/rxwei-patch-1/lib/ClangImporter/SwiftLookupTable.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ class EffectiveClangContext {
196196
DC = omDecl->getCanonicalDecl();
197197
} else if (auto fDecl = dyn_cast<clang::FunctionDecl>(dc)) {
198198
DC = fDecl->getCanonicalDecl();
199+
} else if (auto nsDecl = dyn_cast<clang::NamespaceDecl>(dc)) {
200+
DC = nsDecl->getCanonicalDecl();
199201
} else {
200202
assert(isa<clang::TranslationUnitDecl>(dc) ||
201203
isa<clang::ObjCContainerDecl>(dc) &&

branches/rxwei-patch-1/lib/Driver/ToolChains.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -172,12 +172,18 @@ static void addCommonFrontendArgs(const ToolChain &TC, const OutputInfo &OI,
172172
arguments.push_back(inputArgs.MakeArgString(OI.SDKPath));
173173
}
174174

175+
if (llvm::sys::Process::StandardErrHasColors()) {
176+
arguments.push_back("-color-diagnostics");
177+
}
178+
175179
inputArgs.AddAllArgs(arguments, options::OPT_I);
176180
inputArgs.AddAllArgs(arguments, options::OPT_F, options::OPT_Fsystem);
177181

178182
inputArgs.AddLastArg(arguments, options::OPT_AssertConfig);
179183
inputArgs.AddLastArg(arguments, options::OPT_autolink_force_load);
180-
inputArgs.AddLastArg(arguments, options::OPT_color_diagnostics);
184+
inputArgs.AddLastArg(arguments,
185+
options::OPT_color_diagnostics,
186+
options::OPT_no_color_diagnostics);
181187
inputArgs.AddLastArg(arguments, options::OPT_fixit_all);
182188
inputArgs.AddLastArg(arguments,
183189
options::OPT_warn_swift3_objc_inference_minimal,
@@ -188,6 +194,7 @@ static void addCommonFrontendArgs(const ToolChain &TC, const OutputInfo &OI,
188194
inputArgs.AddLastArg(arguments, options::OPT_enable_library_evolution);
189195
inputArgs.AddLastArg(arguments, options::OPT_enable_testing);
190196
inputArgs.AddLastArg(arguments, options::OPT_enable_private_imports);
197+
inputArgs.AddLastArg(arguments, options::OPT_enable_cxx_interop);
191198
inputArgs.AddLastArg(arguments, options::OPT_g_Group);
192199
inputArgs.AddLastArg(arguments, options::OPT_debug_info_format);
193200
inputArgs.AddLastArg(arguments, options::OPT_import_underlying_module);
@@ -260,9 +267,6 @@ static void addCommonFrontendArgs(const ToolChain &TC, const OutputInfo &OI,
260267
// Pass through any subsystem flags.
261268
inputArgs.AddAllArgs(arguments, options::OPT_Xllvm);
262269
inputArgs.AddAllArgs(arguments, options::OPT_Xcc);
263-
264-
if (llvm::sys::Process::StandardErrHasColors())
265-
arguments.push_back("-color-diagnostics");
266270
}
267271

268272
static void addRuntimeLibraryFlags(const OutputInfo &OI,

branches/rxwei-patch-1/lib/Frontend/CompilerInvocation.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -26,6 +26,7 @@
2626
#include "llvm/Support/FileSystem.h"
2727
#include "llvm/Support/LineIterator.h"
2828
#include "llvm/Support/Path.h"
29+
#include "llvm/Support/Process.h"
2930

3031
using namespace swift;
3132
using namespace llvm::opt;
@@ -498,6 +499,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
498499
TargetArg = A->getValue();
499500
}
500501

502+
Opts.EnableCXXInterop |= Args.hasArg(OPT_enable_cxx_interop);
501503
Opts.EnableObjCInterop =
502504
Args.hasFlag(OPT_enable_objc_interop, OPT_disable_objc_interop,
503505
Target.isOSDarwin());
@@ -659,7 +661,10 @@ static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
659661
Opts.SkipDiagnosticPasses |= Args.hasArg(OPT_disable_diagnostic_passes);
660662
Opts.ShowDiagnosticsAfterFatalError |=
661663
Args.hasArg(OPT_show_diagnostics_after_fatal);
662-
Opts.UseColor |= Args.hasArg(OPT_color_diagnostics);
664+
Opts.UseColor |=
665+
Args.hasFlag(OPT_color_diagnostics,
666+
OPT_no_color_diagnostics,
667+
/*Default=*/llvm::sys::Process::StandardErrHasColors());
663668
Opts.FixitCodeForAllDiagnostics |= Args.hasArg(OPT_fixit_all);
664669
Opts.SuppressWarnings |= Args.hasArg(OPT_suppress_warnings);
665670
Opts.WarningsAsErrors |= Args.hasArg(OPT_warnings_as_errors);

branches/rxwei-patch-1/lib/Frontend/PrintingDiagnosticConsumer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -112,9 +112,9 @@ void PrintingDiagnosticConsumer::handleDiagnostic(
112112
llvm::raw_svector_ostream Out(Text);
113113
DiagnosticEngine::formatDiagnosticText(Out, FormatString, FormatArgs);
114114
}
115-
115+
116116
auto Msg = SM.GetMessage(Loc, SMKind, Text, Ranges, FixIts);
117-
rawSM.PrintMessage(out, Msg);
117+
rawSM.PrintMessage(out, Msg, ForceColors);
118118
}
119119

120120
llvm::SMDiagnostic

branches/rxwei-patch-1/stdlib/public/SwiftShims/GlobalObjects.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
#include "Visibility.h"
2525

2626
#ifdef __cplusplus
27-
namespace swift { extern "C" {
27+
#ifndef __swift__
28+
namespace swift {
29+
#endif
30+
extern "C" {
2831
#endif
2932

3033
struct _SwiftArrayBodyStorage {
@@ -102,7 +105,10 @@ static_assert(
102105
4 * sizeof(__swift_intptr_t) + sizeof(__swift_int64_t),
103106
"_SwiftSetBodyStorage has unexpected size");
104107

105-
}} // extern "C", namespace swift
108+
} // extern "C"
109+
#ifndef __swift__
110+
} // namespace swift
111+
#endif
106112
#endif
107113

108114
#endif

branches/rxwei-patch-1/stdlib/public/SwiftShims/HeapObject.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#define SWIFT_ABI_HEAP_OBJECT_HEADER_SIZE_64 16
2121
#define SWIFT_ABI_HEAP_OBJECT_HEADER_SIZE_32 8
2222

23-
#ifdef __cplusplus
23+
#ifndef __swift__
2424
#include <type_traits>
2525
#include "swift/Basic/type_traits.h"
2626

@@ -48,7 +48,7 @@ struct HeapObject {
4848

4949
SWIFT_HEAPOBJECT_NON_OBJC_MEMBERS;
5050

51-
#ifdef __cplusplus
51+
#ifndef __swift__
5252
HeapObject() = default;
5353

5454
// Initialize a HeapObject header as appropriate for a newly-allocated object.
@@ -68,7 +68,7 @@ struct HeapObject {
6868
void dump() const LLVM_ATTRIBUTE_USED;
6969
#endif
7070

71-
#endif // __cplusplus
71+
#endif // __swift__
7272
};
7373

7474
#ifdef __cplusplus
@@ -92,7 +92,7 @@ __swift_size_t swift_weakRetainCount(HeapObject *obj);
9292
} // extern "C"
9393
#endif
9494

95-
#ifdef __cplusplus
95+
#ifndef __swift__
9696
static_assert(std::is_trivially_destructible<HeapObject>::value,
9797
"HeapObject must be trivially destructible");
9898

branches/rxwei-patch-1/stdlib/public/SwiftShims/RefCount.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ typedef struct {
2121
__swift_uintptr_t refCounts SWIFT_ATTRIBUTE_UNAVAILABLE;
2222
} InlineRefCountsPlaceholder;
2323

24-
#if !defined(__cplusplus)
24+
#if defined(__swift__)
2525

2626
typedef InlineRefCountsPlaceholder InlineRefCounts;
2727

branches/rxwei-patch-1/stdlib/public/SwiftShims/SwiftStddef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ typedef __SIZE_TYPE__ __swift_size_t;
2929
#endif
3030

3131
// This selects the signed equivalent of the unsigned type chosen for size_t.
32-
#if __STDC_VERSION__-0 >= 201112l
32+
#if __STDC_VERSION__-0 >= 201112l || defined(__swift__)
3333
typedef __typeof__(_Generic((__swift_size_t)0, \
3434
unsigned long long int : (long long int)0, \
3535
unsigned long int : (long int)0, \

0 commit comments

Comments
 (0)