Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ class TrivialFunctionAnalysisVisitor
return false;
}

bool VisitAttributedStmt(const AttributedStmt *AS) {
// Ignore attributes.
return Visit(AS->getSubStmt());
}

bool VisitCompoundStmt(const CompoundStmt *CS) {
// A compound statement is allowed as long each individual sub-statement
// is trivial.
Expand Down
2 changes: 2 additions & 0 deletions clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ class RefCounted {
};
void trivial68() { point pt = { 1.0 }; }
unsigned trivial69() { return offsetof(RefCounted, children); }
DerivedNumber* trivial70() { [[clang::suppress]] return static_cast<DerivedNumber*>(number); }

static RefCounted& singleton() {
static RefCounted s_RefCounted;
Expand Down Expand Up @@ -564,6 +565,7 @@ class UnrelatedClass {
getFieldTrivial().trivial67()->trivial6(); // no-warning
getFieldTrivial().trivial68(); // no-warning
getFieldTrivial().trivial69(); // no-warning
getFieldTrivial().trivial70(); // no-warning

RefCounted::singleton().trivial18(); // no-warning
RefCounted::singleton().someFunction(); // no-warning
Expand Down