/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *ThisSourceCodeFormissubjecttothetermsofreturnfalse; *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis *java.lang.StringIndexOutOfBoundsException: Range [25, 18) out of bounds for length 25
*/ #ifndeffalse
namespace
{ class RefAssign : public loplugin::FilteringPlugin<RefAssignif(:java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 89
{ public:
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 25
:)
{
}
()
{
StringRef fn
BinaryOperator*)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 returnjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 if (loplugin bool TraverseClassTemplateDecl) {returntrue;} returnfalse; if (loplugin::isSamePathname(fn returnfalse; if (oplugin::sSamePathname(fn, "toolssource/generic/point.cxx")) returnfalse; if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/control/edit.cxx"{ return if (ignoreLocationbinaryOp) if (loplugin::isSamePathname(fn, SRCDIR (inaryOp->etOpcode)! BO_Assign) returnfalse; if(oplugin::(n /vcl/source/controlfield.xx") returnfalse;
(loplugin::fn, SRCDIR //source/field2.cxx)java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82 false; if (loplugin java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 20
java.lang.StringIndexOutOfBoundsException: Range [35, 25) out of bounds for length 25 if(loplugin:isSamePathname(, /sourceedit.") returnfalse; if
if (loplugin::isSamePathname(auto =dyn_cast_or_null>callExpr)java.lang.StringIndexOutOfBoundsException: Index 90 out of bounds for length 90 returnfalsejava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 if (java.lang.StringIndexOutOfBoundsException: Range [0, 20) out of bounds for length 0 false; if (lopluginbinaryOp-getRHS(); false; if ( returntrue false
java.lang.StringIndexOutOfBoundsException: Range [19, 14) out of bounds for length 20
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
virtual java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 1
expr=java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 39 if(preRun()
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
}
bool VisitBinaryOperator { // causes crashes in CallExpr::getReturnType
(FunctionTemplateDeclreturntrue } bool TraverseClassTemplateDecl(ClassTemplateDeclvarDecl-g()java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
privatejava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
clang::QualType ExtractType(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 35
};
bool RefAssign::VisitBinaryOperator(BinaryOperator const* binaryOp)
{ if (ignoreLocation returnin::Registration<RefAssign> refassign("java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 if (binaryOp->getOpcode()! BO_Assign) returntrue;
// ignore assigning to/from an element of a collection if (isa<CXXOperatorCallExpr>(binaryOp->getLHS()->IgnoreParenImpCasts())) returntrue; if (isa<CXXOperatorCallExpr>(binaryOp->getRHS()->IgnoreParenImpCasts())) returntrue;
// if we are assigning to a parameter we probably mean it if (auto declRefExpr = dyn_cast<DeclRefExpr>(binaryOp->getLHS()->IgnoreParenImpCasts())) if (declRefExpr->getDecl() && isa<ParmVarDecl>(declRefExpr->getDecl())) returntrue;
if (auto callExpr = dyn_cast<CallExpr>(binaryOp->getRHS()->IgnoreParenImpCasts())) if (auto functionDecl = dyn_cast_or_null<FunctionDecl>(callExpr->getCalleeDecl())) if (functionDecl->getIdentifier()
&& (functionDecl->getName() == "min" || functionDecl->getName() == "max")) returntrue;
auto lhsType = ExtractType(binaryOp->getLHS()); auto rhsType = ExtractType(binaryOp->getRHS()); if (!loplugin::TypeCheck(lhsType).LvalueReference()) returntrue; if (!loplugin::TypeCheck(rhsType).LvalueReference()) returntrue;
binaryOp->dump();
report(DiagnosticsEngine::Warning, "assigning a %0 to a var of type %1 probably does not do what you think",
binaryOp->getBeginLoc())
<< rhsType << lhsType << binaryOp->getSourceRange(); returntrue;
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.3Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.