[PATCH] D34091: Support for querying the exception specification type through libclang

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 14 16:36:52 PDT 2017


aaron.ballman added inline comments.


================
Comment at: include/clang-c/Index.h:185
+   */
+  CXCursor_ExceptionSpecificationKind_None, ///< no exception specification
+
----------------
You can drop the trailing comment.


================
Comment at: include/clang-c/Index.h:208
+  /**
+   * \brief The cursor has exception specification computed noexcept..
+   */
----------------
Spurious trailing full stop.


================
Comment at: include/clang-c/Index.h:213
+  /**
+   * \brief The exception specification has not yet been evaluated..
+   */
----------------
Same here.


================
Comment at: test/Index/get-cursor.cpp:152
+void f_dynamic_noexcept_none() throw();
+void f_dynamic_noexcept() throw(int); // just for testing, throwing int is not ideal.
+void f_dynamic_noexcept_any() throw(...);
----------------
The comment isn't helpful and can be removed.


================
Comment at: tools/libclang/CXType.cpp:689
+    QualType T = GetQualType(X);
+    if (T.isNull()) {
+        return -1;
----------------
Can elide the braces.


================
Comment at: tools/libclang/CXType.cpp:693
+
+    if (const FunctionProtoType* FD = T->getAs<FunctionProtoType>()) {
+        return static_cast<int>(FD->getExceptionSpecType());
----------------
Use `const auto *` and elide the braces.


================
Comment at: tools/libclang/CXType.cpp:695
+        return static_cast<int>(FD->getExceptionSpecType());
+    } else {
+        return -1;
----------------
No `else` after a `return`; you can just lower this into the function scope and remove the `else`.


================
Comment at: tools/libclang/CXType.cpp:703
+        return clang_getExceptionSpecificationType(clang_getCursorType(C));
+    } else {
+        return -1;
----------------
No `else` after a `return` and can elide the braces for the `if`.


Repository:
  rL LLVM

https://reviews.llvm.org/D34091





More information about the cfe-commits mailing list