@@ -100,32 +100,33 @@ void Sema::checkFunctionDeclVerbatimLine(const BlockCommandComment *Comment) {
100100 if (!Info->IsFunctionDeclarationCommand )
101101 return ;
102102
103- unsigned DiagSelect;
103+ std::optional< unsigned > DiagSelect;
104104 switch (Comment->getCommandID ()) {
105105 case CommandTraits::KCI_function:
106- DiagSelect = (!isAnyFunctionDecl () && !isFunctionTemplateDecl ())? 1 : 0 ;
106+ if (!isAnyFunctionDecl () && !isFunctionTemplateDecl ())
107+ DiagSelect = diag::CallableKind::Function;
107108 break ;
108109 case CommandTraits::KCI_functiongroup:
109- DiagSelect = (!isAnyFunctionDecl () && !isFunctionTemplateDecl ())? 2 : 0 ;
110+ if (!isAnyFunctionDecl () && !isFunctionTemplateDecl ())
111+ DiagSelect = diag::CallableKind::FunctionGroup;
110112 break ;
111113 case CommandTraits::KCI_method:
112- DiagSelect = ! isObjCMethodDecl () ? 3 : 0 ;
114+ DiagSelect = diag::CallableKind::Method ;
113115 break ;
114116 case CommandTraits::KCI_methodgroup:
115- DiagSelect = ! isObjCMethodDecl () ? 4 : 0 ;
117+ DiagSelect = diag::CallableKind::MethodGroup ;
116118 break ;
117119 case CommandTraits::KCI_callback:
118- DiagSelect = ! isFunctionPointerVarDecl () ? 5 : 0 ;
120+ DiagSelect = diag::CallableKind::Callback ;
119121 break ;
120122 default :
121- DiagSelect = 0 ;
123+ DiagSelect = std:: nullopt ;
122124 break ;
123125 }
124126 if (DiagSelect)
125127 Diag (Comment->getLocation (), diag::warn_doc_function_method_decl_mismatch)
126- << Comment->getCommandMarker ()
127- << (DiagSelect-1 ) << (DiagSelect-1 )
128- << Comment->getSourceRange ();
128+ << Comment->getCommandMarker () << (*DiagSelect) << (*DiagSelect)
129+ << Comment->getSourceRange ();
129130}
130131
131132void Sema::checkContainerDeclVerbatimLine (const BlockCommandComment *Comment) {
0 commit comments