[PATCH] D28476: [Analysis] Add LF_ prefix to LibFunc enums in TargetLibraryInfo. (NFC)

David L. Jones via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 12:44:18 PST 2017


dlj created this revision.
dlj added a reviewer: rsmith.
dlj added a subscriber: llvm-commits.
Herald added subscribers: nemanjai, mzolotukhin, mehdi_amini.

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.)

There are additional changes required in clang.


https://reviews.llvm.org/D28476

Files:
  include/llvm/Analysis/TargetLibraryInfo.def
  include/llvm/Analysis/TargetLibraryInfo.h
  include/llvm/Transforms/Utils/SimplifyLibCalls.h
  lib/Analysis/BasicAliasAnalysis.cpp
  lib/Analysis/ConstantFolding.cpp
  lib/Analysis/MemoryBuiltins.cpp
  lib/Analysis/MemoryLocation.cpp
  lib/Analysis/TargetLibraryInfo.cpp
  lib/Analysis/ValueTracking.cpp
  lib/CodeGen/SelectionDAG/FastISel.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/LTO/UpdateCompilerUsed.cpp
  lib/Target/PowerPC/PPCCTRLoops.cpp
  lib/Transforms/IPO/GlobalOpt.cpp
  lib/Transforms/Scalar/DeadStoreElimination.cpp
  lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  lib/Transforms/Scalar/MemCpyOptimizer.cpp
  lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
  lib/Transforms/Utils/BuildLibCalls.cpp
  lib/Transforms/Utils/LibCallsShrinkWrap.cpp
  lib/Transforms/Utils/Local.cpp
  lib/Transforms/Utils/SimplifyLibCalls.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28476.83673.patch
Type: text/x-patch
Size: 155762 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170109/4b3de511/attachment.bin>


More information about the llvm-commits mailing list