Skip to content

Commit 208f533

Browse files
committed
CPP: Brace placement.
1 parent c406746 commit 208f533

File tree

1 file changed

+36
-72
lines changed

1 file changed

+36
-72
lines changed

cpp/ql/src/semmle/code/cpp/Function.qll

Lines changed: 36 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ private import semmle.code.cpp.internal.ResolveClass
1111
* A C/C++ function [N4140 8.3.5]. Both member functions and non-member
1212
* functions are included. For example the function `MyFunction` in:
1313
* ```
14-
* void MyFunction()
15-
* {
14+
* void MyFunction() {
1615
* DoSomething();
1716
* }
1817
* ```
@@ -509,8 +508,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
509508
* ```
510509
* void MyFunction();
511510
*
512-
* void MyFunction()
513-
* {
511+
* void MyFunction() {
514512
* DoSomething();
515513
* }
516514
* ```
@@ -722,16 +720,13 @@ class FunctionDeclarationEntry extends DeclarationEntry, @fun_decl {
722720
* class). For example the in the following code, `MyFunction` is a
723721
* `TopLevelFunction` but `MyMemberFunction` is not:
724722
* ```
725-
* void MyFunction()
726-
* {
723+
* void MyFunction() {
727724
* DoSomething();
728725
* }
729726
*
730-
* class MyClass
731-
* {
727+
* class MyClass {
732728
* public:
733-
* void MyMemberFunction()
734-
* {
729+
* void MyMemberFunction() {
735730
* DoSomething();
736731
* }
737732
* };
@@ -750,16 +745,13 @@ class TopLevelFunction extends Function {
750745
* static member functions. For example the functions `MyStaticMemberFunction`
751746
* and `MyMemberFunction` in:
752747
* ```
753-
* class MyClass
754-
* {
748+
* class MyClass {
755749
* public:
756-
* void MyMemberFunction()
757-
* {
750+
* void MyMemberFunction() {
758751
* DoSomething();
759752
* }
760753
*
761-
* static void MyStaticMemberFunction()
762-
* {
754+
* static void MyStaticMemberFunction() {
763755
* DoSomething();
764756
* }
765757
* };
@@ -822,17 +814,14 @@ class MemberFunction extends Function {
822814
* `myVirtualFunction` in the following code are each a
823815
* `VirtualFunction`:
824816
* ```
825-
* class A
826-
* {
817+
* class A {
827818
* public:
828819
* virtual void myVirtualFunction() = 0;
829820
* };
830821
*
831-
* class B: public A
832-
* {
822+
* class B: public A {
833823
* public:
834-
* virtual void myVirtualFunction()
835-
* {
824+
* virtual void myVirtualFunction() {
836825
* doSomething();
837826
* }
838827
* };
@@ -860,17 +849,14 @@ class VirtualFunction extends MemberFunction {
860849
* A C++ pure virtual function [N4140 10.4]. For example the first function
861850
* called `myVirtualFunction` in the following code:
862851
* ```
863-
* class A
864-
* {
852+
* class A {
865853
* public:
866854
* virtual void myVirtualFunction() = 0;
867855
* };
868856
*
869-
* class B: public A
870-
* {
857+
* class B: public A {
871858
* public:
872-
* virtual void myVirtualFunction()
873-
* {
859+
* virtual void myVirtualFunction() {
874860
* doSomething();
875861
* }
876862
* };
@@ -888,12 +874,10 @@ class PureVirtualFunction extends VirtualFunction {
888874
* `const` specifier and does not modify the state of its class. For example
889875
* the member function `day` in the following code:
890876
* ```
891-
* class MyClass
892-
* {
877+
* class MyClass {
893878
* ...
894879
*
895-
* int day() const
896-
* {
880+
* int day() const {
897881
* return d;
898882
* }
899883
*
@@ -912,11 +896,9 @@ class ConstMemberFunction extends MemberFunction {
912896
* A C++ constructor [N4140 12.1]. For example the function `MyClass` in the
913897
* following code is a constructor:
914898
* ```
915-
* class MyClass
916-
* {
899+
* class MyClass {
917900
* public:
918-
* MyClass()
919-
* {
901+
* MyClass() {
920902
* ...
921903
* }
922904
* };
@@ -971,11 +953,9 @@ abstract class ImplicitConversionFunction extends MemberFunction {
971953
* A C++ constructor that also defines an implicit conversion. For example the
972954
* function `MyClass` in the following code is a `ConversionConstructor`:
973955
* ```
974-
* class MyClass
975-
* {
956+
* class MyClass {
976957
* public:
977-
* MyClass(const MyOtherClass &from)
978-
* {
958+
* MyClass(const MyOtherClass &from) {
979959
* ...
980960
* }
981961
* };
@@ -1018,11 +998,9 @@ private predicate hasMoveSignature(MemberFunction f) {
1018998
* A C++ copy constructor [N4140 12.8]. For example the function `MyClass` in
1019999
* the following code is a `CopyConstructor`:
10201000
* ```
1021-
* class MyClass
1022-
* {
1001+
* class MyClass {
10231002
* public:
1024-
* MyClass(const MyClass &from)
1025-
* {
1003+
* MyClass(const MyClass &from) {
10261004
* ...
10271005
* }
10281006
* };
@@ -1079,11 +1057,9 @@ class CopyConstructor extends Constructor {
10791057
* A C++ move constructor [N4140 12.8]. For example the function `MyClass` in
10801058
* the following code is a `MoveConstructor`:
10811059
* ```
1082-
* class MyClass
1083-
* {
1060+
* class MyClass {
10841061
* public:
1085-
* MyClass(const MyClass &&from)
1086-
* {
1062+
* MyClass(const MyClass &&from) {
10871063
* ...
10881064
* }
10891065
* };
@@ -1142,11 +1118,9 @@ class MoveConstructor extends Constructor {
11421118
* example the function `MyClass` in the following code is a
11431119
* `NoArgConstructor`:
11441120
* ```
1145-
* class MyClass
1146-
* {
1121+
* class MyClass {
11471122
* public:
1148-
* MyClass()
1149-
* {
1123+
* MyClass() {
11501124
* ...
11511125
* }
11521126
* };
@@ -1162,11 +1136,9 @@ class NoArgConstructor extends Constructor {
11621136
* A C++ destructor [N4140 12.4]. For example the function `~MyClass` in the
11631137
* following code is a destructor:
11641138
* ```
1165-
* class MyClass
1166-
* {
1139+
* class MyClass {
11671140
* public:
1168-
* ~MyClass()
1169-
* {
1141+
* ~MyClass() {
11701142
* ...
11711143
* }
11721144
* };
@@ -1199,8 +1171,7 @@ class Destructor extends MemberFunction {
11991171
* A C++ conversion operator [N4140 12.3.2]. For example the function
12001172
* `operator int` in the following code is a `ConversionOperator`:
12011173
* ```
1202-
* class MyClass
1203-
* {
1174+
* class MyClass {
12041175
* public:
12051176
* operator int();
12061177
* };
@@ -1232,8 +1203,7 @@ class Operator extends Function {
12321203
* A C++ copy assignment operator [N4140 12.8]. For example the function
12331204
* `operator=` in the following code is a `CopyAssignmentOperator`:
12341205
* ```
1235-
* class MyClass
1236-
* {
1206+
* class MyClass {
12371207
* public:
12381208
* MyClass &operator=(const MyClass &other);
12391209
* };
@@ -1264,8 +1234,7 @@ class CopyAssignmentOperator extends Operator {
12641234
* A C++ move assignment operator [N4140 12.8]. For example the function
12651235
* `operator=` in the following code is a `MoveAssignmentOperator`:
12661236
* ```
1267-
* class MyClass
1268-
* {
1237+
* class MyClass {
12691238
* public:
12701239
* MyClass &operator=(const MyClass &&other);
12711240
* };
@@ -1293,8 +1262,7 @@ class MoveAssignmentOperator extends Operator {
12931262
* the function `myTemplateFunction` in the following code:
12941263
* ```
12951264
* template<class T>
1296-
* void myTemplateFunction(T t)
1297-
* {
1265+
* void myTemplateFunction(T t) {
12981266
* ...
12991267
* }
13001268
* ```
@@ -1339,13 +1307,11 @@ class TemplateFunction extends Function {
13391307
* the instantiation `myTemplateFunction<int>` in the following code:
13401308
* ```
13411309
* template<class T>
1342-
* void myTemplateFunction(T t)
1343-
* {
1310+
* void myTemplateFunction(T t) {
13441311
* ...
13451312
* }
13461313
*
1347-
* void caller(int i)
1348-
* {
1314+
* void caller(int i) {
13491315
* myTemplateFunction<int>(i);
13501316
* }
13511317
* ```
@@ -1374,14 +1340,12 @@ class FunctionTemplateInstantiation extends Function {
13741340
* function `myTemplateFunction<int>` in the following code:
13751341
* ```
13761342
* template<class T>
1377-
* void myTemplateFunction(T t)
1378-
* {
1343+
* void myTemplateFunction(T t) {
13791344
* ...
13801345
* }
13811346
*
13821347
* template<>
1383-
* void myTemplateFunction<int>(int i)
1384-
* {
1348+
* void myTemplateFunction<int>(int i) {
13851349
* ...
13861350
* }
13871351
* ```

0 commit comments

Comments
 (0)