[lld] r196054 - Fix "don't" typos missed in previous commit

Alp Toker alp at nuanti.com
Sun Dec 1 18:49:13 PST 2013


On 02/12/2013 02:01, Rui Ueyama wrote:
> On Sun, Dec 1, 2013 at 5:53 PM, Alp Toker <alp at nuanti.com 
> <mailto:alp at nuanti.com>> wrote:
>
>
>     On 02/12/2013 01:05, Rui Ueyama wrote:
>
>         On Sun, Dec 1, 2013 at 3:58 PM, Alp Toker <alp at nuanti.com
>         <mailto:alp at nuanti.com> <mailto:alp at nuanti.com
>         <mailto:alp at nuanti.com>>> wrote:
>
>             Author: alp
>             Date: Sun Dec  1 17:58:45 2013
>             New Revision: 196054
>
>             URL: http://llvm.org/viewvc/llvm-project?rev=196054&view=rev
>             Log:
>             Fix "don't" typos missed in previous commit
>
>             Modified:
>                 lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
>                 lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
>                 lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h
>                 lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h
>                 lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
>                 lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h
>                 lld/trunk/test/elf/X86_64/largebss.test
>
>             Modified:
>         lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
>             URL:
>         http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h?rev=196054&r1=196053&r2=196054&view=diff
>            
>         ==============================================================================
>             --- lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
>         (original)
>             +++ lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
>         Sun Dec
>              1 17:58:45 2013
>             @@ -45,9 +45,9 @@ public:
>                /// creates.
>                enum class OutputMagic : uint8_t {
>                  DEFAULT, // The default mode, no specific magic set
>             -    NMAGIC,  // Disallow shared libraries and dont align
>         sections
>             +    NMAGIC,  // Disallow shared libraries and don't align
>         sections
>                           // PageAlign Data, Mark Text Segment/Data
>         segment RW
>             -    OMAGIC   // Disallow shared libraries and dont align
>         sections,
>             +    OMAGIC   // Disallow shared libraries and don't align
>         sections,
>                           // Mark Text Segment/Data segment RW
>                };
>
>
>             Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
>             URL:
>         http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=196054&r1=196053&r2=196054&view=diff
>            
>         ==============================================================================
>             --- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
>             +++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Sun Dec  1
>             17:58:45 2013
>             @@ -639,7 +639,7 @@ template <class ELFT> void DefaultLayout
>                      lookupSectionFlag &= ~(llvm::ELF::SHF_TLS);
>
>                      Segment<ELFT> *segment;
>             -        // We need a separate segment for sections that
>         dont have
>             +        // We need a separate segment for sections that
>         don't have
>                      // the segment type to be PT_LOAD
>                      if (segmentType != llvm::ELF::PT_LOAD) {
>                        const AdditionalSegmentKey key(segmentType,
>             lookupSectionFlag);
>             @@ -706,7 +706,7 @@ template <class ELFT> void DefaultLayout
>                uint64_t offset = 0;
>                for (auto si : _segments) {
>                  si->setOrdinal(++ordinal);
>             -    // Dont assign offsets for segments that are not loadable
>             +    // Don't assign offsets for segments that are not
>         loadable
>                  if (si->segmentType() != llvm::ELF::PT_LOAD)
>                    continue;
>                  si->assignOffsets(offset);
>             @@ -742,7 +742,7 @@ DefaultLayout<ELFT>::assignVirtualAddres
>                while (true) {
>                  for (auto si : _segments) {
>                    si->finalize();
>             -      // Dont add PT_NULL segments into the program header
>             +      // Don't add PT_NULL segments into the program header
>                    if (si->segmentType() != llvm::ELF::PT_NULL)
>                      newSegmentHeaderAdded =
>         _programHeader->addSegment(si);
>                  }
>             @@ -778,7 +778,7 @@ DefaultLayout<ELFT>::assignVirtualAddres
>                    } else {
>                      si->setVAddr(virtualAddress);
>                      // The first segment has the virtualAddress set
>         to the
>             base address as
>             -        // we have added the file header and the program
>         header
>             dont align the
>             +        // we have added the file header and the program
>         header
>             don't align the
>                      // first segment to the pagesize
>                      si->assignVirtualAddress(address);
>                      si->setMemSize(address - virtualAddress);
>             @@ -841,7 +841,7 @@ DefaultLayout<ELFT>::assignOffsetsForMis
>                uint64_t fileoffset = 0;
>                uint64_t size = 0;
>                for (auto si : _segments) {
>             -    // Dont calculate offsets from non loadable segments
>             +    // Don't calculate offsets from non loadable segments
>                  if ((si->segmentType() != llvm::ELF::PT_LOAD) &&
>                      (si->segmentType() != llvm::ELF::PT_NULL))
>                    continue;
>
>             Modified: lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h
>             URL:
>         http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h?rev=196054&r1=196053&r2=196054&view=diff
>            
>         ==============================================================================
>             --- lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h
>         (original)
>             +++ lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h Sun
>         Dec  1
>             17:58:45 2013
>             @@ -122,7 +122,7 @@ template <class ELFT> void ExecutableWri
>
>                auto bssSection = this->_layout->findOutputSection(".bss");
>
>             -  // If we dont find a bss section, then dont set these
>         values
>             +  // If we don't find a bss section, then don't set these
>         values
>                if (bssSection) {
>                  (*bssStartAtomIter)->_virtualAddr =
>         bssSection->virtualAddr();
>                  (*bssEndAtomIter)->_virtualAddr =
>
>             Modified: lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h
>             URL:
>         http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h?rev=196054&r1=196053&r2=196054&view=diff
>            
>         ==============================================================================
>             --- lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h
>         (original)
>             +++ lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h Sun
>         Dec  1
>             17:58:45 2013
>             @@ -188,7 +188,7 @@ void OutputELFWriter<ELFT>::buildDynamic
>                // The dynamic symbol table need to be sorted earlier
>         because
>             the hash
>                // table needs to be built using the dynamic symbol
>         table. It
>             would be
>                // late to sort the symbols due to that in finalize. In the
>             dynamic symbol
>             -  // table finalize, we call the symbol table finalize and we
>             dont want to
>             +  // table finalize, we call the symbol table finalize and we
>             don't want to
>                // sort again
>                _dynamicSymbolTable->sortSymbols();
>
>
>             Modified: lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
>             URL:
>         http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h?rev=196054&r1=196053&r2=196054&view=diff
>            
>         ==============================================================================
>             --- lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h (original)
>             +++ lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h Sun Dec  1
>             17:58:45 2013
>             @@ -790,7 +790,7 @@ void SymbolTable<ELFT>::addUndefinedAtom
>              }
>
>              /// Add a symbol to the symbol Table, definedAtoms which get
>             added to the symbol
>             -/// section dont have their virtual addresses set at the
>         time of
>             adding the
>             +/// section don't have their virtual addresses set at the
>         time of
>             adding the
>              /// symbol to the symbol table(Example: dynamic symbols), the
>             addresses needs
>              /// to be updated in the table before writing the dynamic
>         symbol
>             table
>              /// information
>             @@ -885,7 +885,7 @@ public:
>
>                virtual void finalize() {
>                  // Defined symbols which have been added into the dynamic
>             symbol table
>             -    // dont have their addresses known until addresses
>         have been
>             assigned
>             +    // don't have their addresses known until addresses
>         have been
>             assigned
>                  // so lets update the symbol values after they have
>         got assigned
>                  for (auto &ste: this->_symbolTable) {
>                    const lld::AtomLayout *atomLayout = ste._atomLayout;
>             @@ -894,7 +894,7 @@ public:
>                    ste._symbol.st_value = atomLayout->_virtualAddr;
>                  }
>
>             -    // Dont sort the symbols
>             +    // Don't sort the symbols
>                  SymbolTable<ELFT>::finalize(false);
>                }
>
>
>             Modified: lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h
>             URL:
>         http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h?rev=196054&r1=196053&r2=196054&view=diff
>            
>         ==============================================================================
>             --- lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h (original)
>             +++ lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h Sun Dec  1
>             17:58:45 2013
>             @@ -570,7 +570,7 @@ template <class ELFT> void Segment<ELFT>
>                      tlsStartAddr += section->memSize();
>                    section->setMemSize(addr + section->memSize() -
>             section->virtualAddr());
>                    // TBSS section is special that it doesnot
>         contribute to
>             memory of any
>
>
>         We should probably s/doesnot/doesn't/ as well?
>
>
>     Done with a couple of other fixes in r196056. I see a few more
>     potential grammar issues that but will hand it over to you.
>
>     I'm planning to run this on LLVM core and clang, but only after
>     we're sure there are no false-positives and 3.4 has been finalized
>     so as not to make backporting difficult for Bill in the next
>     couple of weeks given the size of the patches.
>
>
> Yeah, I guess simple sed wouldn't work as weird spelling might be a 
> valid identifier in code. I'm wondering if clang-format has a feature 
> to fix typos only in comments...

That's the first thing that came to my mind, but it turns out that 
comments are full of domain-specific jargon which evolves over time. A 
"real" spell checker would too readily change words that look similar to 
English. IMO it's better to miss a few typos rather than attempting to 
fix everything Microsoft Word style.

Because of that, I'm satisfied with this approach finding the most 
common mistakes in all files including rst documentation, identifiers / 
function names (see r195985) etc. Best of all, it's catching 
embarrassing mistakes in user-visible strings like llvm::opt 
descriptions and static analyser notes, which matter more than typos in 
comments.

So If I had one feature request for clang-format, it would actually be 
comment re-flow -- the spell checker is currently set up to skip all 
typo corrections that push the line width beyond 80-columns just because 
there's no obvious way to fix up the resulting coding style.

Alp.



>
>     FWIW lld had the one of the lowest typo counts per line amongst
>     the LLVM modules :-)
>
>     Alp.
>
>
>
>             -      // segment, If we see a tbss section, dont add
>         memory size
>             to addr
>             +      // segment, If we see a tbss section, don't add
>         memory size
>             to addr
>                    // The fileOffset is automatically taken care of
>         since TBSS
>             section does
>                    // not endup using file size
>                    if (section->order() !=
>         DefaultLayout<ELFT>::ORDER_TBSS)
>
>             Modified: lld/trunk/test/elf/X86_64/largebss.test
>             URL:
>         http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/X86_64/largebss.test?rev=196054&r1=196053&r2=196054&view=diff
>            
>         ==============================================================================
>             --- lld/trunk/test/elf/X86_64/largebss.test (original)
>             +++ lld/trunk/test/elf/X86_64/largebss.test Sun Dec  1
>         17:58:45 2013
>             @@ -1,5 +1,5 @@
>              # This tests the functionality of handling BSS symbols
>             -# BSS symbols dont occupy file content and are associated
>         with
>             typeZeroFill
>             +# BSS symbols don't occupy file content and are
>         associated with
>             typeZeroFill
>              # Any typeZeroFill content wouldnot have space reserved
>         in the
>             file to store
>              # its content
>
>
>
>             _______________________________________________
>             llvm-commits mailing list
>         llvm-commits at cs.uiuc.edu <mailto:llvm-commits at cs.uiuc.edu>
>         <mailto:llvm-commits at cs.uiuc.edu
>         <mailto:llvm-commits at cs.uiuc.edu>>
>         http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
>     -- 
>     http://www.nuanti.com
>     the browser experts
>
>

-- 
http://www.nuanti.com
the browser experts




More information about the llvm-commits mailing list