fix for translating filenames beginning with numbers to C++ variable names

This commit is contained in:
Vern Paxson 2021-12-10 09:27:21 -08:00
parent 9d884c0285
commit 474a2edc98

View file

@ -206,6 +206,10 @@ string CPPCompile::BodyName(const FuncInfo& func)
string fns = fn; string fns = fn;
transform(fns.begin(), fns.end(), fns.begin(), canonicalize); transform(fns.begin(), fns.end(), fns.begin(), canonicalize);
if ( ! isalpha(fns[0]) )
// This can happen for filenames beginning with numbers.
fns = "_" + fns;
fname = fns + "__" + fname; fname = fns + "__" + fname;
} }