This is an archive of the discontinued LLVM Phabricator instance.

Add LF_ prefix to LibFunc enums in TargetLibraryInfo.
ClosedPublic

Authored by dlj on Jan 9 2017, 12:45 PM.

Details

Summary

The LibFunc::Func enum holds enumerators named for libc functions.
Unfortunately, there are real situations, including libc implementations, where
function names are actually macros (musl uses "#define fopen64 fopen", for
example; any other transitively visible macro would have similar effects).

Strictly speaking, a conforming C++ Standard Library should provide any such
macros as functions instead (via <cstdio>). However, there are some "library"
functions which are not part of the standard, and thus not subject to this
rule (fopen64, for example). So, in order to be both portable and consistent,
the enum should not use the bare function names.

The old enum naming used a namespace LibFunc and an enum Func, with bare
enumerators. This patch changes LibFunc to be an enum with enumerators prefixed
with "LF_". (Unfortunately, a scoped enum is not sufficient to override macros.)

These changes are for clang. See https://reviews.llvm.org/D28476 for LLVM.

Diff Detail

Repository
rL LLVM

Event Timeline

dlj updated this revision to Diff 83674.Jan 9 2017, 12:45 PM
dlj retitled this revision from to Add LF_ prefix to LibFunc enums in TargetLibraryInfo..
dlj updated this object.
dlj added a reviewer: rsmith.
dlj added a subscriber: cfe-commits.
rsmith accepted this revision.Jan 23 2017, 11:16 AM
This revision is now accepted and ready to land.Jan 23 2017, 11:16 AM
This revision was automatically updated to reflect the committed changes.