This patch fixes the issue of clang emitting an unreachable warning when it encounters unreachable __builtin_unreachable() statements. It detects references to __builtin_unreachable and doesn't emit an unreachable warning for them.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
| lib/Analysis/ReachableCode.cpp | ||
|---|---|---|
| 64 ↗ | (On Diff #73781) | Maybe also wrap the inner dyn_cast in an if for symmetry? static bool isBuiltinUnreachable(const Stmt *S) {
if (const auto *DRE = dyn_cast<DeclRefExpr>(S))
if (const auto *FDecl = dyn_cast<FunctionDecl>(DRE->getDecl()))
return FDecl->getIdentifier() &&
FDecl->getBuiltinID() == Builtin::BI__builtin_unreachable;
return false;
} |