[PATCH] D59233: libclang/CIndexer.cpp: Use loadquery() on AIX for path to library

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 22 09:35:30 PDT 2019


hubert.reinterpretcast marked 6 inline comments as done.
hubert.reinterpretcast added a comment.
Herald added a subscriber: jsji.

Thanks @xingxue for the review. I will update for the error handling before committing.



================
Comment at: tools/libclang/CIndexer.cpp:61
+    if (errno != ENOMEM)
+      llvm_unreachable("Encountered an unexpected loadquery() failure");
+
----------------
hubert.reinterpretcast wrote:
> Based on available documentation, this situation should not occur (and thus I believe `llvm_unreachable` is appropriate).
I'll leave this one as `llvm_unreachable`, either the failure is resolved on a later call or the loop will terminate when the amount of memory to request (checked below) is too large.


================
Comment at: tools/libclang/CIndexer.cpp:65
+    if ((BufSize & ~((-1u) >> 1u)) != 0u)
+      llvm_unreachable("BufSize needed for loadquery() too large");
+
----------------
hubert.reinterpretcast wrote:
> This situation is not impossible, but highly improbable. This is a non-programmatic error, and the Programmer's Manual appears to recommend the use of `report_fatal_error`. Some additional guidance would be appreciated.
I will change this to `report_fatal_error`.


================
Comment at: tools/libclang/CIndexer.cpp:84
+    if (CurInfo->ldinfo_next == 0u)
+      llvm_unreachable("Cannot locate entry point in the loadquery() results");
+    CurInfo = reinterpret_cast<ld_xinfo *>(reinterpret_cast<char *>(CurInfo) +
----------------
hubert.reinterpretcast wrote:
> This is also supposed to not happen.
I will change this to `report_fatal_error`. Infinite loops are unfriendly.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59233/new/

https://reviews.llvm.org/D59233





More information about the cfe-commits mailing list