|
9 | 9 | #include "Boolean.h"
|
10 | 10 | #include "Interp.h"
|
11 | 11 | #include "PrimType.h"
|
| 12 | +#include "clang/AST/OSLog.h" |
12 | 13 | #include "clang/AST/RecordLayout.h"
|
13 | 14 | #include "clang/Basic/Builtins.h"
|
14 | 15 | #include "clang/Basic/TargetInfo.h"
|
@@ -1088,6 +1089,17 @@ static bool interp__builtin_is_aligned_up_down(InterpState &S, CodePtr OpPC,
|
1088 | 1089 | return false;
|
1089 | 1090 | }
|
1090 | 1091 |
|
| 1092 | +static bool interp__builtin_os_log_format_buffer_size(InterpState &S, |
| 1093 | + CodePtr OpPC, |
| 1094 | + const InterpFrame *Frame, |
| 1095 | + const Function *Func, |
| 1096 | + const CallExpr *Call) { |
| 1097 | + analyze_os_log::OSLogBufferLayout Layout; |
| 1098 | + analyze_os_log::computeOSLogBufferLayout(S.getCtx(), Call, Layout); |
| 1099 | + pushInteger(S, Layout.size().getQuantity(), Call->getType()); |
| 1100 | + return true; |
| 1101 | +} |
| 1102 | + |
1091 | 1103 | bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F,
|
1092 | 1104 | const CallExpr *Call) {
|
1093 | 1105 | const InterpFrame *Frame = S.Current;
|
@@ -1409,6 +1421,11 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F,
|
1409 | 1421 | return false;
|
1410 | 1422 | break;
|
1411 | 1423 |
|
| 1424 | + case Builtin::BI__builtin_os_log_format_buffer_size: |
| 1425 | + if (!interp__builtin_os_log_format_buffer_size(S, OpPC, Frame, F, Call)) |
| 1426 | + return false; |
| 1427 | + break; |
| 1428 | + |
1412 | 1429 | default:
|
1413 | 1430 | S.FFDiag(S.Current->getLocation(OpPC),
|
1414 | 1431 | diag::note_invalid_subexpr_in_const_expr)
|
|
0 commit comments