JonasToth marked an inline comment as done.
JonasToth added inline comments.


================
Comment at: clang-tidy/modernize/NoexceptCorrectnessCheck.cpp:60
+          N.getNodeAs<FunctionDecl>("direct_throwing_decl")) {
+    // FIXME how is that done? i did not find a noThrow predicate
+    //if (ThrowingDecl->isNoThrow()) {
----------------
JonasToth wrote:
> mgehre wrote:
> > JonasToth wrote:
> > > How can i find out the exception spepcification in a `FunctionDecl`? I 
> > > would like to check if `noexcept` might be added when it is not justified.
> > Try `ThrowingDecl 
> > ->getType()->getAs<FunctionProtoType>()->getNoexceptSpec()`
> Does not build :/
> 
>    note: candidate: clang::FunctionProtoType::NoexceptResult 
> clang::FunctionProtoType::getNoexceptSpec(const clang::ASTContext&) const
>    NoexceptResult getNoexceptSpec(const ASTContext &Ctx) const;
> 
> Where do i get the ASTContext from?
`FunctionPrototype` has the `isNothrow` method, but it needs the `ASTContext` 
as well.
An alternative solution would be `hasNoexceptExceptionSpec()`. It would ignore 
`throw()` most likely.


Repository:
  rL LLVM

https://reviews.llvm.org/D31370



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to