clang on darwin broken since r212689

I haven’t seen this discussed outside of my bug report…

http://llvm.org/bugs/show_bug.cgi?id=20326

and the later comments on…

http://reviews.llvm.org/D3908

but the commit of r212689…

https://www.mail-archive.com/cfe-commits@cs.uiuc.edu/msg100897.html

has broken the darwin targets for clang via blockage of the proper use of the
system _stdint.h and _types.h headers by the newly added clang versions.
This should be a release blocker for branching 3.5 until it is resolved, no?
Deleting the installed /sw/opt/llvm-3.5.0/lib/clang/3.5.0/include/_stdint.h and
/sw/opt/llvm-3.5.0/lib/clang/3.5.0/include/_types.h files eliminates the breakage
so perhaps the best solution is not to have those files installed at all outside
of the freebsd target.
Jack

Great timing, I was planning to write about this just a few minutes
ago. I didn't investigate which commit broke it. I have prepared a
tiny patch that I applied locally. basically, on top of the header
file:

#if defined(__APPLE__)
#include_next<_types.h>
#endif

I guess we can address this issue either with something like my patch
or by skipping installation on darwin.

Ismail,
Unfortunately that doesn’t address the actual bug. The problem code is in

set(out_files)
foreach( f ${files} )
  set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} )
  set( dst ${output_dir}/${f} )
  add_custom_command(OUTPUT ${dst}
    DEPENDS ${src}
    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
    COMMENT "Copying clang's ${f}...")
  list(APPEND out_files ${dst})
endforeach( f )

of lib/Headers/CMakeLists.txt which fails to create the machine subdirectory during ‘make install’.
The entries for machine/_stdint.h and machine/_types.h in files are reduced to just _stdint.h and
_types.h when the those files entries are copied. This is the bug that need to be fixed and not
hacked around.
Jack

FYI, I’ve requested a revert.

The actual problem code is…

install(
FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)

in lib/Headers/CMakeLists.txt. From http://www.cmake.org/Wiki/CMake:Install_Commands,
it would appear that the entries in FILES are reduced to the base file name and any prefixed
path is stripped off. A separate files2 list would be required for _stdint.h and _types.h as well
as an explicit install with the DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/machine.