Skip to content
Open
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 @@ -666,6 +666,10 @@ class TrivialFunctionAnalysisVisitor
return IsFunctionTrivial(Callee);
}

bool VisitGCCAsmStmt(const GCCAsmStmt *AS) {
return AS->getAsmString() == "brk #0xc471";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need to be restricted to a specific brk constant, and should it include int3, and similar?

I guess it's unlikely as whitespace is usually present only in multiline asm but is it worth considering stripping white space?

}

bool
VisitSubstNonTypeTemplateParmExpr(const SubstNonTypeTemplateParmExpr *E) {
// Non-type template paramter is compile time constant and trivial.
Expand Down
22 changes: 22 additions & 0 deletions clang/test/Analysis/Checkers/WebKit/trivial-code-check-asm-brk.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// RUN: %clang_analyze_cc1 -triple arm-darwin -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s
// expected-no-diagnostics

void crash()
{
__asm__ volatile ("brk #0xc471");
__builtin_unreachable();
}

class SomeObj {
public:
void ref();
void deref();

void someWork() { crash(); }
};

SomeObj* provide();

void doSomeWork() {
provide()->someWork();
}