summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2018-11-01 13:49:54 +0000
committerTim Northover <tnorthover@apple.com>2018-11-01 13:49:54 +0000
commita94ecc619b3eb82144af0ac049676728b84caa77 (patch)
tree9fe52dac0071b3a19aeab1f378daa9bcadc1ede2 /clang/lib/AST/ExprConstant.cpp
parent1546efd4a7c1fffe0428ea4f27bf2037eeec4df3 (diff)
downloadbcm5719-llvm-a94ecc619b3eb82144af0ac049676728b84caa77.tar.gz
bcm5719-llvm-a94ecc619b3eb82144af0ac049676728b84caa77.zip
Logging: make os_log buffer size an integer constant expression.
The size of an os_log buffer is known at any stage of compilation, so making it a constant expression means that the common idiom of declaring a buffer for it won't result in a VLA. That allows the compiler to skip saving and restoring the stack pointer around such buffers. llvm-svn: 345828
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index bf08d6bb657..9fc7b30b669 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -33,6 +33,7 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/Analysis/Analyses/OSLog.h"
#include "clang/AST/APValue.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
@@ -8126,6 +8127,12 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
llvm_unreachable("unexpected EvalMode");
}
+ case Builtin::BI__builtin_os_log_format_buffer_size: {
+ analyze_os_log::OSLogBufferLayout Layout;
+ analyze_os_log::computeOSLogBufferLayout(Info.Ctx, E, Layout);
+ return Success(Layout.size().getQuantity(), E);
+ }
+
case Builtin::BI__builtin_bswap16:
case Builtin::BI__builtin_bswap32:
case Builtin::BI__builtin_bswap64: {
OpenPOWER on IntegriCloud