std::vector<int32_t> UnixSignals::GetFilteredSignals(llvm::Optional<bool> should_suppress, llvm::Optional<bool> should_stop, llvm::Optional<bool> should_notify) { std::vector<int32_t> result; for (int32_t signo = GetFirstSignalNumber(); signo != LLDB_INVALID_SIGNAL_NUMBER; signo = GetNextSignalNumber(signo)) { bool signal_suppress = false; bool signal_stop = false; bool signal_notify = false; GetSignalInfo(signo, signal_suppress, signal_stop, signal_notify); // If any of filtering conditions are not met, we move on to the next // signal. if (should_suppress.hasValue() && signal_suppress != should_suppress.getValue()) continue; if (should_stop.hasValue() && signal_stop != should_stop.getValue()) continue; if (should_notify.hasValue() && signal_notify != should_notify.getValue()) continue; result.push_back(signo); } return result; }
FunctionDeclSyntax SyntaxFactory:: makeFunctionDecl(TypeAttributesSyntax Attributes, DeclModifierListSyntax Modifiers, RC<TokenSyntax> FuncKeyword, RC<TokenSyntax> Identifier, llvm::Optional<GenericParameterClauseSyntax> GenericParams, FunctionSignatureSyntax Signature, llvm::Optional<GenericWhereClauseSyntax> GenericWhereClause, llvm::Optional<CodeBlockStmtSyntax> Body) { auto Raw = RawSyntax::make(SyntaxKind::FunctionDecl, { Attributes.getRaw(), Modifiers.getRaw(), FuncKeyword, Identifier, GenericParams.hasValue() ? GenericParams.getValue().getRaw() : SyntaxFactory::makeBlankGenericParameterClause().getRaw(), Signature.getRaw(), GenericWhereClause.hasValue() ? GenericWhereClause.getValue().getRaw() : SyntaxFactory::makeBlankGenericWhereClause().getRaw(), Body.hasValue() ? Body.getValue().getRaw() : SyntaxFactory::makeBlankCodeBlock().getRaw() }, SourcePresence::Present); auto Data = FunctionDeclSyntaxData::make(Raw); return { Data, Data.get() }; }
FunctionParameterSyntax SyntaxFactory:: makeFunctionParameter(RC<TokenSyntax> ExternalName, RC<TokenSyntax> LocalName, RC<TokenSyntax> Colon, llvm::Optional<TypeSyntax> ParameterTypeSyntax, RC<TokenSyntax> Ellipsis, RC<TokenSyntax> Equal, llvm::Optional<ExprSyntax> DefaultValue, RC<TokenSyntax> TrailingComma) { auto Raw = RawSyntax::make(SyntaxKind::FunctionParameter, { ExternalName, LocalName, Colon, ParameterTypeSyntax.hasValue() ? ParameterTypeSyntax.getValue().getRaw() : RawSyntax::missing(SyntaxKind::MissingType), Ellipsis, Equal, DefaultValue.hasValue() ? DefaultValue.getValue().getRaw() : RawSyntax::missing(SyntaxKind::MissingExpr), TrailingComma, }, SourcePresence::Present); auto Data = FunctionParameterSyntaxData::make(Raw); return { Data, Data.get() }; }
void updateArgIfSet(llvm::cl::opt<T> &argValue, const llvm::Optional<T> &configValue) { if (configValue.hasValue() && argValue.getNumOccurrences() == 0) { argValue.setValue(configValue.getValue()); } }
SymbolicReferenceExprSyntax SyntaxFactory::makeSymbolicReferenceExpr(RC<TokenSyntax> Identifier, llvm::Optional<GenericArgumentClauseSyntax> GenericArgs) { auto Raw = RawSyntax::make(SyntaxKind::SymbolicReferenceExpr, { Identifier, GenericArgs.hasValue() ? GenericArgs.getValue().getRaw() : RawSyntax::missing(SyntaxKind::GenericArgumentClause) }, SourcePresence::Present); auto Data = SymbolicReferenceExprSyntaxData::make(Raw); return { Data, Data.get() }; }