Mangle all funny file names for .x function (ROOT-8467).

This commit is contained in:
Philippe Canal 2016-11-28 10:25:50 -06:00 committed by sftnight
parent 5e14792560
commit 1d0c1e0156

View File

@ -91,8 +91,36 @@ namespace cling {
if (ret[0] >= '0' && ret[0] <= '9') if (ret[0] >= '0' && ret[0] <= '9')
ret.insert(ret.begin(), '_'); ret.insert(ret.begin(), '_');
for (char& c: ret) { for (char& c: ret) {
if (c == '-' || c == '+' || c == '-' || c == '.' || c == '@' || c == '~') switch(c) {
c = '_'; case '+': c = '_'; break;
case '-': c = '_'; break;
case '*': c = '_'; break;
case '/': c = '_'; break;
case '&': c = '_'; break;
case '%': c = '_'; break;
case '|': c = '_'; break;
case '^': c = '_'; break;
case '>': c = '_'; break;
case '<': c = '_'; break;
case '=': c = '_'; break;
case '~': c = '_'; break;
case '.': c = '_'; break;
case '(': c = '_'; break;
case ')': c = '_'; break;
case '[': c = '_'; break;
case ']': c = '_'; break;
case '!': c = '_'; break;
case ',': c = '_'; break;
case '$': c = '_'; break;
case ' ': c = '_'; break;
case ':': c = '_'; break;
case '"': c = '_'; break;
case '@': c = '_'; break;
case '\'': c = '_'; break;
case '\\': c = '_'; break;
default:
/* nothing to do */
};
} }
return ret; return ret;
} }
@ -111,7 +139,7 @@ namespace cling {
std::string expression; std::string expression;
std::string FuncName = llvm::sys::path::stem(file); std::string FuncName = llvm::sys::path::stem(file);
if (!FuncName.empty()) { if (!FuncName.empty()) {
FuncName = normalizeDotXFuncName(FuncName); FuncName = normalizeDotXFuncName(FuncName);
if (T->containsNamedDecl(FuncName)) { if (T->containsNamedDecl(FuncName)) {
expression = FuncName + args.str(); expression = FuncName + args.str();
// Give the user some context in case we have a problem invoking // Give the user some context in case we have a problem invoking