diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/AST/FormatString.h (renamed from clang/include/clang/Analysis/Analyses/FormatString.h) | 0 | ||||
-rw-r--r-- | clang/include/clang/AST/OSLog.h (renamed from clang/include/clang/Analysis/Analyses/OSLog.h) | 0 | ||||
-rw-r--r-- | clang/lib/AST/CMakeLists.txt | 4 | ||||
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 7 | ||||
-rw-r--r-- | clang/lib/AST/FormatString.cpp (renamed from clang/lib/Analysis/FormatString.cpp) | 0 | ||||
-rw-r--r-- | clang/lib/AST/FormatStringParsing.h (renamed from clang/lib/Analysis/FormatStringParsing.h) | 2 | ||||
-rw-r--r-- | clang/lib/AST/OSLog.cpp (renamed from clang/lib/Analysis/OSLog.cpp) | 4 | ||||
-rw-r--r-- | clang/lib/AST/PrintfFormatString.cpp (renamed from clang/lib/Analysis/PrintfFormatString.cpp) | 4 | ||||
-rw-r--r-- | clang/lib/AST/ScanfFormatString.cpp (renamed from clang/lib/Analysis/ScanfFormatString.cpp) | 2 | ||||
-rw-r--r-- | clang/lib/Analysis/CMakeLists.txt | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 9 | ||||
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 2 | ||||
-rw-r--r-- | clang/test/CodeGen/builtins.c | 13 |
13 files changed, 27 insertions, 24 deletions
diff --git a/clang/include/clang/Analysis/Analyses/FormatString.h b/clang/include/clang/AST/FormatString.h index 598d341ac82..598d341ac82 100644 --- a/clang/include/clang/Analysis/Analyses/FormatString.h +++ b/clang/include/clang/AST/FormatString.h diff --git a/clang/include/clang/Analysis/Analyses/OSLog.h b/clang/include/clang/AST/OSLog.h index 1e60a237b77..1e60a237b77 100644 --- a/clang/include/clang/Analysis/Analyses/OSLog.h +++ b/clang/include/clang/AST/OSLog.h diff --git a/clang/lib/AST/CMakeLists.txt b/clang/lib/AST/CMakeLists.txt index 4f868a3af59..45ed87d670f 100644 --- a/clang/lib/AST/CMakeLists.txt +++ b/clang/lib/AST/CMakeLists.txt @@ -39,6 +39,7 @@ add_clang_library(clangAST ExprObjC.cpp ExternalASTMerger.cpp ExternalASTSource.cpp + FormatString.cpp InheritViz.cpp ItaniumCXXABI.cpp ItaniumMangle.cpp @@ -48,12 +49,15 @@ add_clang_library(clangAST NestedNameSpecifier.cpp NSAPI.cpp ODRHash.cpp + OSLog.cpp OpenMPClause.cpp ParentMap.cpp + PrintfFormatString.cpp QualTypeNames.cpp RawCommentList.cpp RecordLayout.cpp RecordLayoutBuilder.cpp + ScanfFormatString.cpp SelectorLocationsKind.cpp Stmt.cpp StmtCXX.cpp diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 15efe433bd1..a85d5cf9d5f 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -39,6 +39,7 @@ #include "clang/AST/ASTLambda.h" #include "clang/AST/CharUnits.h" #include "clang/AST/Expr.h" +#include "clang/AST/OSLog.h" #include "clang/AST/RecordLayout.h" #include "clang/AST/StmtVisitor.h" #include "clang/AST/TypeLoc.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: { diff --git a/clang/lib/Analysis/FormatString.cpp b/clang/lib/AST/FormatString.cpp index 5e2137c7088..5e2137c7088 100644 --- a/clang/lib/Analysis/FormatString.cpp +++ b/clang/lib/AST/FormatString.cpp diff --git a/clang/lib/Analysis/FormatStringParsing.h b/clang/lib/AST/FormatStringParsing.h index a63140b366c..91fab155e4c 100644 --- a/clang/lib/Analysis/FormatStringParsing.h +++ b/clang/lib/AST/FormatStringParsing.h @@ -3,7 +3,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/Type.h" -#include "clang/Analysis/Analyses/FormatString.h" +#include "clang/AST/FormatString.h" namespace clang { diff --git a/clang/lib/Analysis/OSLog.cpp b/clang/lib/AST/OSLog.cpp index b2983932ea2..cf20706c4b3 100644 --- a/clang/lib/Analysis/OSLog.cpp +++ b/clang/lib/AST/OSLog.cpp @@ -1,11 +1,11 @@ // TODO: header template -#include "clang/Analysis/Analyses/OSLog.h" +#include "clang/AST/OSLog.h" #include "clang/AST/Attr.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/ExprObjC.h" -#include "clang/Analysis/Analyses/FormatString.h" +#include "clang/AST/FormatString.h" #include "clang/Basic/Builtins.h" #include "llvm/ADT/SmallBitVector.h" diff --git a/clang/lib/Analysis/PrintfFormatString.cpp b/clang/lib/AST/PrintfFormatString.cpp index dcb15c5e375..96a8f258ed3 100644 --- a/clang/lib/Analysis/PrintfFormatString.cpp +++ b/clang/lib/AST/PrintfFormatString.cpp @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// -#include "clang/Analysis/Analyses/FormatString.h" -#include "clang/Analysis/Analyses/OSLog.h" +#include "clang/AST/FormatString.h" +#include "clang/AST/OSLog.h" #include "FormatStringParsing.h" #include "clang/Basic/TargetInfo.h" diff --git a/clang/lib/Analysis/ScanfFormatString.cpp b/clang/lib/AST/ScanfFormatString.cpp index a9af0cdfdac..bda97c57c87 100644 --- a/clang/lib/Analysis/ScanfFormatString.cpp +++ b/clang/lib/AST/ScanfFormatString.cpp @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -#include "clang/Analysis/Analyses/FormatString.h" +#include "clang/AST/FormatString.h" #include "FormatStringParsing.h" #include "clang/Basic/TargetInfo.h" diff --git a/clang/lib/Analysis/CMakeLists.txt b/clang/lib/Analysis/CMakeLists.txt index 36a37f49858..5345a56f200 100644 --- a/clang/lib/Analysis/CMakeLists.txt +++ b/clang/lib/Analysis/CMakeLists.txt @@ -16,15 +16,11 @@ add_clang_library(clangAnalysis CodeInjector.cpp Dominators.cpp ExprMutationAnalyzer.cpp - FormatString.cpp LiveVariables.cpp - OSLog.cpp ObjCNoReturn.cpp PostOrderCFGView.cpp - PrintfFormatString.cpp ProgramPoint.cpp ReachableCode.cpp - ScanfFormatString.cpp ThreadSafety.cpp ThreadSafetyCommon.cpp ThreadSafetyLogical.cpp diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 2c7a3d720a7..f880e93068a 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -21,7 +21,7 @@ #include "TargetInfo.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" -#include "clang/Analysis/Analyses/OSLog.h" +#include "clang/AST/OSLog.h" #include "clang/Basic/TargetBuiltins.h" #include "clang/Basic/TargetInfo.h" #include "clang/CodeGen/CGFunctionInfo.h" @@ -3606,13 +3606,6 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, case Builtin::BI__builtin_os_log_format: return emitBuiltinOSLogFormat(*E); - case Builtin::BI__builtin_os_log_format_buffer_size: { - analyze_os_log::OSLogBufferLayout Layout; - analyze_os_log::computeOSLogBufferLayout(CGM.getContext(), E, Layout); - return RValue::get(ConstantInt::get(ConvertType(E->getType()), - Layout.size().getQuantity())); - } - case Builtin::BI__xray_customevent: { if (!ShouldXRayInstrumentFunction()) return RValue::getIgnored(); diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 792171a4f5d..4660ed55aee 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -27,6 +27,7 @@ #include "clang/AST/ExprCXX.h" #include "clang/AST/ExprObjC.h" #include "clang/AST/ExprOpenMP.h" +#include "clang/AST/FormatString.h" #include "clang/AST/NSAPI.h" #include "clang/AST/NonTrivialTypeVisitor.h" #include "clang/AST/OperationKinds.h" @@ -35,7 +36,6 @@ #include "clang/AST/Type.h" #include "clang/AST/TypeLoc.h" #include "clang/AST/UnresolvedSet.h" -#include "clang/Analysis/Analyses/FormatString.h" #include "clang/Basic/AddressSpaces.h" #include "clang/Basic/CharInfo.h" #include "clang/Basic/Diagnostic.h" diff --git a/clang/test/CodeGen/builtins.c b/clang/test/CodeGen/builtins.c index 77b479e4c11..6ca3c414cf3 100644 --- a/clang/test/CodeGen/builtins.c +++ b/clang/test/CodeGen/builtins.c @@ -729,25 +729,28 @@ void test_builtin_os_log_merge_helper1(void *buf, unsigned u, long long ll) { // CHECK-LABEL: define void @test_builtin_os_log_errno void test_builtin_os_log_errno() { - // CHECK: %[[VLA:.*]] = alloca i8, i64 4, align 16 - // CHECK: call void @__os_log_helper_16_2_1_0_96(i8* %[[VLA]]) + // CHECK-NOT: @stacksave + // CHECK: %[[BUF:.*]] = alloca [4 x i8], align 1 + // CHECK: %[[DECAY:.*]] = getelementptr inbounds [4 x i8], [4 x i8]* %[[BUF]], i32 0, i32 0 + // CHECK: call void @__os_log_helper_1_2_1_0_96(i8* %[[DECAY]]) + // CHECK-NOT: @stackrestore char buf[__builtin_os_log_format_buffer_size("%m")]; __builtin_os_log_format(buf, "%m"); } -// CHECK-LABEL: define linkonce_odr hidden void @__os_log_helper_16_2_1_0_96 +// CHECK-LABEL: define linkonce_odr hidden void @__os_log_helper_1_2_1_0_96 // CHECK: (i8* %[[BUFFER:.*]]) // CHECK: %[[BUFFER_ADDR:.*]] = alloca i8*, align 8 // CHECK: store i8* %[[BUFFER]], i8** %[[BUFFER_ADDR]], align 8 // CHECK: %[[BUF:.*]] = load i8*, i8** %[[BUFFER_ADDR]], align 8 // CHECK: %[[SUMMARY:.*]] = getelementptr i8, i8* %[[BUF]], i64 0 -// CHECK: store i8 2, i8* %[[SUMMARY]], align 16 +// CHECK: store i8 2, i8* %[[SUMMARY]], align 1 // CHECK: %[[NUMARGS:.*]] = getelementptr i8, i8* %[[BUF]], i64 1 // CHECK: store i8 1, i8* %[[NUMARGS]], align 1 // CHECK: %[[ARGDESCRIPTOR:.*]] = getelementptr i8, i8* %[[BUF]], i64 2 -// CHECK: store i8 96, i8* %[[ARGDESCRIPTOR]], align 2 +// CHECK: store i8 96, i8* %[[ARGDESCRIPTOR]], align 1 // CHECK: %[[ARGSIZE:.*]] = getelementptr i8, i8* %[[BUF]], i64 3 // CHECK: store i8 0, i8* %[[ARGSIZE]], align 1 // CHECK-NEXT: ret void |