Skip to content

Commit

Permalink
Merge pull request #695 from swiftwasm/master
Browse files Browse the repository at this point in the history
[pull] swiftwasm from master
  • Loading branch information
pull[bot] authored Apr 18, 2020
2 parents 6cc409e + dc42259 commit aa4f904
Show file tree
Hide file tree
Showing 139 changed files with 2,726 additions and 1,330 deletions.
9 changes: 9 additions & 0 deletions include/swift/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ namespace clang {
class ObjCInterfaceDecl;
}

namespace llvm {
class LLVMContext;
}

namespace swift {
class AbstractFunctionDecl;
class ASTContext;
Expand Down Expand Up @@ -949,6 +953,11 @@ class ASTContext final {
GenericSignatureBuilder &&builder);
friend class GenericSignatureBuilder;

private:
friend class IntrinsicInfo;
/// Retrieve an LLVMContext that is used for scratch space for intrinsic lookup.
llvm::LLVMContext &getIntrinsicScratchContext() const;

public:
/// Retrieve or create the stored generic signature builder for the given
/// canonical generic signature and module.
Expand Down
2 changes: 2 additions & 0 deletions include/swift/AST/ASTMangler.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ class ASTMangler : public Mangler {

std::string mangleOpaqueTypeDecl(const OpaqueTypeDecl *decl);

std::string mangleOpaqueTypeDecl(const ValueDecl *decl);

enum SpecialContext {
ObjCContext,
ClangImporterContext,
Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/AutoDiff.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ struct SILAutoDiffIndices {

std::string mangle() const {
std::string result = "src_" + llvm::utostr(source) + "_wrt_";
interleave(
llvm::interleave(
parameters->getIndices(),
[&](unsigned idx) { result += llvm::utostr(idx); },
[&] { result += '_'; });
Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/Builtins.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class IntrinsicInfo {
public:
llvm::Intrinsic::ID ID;
SmallVector<Type, 4> Types;
bool hasAttribute(llvm::Attribute::AttrKind Kind) const;
const llvm::AttributeList &getOrCreateAttributes(ASTContext &Ctx) const;
};

/// Turn a string like "release" into the LLVM enum.
Expand Down
70 changes: 70 additions & 0 deletions include/swift/AST/DefineDiagnosticMacros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//===--- DefineDiagnosticMacros.h - Shared Diagnostic Macros ----*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2020 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file defines macros shared across diagnostic definition files.
//
//===----------------------------------------------------------------------===//

// Define macros
#ifdef DEFINE_DIAGNOSTIC_MACROS

#if !(defined(DIAG) || (defined(ERROR) && defined(WARNING) && defined(NOTE) && \
defined(REMARK)))
#error Must define either DIAG or the set {ERROR,WARNING,NOTE,REMARK}
#endif

#ifndef ERROR
#define ERROR(ID, Options, Text, Signature) \
DIAG(ERROR, ID, Options, Text, Signature)
#endif

#ifndef WARNING
#define WARNING(ID, Options, Text, Signature) \
DIAG(WARNING, ID, Options, Text, Signature)
#endif

#ifndef NOTE
#define NOTE(ID, Options, Text, Signature) \
DIAG(NOTE, ID, Options, Text, Signature)
#endif

#ifndef REMARK
#define REMARK(ID, Options, Text, Signature) \
DIAG(REMARK, ID, Options, Text, Signature)
#endif

#ifndef FIXIT
#define FIXIT(ID, Text, Signature)
#endif

#undef DEFINE_DIAGNOSTIC_MACROS
#endif

// Undefine macros
#ifdef UNDEFINE_DIAGNOSTIC_MACROS

#ifndef DIAG_NO_UNDEF

#if defined(DIAG)
#undef DIAG
#endif

#undef REMARK
#undef NOTE
#undef WARNING
#undef ERROR
#undef FIXIT

#endif

#undef UNDEFINE_DIAGNOSTIC_MACROS
#endif
39 changes: 4 additions & 35 deletions include/swift/AST/DiagnosticsAll.def
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,8 @@
//
//===----------------------------------------------------------------------===//

#if !(defined(DIAG) || (defined(ERROR) && defined(WARNING) && defined(NOTE)))
# error Must define either DIAG or the set {ERROR,WARNING,NOTE}
#endif

#ifndef ERROR
# define ERROR(ID,Options,Text,Signature) \
DIAG(ERROR,ID,Options,Text,Signature)
#endif

#ifndef WARNING
# define WARNING(ID,Options,Text,Signature) \
DIAG(WARNING,ID,Options,Text,Signature)
#endif

#ifndef NOTE
# define NOTE(ID,Options,Text,Signature) \
DIAG(NOTE,ID,Options,Text,Signature)
#endif

#ifndef REMARK
# define REMARK(ID,Options,Text,Signature) \
DIAG(REMARK,ID,Options,Text,Signature)
#endif

#ifndef FIXIT
# define FIXIT(ID, Text, Signature)
#endif
#define DEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"

#define DIAG_NO_UNDEF

Expand All @@ -57,11 +32,5 @@

#undef DIAG_NO_UNDEF

#if defined(DIAG)
# undef DIAG
#endif
#undef NOTE
#undef WARNING
#undef ERROR
#undef REMARK
#undef FIXIT
#define UNDEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"
36 changes: 4 additions & 32 deletions include/swift/AST/DiagnosticsClangImporter.def
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,8 @@
//
//===----------------------------------------------------------------------===//

#if !(defined(DIAG) || (defined(ERROR) && defined(WARNING) && defined(NOTE) && defined(REMARK)))
# error Must define either DIAG or the set {ERROR,WARNING,NOTE,REMARK}
#endif

#ifndef ERROR
# define ERROR(ID,Options,Text,Signature) \
DIAG(ERROR,ID,Options,Text,Signature)
#endif

#ifndef WARNING
# define WARNING(ID,Options,Text,Signature) \
DIAG(WARNING,ID,Options,Text,Signature)
#endif

#ifndef NOTE
# define NOTE(ID,Options,Text,Signature) \
DIAG(NOTE,ID,Options,Text,Signature)
#endif

#ifndef REMARK
# define REMARK(ID,Options,Text,Signature) \
DIAG(REMARK,ID,Options,Text,Signature)
#endif
#define DEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"

WARNING(warning_from_clang,none,
"%0", (StringRef))
Expand Down Expand Up @@ -101,12 +80,5 @@ WARNING(implicit_bridging_header_imported_from_module,none,
"is deprecated and will be removed in a later version of Swift",
(StringRef, Identifier))

#ifndef DIAG_NO_UNDEF
# if defined(DIAG)
# undef DIAG
# endif
# undef NOTE
# undef WARNING
# undef ERROR
# undef REMARK
#endif
#define UNDEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"
40 changes: 4 additions & 36 deletions include/swift/AST/DiagnosticsCommon.def
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,8 @@
//
//===----------------------------------------------------------------------===//

#if !(defined(DIAG) || (defined(ERROR) && defined(WARNING) && defined(NOTE) && defined(REMARK)))
# error Must define either DIAG or the set {ERROR,WARNING,NOTE,REMARK}
#endif

#ifndef ERROR
# define ERROR(ID,Options,Text,Signature) \
DIAG(ERROR,ID,Options,Text,Signature)
#endif

#ifndef WARNING
# define WARNING(ID,Options,Text,Signature) \
DIAG(WARNING,ID,Options,Text,Signature)
#endif

#ifndef NOTE
# define NOTE(ID,Options,Text,Signature) \
DIAG(NOTE,ID,Options,Text,Signature)
#endif

#ifndef REMARK
# define REMARK(ID,Options,Text,Signature) \
DIAG(REMARK,ID,Options,Text,Signature)
#endif

#ifndef FIXIT
# define FIXIT(ID, Text, Signature)
#endif
#define DEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"

ERROR(invalid_diagnostic,none,
"INTERNAL ERROR: this diagnostic should not be produced", ())
Expand Down Expand Up @@ -188,12 +163,5 @@ WARNING(cross_imported_by_both_modules, none,
"please report this bug to the maintainers of these modules",
(Identifier, Identifier, Identifier))

#ifndef DIAG_NO_UNDEF
# if defined(DIAG)
# undef DIAG
# endif
# undef NOTE
# undef WARNING
# undef ERROR
# undef FIXIT
#endif
#define UNDEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"
35 changes: 4 additions & 31 deletions include/swift/AST/DiagnosticsDriver.def
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,8 @@
//
//===----------------------------------------------------------------------===//

#if !(defined(DIAG) || (defined(ERROR) && defined(WARNING) && defined(NOTE)))
# error Must define either DIAG or the set {ERROR,WARNING,NOTE}
#endif

#ifndef ERROR
# define ERROR(ID,Options,Text,Signature) \
DIAG(ERROR,ID,Options,Text,Signature)
#endif

#ifndef WARNING
# define WARNING(ID,Options,Text,Signature) \
DIAG(WARNING,ID,Options,Text,Signature)
#endif

#ifndef NOTE
# define NOTE(ID,Options,Text,Signature) \
DIAG(NOTE,ID,Options,Text,Signature)
#endif

#ifndef REMARK
# define REMARK(ID,Options,Text,Signature) \
DIAG(REMARK,ID,Options,Text,Signature)
#endif
#define DEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"

WARNING(warning_parallel_execution_not_supported,none,
"parallel execution not supported; falling back to serial execution",
Expand Down Expand Up @@ -211,11 +190,5 @@ WARNING(warn_drv_darwin_sdk_invalid_settings, none,
"SDK settings were ignored because 'SDKSettings.json' could not be parsed",
())

#ifndef DIAG_NO_UNDEF
# if defined(DIAG)
# undef DIAG
# endif
# undef NOTE
# undef WARNING
# undef ERROR
#endif
#define UNDEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"
41 changes: 8 additions & 33 deletions include/swift/AST/DiagnosticsFrontend.def
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,8 @@
//
//===----------------------------------------------------------------------===//

#if !(defined(DIAG) || (defined(ERROR) && defined(WARNING) && defined(NOTE) && \
defined(REMARK)))
# error Must define either DIAG or the set {ERROR,WARNING,NOTE,REMARK}
#endif

#ifndef ERROR
# define ERROR(ID,Options,Text,Signature) \
DIAG(ERROR,ID,Options,Text,Signature)
#endif

#ifndef WARNING
# define WARNING(ID,Options,Text,Signature) \
DIAG(WARNING,ID,Options,Text,Signature)
#endif

#ifndef NOTE
# define NOTE(ID,Options,Text,Signature) \
DIAG(NOTE,ID,Options,Text,Signature)
#endif

#ifndef REMARK
# define REMARK(ID,Options,Text,Signature) \
DIAG(REMARK,ID,Options,Text,Signature)
#endif
#define DEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"

WARNING(warning_no_such_sdk,none,
"no such SDK: '%0'", (StringRef))
Expand All @@ -61,6 +39,10 @@ ERROR(error_unsupported_target_arch, none,
ERROR(error_unsupported_opt_for_target, none,
"unsupported option '%0' for target '%1'", (StringRef, StringRef))

WARNING(warning_inferred_simulator_target,none,
"inferring simulator environment for target '%0'; "
"use '-target %1' instead", (StringRef, StringRef))

ERROR(error_argument_not_allowed_with, none,
"argument '%0' is not allowed with '%1'", (StringRef, StringRef))

Expand Down Expand Up @@ -407,12 +389,5 @@ ERROR(expectation_missing_opening_braces,none,
ERROR(expectation_missing_closing_braces,none,
"didn't find '}}' to match '{{' in expectation", ())

#ifndef DIAG_NO_UNDEF
# if defined(DIAG)
# undef DIAG
# endif
# undef REMARK
# undef NOTE
# undef WARNING
# undef ERROR
#endif
#define UNDEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"
Loading

0 comments on commit aa4f904

Please sign in to comment.