Skip to content

Commit 273d097

Browse files
committed
Remove default case for unhandled enum values
Code consistency in switch statement
1 parent 8d8dde8 commit 273d097

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

clang-tools-extra/clang-doc/BitcodeReader.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,13 @@ static llvm::Error parseRecord(const Record &R, unsigned ID,
315315

316316
static llvm::Error parseRecord(const Record &R, unsigned ID,
317317
llvm::StringRef Blob, CommentInfo *I) {
318+
llvm::SmallString<16> KindStr;
318319
switch (ID) {
319-
case COMMENT_KIND: {
320-
llvm::SmallString<16> KindStr;
320+
case COMMENT_KIND:
321321
if (llvm::Error Err = decodeRecord(R, KindStr, Blob))
322322
return Err;
323323
I->Kind = stringToCommentKind(KindStr);
324324
return llvm::Error::success();
325-
}
326325
case COMMENT_TEXT:
327326
return decodeRecord(R, I->Text, Blob);
328327
case COMMENT_NAME:

clang-tools-extra/clang-doc/HTMLGenerator.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,10 +678,19 @@ static std::unique_ptr<HTMLNode> genHTML(const CommentInfo &I) {
678678
return std::make_unique<TextNode>(I.Text);
679679
}
680680

681-
// For now, no handling — fallthrough.
682-
default:
681+
// For now, return nullptr for unsupported comment kinds
682+
case CommentKind::CK_InlineCommandComment:
683+
case CommentKind::CK_HTMLStartTagComment:
684+
case CommentKind::CK_HTMLEndTagComment:
685+
case CommentKind::CK_ParamCommandComment:
686+
case CommentKind::CK_TParamCommandComment:
687+
case CommentKind::CK_VerbatimBlockComment:
688+
case CommentKind::CK_VerbatimBlockLineComment:
689+
case CommentKind::CK_VerbatimLineComment:
690+
case CommentKind::CK_Unknown:
683691
return nullptr;
684692
}
693+
llvm_unreachable("Unhandled CommentKind");
685694
}
686695

687696
static std::unique_ptr<TagNode> genHTML(const std::vector<CommentInfo> &C) {

0 commit comments

Comments
 (0)