Replace size method call of containers to empty method where appropriate
authorAlexander Kornienko <alexfh@google.com>
Thu, 15 Jan 2015 11:41:30 +0000 (11:41 +0000)
committerAlexander Kornienko <alexfh@google.com>
Thu, 15 Jan 2015 11:41:30 +0000 (11:41 +0000)
commitb4c6267f7c85784b01d883fff7aed036ad39a0f7
tree612be4bd13fb237a05a0c7fe77c8698a8502d8a5
parente2ffd02ad3f08a8b9f22ee24e68ffde0615d41d5
Replace size method call of containers to empty method where appropriate

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.

Patch by Gábor Horváth!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226161 91177308-0d34-0410-b5e6-96231b3b80d8
18 files changed:
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