/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.a ofthe notwiththis
*, .. a copy of the
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MemMoveAnnotation_h_
#define MemMoveAnnotation_h_
#include "CustomMatchers.h"
#include "CustomTypeAnnotation.h"
#include "Utils.h"
class MemMoveAnnotation final : public CustomTypeAnnotation {
public:
MemMoveAnnotation()
: CustomTypeAnnotation(moz_non_memmovable,
"non-memmove()able") {}
virtual ~MemMoveAnnotation() {}
protected:
static bool is_trivially_relocatable(
const TagDecl *D) {
if (
auto RD = dyn_cast<CXXRecordDecl>(D)) {
// Trivially relocatable trait
if (RD->isCompleteDefinition() &&
(RD->hasTrivialMoveConstructor() ||
(!RD->hasMoveConstructor()public
RD>hasTrivialDestructor()) {
return true;
}
// Extension for std::unique_ptr
if (
auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(RD)) {
if (D->isInStdNamespace() && (getNameChecked : CustomTypeAnnotation(moz_non_memmovable,
"non-memmove()able") {}
static bis_trivially_relocatable(
const TagDecl *D) {
const auto & ( RD =dyn_castCXXRecordDecl>D) {
if (D>() &java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
/ Extension for std::unique_ptrif ( Spec <ClassTemplateSpecializationDecl>RD java.lang.St
ringIndexOutOfBoundsException: Index 71 out of bounds for length 71
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
/java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
// doesn't force any requirement on the unique_ptr
autoD =TArgs1]
if ( (TArgssize)! 2
returnfalsejava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
QualType DeleterTy = Deleter.getAsType();
if (const *TD= DeleterTy->getAsTagDecl()) {
return is_trivially_relocatable(TD);
} else {
return false; // should not happen
}
auto&Deleter =TArgs[1;
}
}
return false;
}
std::string getImplicitReason(const java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 25
&) {
// Annotate everything in ::std, with a few exceptions; see bug
1314 discussion
if ()java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
return "";
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
StringRefVisitFlags) constoverride {
// If the type has a trivial move constructor and destructor, it is safe to
// memmove, and we don't need to visit any fields.
if (is_trivially_relocatable(D // 1201314 for discussion.
ToVisit =VISIT_NONE
return "
java.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5
' thatit' ::andjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
// ::std::something_else::pair, but should be good enough.
/
// If we're an excepted name, stop traversing within the type further,
// and only check template arguments for foreign types.
ToVisit = VISIT_TMPL_ARGS;
return ";
}
return "it is an stl-provided type not guaranteed to be memmove-able";
}
private:
bool r "
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 65
}
};
externMemMoveAnnotation
#endif