Skip to content
Snippets Groups Projects
Commit 05ee1288 authored by Axel Naumann's avatar Axel Naumann
Browse files

Be CINT-compatible: non-default arguments return NULL as DefaultValue()

git-svn-id: http://root.cern.ch/svn/root/trunk@47449 27541ba8-7e3a-0410-8455-c3a389f83636
parent aab8ee6c
No related branches found
No related tags found
No related merge requests found
...@@ -115,27 +115,29 @@ const char *TClingMethodArgInfo::DefaultValue() const ...@@ -115,27 +115,29 @@ const char *TClingMethodArgInfo::DefaultValue() const
static std::string buf; static std::string buf;
buf.clear(); buf.clear();
llvm::raw_string_ostream out(buf); llvm::raw_string_ostream out(buf);
if (expr) { if (!expr) {
bool implicitInit = false; // CINT returned NULL for non-defaulted args.
if (const clang::CXXConstructExpr *construct = return 0;
llvm::dyn_cast<clang::CXXConstructExpr>(expr)) { }
implicitInit = (pvd->getInitStyle() == clang::VarDecl::CallInit) && bool implicitInit = false;
(construct->getNumArgs() == 0) && if (const clang::CXXConstructExpr *construct =
!construct->isListInitialization(); llvm::dyn_cast<clang::CXXConstructExpr>(expr)) {
implicitInit = (pvd->getInitStyle() == clang::VarDecl::CallInit) &&
(construct->getNumArgs() == 0) &&
!construct->isListInitialization();
}
if (!implicitInit) {
if (pvd->getInitStyle() == clang::VarDecl::CallInit) {
//out << "(";
} }
if (!implicitInit) { else if (pvd->getInitStyle() == clang::VarDecl::CInit) {
if (pvd->getInitStyle() == clang::VarDecl::CallInit) { //out << " = ";
//out << "("; }
} expr->printPretty(out, 0, policy, /*Indentation=*/0);
else if (pvd->getInitStyle() == clang::VarDecl::CInit) { if (pvd->getInitStyle() == clang::VarDecl::CallInit) {
//out << " = "; //out << ")";
}
expr->printPretty(out, 0, policy, /*Indentation=*/0);
if (pvd->getInitStyle() == clang::VarDecl::CallInit) {
//out << ")";
}
out.flush();
} }
out.flush();
} }
return buf.c_str(); return buf.c_str();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment