Skip to content

Commit 250082d

Browse files
committed
[NFC] Reformat all the LLVMs
Reformatting everything now that we have `llvm` namespaces. I've separated this from the main commit to help manage merge-conflicts and for making it a bit easier to read the mega-patch.
1 parent f3ff561 commit 250082d

File tree

416 files changed

+3776
-3733
lines changed

Some content is hidden

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

416 files changed

+3776
-3733
lines changed

include/swift/APIDigester/ModuleAnalyzerNodes.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ class SDKContext {
180180
std::vector<BreakingAttributeInfo> BreakingAttrs;
181181
// The common version of two ABI/API descriptors under comparison.
182182
llvm::Optional<uint8_t> CommonVersion;
183+
183184
public:
184185
// Define the set of known identifiers.
185186
#define IDENTIFIER_WITH_NAME(Name, IdStr) StringRef Id_##Name = IdStr;
@@ -586,11 +587,11 @@ class SDKNodeDeclType: public SDKNodeDecl {
586587
return InheritsConvenienceInitializers;
587588
};
588589

589-
llvm::Optional<SDKNodeDeclType*> getSuperclass() const;
590+
llvm::Optional<SDKNodeDeclType *> getSuperclass() const;
590591

591592
/// Finding the node through all children, including the inherited ones,
592593
/// whose printed name matches with the given name.
593-
llvm::Optional<SDKNodeDecl*> lookupChildByPrintedName(StringRef Name) const;
594+
llvm::Optional<SDKNodeDecl *> lookupChildByPrintedName(StringRef Name) const;
594595
SDKNodeType *getRawValueType() const;
595596
bool isConformingTo(KnownProtocolKind Kind) const;
596597
void jsonize(json::Output &out) override;

include/swift/AST/ASTContext.h

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -803,9 +803,9 @@ class ASTContext final {
803803
///
804804
/// SIL analog of \c ASTContext::getClangFunctionType .
805805
const clang::Type *
806-
getCanonicalClangFunctionType(
807-
ArrayRef<SILParameterInfo> params, llvm::Optional<SILResultInfo> result,
808-
SILFunctionType::Representation trueRep);
806+
getCanonicalClangFunctionType(ArrayRef<SILParameterInfo> params,
807+
llvm::Optional<SILResultInfo> result,
808+
SILFunctionType::Representation trueRep);
809809

810810
/// Instantiates "Impl.Converter" if needed, then translate Swift generic
811811
/// substitutions to equivalent C++ types using \p templateParams and \p
@@ -1031,25 +1031,24 @@ class ASTContext final {
10311031

10321032
/// Retrieve the module dependencies for the module with the given name.
10331033
///
1034-
llvm::Optional<const ModuleDependencyInfo*> getModuleDependencies(
1035-
StringRef moduleName,
1036-
ModuleDependenciesCache &cache,
1034+
llvm::Optional<const ModuleDependencyInfo *> getModuleDependencies(
1035+
StringRef moduleName, ModuleDependenciesCache &cache,
10371036
InterfaceSubContextDelegate &delegate,
1038-
bool optionalDependencyLookup = false,
1039-
bool isTestableImport = false,
1040-
llvm::Optional<std::pair<std::string, swift::ModuleDependencyKind>> dependencyOf = llvm::None);
1037+
bool optionalDependencyLookup = false, bool isTestableImport = false,
1038+
llvm::Optional<std::pair<std::string, swift::ModuleDependencyKind>>
1039+
dependencyOf = llvm::None);
10411040

10421041
/// Retrieve the module dependencies for the Clang module with the given name.
1043-
llvm::Optional<const ModuleDependencyInfo*> getClangModuleDependencies(
1044-
StringRef moduleName,
1045-
ModuleDependenciesCache &cache,
1046-
InterfaceSubContextDelegate &delegate);
1042+
llvm::Optional<const ModuleDependencyInfo *>
1043+
getClangModuleDependencies(StringRef moduleName,
1044+
ModuleDependenciesCache &cache,
1045+
InterfaceSubContextDelegate &delegate);
10471046

10481047
/// Retrieve the module dependencies for the Swift module with the given name.
1049-
llvm::Optional<const ModuleDependencyInfo*> getSwiftModuleDependencies(
1050-
StringRef moduleName,
1051-
ModuleDependenciesCache &cache,
1052-
InterfaceSubContextDelegate &delegate);
1048+
llvm::Optional<const ModuleDependencyInfo *>
1049+
getSwiftModuleDependencies(StringRef moduleName,
1050+
ModuleDependenciesCache &cache,
1051+
InterfaceSubContextDelegate &delegate);
10531052

10541053
/// Compute the extra implicit framework search paths on Apple platforms:
10551054
/// $SDKROOT/System/Library/Frameworks/ and $SDKROOT/Library/Frameworks/.

include/swift/AST/ASTDemangler.h

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
#ifndef SWIFT_AST_ASTDEMANGLER_H
2323
#define SWIFT_AST_ASTDEMANGLER_H
2424

25-
#include "llvm/ADT/ArrayRef.h"
26-
#include "llvm/ADT/StringRef.h"
27-
#include "llvm/ADT/Optional.h"
2825
#include "swift/AST/Types.h"
2926
#include "swift/Demangling/Demangler.h"
3027
#include "swift/Demangling/NamespaceMacros.h"
3128
#include "swift/Demangling/TypeDecoder.h"
29+
#include "llvm/ADT/ArrayRef.h"
30+
#include "llvm/ADT/Optional.h"
31+
#include "llvm/ADT/StringRef.h"
3232

3333
namespace swift {
3434

@@ -124,11 +124,11 @@ class ASTBuilder {
124124
FunctionMetadataDifferentiabilityKind diffKind, Type globalActor);
125125

126126
Type createImplFunctionType(
127-
Demangle::ImplParameterConvention calleeConvention,
128-
ArrayRef<Demangle::ImplFunctionParam<Type>> params,
129-
ArrayRef<Demangle::ImplFunctionResult<Type>> results,
130-
llvm::Optional<Demangle::ImplFunctionResult<Type>> errorResult,
131-
ImplFunctionTypeFlags flags);
127+
Demangle::ImplParameterConvention calleeConvention,
128+
ArrayRef<Demangle::ImplFunctionParam<Type>> params,
129+
ArrayRef<Demangle::ImplFunctionResult<Type>> results,
130+
llvm::Optional<Demangle::ImplFunctionResult<Type>> errorResult,
131+
ImplFunctionTypeFlags flags);
132132

133133
Type createProtocolCompositionType(ArrayRef<ProtocolDecl *> protocols,
134134
Type superclass,
@@ -143,11 +143,13 @@ class ASTBuilder {
143143
Type createSymbolicExtendedExistentialType(NodePointer shapeNode,
144144
ArrayRef<Type> genArgs);
145145

146-
Type createExistentialMetatypeType(Type instance,
147-
llvm::Optional<Demangle::ImplMetatypeRepresentation> repr=llvm::None);
146+
Type createExistentialMetatypeType(
147+
Type instance,
148+
llvm::Optional<Demangle::ImplMetatypeRepresentation> repr = llvm::None);
148149

149-
Type createMetatypeType(Type instance,
150-
llvm::Optional<Demangle::ImplMetatypeRepresentation> repr=llvm::None);
150+
Type createMetatypeType(
151+
Type instance,
152+
llvm::Optional<Demangle::ImplMetatypeRepresentation> repr = llvm::None);
151153

152154
Type createGenericTypeParameterType(unsigned depth, unsigned index);
153155

@@ -223,8 +225,7 @@ class ASTBuilder {
223225
SynthesizedByImporter
224226
};
225227

226-
llvm::Optional<ForeignModuleKind>
227-
getForeignModuleKind(NodePointer node);
228+
llvm::Optional<ForeignModuleKind> getForeignModuleKind(NodePointer node);
228229

229230
GenericTypeDecl *findTypeDecl(DeclContext *dc,
230231
Identifier name,

include/swift/AST/ASTMangler.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
#ifndef SWIFT_AST_ASTMANGLER_H
1414
#define SWIFT_AST_ASTMANGLER_H
1515

16-
#include "swift/Basic/Mangler.h"
17-
#include "swift/AST/Types.h"
1816
#include "swift/AST/Decl.h"
1917
#include "swift/AST/FreestandingMacroExpansion.h"
18+
#include "swift/AST/Types.h"
19+
#include "swift/Basic/Mangler.h"
2020
#include "swift/Basic/TaggedUnion.h"
2121
#include "llvm/ADT/Optional.h"
2222

@@ -252,12 +252,10 @@ class ASTMangler : public Mangler {
252252
///
253253
/// - If `predefined` is true, this mangles the symbol name of the completion handler
254254
/// predefined in the Swift runtime for the given type signature.
255-
std::string mangleObjCAsyncCompletionHandlerImpl(CanSILFunctionType BlockType,
256-
CanType ResultType,
257-
CanGenericSignature Sig,
258-
llvm::Optional<bool> FlagParamIsZeroOnError,
259-
bool predefined);
260-
255+
std::string mangleObjCAsyncCompletionHandlerImpl(
256+
CanSILFunctionType BlockType, CanType ResultType, CanGenericSignature Sig,
257+
llvm::Optional<bool> FlagParamIsZeroOnError, bool predefined);
258+
261259
/// Mangle the derivative function (JVP/VJP), or optionally its vtable entry
262260
/// thunk, for the given:
263261
/// - Mangled original function declaration.
@@ -381,7 +379,7 @@ class ASTMangler : public Mangler {
381379
ObjCContext,
382380
ClangImporterContext,
383381
};
384-
382+
385383
static llvm::Optional<SpecialContext>
386384
getSpecialManglingContext(const ValueDecl *decl, bool useObjCProtocolNames);
387385

include/swift/AST/ASTPrinter.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ class ASTPrinter {
133133
/// Called before printing of a declaration.
134134
///
135135
/// Callers should use callPrintDeclPre().
136-
virtual void printDeclPre(const Decl *D, llvm::Optional<BracketOptions> Bracket) {}
136+
virtual void printDeclPre(const Decl *D,
137+
llvm::Optional<BracketOptions> Bracket) {}
137138
/// Called before printing at the point which would be considered the location
138139
/// of the declaration (normally the name of the declaration).
139140
///
@@ -147,7 +148,8 @@ class ASTPrinter {
147148
/// Called after finishing printing of a declaration.
148149
///
149150
/// Callers should use callPrintDeclPost().
150-
virtual void printDeclPost(const Decl *D, llvm::Optional<BracketOptions> Bracket) {}
151+
virtual void printDeclPost(const Decl *D,
152+
llvm::Optional<BracketOptions> Bracket) {}
151153

152154
/// Called before printing the result type of the declaration. Printer can
153155
/// replace \p TL to customize the input.
@@ -174,15 +176,15 @@ class ASTPrinter {
174176
virtual void printModuleRef(ModuleEntity Mod, Identifier Name);
175177

176178
/// Called before printing a synthesized extension.
177-
virtual void printSynthesizedExtensionPre(const ExtensionDecl *ED,
178-
TypeOrExtensionDecl NTD,
179-
llvm::Optional<BracketOptions> Bracket) {}
179+
virtual void
180+
printSynthesizedExtensionPre(const ExtensionDecl *ED, TypeOrExtensionDecl NTD,
181+
llvm::Optional<BracketOptions> Bracket) {}
180182

181183
/// Called after printing a synthesized extension.
182-
virtual void printSynthesizedExtensionPost(const ExtensionDecl *ED,
183-
TypeOrExtensionDecl TargetDecl,
184-
llvm::Optional<BracketOptions> Bracket) {
185-
}
184+
virtual void
185+
printSynthesizedExtensionPost(const ExtensionDecl *ED,
186+
TypeOrExtensionDecl TargetDecl,
187+
llvm::Optional<BracketOptions> Bracket) {}
186188

187189
/// Called before printing a structured entity.
188190
///
@@ -307,7 +309,8 @@ class ASTPrinter {
307309
void callPrintDeclPre(const Decl *D, llvm::Optional<BracketOptions> Bracket);
308310

309311
/// Make a callback to printDeclPost(), performing any necessary bookkeeping.
310-
void callPrintDeclPost(const Decl *D, llvm::Optional<BracketOptions> Bracket) {
312+
void callPrintDeclPost(const Decl *D,
313+
llvm::Optional<BracketOptions> Bracket) {
311314
printDeclPost(D, Bracket);
312315
}
313316

include/swift/AST/ASTScope.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
#include "swift/Basic/LLVM.h"
3737
#include "swift/Basic/NullablePtr.h"
3838
#include "swift/Basic/SourceManager.h"
39+
#include "llvm/ADT/Optional.h"
3940
#include "llvm/ADT/PointerIntPair.h"
4041
#include "llvm/ADT/STLExtras.h"
4142
#include "llvm/ADT/SmallVector.h"
42-
#include "llvm/ADT/Optional.h"
4343

4444
/// In case there's a bug in the ASTScope lookup system, suggest that the user
4545
/// try disabling it.

include/swift/AST/ASTWalker.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@ struct ReferenceMetaData {
5353
/// When non-none, this is a custom attribute reference.
5454
llvm::Optional<std::pair<const CustomAttr *, Decl *>> CustomAttrRef;
5555

56-
ReferenceMetaData(
57-
SemaReferenceKind Kind, llvm::Optional<AccessKind> AccKind,
58-
bool isImplicit = false,
59-
llvm::Optional<std::pair<const CustomAttr *, Decl *>> customAttrRef
60-
= llvm::None
61-
) : Kind(Kind), AccKind(AccKind), isImplicit(isImplicit),
62-
CustomAttrRef(customAttrRef) {}
56+
ReferenceMetaData(SemaReferenceKind Kind, llvm::Optional<AccessKind> AccKind,
57+
bool isImplicit = false,
58+
llvm::Optional<std::pair<const CustomAttr *, Decl *>>
59+
customAttrRef = llvm::None)
60+
: Kind(Kind), AccKind(AccKind), isImplicit(isImplicit),
61+
CustomAttrRef(customAttrRef) {}
6362
};
6463

6564
/// Specifies how the initialization expression of a \c lazy variable should be

include/swift/AST/AbstractSourceFileDepGraphFactory.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include "swift/AST/Decl.h"
1717
#include "swift/AST/DeclContext.h"
1818
#include "swift/AST/FineGrainedDependencies.h"
19-
#include "llvm/Support/VirtualOutputBackend.h"
2019
#include "llvm/ADT/Optional.h"
20+
#include "llvm/Support/VirtualOutputBackend.h"
2121

2222
namespace swift {
2323
class DiagnosticEngine;
@@ -97,9 +97,9 @@ class AbstractSourceFileDepGraphFactory {
9797

9898
/// Add an external dependency node to the graph. If the provided fingerprint
9999
/// is not \c None, it is added to the def key.
100-
void addAnExternalDependency(const DependencyKey &def,
101-
const DependencyKey &use,
102-
llvm::Optional<Fingerprint> dependencyFingerprint);
100+
void
101+
addAnExternalDependency(const DependencyKey &def, const DependencyKey &use,
102+
llvm::Optional<Fingerprint> dependencyFingerprint);
103103

104104
static llvm::Optional<Fingerprint>
105105
getFingerprintIfAny(std::pair<const NominalTypeDecl *, const ValueDecl *>) {

include/swift/AST/AccessNotes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
#include "swift/AST/Identifier.h"
2222
#include "swift/AST/StorageImpl.h"
2323
#include "swift/Basic/NullablePtr.h"
24+
#include "llvm/ADT/Optional.h"
2425
#include "llvm/Support/Error.h"
2526
#include "llvm/Support/MemoryBuffer.h"
2627
#include "llvm/Support/raw_ostream.h"
27-
#include "llvm/ADT/Optional.h"
2828
#include <set>
2929
#include <string>
3030
#include <vector>

include/swift/AST/AccessScope.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
#include "swift/AST/AttrKind.h"
1717
#include "swift/AST/DeclContext.h"
1818
#include "swift/Basic/Debug.h"
19-
#include "llvm/ADT/PointerIntPair.h"
20-
#include "llvm/ADT/Optional.h"
2119
#include "llvm/ADT/None.h"
20+
#include "llvm/ADT/Optional.h"
21+
#include "llvm/ADT/PointerIntPair.h"
2222

2323
namespace swift {
2424

@@ -134,7 +134,8 @@ class AccessScope {
134134

135135
/// Returns the narrowest access scope if this and the specified access scope
136136
/// have common intersection, or None if scopes don't intersect.
137-
const llvm::Optional<AccessScope> intersectWith(AccessScope accessScope) const {
137+
const llvm::Optional<AccessScope>
138+
intersectWith(AccessScope accessScope) const {
138139
if (hasEqualDeclContextWith(accessScope)) {
139140
if (isPrivate())
140141
return *this;

include/swift/AST/AnyFunctionRef.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
#ifndef SWIFT_AST_ANY_FUNCTION_REF_H
1414
#define SWIFT_AST_ANY_FUNCTION_REF_H
1515

16-
#include "swift/Basic/Compiler.h"
17-
#include "swift/Basic/Debug.h"
18-
#include "swift/Basic/LLVM.h"
1916
#include "swift/AST/Decl.h"
2017
#include "swift/AST/Expr.h"
2118
#include "swift/AST/ParameterList.h"
2219
#include "swift/AST/Types.h"
20+
#include "swift/Basic/Compiler.h"
21+
#include "swift/Basic/Debug.h"
22+
#include "swift/Basic/LLVM.h"
2323
#include "llvm/ADT/DenseMap.h"
24-
#include "llvm/ADT/PointerUnion.h"
25-
#include "llvm/ADT/Optional.h"
2624
#include "llvm/ADT/None.h"
25+
#include "llvm/ADT/Optional.h"
26+
#include "llvm/ADT/PointerUnion.h"
2727

2828
namespace swift {
2929
class CaptureInfo;

include/swift/AST/ArgumentList.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include "swift/AST/ASTAllocated.h"
2121
#include "swift/AST/Types.h"
2222
#include "swift/Basic/Debug.h"
23-
#include "llvm/ADT/STLExtras.h"
2423
#include "llvm/ADT/Optional.h"
24+
#include "llvm/ADT/STLExtras.h"
2525
#include "llvm/Support/TrailingObjects.h"
2626

2727
namespace swift {
@@ -221,8 +221,9 @@ class alignas(Argument) ArgumentList final
221221
/// \param arena The arena to allocate the ArgumentList in.
222222
static ArgumentList *
223223
create(ASTContext &ctx, SourceLoc lParenLoc, ArrayRef<Argument> args,
224-
SourceLoc rParenLoc, llvm::Optional<unsigned> firstTrailingClosureIndex,
225-
bool isImplicit, ArgumentList *originalArgs = nullptr,
224+
SourceLoc rParenLoc,
225+
llvm::Optional<unsigned> firstTrailingClosureIndex, bool isImplicit,
226+
ArgumentList *originalArgs = nullptr,
226227
AllocationArena arena = AllocationArena::Permanent);
227228

228229
/// Create a new explicit parsed ArgumentList.
@@ -255,17 +256,17 @@ class alignas(Argument) ArgumentList final
255256
/// \param rParenLoc The location of the closing ')'. Note that for a
256257
/// subscript argument list, this will be for the closing ']'.
257258
/// \param arena The arena to allocate the ArgumentList in.
258-
static ArgumentList *
259-
createImplicit(ASTContext &ctx, SourceLoc lParenLoc, ArrayRef<Argument> args,
260-
SourceLoc rParenLoc,
261-
llvm::Optional<unsigned> firstTrailingClosureIndex = llvm::None,
262-
AllocationArena arena = AllocationArena::Permanent);
259+
static ArgumentList *createImplicit(
260+
ASTContext &ctx, SourceLoc lParenLoc, ArrayRef<Argument> args,
261+
SourceLoc rParenLoc,
262+
llvm::Optional<unsigned> firstTrailingClosureIndex = llvm::None,
263+
AllocationArena arena = AllocationArena::Permanent);
263264

264265
/// Create a new implicit ArgumentList with a set of \p args.
265-
static ArgumentList *
266-
createImplicit(ASTContext &ctx, ArrayRef<Argument> args,
267-
llvm::Optional<unsigned> firstTrailingClosureIndex = llvm::None,
268-
AllocationArena arena = AllocationArena::Permanent);
266+
static ArgumentList *createImplicit(
267+
ASTContext &ctx, ArrayRef<Argument> args,
268+
llvm::Optional<unsigned> firstTrailingClosureIndex = llvm::None,
269+
AllocationArena arena = AllocationArena::Permanent);
269270

270271
/// Create a new implicit ArgumentList with a single labeled argument
271272
/// expression.
@@ -527,7 +528,7 @@ class alignas(Argument) ArgumentList final
527528
/// will match against semantic sub-expressions, but that may be disabled by
528529
/// passing \c false for \c allowSemantic.
529530
llvm::Optional<unsigned> findArgumentExpr(Expr *expr,
530-
bool allowSemantic = true) const;
531+
bool allowSemantic = true) const;
531532

532533
/// Creates a TupleExpr or ParenExpr that holds the argument exprs. A
533534
/// ParenExpr will be returned for a single argument, otherwise a TupleExpr.

0 commit comments

Comments
 (0)