case 'e':
return llvm::make_unique<PrintfArgChecker> (gerr_arg_handler,
this->pcontext, this->ci);
- default:
- print_warning (std::string("unknown parser flag: ") + type,
+ default: {
+ auto err_msg = std::string ("unknown parser flag: ") + type;
+ print_warning (err_msg.c_str(),
e, this->pcontext, this->ci);
break;
+ }
}
return nullptr;
<< ", got " <<
(E->getNumArgs () - (pos + 1))
<< " args";
- print_error (err_buf.str(), E, this->pcontext, this->ci);
+ print_error (err_buf.str().c_str(), E, this->pcontext, this->ci);
return false;
}
auto type = arg->getType ().split ().Ty;
if (!type->isPointerType ()) {
- print_error (
- std::string ("bad string argument for %s: ") +
- arg->getType ().getAsString (),
+ auto err_msg = std::string ("bad string argument for %s: ") +
+ arg->getType ().getAsString ();
+ print_error (err_msg.c_str(),
arg, ctx->past, ctx->pci);
return false;
}
if (desugared_type) {
desugared_type->dump ();
}
- print_error (
- std::string ("bad string argument for %s: ") +
- arg->getType ().getAsString (),
+ auto err_msg = std::string ("bad string argument for %s: ") +
+ arg->getType ().getAsString ();
+ print_error (err_msg.c_str(),
arg, ctx->past, ctx->pci);
return false;
}
auto desugared_type = type->getUnqualifiedDesugaredType ();
if (!desugared_type->isBuiltinType ()) {
- print_error (
- std::string ("not a builtin type for ") + fmt + " arg: " +
- arg->getType ().getAsString (),
+ auto err_msg = std::string ("not a builtin type for ") + fmt + " arg: " +
+ arg->getType ().getAsString ();
+ print_error (err_msg.c_str(),
arg, ctx->past, ctx->pci);
return false;
}
}
if (!found) {
- print_error (
- std::string ("bad argument for ") + fmt + " arg: " +
- arg->getType ().getAsString () + ", resolved as: " +
- builtin_type->getNameAsCString (ctx->past->getPrintingPolicy ()),
+ auto err_msg = std::string ("bad argument for ") +
+ fmt + " arg: " +
+ arg->getType ().getAsString () +
+ ", resolved as: " +
+ builtin_type->getNameAsCString (ctx->past->getPrintingPolicy ());
+ print_error (err_msg.c_str(),
arg, ctx->past, ctx->pci);
return false;
}
auto type = arg->getType ().split ().Ty;
if (!type->isPointerType ()) {
- print_error (
- std::string ("bad pointer argument for %p: ") +
- arg->getType ().getAsString (),
+ auto err_msg = std::string ("bad pointer argument for %p: ") +
+ arg->getType ().getAsString ();
+ print_error (err_msg.c_str(),
arg, ctx->past, ctx->pci);
return false;
}
auto type = arg->getType ().split ().Ty;
if (!type->isPointerType ()) {
- print_error (
- std::string ("bad string argument for %s: ") +
- arg->getType ().getAsString (),
+ auto err_msg = std::string ("non pointer argument for %s: ") +
+ arg->getType ().getAsString ();
+ print_error (err_msg.c_str(),
arg, ctx->past, ctx->pci);
return false;
}
auto desugared_type = ptr_type->getUnqualifiedDesugaredType ();
if (!desugared_type->isRecordType ()) {
- print_error (
- std::string ("not a record type for ") + fmt + " arg: " +
- arg->getType ().getAsString (),
+ auto err_msg = std::string ("not a record type for ") + fmt + " arg: " +
+ arg->getType ().getAsString ();
+ print_error (err_msg.c_str(),
arg, ctx->past, ctx->pci);
return false;
}
auto struct_def = struct_decl->getNameAsString ();
if (struct_def != sname) {
- print_error (std::string ("bad argument '") + struct_def + "' for "
- + fmt + " arg: " +
- arg->getType ().getAsString (),
+ auto err_msg = std::string ("bad argument '") + struct_def + "' for "
+ + fmt + " arg: " +
+ arg->getType ().getAsString ();
+ print_error (err_msg.c_str(),
arg, ctx->past, ctx->pci);
return false;
}