Skip to content

Commit

Permalink
Merge pull request #149 from kornilova-l/rename-anonymous-parameters
Browse files Browse the repository at this point in the history
Rename anonymous parameters to pN
  • Loading branch information
kornilova203 authored Aug 8, 2018
2 parents ab51928 + 9577892 commit af54d3e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bindgen/visitor/TreeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ bool TreeVisitor::VisitFunctionDecl(clang::FunctionDecl *func) {
std::string pname = parm->getNameAsString();

if (pname.empty()) {
pname = "anonymous" + std::to_string(anonCounter++);
pname = "p" + std::to_string(anonCounter++);
}

std::shared_ptr<Type> ptype = typeTranslator.translate(parm->getType());
Expand Down
5 changes: 2 additions & 3 deletions tests/samples/Function.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ object Function {
def void_arg(): native.CFloat = native.extern
def one_arg(a: native.CInt): native.CChar = native.extern
def two_args(a: native.CFloat, b: native.CInt): native.Ptr[Byte] = native.extern
def anonymous_args(anonymous0: native.CFloat, anonymous1: native.CInt): native.CDouble = native.extern
def anonymous_args(p0: native.CFloat, p1: native.CInt): native.CDouble = native.extern
def variadic_args(a: native.CDouble, varArgs: native.CString, varArgs0: native.CVararg*): native.CDouble = native.extern
def acceptsArray(anonymous0: native.Ptr[native.CInt]): Unit = native.extern
def acceptsArray(p0: native.Ptr[native.CInt]): Unit = native.extern
}

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

4 changes: 2 additions & 2 deletions tests/samples/OpaqueTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ object OpaqueTypes {
type functionPointerWithPointerToOpaqueType = native.CFunctionPtr1[native.Ptr[native.Ptr[struct_undefinedStruct]], native.Ptr[undefinedUnion]]
def move(point: native.Ptr[struct_point], x: native.CInt, y: native.CInt): native.Ptr[struct_point] = native.extern
def processPoints(p: native.Ptr[points]): native.Ptr[union_u] = native.extern
def usePointerToUndefinedStruct(anonymous0: native.Ptr[struct_undefinedStruct]): Unit = native.extern
def usePointerToUndefinedStruct(p0: native.Ptr[struct_undefinedStruct]): Unit = native.extern
def fun(): native.Ptr[native.Ptr[undefinedUnion]] = native.extern
def returnPointerToAliasOfUndefinedStruct(): native.Ptr[aliasForUndefinedStruct] = native.extern
def usePointerToUndefinedIncludedStruct(anonymous0: native.Ptr[undefinedIncludedStruct]): Unit = native.extern
def usePointerToUndefinedIncludedStruct(p0: native.Ptr[undefinedIncludedStruct]): Unit = native.extern
}

import OpaqueTypes._
Expand Down
6 changes: 3 additions & 3 deletions tests/samples/PrivateMembers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ object PrivateMembers {
type privateStructWithTypedefPtr = native.Ptr[struct_privateStructWithTypedef]
def getTypeThatUsesPrivateTypes(): pid_t = native.extern
def getPrivateType(): native.Ptr[__private_type] = native.extern
def usesPrivateUnion(anonymous0: native.Ptr[union___unionWithPrivateName]): Unit = native.extern
def usesPrivateStruct(anonymous0: native.Ptr[struct_structWithPrivateType], anonymous1: native.Ptr[struct_normalStruct]): Unit = native.extern
def usesPrivateEnum(anonymous0: native.Ptr[enum___privateEnum]): Unit = native.extern
def usesPrivateUnion(p0: native.Ptr[union___unionWithPrivateName]): Unit = native.extern
def usesPrivateStruct(p0: native.Ptr[struct_structWithPrivateType], p1: native.Ptr[struct_normalStruct]): Unit = native.extern
def usesPrivateEnum(p0: native.Ptr[enum___privateEnum]): Unit = native.extern
}

import PrivateMembers._
Expand Down
2 changes: 1 addition & 1 deletion tests/samples/ReuseBindings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import scala.scalanative.native._
object ReuseBindings {
type aliasForBigStruct = org.scalanative.bindgen.samples.Struct.struct_bigStruct
type struct_usesImportedEnum = native.CStruct1[org.scalanative.bindgen.samples.Struct.enum_pointIndex]
def useStruct(anonymous0: native.Ptr[org.scalanative.bindgen.samples.Struct.struct_point]): Unit = native.extern
def useStruct(p0: native.Ptr[org.scalanative.bindgen.samples.Struct.struct_point]): Unit = native.extern
def returnTypedef_point_s(): native.Ptr[org.scalanative.bindgen.samples.Struct.struct_point] = native.extern
def returnTypedef_point(): native.Ptr[org.scalanative.bindgen.samples.Struct.point] = native.extern
def readBook(book: native.Ptr[org.scalanative.bindgen.samples.CustomNames.book]): Unit = native.extern
Expand Down
4 changes: 2 additions & 2 deletions tests/samples/native.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import scala.scalanative.native._
object nativeLib {
type nativeFunc0 = native.CInt
@native.link("native")
def nativeFunc0(anonymous0: native.CInt): Unit = native.extern
def nativeFunc(anonymous0: native.CFloat): Unit = native.extern
def nativeFunc0(p0: native.CInt): Unit = native.extern
def nativeFunc(p0: native.CFloat): Unit = native.extern
}

0 comments on commit af54d3e

Please sign in to comment.