Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 5bbcdd7

Browse files
committed
Add LF_ prefix to LibFunc enums in TargetLibraryInfo.
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. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28477 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292849 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 0ed7413 commit 5bbcdd7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/CodeGen/BackendUtil.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static TargetLibraryInfoImpl *createTLII(llvm::Triple &TargetTriple,
262262
TLII->disableAllFunctions();
263263
else {
264264
// Disable individual libc/libm calls in TargetLibraryInfo.
265-
LibFunc::Func F;
265+
LibFunc F;
266266
for (auto &FuncName : CodeGenOpts.getNoBuiltinFuncs())
267267
if (TLII->getLibFunc(FuncName, F))
268268
TLII->setUnavailable(F);

0 commit comments

Comments
 (0)