Skip to content

Commit a4e9cfd

Browse files
committed
[NFC] Fix a potential compile error in llvm::to_string(ThinOrFullLTOPhase Phase)
#123994 (comment)
1 parent e59ed0f commit a4e9cfd

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

llvm/include/llvm/Pass.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,7 @@ enum class ThinOrFullLTOPhase {
8787
};
8888

8989
#ifndef NDEBUG
90-
constexpr const char *to_string(ThinOrFullLTOPhase Phase) {
91-
switch (Phase) {
92-
case ThinOrFullLTOPhase::None:
93-
return "None";
94-
case ThinOrFullLTOPhase::ThinLTOPreLink:
95-
return "ThinLTOPreLink";
96-
case ThinOrFullLTOPhase::ThinLTOPostLink:
97-
return "ThinLTOPostLink";
98-
case ThinOrFullLTOPhase::FullLTOPreLink:
99-
return "FullLTOPreLink";
100-
case ThinOrFullLTOPhase::FullLTOPostLink:
101-
return "FullLTOPostLink";
102-
}
103-
}
90+
const char *to_string(ThinOrFullLTOPhase Phase);
10491
#endif
10592

10693
//===----------------------------------------------------------------------===//

llvm/lib/IR/Pass.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,3 +282,21 @@ AnalysisUsage &AnalysisUsage::addRequiredTransitiveID(char &ID) {
282282
pushUnique(RequiredTransitive, &ID);
283283
return *this;
284284
}
285+
286+
#ifndef NDEBUG
287+
const char *llvm::to_string(ThinOrFullLTOPhase Phase) {
288+
switch (Phase) {
289+
case ThinOrFullLTOPhase::None:
290+
return "None";
291+
case ThinOrFullLTOPhase::ThinLTOPreLink:
292+
return "ThinLTOPreLink";
293+
case ThinOrFullLTOPhase::ThinLTOPostLink:
294+
return "ThinLTOPostLink";
295+
case ThinOrFullLTOPhase::FullLTOPreLink:
296+
return "FullLTOPreLink";
297+
case ThinOrFullLTOPhase::FullLTOPostLink:
298+
return "FullLTOPostLink";
299+
}
300+
llvm_unreachable("invalid phase");
301+
}
302+
#endif

0 commit comments

Comments
 (0)