Clean up some whitespace and comments for the new logging builtins patch.
diff --git a/include/clang/Analysis/Analyses/OSLog.h b/include/clang/Analysis/Analyses/OSLog.h
index 9fde26a..084b079 100644
--- a/include/clang/Analysis/Analyses/OSLog.h
+++ b/include/clang/Analysis/Analyses/OSLog.h
@@ -105,7 +105,7 @@
}
return result;
}
-
+
bool getHasPrivateItems() const {
return std::any_of(Items.begin(), Items.end(),
[](const OSLogBufferItem &item) { return item.getIsPrivate(); });
@@ -139,7 +139,8 @@
// __builtin_os_log_format_buffer_size(), compute the layout of the buffer that
// the call will write into and store it in 'layout'. Returns 'false' if there
// was some error encountered while computing the layout, and 'true' otherwise.
-bool computeOSLogBufferLayout(clang::ASTContext &Ctx, const clang::CallExpr *E, OSLogBufferLayout &layout);
+bool computeOSLogBufferLayout(clang::ASTContext &Ctx, const clang::CallExpr *E,
+ OSLogBufferLayout &layout);
} // namespace analyze_os_log
} // namespace clang
diff --git a/lib/Analysis/OSLog.cpp b/lib/Analysis/OSLog.cpp
index 804cee2..b6e9c49 100644
--- a/lib/Analysis/OSLog.cpp
+++ b/lib/Analysis/OSLog.cpp
@@ -1,4 +1,16 @@
-// TODO: header template
+//===--- OSLog.cpp - Analysis of calls to os_log builtins -------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines APIs for determining the layout of the data buffer for
+// os_log() and os_trace().
+//
+//===----------------------------------------------------------------------===//
#include "clang/Analysis/Analyses/OSLog.h"
#include "clang/Analysis/Analyses/FormatString.h"
@@ -118,7 +130,9 @@
}
};
-bool clang::analyze_os_log::computeOSLogBufferLayout(ASTContext &Ctx, const CallExpr *E, OSLogBufferLayout &layout)
+bool clang::analyze_os_log::computeOSLogBufferLayout(ASTContext &Ctx,
+ const CallExpr *E,
+ OSLogBufferLayout &layout)
{
ArrayRef<const Expr *> Args(E->getArgs(), E->getArgs() + E->getNumArgs());
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index c42433d..90ae3ce 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -2877,7 +2877,7 @@
unsigned BuiltinID =
cast<FunctionDecl>(TheCall->getCalleeDecl())->getBuiltinID();
bool IsSizeCall = BuiltinID == Builtin::BI__builtin_os_log_format_buffer_size;
-
+
unsigned NumArgs = TheCall->getNumArgs();
unsigned NumRequiredArgs = IsSizeCall ? 1 : 2;
if (NumArgs < NumRequiredArgs) {
@@ -2931,7 +2931,7 @@
TheCall->setArg(i, Arg.get());
i++;
}
-
+
// Check formatting specifiers. NOTE: We're only doing this for the non-size
// call to avoid duplicate diagnostics.
if (!IsSizeCall) {
@@ -3443,12 +3443,13 @@
llvm::SmallBitVector &CheckedVarArgs;
public:
CheckFormatHandler(Sema &s, const StringLiteral *fexpr,
- const Expr *origFormatExpr, const Sema::FormatStringType
- type, unsigned firstDataArg, unsigned numDataArgs, const
- char *beg, bool hasVAListArg, ArrayRef<const Expr *> Args,
+ const Expr *origFormatExpr,
+ const Sema::FormatStringType type, unsigned firstDataArg,
+ unsigned numDataArgs, const char *beg, bool hasVAListArg,
+ ArrayRef<const Expr *> Args,
unsigned formatIdx, bool inFunctionCall,
- Sema::VariadicCallType callType, llvm::SmallBitVector
- &CheckedVarArgs)
+ Sema::VariadicCallType callType,
+ llvm::SmallBitVector &CheckedVarArgs)
: S(s), FExpr(fexpr), OrigFormatExpr(origFormatExpr), FSType(type),
FirstDataArg(firstDataArg), NumDataArgs(numDataArgs), Beg(beg),
HasVAListArg(hasVAListArg), Args(Args), FormatIdx(formatIdx),
@@ -3861,11 +3862,13 @@
class CheckPrintfHandler : public CheckFormatHandler {
public:
CheckPrintfHandler(Sema &s, const StringLiteral *fexpr,
- const Expr *origFormatExpr, const Sema::FormatStringType type,
- unsigned firstDataArg, unsigned numDataArgs,
+ const Expr *origFormatExpr,
+ const Sema::FormatStringType type, unsigned firstDataArg,
+ unsigned numDataArgs,
const char *beg, bool hasVAListArg,
- ArrayRef<const Expr *> Args, unsigned formatIdx,
- bool inFunctionCall, Sema::VariadicCallType CallType,
+ ArrayRef<const Expr *> Args,
+ unsigned formatIdx, bool inFunctionCall,
+ Sema::VariadicCallType CallType,
llvm::SmallBitVector &CheckedVarArgs)
: CheckFormatHandler(s, fexpr, origFormatExpr, type, firstDataArg,
numDataArgs, beg, hasVAListArg, Args,
@@ -4701,11 +4704,12 @@
public:
CheckScanfHandler(Sema &s, const StringLiteral *fexpr,
const Expr *origFormatExpr, Sema::FormatStringType type,
- unsigned firstDataArg, unsigned numDataArgs, const char
- *beg, bool hasVAListArg, ArrayRef<const Expr *> Args,
+ unsigned firstDataArg,
+ unsigned numDataArgs, const char *beg, bool hasVAListArg,
+ ArrayRef<const Expr *> Args,
unsigned formatIdx, bool inFunctionCall,
- Sema::VariadicCallType CallType, llvm::SmallBitVector
- &CheckedVarArgs)
+ Sema::VariadicCallType CallType,
+ llvm::SmallBitVector &CheckedVarArgs)
: CheckFormatHandler(s, fexpr, origFormatExpr, type, firstDataArg,
numDataArgs, beg, hasVAListArg, Args, formatIdx,
inFunctionCall, CallType, CheckedVarArgs)
diff --git a/test/CodeGen/builtins.c b/test/CodeGen/builtins.c
index a8bd3a2..f0ab4f4 100644
--- a/test/CodeGen/builtins.c
+++ b/test/CodeGen/builtins.c
@@ -293,7 +293,7 @@
// CHECK: store i8 34, i8* [[ARG2_DESC]]
// CHECK: [[ARG2_SIZE:%.*]] = getelementptr i8, i8* [[BUF2]], i64 9
// CHECK: store i8 8, i8* [[ARG2_SIZE]]
- // CHECK: [[ARG2:%.*]] = getelementptr i8, i8* [[BUF2]], i64 10
+ // CHECK: [[ARG2:%.*]] = getelementptr i8, i8* [[BUF2]], i64 10
// CHECK: [[ARG2_PTR:%.*]] = bitcast i8* [[ARG2]] to i8**
// CHECK: [[DATA2:%.*]] = load i8*, i8** [[DATA_ADDR]]
// CHECK: store i8* [[DATA2]], i8** [[ARG2_PTR]]