Skip to content

Commit 62150a1

Browse files
committed
Avoid duplicate anonymous parameters
1 parent 01751cc commit 62150a1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

TreeVisitor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ bool TreeVisitor::VisitFunctionDecl(clang::FunctionDecl *func) {
1414
std::string retType = typeTranslator.Translate(func->getReturnType());
1515
std::string params = "";
1616

17+
int anonCounter = 0;
18+
1719
for (const clang::ParmVarDecl* parm : func->parameters()){
1820
//Handle default values
1921
std::string pname = handleReservedWords(parm->getNameAsString());
22+
2023
if(pname == ""){
21-
pname = "anonymous";
24+
pname = "anonymous" + std::to_string(anonCounter++);
2225
}
2326

2427
params += pname;

0 commit comments

Comments
 (0)