Skip to content

Commit ee80f6d

Browse files
committed
Cleanup clang
1 parent 645501b commit ee80f6d

File tree

12 files changed

+93
-211
lines changed

12 files changed

+93
-211
lines changed

.clang-format

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,4 @@
1-
---
2-
# BasedOnStyle: LLVM
3-
AccessModifierOffset: -2
4-
ConstructorInitializerIndentWidth: 4
5-
AlignEscapedNewlinesLeft: false
6-
AlignTrailingComments: true
7-
AllowAllParametersOfDeclarationOnNextLine: true
8-
AllowShortIfStatementsOnASingleLine: false
9-
AllowShortLoopsOnASingleLine: false
10-
AlwaysBreakTemplateDeclarations: false
11-
AlwaysBreakBeforeMultilineStrings: false
12-
BreakBeforeBinaryOperators: false
13-
BreakBeforeTernaryOperators: true
14-
BreakConstructorInitializersBeforeComma: false
15-
BinPackParameters: false
16-
ColumnLimit: 80
17-
ConstructorInitializerAllOnOneLineOrOnePerLine: false
18-
DerivePointerBinding: false
19-
ExperimentalAutoDetectBinPacking: false
20-
IndentCaseLabels: false
21-
MaxEmptyLinesToKeep: 1
22-
NamespaceIndentation: None
23-
ObjCSpaceBeforeProtocolList: true
24-
PenaltyBreakBeforeFirstCallParameter: 19
25-
PenaltyBreakComment: 60
26-
PenaltyBreakString: 1000
27-
PenaltyBreakFirstLessLess: 120
28-
PenaltyExcessCharacter: 1000000
29-
PenaltyReturnTypeOnItsOwnLine: 60
30-
PointerBindsToType: true
31-
SpacesBeforeTrailingComments: 1
32-
Cpp11BracedListStyle: true
33-
Standard: Cpp11
34-
IndentWidth: 2
35-
TabWidth: 8
36-
UseTab: Never
37-
BreakBeforeBraces: Attach
38-
IndentFunctionDeclarationAfterType: false
39-
SpacesInParentheses: false
40-
SpacesInAngles: false
41-
SpaceInEmptyParentheses: false
42-
SpacesInCStyleCastParentheses: false
43-
SpaceAfterControlStatementKeyword: true
44-
SpaceBeforeAssignmentOperators: true
45-
ContinuationIndentWidth: 4
46-
...
1+
BasedOnStyle: LLVM
2+
DerivePointerAlignment: false
3+
PointerAlignment: Left
474

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ sudo: false
99
addons:
1010
homebrew:
1111
packages:
12+
- clang-format
1213
- meson
1314
- ninja
1415
update: false # do not update homebrew by default

include/json/config.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@
7474
#if defined(_MSC_VER) && _MSC_VER < 1900
7575
// As recommended at
7676
// https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
77-
extern JSON_API int
78-
msvc_pre1900_c99_snprintf(char* outBuf, size_t size, const char* format, ...);
77+
extern JSON_API int msvc_pre1900_c99_snprintf(char* outBuf, size_t size,
78+
const char* format, ...);
7979
#define jsoncpp_snprintf msvc_pre1900_c99_snprintf
8080
#else
8181
#define jsoncpp_snprintf std::snprintf
@@ -139,16 +139,16 @@ typedef UInt64 LargestUInt;
139139
#endif // if defined(JSON_NO_INT64)
140140

141141
template <typename T>
142-
using Allocator = typename std::conditional<JSONCPP_USING_SECURE_MEMORY,
143-
SecureAllocator<T>,
144-
std::allocator<T>>::type;
142+
using Allocator =
143+
typename std::conditional<JSONCPP_USING_SECURE_MEMORY, SecureAllocator<T>,
144+
std::allocator<T>>::type;
145145
using String = std::basic_string<char, std::char_traits<char>, Allocator<char>>;
146-
using IStringStream = std::basic_istringstream<String::value_type,
147-
String::traits_type,
148-
String::allocator_type>;
149-
using OStringStream = std::basic_ostringstream<String::value_type,
150-
String::traits_type,
151-
String::allocator_type>;
146+
using IStringStream =
147+
std::basic_istringstream<String::value_type, String::traits_type,
148+
String::allocator_type>;
149+
using OStringStream =
150+
std::basic_ostringstream<String::value_type, String::traits_type,
151+
String::allocator_type>;
152152
using IStream = std::istream;
153153
using OStream = std::ostream;
154154
} // namespace Json

include/json/reader.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,7 @@ class JSON_API CharReader {
262262
* \return \c true if the document was successfully parsed, \c false if an
263263
* error occurred.
264264
*/
265-
virtual bool parse(char const* beginDoc,
266-
char const* endDoc,
267-
Value* root,
265+
virtual bool parse(char const* beginDoc, char const* endDoc, Value* root,
268266
String* errs) = 0;
269267

270268
class JSON_API Factory {
@@ -364,9 +362,7 @@ class JSON_API CharReaderBuilder : public CharReader::Factory {
364362
* Someday we might have a real StreamReader, but for now this
365363
* is convenient.
366364
*/
367-
bool JSON_API parseFromStream(CharReader::Factory const&,
368-
IStream&,
369-
Value* root,
365+
bool JSON_API parseFromStream(CharReader::Factory const&, IStream&, Value* root,
370366
String* errs);
371367

372368
/** \brief Read from 'sin' into 'root'.

include/json/value.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,8 @@ class JSON_API Value {
493493
/// Return the member named key if it exist, defaultValue otherwise.
494494
/// \note deep copy
495495
/// \note key may contain embedded nulls.
496-
Value
497-
get(const char* begin, const char* end, const Value& defaultValue) const;
496+
Value get(const char* begin, const char* end,
497+
const Value& defaultValue) const;
498498
/// Return the member named key if it exist, defaultValue otherwise.
499499
/// \note deep copy
500500
/// \param key may contain embedded nulls.
@@ -691,8 +691,7 @@ class JSON_API PathArgument {
691691
*/
692692
class JSON_API Path {
693693
public:
694-
Path(const String& path,
695-
const PathArgument& a1 = PathArgument(),
694+
Path(const String& path, const PathArgument& a1 = PathArgument(),
696695
const PathArgument& a2 = PathArgument(),
697696
const PathArgument& a3 = PathArgument(),
698697
const PathArgument& a4 = PathArgument(),
@@ -709,10 +708,8 @@ class JSON_API Path {
709708
typedef std::vector<PathArgument> Args;
710709

711710
void makePath(const String& path, const InArgs& in);
712-
void addPathInArg(const String& path,
713-
const InArgs& in,
714-
InArgs::const_iterator& itInArg,
715-
PathArgument::Kind kind);
711+
void addPathInArg(const String& path, const InArgs& in,
712+
InArgs::const_iterator& itInArg, PathArgument::Kind kind);
716713
static void invalidPath(const String& path, int location);
717714

718715
Args args_;

include/json/writer.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,9 @@ String JSON_API valueToString(UInt value);
346346
#endif // if defined(JSON_HAS_INT64)
347347
String JSON_API valueToString(LargestInt value);
348348
String JSON_API valueToString(LargestUInt value);
349-
String JSON_API
350-
valueToString(double value,
351-
unsigned int precision = Value::defaultRealPrecision,
352-
PrecisionType precisionType = PrecisionType::significantDigits);
349+
String JSON_API valueToString(
350+
double value, unsigned int precision = Value::defaultRealPrecision,
351+
PrecisionType precisionType = PrecisionType::significantDigits);
353352
String JSON_API valueToString(bool value);
354353
String JSON_API valueToQuotedString(const char* value);
355354

src/jsontestrunner/main.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ static Json::String readInputTestFile(const char* path) {
6868
return text;
6969
}
7070

71-
static void
72-
printValueTree(FILE* fout, Json::Value& value, const Json::String& path = ".") {
71+
static void printValueTree(FILE* fout, Json::Value& value,
72+
const Json::String& path = ".") {
7373
if (value.hasComment(Json::commentBefore)) {
7474
fprintf(fout, "%s\n", value.getComment(Json::commentBefore).c_str());
7575
}
@@ -125,8 +125,7 @@ printValueTree(FILE* fout, Json::Value& value, const Json::String& path = ".") {
125125
static int parseAndSaveValueTree(const Json::String& input,
126126
const Json::String& actual,
127127
const Json::String& kind,
128-
const Json::Features& features,
129-
bool parseOnly,
128+
const Json::Features& features, bool parseOnly,
130129
Json::Value* root) {
131130
Json::Reader reader(features);
132131
bool parsingSuccessful =

0 commit comments

Comments
 (0)