aboutsummaryrefslogtreecommitdiffstats
path: root/clang-plugin
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-17 19:00:05 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-17 19:00:05 +0100
commitd670c33cad4a4198d0b58e3fb3814c0ce36867a5 (patch)
tree23d61347189f09a5aa63bf67ac73be279f79c3b1 /clang-plugin
parent5f453d2a9e92fafe1f3b043f640c0c589e193750 (diff)
downloadrspamd-d670c33cad4a4198d0b58e3fb3814c0ce36867a5.tar.gz
rspamd-d670c33cad4a4198d0b58e3fb3814c0ce36867a5.zip
[Minor] More fixes to plugin
Diffstat (limited to 'clang-plugin')
-rw-r--r--clang-plugin/printf_check.cc61
1 files changed, 33 insertions, 28 deletions
diff --git a/clang-plugin/printf_check.cc b/clang-plugin/printf_check.cc
index 9589f8d9c..cecd845a2 100644
--- a/clang-plugin/printf_check.cc
+++ b/clang-plugin/printf_check.cc
@@ -207,10 +207,12 @@ namespace rspamd {
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;
@@ -436,7 +438,7 @@ namespace rspamd {
<< ", 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;
}
@@ -480,9 +482,9 @@ namespace rspamd {
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;
}
@@ -499,9 +501,9 @@ namespace rspamd {
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;
}
@@ -519,9 +521,9 @@ namespace rspamd {
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;
}
@@ -538,10 +540,12 @@ namespace rspamd {
}
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;
}
@@ -672,9 +676,9 @@ namespace rspamd {
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;
}
@@ -733,9 +737,9 @@ namespace rspamd {
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;
}
@@ -744,9 +748,9 @@ namespace rspamd {
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;
}
@@ -756,9 +760,10 @@ namespace rspamd {
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;
}