* Sample file to demonstrate various clang-format messages
*/
#include <string>
#include <vector>
#include <stdio.h>
namespace foo {
int foo;
namespace bar {
int bar;
namespace {
int anony;
}
}
* A Class comment
*/
class Example {
public:
Example() : _aVariable(4), _bVariable(42) {}
Example(int a)
: _aVariable(a),
_bVariable(42),
_AReallyReallyLongVariableName(4),
_AnotherReallyReallyLongVariableNameToTriggerWrapping(42) {
printf("Hello ");
}
~Example() {}
* A Function comment
* AllowShortFunctionsOnASingleLine: Empty
*/
int getOneLineFunction() {
return 0;
}
* AllowShortFunctionsOnASingleLine: Empty
*/
void doNothing() {}
* A Useful Function comment
*/
int manyVariableFunction(unsigned long long arg1, char arg2, unsigned long long arg3);
private:
int _aVariable;
long _bVariable;
short _cVarianble = 49;
long _AReallyReallyLongVariableName;
long _AnotherReallyReallyLongVariableNameToTriggerWrapping;
};
int foo3() {
return 42;
}
template <typename T>
T myAdd(T x, T y) {
return x + y;
}
int Example::manyVariableFunction(unsigned long long argWithLongName,
char arg2,
unsigned long long argWithAnotherLongName) {
int aaaa = 12;
int b = 23;
int ccc = 23;
const char* some_pointer = "Hello";
std::vector<std::pair<std::string, int>> list;
char* some_nonconst_pointer = (char*)some_pointer;
if (argWithLongName == 0) {
} else if (b % 7 = 3) {
}
else {
}
if (arg2 == 'a')
arg2 = 'b';
int bbbbbbbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccccccccc;
int aaaaaaaaaaaaaaaaaaaaaaaaaaaa =
bbbbbbbbbbbbbbbbbbbbbbbbbbbb + cccccccccccccccccccccccccccccc;
int dddddddddddddddddddddddddddd = aaaaaaaaaaaaaaaaaaaaaaaaaaaa * 7 + 4 % 235124 > 275645
? bbbbbbbbbbbbbbbbbbbbbbbbbbbb + 897234
: cccccccccccccccccccccccccccccc % 1293402;
if (b) {
return 3;
}
while (b < 5)
b++;
if (b > 5 || b % 42 || cccccccccccccccccccccccccccccc % 873 || aaaa * 12312 % 23485 != 9873 ||
some_pointer != 0) {
printf("Huh!\n");
}
printf("A short function call %s %s %d - %ld\n", "", "tgz", 4, ULONG_MAX);
printf("A long function call %s %s %d - %ld\n",
"http://www.mongodbo.org/downloads",
"mongodb-latest.tgz",
4,
ULONG_MAX);
printf("Thing1 %s\n", "Thing2");
printf("%c\n", arg2);
switch (arg2) {
case 'a':
return 2;
case 'y':
case 'z':
break;
default:
break;
}
do {
} while (0);
return 1;
}
}