This is an archive of the discontinued LLVM Phabricator instance.

Make windows resource generation more robust to misconfiguration.
AbandonedPublic

Authored by stellaraccident on Sep 25 2021, 3:11 PM.

Details

Reviewers
stella.stamenova
Summary

I was experiencing this in an out-of-tree project when building a DLL in a context that didn't have LLVM_VERSION_* and friends set. It causes obscure errors in the resource compiler if not integers.

Diff Detail

Event Timeline

stellaraccident requested review of this revision.Sep 25 2021, 3:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 25 2021, 3:11 PM

LGTM. I find it easier to read if it's all done together (see comment), but it's fine either way.

llvm/cmake/modules/AddLLVM.cmake
386

Since the issue you saw was when LLVM_VERSION* was not defined, I think it would be a bit cleaner if you made all the assignments together e.g.:

if (NOT DEFINED ARG_VERSION_MAJOR)
  if (${LLVM_VERSION_MAJOR})
    set(ARG_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
  else
    set(ARG_VERSION_MAJOR 0)
  endif
endif

It's not any less verbose, but it's a bit more explicit.

stellaraccident abandoned this revision.Oct 11 2022, 6:32 AM

Another contributor cloned and submitted this with suggested fixes as a new patch: https://reviews.llvm.org/D135650

Closing this one.

Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2022, 6:32 AM