;
18classOSLogFormatStringHandler
22 const Expr*
E=
nullptr;
23std::optional<OSLogBufferItem::Kind>
Kind;
24std::optional<unsigned>
Size;
25std::optional<const Expr *> Count;
26std::optional<const Expr *> Precision;
27std::optional<const Expr *> FieldWidth;
28 unsigned charFlags = 0;
38 returnOSLogBufferItem::StringKind;
40 returnOSLogBufferItem::WideStringKind;
42 returnOSLogBufferItem::PointerKind;
44 returnOSLogBufferItem::ObjCObjKind;
46 returnOSLogBufferItem::ErrnoKind;
48 returnOSLogBufferItem::ScalarKind;
55ArgsData.reserve(Args.size());
59 const char*StartSpecifier,
unsignedSpecifierLen,
61 if(!FS.consumesDataArgument() &&
62FS.getConversionSpecifier().getKind() !=
66ArgsData.emplace_back();
67 unsignedArgIndex = FS.getArgIndex();
68 if(ArgIndex < Args.size())
69ArgsData.back().E = Args[ArgIndex];
72ArgsData.back().Kind =
getKind(FS.getConversionSpecifier().getKind());
73 if(ArgsData.back().Kind != OSLogBufferItem::ErrnoKind &&
80 switch(FS.getConversionSpecifier().getKind()) {
83 auto&precision = FS.getPrecision();
84 switch(precision.getHowSpecified()) {
88ArgsData.back().Size = precision.getConstantAmount();
91ArgsData.back().Count = Args[precision.getArgIndex()];
99 auto&precision = FS.getPrecision();
100 switch(precision.getHowSpecified()) {
104ArgsData.back().Size = precision.getConstantAmount();
107ArgsData.back().Count = Args[precision.getArgIndex()];
115 if(FS.getPrecision().hasDataArgument()) {
116ArgsData.back().Precision = Args[FS.getPrecision().getArgIndex()];
120 if(FS.getFieldWidth().hasDataArgument()) {
121ArgsData.back().FieldWidth = Args[FS.getFieldWidth().getArgIndex()];
124 if(FS.isSensitive())
125ArgsData.back().Flags |= OSLogBufferItem::IsSensitive;
126 else if(FS.isPrivate())
127ArgsData.back().Flags |= OSLogBufferItem::IsPrivate;
128 else if(FS.isPublic())
129ArgsData.back().Flags |= OSLogBufferItem::IsPublic;
131ArgsData.back().MaskType = FS.getMaskType();
136Layout.
Items.clear();
137 for(
auto&
Data: ArgsData) {
138 if(!
Data.MaskType.empty()) {
140Layout.
Items.emplace_back(OSLogBufferItem::MaskKind,
nullptr,
141Size, 0,
Data.MaskType);
144 if(
Data.FieldWidth) {
146Layout.
Items.emplace_back(OSLogBufferItem::ScalarKind, *
Data.FieldWidth,
149 if(
Data.Precision) {
151Layout.
Items.emplace_back(OSLogBufferItem::ScalarKind, *
Data.Precision,
157Layout.
Items.emplace_back(OSLogBufferItem::CountKind, *
Data.Count, Size,
165 if(*
Data.Kind == OSLogBufferItem::ErrnoKind)
172Layout.
Items.emplace_back(OSLogBufferItem::ScalarKind,
Data.E, Size,
184 const Expr*StringArg;
186 switch(
E->getBuiltinCallee()) {
187 caseBuiltin::BI__builtin_os_log_format_buffer_size:
188assert(
E->getNumArgs() >= 1 &&
189 "__builtin_os_log_format_buffer_size takes at least 1 argument");
190StringArg =
E->getArg(0);
191VarArgs = Args.slice(1);
193 caseBuiltin::BI__builtin_os_log_format:
194assert(
E->getNumArgs() >= 2 &&
195 "__builtin_os_log_format takes at least 2 arguments");
196StringArg =
E->getArg(1);
197VarArgs = Args.slice(2);
200llvm_unreachable(
"non-os_log builtin passed to computeOSLogBufferLayout");
206OSLogFormatStringHandler H(VarArgs);
210H.computeLayout(Ctx, Layout);
Defines enum values for all the target-independent builtin functions.
static Decl::Kind getKind(const Decl *D)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const LangOptions & getLangOpts() const
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
const TargetInfo & getTargetInfo() const
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
CharUnits - This is an opaque type for sizes expressed in character units.
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
This represents one expression.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
StringLiteral - This represents a string literal expression, e.g.
StringRef getString() const
Exposes information about the current target.
virtual bool HandlePrintfSpecifier(const analyze_printf::PrintfSpecifier &FS, const char *startSpecifier, unsigned specifierLen, const TargetInfo &Target)
An OSLogBufferItem represents a single item in the data written by a call to os_log() or os_trace().
SmallVector< OSLogBufferItem, 4 > Items
bool computeOSLogBufferLayout(clang::ASTContext &Ctx, const clang::CallExpr *E, OSLogBufferLayout &layout)
The JSON file list parser is used to communicate input to InstallAPI.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4