================
@@ -100,32 +100,33 @@ void Sema::checkFunctionDeclVerbatimLine(const
BlockCommandComment *Comment) {
if (!Info->IsFunctionDeclarationCommand)
return;
- unsigned DiagSelect;
+ std::optional<unsigned> DiagSelect;
switch (Comment->getCommandID()) {
case CommandTraits::KCI_function:
- DiagSelect = (!isAnyFunctionDecl() && !isFunctionTemplateDecl())? 1 : 0;
+ if (!isAnyFunctionDecl() && !isFunctionTemplateDecl())
+ DiagSelect = diag::CallableKind::Function;
break;
case CommandTraits::KCI_functiongroup:
- DiagSelect = (!isAnyFunctionDecl() && !isFunctionTemplateDecl())? 2 : 0;
+ if (!isAnyFunctionDecl() && !isFunctionTemplateDecl())
+ DiagSelect = diag::CallableKind::FunctionGroup;
break;
case CommandTraits::KCI_method:
- DiagSelect = !isObjCMethodDecl() ? 3 : 0;
+ DiagSelect = diag::CallableKind::Method;
break;
case CommandTraits::KCI_methodgroup:
- DiagSelect = !isObjCMethodDecl() ? 4 : 0;
+ DiagSelect = diag::CallableKind::MethodGroup;
break;
case CommandTraits::KCI_callback:
- DiagSelect = !isFunctionPointerVarDecl() ? 5 : 0;
+ DiagSelect = diag::CallableKind::Callback;
break;
default:
- DiagSelect = 0;
+ DiagSelect = std::nullopt;
----------------
erichkeane wrote:
I'd rather just omit the 'default' here. Default ctor should handle the
nullopt construction.
https://github.com/llvm/llvm-project/pull/146426
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits