Skip to content

Commit 825127b

Browse files
committed
Added an inline keyword to a function defined in a header
Otherwise, we could get an ODR violation due to duplicate definitions coming from multiple translation units that include this header.
1 parent 48ba315 commit 825127b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/IRGen/SwitchBuilder.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,9 @@ class SwitchSwitchBuilder final : public SwitchBuilder {
165165
}
166166
};
167167

168-
std::unique_ptr<SwitchBuilder> SwitchBuilder::create(IRGenFunction &IGF,
169-
llvm::Value *Subject,
170-
SwitchDefaultDest Default,
171-
unsigned NumCases) {
168+
inline std::unique_ptr<SwitchBuilder>
169+
SwitchBuilder::create(IRGenFunction &IGF, llvm::Value *Subject,
170+
SwitchDefaultDest Default, unsigned NumCases) {
172171
// Pick a builder based on how many total reachable destinations we intend
173172
// to have.
174173
switch (NumCases + (Default.getInt() == IsNotUnreachable)) {

0 commit comments

Comments
 (0)