日报240624:禁用chromium里的[chromium-rawptr] 报错

2024-06-26 08:55:26 浏览数 (1)

* RAW_PTR_EXCLUSION 可以禁用error : [chromium-rawptr] Use raw_ptr<T> instead of a raw pointer.

加在字段前面就行,,比如

class MyClass {

public:

// Error expected.

SomeClass* raw_ptr_field1;

// No error expected. Fields can be excluded due to performance reasons.

RAW_PTR_EXCLUSION SomeClass* ignored_ptr_field1;

// Error expected.

SomeClass* raw_ptr_field2;

// No error expected. Fields can be excluded due to performance reasons.

RAW_PTR_EXCLUSION SomeClass* ignored_ptr_field2;

// Error expected.

SomeClass& raw_ref_field1;

// No error expected. Fields can be excluded due to performance reasons.

RAW_PTR_EXCLUSION SomeClass& ignored_ref_field1;

// Error expected.

SomeClass& raw_ref_field2;

// No error expected. Fields can be excluded due to performance reasons.

RAW_PTR_EXCLUSION SomeClass& ignored_ref_field2;

// Error expected.

base::span<SomeClass> span_field;

// No error expected. Fields can be excluded due to performance reasons.

RAW_PTR_EXCLUSION base::span<SomeClass> ignored_span_field;

};

0 人点赞