Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Stornelli2019-04-12 12:15:16 -0400
committerMarco Stornelli2019-05-12 09:42:21 -0400
commitf893b77dba991ba1b3348d72267573540e9ce8bd (patch)
tree91b5f2cbe30fb629af8007f444b31b138c077039 /core/org.eclipse.cdt.ui.tests/resources
parent826a0b2c0effc6a8d1479ddbff8d5b4bbd31a6b6 (diff)
downloadorg.eclipse.cdt-f893b77dba991ba1b3348d72267573540e9ce8bd.tar.gz
org.eclipse.cdt-f893b77dba991ba1b3348d72267573540e9ce8bd.tar.xz
org.eclipse.cdt-f893b77dba991ba1b3348d72267573540e9ce8bd.zip
Bug 461435 - Added options to format pointers in methods
Rules used: 1) Default is right alignment to be compliant with built-in formatter rules; 2) Pointer with declarator without name will be always left alignment unless there's a nested declarator; 3) Return value of methods/functions is always left alignment; 4) If left alignment is selected, if space after comma is selected too for a declaration list, space is always forced after the comma. Change-Id: I82d5ad130e665e5357644cc59655a558f3fb732f Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests/resources')
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/constalign/leftChanged/After.cpp8
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/constalign/leftChanged/Before.cpp2
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/constalign/rightChanged/After.cpp8
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/constalign/rightChanged/Before.cpp2
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp4
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp8
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp8
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/templates/After.cpp10
8 files changed, 25 insertions, 25 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/resources/constalign/leftChanged/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/constalign/leftChanged/After.cpp
index 658556eec44..2b257faac69 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/constalign/leftChanged/After.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/constalign/leftChanged/After.cpp
@@ -1,7 +1,7 @@
-void f(const int * const);
+void f(const int* const);
-void f(const int * const) {
+void f(const int* const) {
}
@@ -11,7 +11,7 @@ int main(int argc, char **argv) {
const int j { 8 };
- const int * const klz;
+ const int *const klz;
const int l { 2 };
@@ -25,4 +25,4 @@ int main(int argc, char **argv) {
using const_int = int;
const const_int s = 7;
-} \ No newline at end of file
+}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/constalign/leftChanged/Before.cpp b/core/org.eclipse.cdt.ui.tests/resources/constalign/leftChanged/Before.cpp
index 71fc943a67f..f25df27fd7b 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/constalign/leftChanged/Before.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/constalign/leftChanged/Before.cpp
@@ -26,4 +26,4 @@ int main(int argc, char **argv) {
using const_int = int;
const_int const s = 7;
-} \ No newline at end of file
+}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/constalign/rightChanged/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/constalign/rightChanged/After.cpp
index d46d4b9ee53..a96b5176bf1 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/constalign/rightChanged/After.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/constalign/rightChanged/After.cpp
@@ -1,7 +1,7 @@
-void f(int const * const);
+void f(int const* const);
-void f(int const * const) {
+void f(int const* const) {
}
@@ -11,7 +11,7 @@ int main(int argc, char **argv) {
int const j { 8 };
- int const * const klz;
+ int const *const klz;
int const l { 2 };
@@ -23,4 +23,4 @@ int main(int argc, char **argv) {
using int_const = int;
int_const const r = 7;
-} \ No newline at end of file
+}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/constalign/rightChanged/Before.cpp b/core/org.eclipse.cdt.ui.tests/resources/constalign/rightChanged/Before.cpp
index 84a0ff7214e..0a73c053946 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/constalign/rightChanged/Before.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/constalign/rightChanged/Before.cpp
@@ -24,4 +24,4 @@ int main(int argc, char **argv) {
using int_const = int;
const int_const r = 7;
-} \ No newline at end of file
+}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp
index 9294a64417a..3aa42ba501e 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp
@@ -24,8 +24,8 @@ AClass::AClass(int x) throw (int) :
int main(int argc, char **argv) {
}
// handling of string concat
-char* s1 = "this " "is " "one " "string.";
-char* s2 = "this " "is "
+char *s1 = "this " "is " "one " "string.";
+char *s2 = "this " "is "
"one " "string.";
// macro definition with line comment
#define ID(x) x // identity
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp
index 4f07ae9de88..e712f9feab8 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp
@@ -7,17 +7,17 @@ public:
Point(double x, double y) :
x(x), y(y) {
}
- double distance(const Point& other) const;
- int compareX(const Point& other) const;
+ double distance(const Point &other) const;
+ int compareX(const Point &other) const;
double x;
double y;
};
-double Point::distance(const Point& other) const {
+double Point::distance(const Point &other) const {
double dx = x - other.x;
double dy = y - other.y;
return sqrt(dx * dx + dy * dy);
}
-int Point::compareX(const Point& other) const {
+int Point::compareX(const Point &other) const {
if (x < other.x) {
return -1;
} else if (x > other.x) {
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp
index 3fb644c93a3..4a449ebf937 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp
@@ -8,9 +8,9 @@ struct SimpleStruct {
float floatNum;
};
-void SimpleStruct_construct(struct SimpleStruct * const s);
+void SimpleStruct_construct(struct SimpleStruct *const s);
-int SimpleStruct_doSomething(const struct SimpleStruct * const s);
+int SimpleStruct_doSomething(const struct SimpleStruct *const s);
#endif /* SIMPLE_H */
@@ -34,14 +34,14 @@ const SimpleStruct array[] = { { SIZEOF(simpleStruct, num),
// single line outside scope
-void SimpleStruct_construct(struct SimpleStruct * const s) {
+void SimpleStruct_construct(struct SimpleStruct *const s) {
// single line
s->num = 1;
s->name = "boo";
s->floatNum = 1.5;
}
-int ConnectParams_doSomething(const struct SimpleStruct * const s) {
+int ConnectParams_doSomething(const struct SimpleStruct *const s) {
/*
* multiline
*/
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/templates/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/templates/After.cpp
index ef9a86282cd..159123ea3b6 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/templates/After.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/templates/After.cpp
@@ -13,16 +13,16 @@ class Foo {
// TEMPLATE_STRUCT
template<class Key, class Value, class SortAlgorithm = DefaultSort>
struct Map {
- Key* keys;
- Value* values;
- SortAlgorithm* sortAlgorithm;
+ Key *keys;
+ Value *values;
+ SortAlgorithm *sortAlgorithm;
Map();
};
// TEMPLATE_CLASS
template<class T> class nonVector {
private:
- T* head;
+ T *head;
public:
nonVector() {
@@ -65,7 +65,7 @@ template<class Bar> void Foo::fum(int i) {
}
// TEMPLATE_VARIABLES
-template<bool threads, int inst> char* default_alloc_template<threads, inst>::S_start_free =
+template<bool threads, int inst> char *default_alloc_template<threads, inst>::S_start_free =
0;
// an instantiation, not a template:

Back to the top