This is an archive of the discontinued LLVM Phabricator instance.

libclang/CIndexer.cpp: Use loadquery() on AIX for path to library
ClosedPublic

Authored by hubert.reinterpretcast on Mar 11 2019, 3:44 PM.

Details

Summary

dladdr is not available on AIX. Similar functionality is presented through loadquery. This patch replaces a use of dladdr with a version based on loadquery.

Diff Detail

Repository
rC Clang

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2019, 3:44 PM
Herald added a subscriber: arphaman. · View Herald Transcript

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.

tools/libclang/CIndexer.cpp
61

Based on available documentation, this situation should not occur (and thus I believe llvm_unreachable is appropriate).

65

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.

84

This is also supposed to not happen.

xingxue accepted this revision.Mar 15 2019, 8:40 AM

LGTM. Thanks!

This revision is now accepted and ready to land.Mar 15 2019, 8:40 AM

@asb @lhames @majnemer, based on D36826, I believe that your guidance would be helpful here regarding the use of llvm_unreachable, report_fatal_error, and assert.

hubert.reinterpretcast marked 6 inline comments as done.Mar 22 2019, 9:33 AM

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

tools/libclang/CIndexer.cpp
61

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.

65

I will change this to report_fatal_error.

84

I will change this to report_fatal_error. Infinite loops are unfriendly.

asb added a comment.Mar 22 2019, 12:18 PM

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

Use of report_fatal_error/llvm_unreachable isn't fully consistent within the LLVM codebase, but I think your choices here are sensible.

This revision was automatically updated to reflect the committed changes.
hubert.reinterpretcast marked 3 inline comments as done.