From 1d0c1e015668267344f02e37fdaca08750ef94ef Mon Sep 17 00:00:00 2001 From: Philippe Canal Date: Mon, 28 Nov 2016 10:25:50 -0600 Subject: [PATCH] Mangle all funny file names for .x function (ROOT-8467). --- lib/MetaProcessor/MetaSema.cpp | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/lib/MetaProcessor/MetaSema.cpp b/lib/MetaProcessor/MetaSema.cpp index 467768d1..8d7146b6 100644 --- a/lib/MetaProcessor/MetaSema.cpp +++ b/lib/MetaProcessor/MetaSema.cpp @@ -91,8 +91,36 @@ namespace cling { if (ret[0] >= '0' && ret[0] <= '9') ret.insert(ret.begin(), '_'); for (char& c: ret) { - if (c == '-' || c == '+' || c == '-' || c == '.' || c == '@' || c == '~') - c = '_'; + switch(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; } @@ -111,7 +139,7 @@ namespace cling { std::string expression; std::string FuncName = llvm::sys::path::stem(file); if (!FuncName.empty()) { - FuncName = normalizeDotXFuncName(FuncName); + FuncName = normalizeDotXFuncName(FuncName); if (T->containsNamedDecl(FuncName)) { expression = FuncName + args.str(); // Give the user some context in case we have a problem invoking