Skip to content

Commit af54d3e

Browse files
authored
Merge pull request #149 from kornilova-l/rename-anonymous-parameters
Rename anonymous parameters to pN
2 parents ab51928 + 9577892 commit af54d3e

File tree

6 files changed

+11
-12
lines changed

6 files changed

+11
-12
lines changed

bindgen/visitor/TreeVisitor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ bool TreeVisitor::VisitFunctionDecl(clang::FunctionDecl *func) {
1818
std::string pname = parm->getNameAsString();
1919

2020
if (pname.empty()) {
21-
pname = "anonymous" + std::to_string(anonCounter++);
21+
pname = "p" + std::to_string(anonCounter++);
2222
}
2323

2424
std::shared_ptr<Type> ptype = typeTranslator.translate(parm->getType());

tests/samples/Function.scala

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ object Function {
1313
def void_arg(): native.CFloat = native.extern
1414
def one_arg(a: native.CInt): native.CChar = native.extern
1515
def two_args(a: native.CFloat, b: native.CInt): native.Ptr[Byte] = native.extern
16-
def anonymous_args(anonymous0: native.CFloat, anonymous1: native.CInt): native.CDouble = native.extern
16+
def anonymous_args(p0: native.CFloat, p1: native.CInt): native.CDouble = native.extern
1717
def variadic_args(a: native.CDouble, varArgs: native.CString, varArgs0: native.CVararg*): native.CDouble = native.extern
18-
def acceptsArray(anonymous0: native.Ptr[native.CInt]): Unit = native.extern
18+
def acceptsArray(p0: native.Ptr[native.CInt]): Unit = native.extern
1919
}
2020

2121
import Function._
@@ -34,4 +34,3 @@ object FunctionHelpers {
3434
def a_=(value: native.CInt): Unit = !p.cast[native.Ptr[native.CInt]] = value
3535
}
3636
}
37-

tests/samples/OpaqueTypes.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ object OpaqueTypes {
2323
type functionPointerWithPointerToOpaqueType = native.CFunctionPtr1[native.Ptr[native.Ptr[struct_undefinedStruct]], native.Ptr[undefinedUnion]]
2424
def move(point: native.Ptr[struct_point], x: native.CInt, y: native.CInt): native.Ptr[struct_point] = native.extern
2525
def processPoints(p: native.Ptr[points]): native.Ptr[union_u] = native.extern
26-
def usePointerToUndefinedStruct(anonymous0: native.Ptr[struct_undefinedStruct]): Unit = native.extern
26+
def usePointerToUndefinedStruct(p0: native.Ptr[struct_undefinedStruct]): Unit = native.extern
2727
def fun(): native.Ptr[native.Ptr[undefinedUnion]] = native.extern
2828
def returnPointerToAliasOfUndefinedStruct(): native.Ptr[aliasForUndefinedStruct] = native.extern
29-
def usePointerToUndefinedIncludedStruct(anonymous0: native.Ptr[undefinedIncludedStruct]): Unit = native.extern
29+
def usePointerToUndefinedIncludedStruct(p0: native.Ptr[undefinedIncludedStruct]): Unit = native.extern
3030
}
3131

3232
import OpaqueTypes._

tests/samples/PrivateMembers.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ object PrivateMembers {
1919
type privateStructWithTypedefPtr = native.Ptr[struct_privateStructWithTypedef]
2020
def getTypeThatUsesPrivateTypes(): pid_t = native.extern
2121
def getPrivateType(): native.Ptr[__private_type] = native.extern
22-
def usesPrivateUnion(anonymous0: native.Ptr[union___unionWithPrivateName]): Unit = native.extern
23-
def usesPrivateStruct(anonymous0: native.Ptr[struct_structWithPrivateType], anonymous1: native.Ptr[struct_normalStruct]): Unit = native.extern
24-
def usesPrivateEnum(anonymous0: native.Ptr[enum___privateEnum]): Unit = native.extern
22+
def usesPrivateUnion(p0: native.Ptr[union___unionWithPrivateName]): Unit = native.extern
23+
def usesPrivateStruct(p0: native.Ptr[struct_structWithPrivateType], p1: native.Ptr[struct_normalStruct]): Unit = native.extern
24+
def usesPrivateEnum(p0: native.Ptr[enum___privateEnum]): Unit = native.extern
2525
}
2626

2727
import PrivateMembers._

tests/samples/ReuseBindings.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import scala.scalanative.native._
88
object ReuseBindings {
99
type aliasForBigStruct = org.scalanative.bindgen.samples.Struct.struct_bigStruct
1010
type struct_usesImportedEnum = native.CStruct1[org.scalanative.bindgen.samples.Struct.enum_pointIndex]
11-
def useStruct(anonymous0: native.Ptr[org.scalanative.bindgen.samples.Struct.struct_point]): Unit = native.extern
11+
def useStruct(p0: native.Ptr[org.scalanative.bindgen.samples.Struct.struct_point]): Unit = native.extern
1212
def returnTypedef_point_s(): native.Ptr[org.scalanative.bindgen.samples.Struct.struct_point] = native.extern
1313
def returnTypedef_point(): native.Ptr[org.scalanative.bindgen.samples.Struct.point] = native.extern
1414
def readBook(book: native.Ptr[org.scalanative.bindgen.samples.CustomNames.book]): Unit = native.extern

tests/samples/native.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ import scala.scalanative.native._
88
object nativeLib {
99
type nativeFunc0 = native.CInt
1010
@native.link("native")
11-
def nativeFunc0(anonymous0: native.CInt): Unit = native.extern
12-
def nativeFunc(anonymous0: native.CFloat): Unit = native.extern
11+
def nativeFunc0(p0: native.CInt): Unit = native.extern
12+
def nativeFunc(p0: native.CFloat): Unit = native.extern
1313
}

0 commit comments

Comments
 (0)