[PATCH] Replace size method call of containers to empty method where appropriate

Gábor Horváth xazax.hun at gmail.com
Mon Jan 12 05:07:29 PST 2015


Hi klimek, alexfh,

This patch was generated by a clang tidy checker that is being open sourced.
The documentation of that checker is the following:

/// The emptiness of a container should be checked using the empty method
/// instead of the size method. It is not guaranteed that size is a
/// constant-time function, and it is generally more efficient and also shows
/// clearer intent to use empty. Furthermore some containers may implement the
/// empty method but not implement the size method. Using empty whenever
/// possible makes it easier to switch to another container in the future.

http://reviews.llvm.org/D6924

Files:
  lib/CodeGen/SelectionDAG/TargetLowering.cpp
  lib/CodeGen/UnreachableBlockElim.cpp
  lib/MC/MCMachOStreamer.cpp
  lib/MC/MCParser/AsmParser.cpp
  lib/ProfileData/CoverageMapping.cpp
  lib/TableGen/Record.cpp
  lib/TableGen/TGParser.cpp
  lib/Transforms/Vectorize/BBVectorize.cpp
  lib/Transforms/Vectorize/LoopVectorize.cpp
  lib/Transforms/Vectorize/SLPVectorizer.cpp
  utils/TableGen/AsmMatcherEmitter.cpp
  utils/TableGen/AsmWriterEmitter.cpp
  utils/TableGen/CodeEmitterGen.cpp
  utils/TableGen/CodeGenMapTable.cpp
  utils/TableGen/DFAPacketizerEmitter.cpp
  utils/TableGen/FixedLenDecoderEmitter.cpp
  utils/TableGen/SubtargetEmitter.cpp
  utils/TableGen/X86RecognizableInstr.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6924.18015.patch
Type: text/x-patch
Size: 11718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150112/fe3658ee/attachment.bin>


More information about the llvm-commits mailing list