[PATCH] D28477: Add LF_ prefix to LibFunc enums in TargetLibraryInfo.
David L. Jones via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 9 12:45:04 PST 2017
dlj created this revision.
dlj added a reviewer: rsmith.
dlj added a subscriber: cfe-commits.
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.
https://reviews.llvm.org/D28477
Files:
lib/CodeGen/BackendUtil.cpp
Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -262,7 +262,7 @@
TLII->disableAllFunctions();
else {
// Disable individual libc/libm calls in TargetLibraryInfo.
- LibFunc::Func F;
+ LibFunc F;
for (auto &FuncName : CodeGenOpts.getNoBuiltinFuncs())
if (TLII->getLibFunc(FuncName, F))
TLII->setUnavailable(F);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28477.83674.patch
Type: text/x-patch
Size: 470 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170109/b68b2532/attachment-0001.bin>
More information about the cfe-commits
mailing list