hubert.reinterpretcast added a comment.

I believe that the conditions being checked for with `llvm_unreachable` in this 
patch are of the debug-only variety; however, some input would be appreciated 
regarding the choice of using `llvm_unreachable` instead of 
`report_fatal_error` or `assert`.



================
Comment at: tools/libclang/CIndexer.cpp:61
+    if (errno != ENOMEM)
+      llvm_unreachable("Encountered an unexpected loadquery() failure");
+
----------------
Based on available documentation, this situation should not occur (and thus I 
believe `llvm_unreachable` is appropriate).


================
Comment at: tools/libclang/CIndexer.cpp:65
+    if ((BufSize & ~((-1u) >> 1u)) != 0u)
+      llvm_unreachable("BufSize needed for loadquery() too large");
+
----------------
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.


================
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) +
----------------
This is also supposed to not happen.


Repository:
  rC Clang

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

https://reviews.llvm.org/D59233



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

Reply via email to