clang on darwin broken since r212689

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

and the later comments on…

but the commit of r212689…

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.

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

#if defined(__APPLE__)

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

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

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.

FYI, I’ve requested a revert.

The actual problem code is…

FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h

in lib/Headers/CMakeLists.txt. From,
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.