Skip to content

Commit 9dae048

Browse files
committed
[NFC] clang-format SerializationOptions.h
1 parent 1985b6c commit 9dae048

File tree

1 file changed

+136
-135
lines changed

1 file changed

+136
-135
lines changed

include/swift/Serialization/SerializationOptions.h

Lines changed: 136 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -24,143 +24,144 @@
2424

2525
namespace swift {
2626

27-
class SerializationOptions {
28-
public:
29-
SerializationOptions() = default;
30-
SerializationOptions(SerializationOptions &&) = default;
31-
SerializationOptions &operator=(SerializationOptions &&) = default;
32-
SerializationOptions(const SerializationOptions &) = default;
33-
SerializationOptions &operator=(const SerializationOptions &) = default;
34-
~SerializationOptions() = default;
35-
36-
StringRef OutputPath;
37-
StringRef DocOutputPath;
38-
StringRef SourceInfoOutputPath;
39-
std::string ABIDescriptorPath;
40-
bool emptyABIDescriptor = false;
41-
llvm::VersionTuple UserModuleVersion;
42-
std::set<std::string> AllowableClients;
43-
std::string SDKName;
44-
std::string SDKVersion;
45-
46-
StringRef GroupInfoPath;
47-
StringRef ImportedHeader;
48-
StringRef ModuleLinkName;
49-
StringRef ModuleInterface;
50-
std::vector<std::string> ExtraClangOptions;
51-
std::vector<swift::PluginSearchOption> PluginSearchOptions;
52-
53-
/// Path prefixes that should be rewritten in debug info.
54-
PathRemapper DebuggingOptionsPrefixMap;
55-
56-
/// Obfuscate the serialized paths so we don't have the actual paths encoded
57-
/// in the .swiftmodule file.
58-
PathObfuscator PathObfuscator;
59-
60-
/// Describes a single-file dependency for this module, along with the
61-
/// appropriate strategy for how to verify if it's up-to-date.
62-
class FileDependency {
63-
/// The size of the file on disk, in bytes.
64-
uint64_t Size : 62;
65-
66-
/// A dependency can be either hash-based or modification-time-based.
67-
bool IsHashBased : 1;
68-
69-
/// The dependency path can be absolute or relative to the SDK
70-
bool IsSDKRelative : 1;
71-
72-
union {
73-
/// The last modification time of the file.
74-
uint64_t ModificationTime;
75-
76-
/// The xxHash of the full contents of the file.
77-
uint64_t ContentHash;
78-
};
79-
80-
/// The path to the dependency.
81-
std::string Path;
82-
83-
FileDependency(uint64_t size, bool isHash, uint64_t hashOrModTime,
84-
StringRef path, bool isSDKRelative):
85-
Size(size), IsHashBased(isHash), IsSDKRelative(isSDKRelative),
86-
ModificationTime(hashOrModTime), Path(path) {}
87-
public:
88-
FileDependency() = delete;
89-
90-
/// Creates a new hash-based file dependency.
91-
static FileDependency
92-
hashBased(StringRef path, bool isSDKRelative, uint64_t size, uint64_t hash) {
93-
return FileDependency(size, /*isHash*/true, hash, path, isSDKRelative);
94-
}
95-
96-
/// Creates a new modification time-based file dependency.
97-
static FileDependency
98-
modTimeBased(StringRef path, bool isSDKRelative, uint64_t size, uint64_t mtime) {
99-
return FileDependency(size, /*isHash*/false, mtime, path, isSDKRelative);
100-
}
101-
102-
/// Updates the last-modified time of this dependency.
103-
/// If the dependency is a hash-based dependency, it becomes
104-
/// modification time-based.
105-
void setLastModificationTime(uint64_t mtime) {
106-
IsHashBased = false;
107-
ModificationTime = mtime;
108-
}
109-
110-
/// Updates the content hash of this dependency.
111-
/// If the dependency is a modification time-based dependency, it becomes
112-
/// hash-based.
113-
void setContentHash(uint64_t hash) {
114-
IsHashBased = true;
115-
ContentHash = hash;
116-
}
117-
118-
/// Determines if this dependency is hash-based and should be validated
119-
/// based on content hash.
120-
bool isHashBased() const { return IsHashBased; }
121-
122-
/// Determines if this dependency is absolute or relative to the SDK.
123-
bool isSDKRelative() const { return IsSDKRelative; }
124-
125-
/// Determines if this dependency is hash-based and should be validated
126-
/// based on modification time.
127-
bool isModificationTimeBased() const { return !IsHashBased; }
128-
129-
/// Gets the modification time, if this is a modification time-based
130-
/// dependency.
131-
uint64_t getModificationTime() const {
132-
assert(isModificationTimeBased() &&
133-
"cannot get modification time for hash-based dependency");
134-
return ModificationTime;
135-
}
136-
137-
/// Gets the content hash, if this is a hash-based
138-
/// dependency.
139-
uint64_t getContentHash() const {
140-
assert(isHashBased() &&
141-
"cannot get content hash for mtime-based dependency");
142-
return ContentHash;
143-
}
144-
145-
StringRef getPath() const { return Path; }
146-
uint64_t getSize() const { return Size; }
27+
class SerializationOptions {
28+
public:
29+
SerializationOptions() = default;
30+
SerializationOptions(SerializationOptions &&) = default;
31+
SerializationOptions &operator=(SerializationOptions &&) = default;
32+
SerializationOptions(const SerializationOptions &) = default;
33+
SerializationOptions &operator=(const SerializationOptions &) = default;
34+
~SerializationOptions() = default;
35+
36+
StringRef OutputPath;
37+
StringRef DocOutputPath;
38+
StringRef SourceInfoOutputPath;
39+
std::string ABIDescriptorPath;
40+
bool emptyABIDescriptor = false;
41+
llvm::VersionTuple UserModuleVersion;
42+
std::set<std::string> AllowableClients;
43+
std::string SDKName;
44+
std::string SDKVersion;
45+
46+
StringRef GroupInfoPath;
47+
StringRef ImportedHeader;
48+
StringRef ModuleLinkName;
49+
StringRef ModuleInterface;
50+
std::vector<std::string> ExtraClangOptions;
51+
std::vector<swift::PluginSearchOption> PluginSearchOptions;
52+
53+
/// Path prefixes that should be rewritten in debug info.
54+
PathRemapper DebuggingOptionsPrefixMap;
55+
56+
/// Obfuscate the serialized paths so we don't have the actual paths encoded
57+
/// in the .swiftmodule file.
58+
PathObfuscator PathObfuscator;
59+
60+
/// Describes a single-file dependency for this module, along with the
61+
/// appropriate strategy for how to verify if it's up-to-date.
62+
class FileDependency {
63+
/// The size of the file on disk, in bytes.
64+
uint64_t Size : 62;
65+
66+
/// A dependency can be either hash-based or modification-time-based.
67+
bool IsHashBased : 1;
68+
69+
/// The dependency path can be absolute or relative to the SDK
70+
bool IsSDKRelative : 1;
71+
72+
union {
73+
/// The last modification time of the file.
74+
uint64_t ModificationTime;
75+
76+
/// The xxHash of the full contents of the file.
77+
uint64_t ContentHash;
14778
};
148-
ArrayRef<FileDependency> Dependencies;
149-
ArrayRef<std::string> PublicDependentLibraries;
150-
151-
bool AutolinkForceLoad = false;
152-
bool SerializeAllSIL = false;
153-
bool SerializeOptionsForDebugging = false;
154-
bool IsSIB = false;
155-
bool DisableCrossModuleIncrementalInfo = false;
156-
bool StaticLibrary = false;
157-
bool HermeticSealAtLink = false;
158-
bool EmbeddedSwiftModule = false;
159-
bool IsOSSA = false;
160-
bool SkipNonExportableDecls = false;
161-
bool ExplicitModuleBuild = false;
162-
bool EnableSerializationRemarks = false;
79+
80+
/// The path to the dependency.
81+
std::string Path;
82+
83+
FileDependency(uint64_t size, bool isHash, uint64_t hashOrModTime,
84+
StringRef path, bool isSDKRelative)
85+
: Size(size), IsHashBased(isHash), IsSDKRelative(isSDKRelative),
86+
ModificationTime(hashOrModTime), Path(path) {}
87+
88+
public:
89+
FileDependency() = delete;
90+
91+
/// Creates a new hash-based file dependency.
92+
static FileDependency hashBased(StringRef path, bool isSDKRelative,
93+
uint64_t size, uint64_t hash) {
94+
return FileDependency(size, /*isHash*/ true, hash, path, isSDKRelative);
95+
}
96+
97+
/// Creates a new modification time-based file dependency.
98+
static FileDependency modTimeBased(StringRef path, bool isSDKRelative,
99+
uint64_t size, uint64_t mtime) {
100+
return FileDependency(size, /*isHash*/ false, mtime, path, isSDKRelative);
101+
}
102+
103+
/// Updates the last-modified time of this dependency.
104+
/// If the dependency is a hash-based dependency, it becomes
105+
/// modification time-based.
106+
void setLastModificationTime(uint64_t mtime) {
107+
IsHashBased = false;
108+
ModificationTime = mtime;
109+
}
110+
111+
/// Updates the content hash of this dependency.
112+
/// If the dependency is a modification time-based dependency, it becomes
113+
/// hash-based.
114+
void setContentHash(uint64_t hash) {
115+
IsHashBased = true;
116+
ContentHash = hash;
117+
}
118+
119+
/// Determines if this dependency is hash-based and should be validated
120+
/// based on content hash.
121+
bool isHashBased() const { return IsHashBased; }
122+
123+
/// Determines if this dependency is absolute or relative to the SDK.
124+
bool isSDKRelative() const { return IsSDKRelative; }
125+
126+
/// Determines if this dependency is hash-based and should be validated
127+
/// based on modification time.
128+
bool isModificationTimeBased() const { return !IsHashBased; }
129+
130+
/// Gets the modification time, if this is a modification time-based
131+
/// dependency.
132+
uint64_t getModificationTime() const {
133+
assert(isModificationTimeBased() &&
134+
"cannot get modification time for hash-based dependency");
135+
return ModificationTime;
136+
}
137+
138+
/// Gets the content hash, if this is a hash-based
139+
/// dependency.
140+
uint64_t getContentHash() const {
141+
assert(isHashBased() &&
142+
"cannot get content hash for mtime-based dependency");
143+
return ContentHash;
144+
}
145+
146+
StringRef getPath() const { return Path; }
147+
uint64_t getSize() const { return Size; }
163148
};
149+
ArrayRef<FileDependency> Dependencies;
150+
ArrayRef<std::string> PublicDependentLibraries;
151+
152+
bool AutolinkForceLoad = false;
153+
bool SerializeAllSIL = false;
154+
bool SerializeOptionsForDebugging = false;
155+
bool IsSIB = false;
156+
bool DisableCrossModuleIncrementalInfo = false;
157+
bool StaticLibrary = false;
158+
bool HermeticSealAtLink = false;
159+
bool EmbeddedSwiftModule = false;
160+
bool IsOSSA = false;
161+
bool SkipNonExportableDecls = false;
162+
bool ExplicitModuleBuild = false;
163+
bool EnableSerializationRemarks = false;
164+
};
164165

165166
} // end namespace swift
166167
#endif

0 commit comments

Comments
 (0)