[cfe-dev] [StaticAnalyzer] Can it detect __builtin_trap() ?

Andrzej Krzemienski via cfe-dev cfe-dev at lists.llvm.org
Mon Jun 5 09:57:24 PDT 2017


Hi Everyone,
Does Clan Static Analyzer recognize `__builtin_trap()` or
`__builtin_assume()` or `__builtin_unreachable()` or some similar thin that
indicates undesired failure? So that I (library author) could assist the
analyzer in reporting bad usages of a library:

```
T& optional<T>::value()
{
  if (!this->is_initialized)
    __builtin_trap(); // if analyzer reaches this path, it should report a
warnin
  return reinterpret_cast<T&>(_raw_storage);
}
```

Regards,
&rzej;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170605/88ac8f83/attachment.html>


More information about the cfe-dev mailing list