31 const auto IsSigterm = [](
const auto &KeyValue) ->
bool {
32 return KeyValue.first->getName() ==
"SIGTERM" &&
33 KeyValue.first->hasMacroDefinition();
35 const auto Macros =
PP->macros();
36 const auto TryExpandAsInteger =
37 [&](Preprocessor::macro_iterator It) -> std::optional<unsigned> {
38 if (It == Macros.end())
40 const MacroInfo *MI =
PP->getMacroInfo(It->first);
41 const Token &T = MI->tokens().back();
48 const StringRef ValueStr =
PP->getSpelling(T, Buffer, &Invalid);
53 constexpr unsigned AutoSenseRadix = 0;
54 if (ValueStr.getAsInteger(AutoSenseRadix, IntValue))
56 return IntValue.getZExtValue();
59 const auto SigtermMacro = llvm::find_if(Macros, IsSigterm);
64 const auto *MatchedExpr = Result.Nodes.getNodeAs<Expr>(
"thread-kill");
65 const auto *MatchedIntLiteral =
66 Result.Nodes.getNodeAs<IntegerLiteral>(
"integer-literal");
68 diag(MatchedExpr->getBeginLoc(),
69 "thread should not be terminated by raising the 'SIGTERM' signal");