[lld] r268093 - Fix some Include What You Use warnings; other minor fixes.

George Burgess IV via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 15:52:24 PDT 2016


FWIW, the style guide has a note about this:
http://llvm.org/docs/CodingStandards.html#namespace-indentation

Specifically, "Feel free to skip the closing comment when the namespace
being closed is obvious for any reason. For example, the outer-most
namespace in a header file is rarely a source of confusion. But namespaces
both anonymous and named in source files that are being closed half way
through the file probably could use clarification."

I have no opinion here; just relaying what I found. :)

On Fri, Apr 29, 2016 at 3:49 PM, David Blaikie via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

>
>
> On Fri, Apr 29, 2016 at 12:47 PM, Eugene Zelenko via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: eugenezelenko
>> Date: Fri Apr 29 14:47:09 2016
>> New Revision: 268093
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=268093&view=rev
>> Log:
>> Fix some Include What You Use warnings; other minor fixes.
>>
>> Differential revision: http://reviews.llvm.org/D19735
>>
>> Modified:
>>     lld/trunk/include/lld/Core/Simple.h
>>     lld/trunk/lib/ReaderWriter/MachO/Atoms.h
>>     lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
>>
>> Modified: lld/trunk/include/lld/Core/Simple.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Simple.h?rev=268093&r1=268092&r2=268093&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/include/lld/Core/Simple.h (original)
>> +++ lld/trunk/include/lld/Core/Simple.h Fri Apr 29 14:47:09 2016
>> @@ -15,14 +15,23 @@
>>  #ifndef LLD_CORE_SIMPLE_H
>>  #define LLD_CORE_SIMPLE_H
>>
>> +#include "lld/Core/AbsoluteAtom.h"
>> +#include "lld/Core/Atom.h"
>>  #include "lld/Core/DefinedAtom.h"
>>  #include "lld/Core/File.h"
>> -#include "lld/Core/LinkingContext.h"
>>  #include "lld/Core/Reference.h"
>> +#include "lld/Core/SharedLibraryAtom.h"
>>  #include "lld/Core/UndefinedAtom.h"
>> +#include "llvm/ADT/SmallVector.h"
>> +#include "llvm/ADT/StringRef.h"
>>  #include "llvm/ADT/ilist.h"
>> -#include "llvm/ADT/ilist_node.h"
>> -#include <atomic>
>> +#include "llvm/Support/Allocator.h"
>> +#include "llvm/Support/Casting.h"
>> +#include "llvm/Support/ErrorHandling.h"
>> +#include <algorithm>
>> +#include <cassert>
>> +#include <cstdint>
>> +#include <functional>
>>
>>  namespace lld {
>>
>> @@ -142,12 +151,13 @@ private:
>>    SimpleReference *_prev;
>>  };
>>
>> -}
>> +} // end namespace lld
>>
>
> Do we have any significantly prevailing style for end of namespace
> comments? (does the style guide say we should have them? Do we usually use
> "end blah" rather than just "blah", etc) - I'd be a bit surprised. & if we
> don't, I'd hesitate to do any cleanup like this.
>
>
>>
>>  // ilist will lazily create a sentinal (so end() can return a node past
>> the
>>  // end of the list). We need this trait so that the sentinal is allocated
>>  // via the BumpPtrAllocator.
>>  namespace llvm {
>> +
>>  template<>
>>  struct ilist_sentinel_traits<lld::SimpleReference> {
>>
>> @@ -183,7 +193,8 @@ struct ilist_sentinel_traits<lld::Simple
>>  private:
>>    mutable llvm::BumpPtrAllocator *_allocator;
>>  };
>> -}
>> +
>> +} // end namespace llvm
>>
>>  namespace lld {
>>
>> @@ -194,7 +205,7 @@ public:
>>      _references.setAllocator(&f.allocator());
>>    }
>>
>> -  ~SimpleDefinedAtom() {
>> +  ~SimpleDefinedAtom() override {
>>      _references.clearAndLeakNodesUnsafely();
>>    }
>>
>> @@ -278,6 +289,7 @@ public:
>>        _references.push_back(node);
>>      }
>>    }
>> +
>>    void setOrdinal(uint64_t ord) { _ordinal = ord; }
>>
>>  private:
>> @@ -312,4 +324,4 @@ private:
>>
>>  } // end namespace lld
>>
>> -#endif
>> +#endif // LLD_CORE_SIMPLE_H
>>
>> Modified: lld/trunk/lib/ReaderWriter/MachO/Atoms.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/Atoms.h?rev=268093&r1=268092&r2=268093&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/lib/ReaderWriter/MachO/Atoms.h (original)
>> +++ lld/trunk/lib/ReaderWriter/MachO/Atoms.h Fri Apr 29 14:47:09 2016
>> @@ -1,4 +1,4 @@
>> -//===- lib/ReaderWriter/MachO/Atoms.h
>> -------------------------------------===//
>> +//===- lib/ReaderWriter/MachO/Atoms.h ---------------------------*- C++
>> -*-===//
>>  //
>>  //                             The LLVM Linker
>>  //
>> @@ -10,10 +10,21 @@
>>  #ifndef LLD_READER_WRITER_MACHO_ATOMS_H
>>  #define LLD_READER_WRITER_MACHO_ATOMS_H
>>
>> +#include "lld/Core/Atom.h"
>> +#include "lld/Core/DefinedAtom.h"
>> +#include "lld/Core/SharedLibraryAtom.h"
>>  #include "lld/Core/Simple.h"
>> +#include "llvm/ADT/ArrayRef.h"
>> +#include "llvm/ADT/StringRef.h"
>> +#include <cstdint>
>> +#include <string>
>>
>>  namespace lld {
>> +
>> +class File;
>> +
>>  namespace mach_o {
>> +
>>  class MachODefinedAtom : public SimpleDefinedAtom {
>>  public:
>>    MachODefinedAtom(const File &f, const StringRef name, Scope scope,
>> @@ -164,7 +175,7 @@ private:
>>    StringRef _dylibInstallName;
>>  };
>>
>> -} // namespace mach_o
>> -} // namespace lld
>> +} // end namespace mach_o
>> +} // end namespace lld
>>
>>  #endif // LLD_READER_WRITER_MACHO_ATOMS_H
>>
>> Modified: lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp?rev=268093&r1=268092&r2=268093&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp (original)
>> +++ lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp Fri Apr 29
>> 14:47:09 2016
>> @@ -7,31 +7,41 @@
>>  //
>>
>>  //===----------------------------------------------------------------------===//
>>
>> +#include "lld/Core/AbsoluteAtom.h"
>>  #include "lld/Core/ArchiveLibraryFile.h"
>> +#include "lld/Core/Atom.h"
>>  #include "lld/Core/DefinedAtom.h"
>>  #include "lld/Core/Error.h"
>>  #include "lld/Core/File.h"
>> -#include "lld/Core/LLVM.h"
>> +#include "lld/Core/LinkingContext.h"
>>  #include "lld/Core/Reader.h"
>>  #include "lld/Core/Reference.h"
>> +#include "lld/Core/SharedLibraryAtom.h"
>>  #include "lld/Core/Simple.h"
>> +#include "lld/Core/UndefinedAtom.h"
>>  #include "lld/Core/Writer.h"
>>  #include "lld/ReaderWriter/YamlContext.h"
>>  #include "llvm/ADT/ArrayRef.h"
>>  #include "llvm/ADT/DenseMap.h"
>>  #include "llvm/ADT/StringMap.h"
>> +#include "llvm/ADT/StringRef.h"
>>  #include "llvm/ADT/Twine.h"
>> +#include "llvm/Support/Allocator.h"
>>  #include "llvm/Support/Debug.h"
>> -#include "llvm/Support/Errc.h"
>> -#include "llvm/Support/ErrorHandling.h"
>> +#include "llvm/Support/Error.h"
>> +#include "llvm/Support/ErrorOr.h"
>> +#include "llvm/Support/FileSystem.h"
>>  #include "llvm/Support/Format.h"
>>  #include "llvm/Support/MemoryBuffer.h"
>> -#include "llvm/Support/Path.h"
>>  #include "llvm/Support/YAMLTraits.h"
>>  #include "llvm/Support/raw_ostream.h"
>> +#include <cassert>
>> +#include <cstdint>
>> +#include <cstring>
>>  #include <memory>
>>  #include <string>
>>  #include <system_error>
>> +#include <vector>
>>
>>  using llvm::yaml::MappingTraits;
>>  using llvm::yaml::ScalarEnumerationTraits;
>> @@ -233,7 +243,7 @@ struct RefKind {
>>    Reference::KindValue      value;
>>  };
>>
>> -} // anonymous namespace
>> +} // end anonymous namespace
>>
>>  LLVM_YAML_IS_SEQUENCE_VECTOR(ArchMember)
>>  LLVM_YAML_IS_SEQUENCE_VECTOR(const lld::Reference *)
>> @@ -838,7 +848,9 @@ template <> struct MappingTraits<const l
>>                                     << ", " << _name.size() << ")\n");
>>        return this;
>>      }
>> +
>>      void bind(const RefNameResolver &);
>> +
>>      // Extract current File object from YAML I/O parsing context
>>      const lld::File &fileFromContext(IO &io) {
>>        YamlContext *info = reinterpret_cast<YamlContext
>> *>(io.getContext());
>> @@ -1044,7 +1056,6 @@ template <> struct MappingTraits<lld::Un
>>
>>  // YAML conversion for const lld::SharedLibraryAtom*
>>  template <> struct MappingTraits<const lld::SharedLibraryAtom *> {
>> -
>>    class NormalizedAtom : public lld::SharedLibraryAtom {
>>    public:
>>      NormalizedAtom(IO &io)
>> @@ -1199,8 +1210,8 @@ template <> struct MappingTraits<lld::Ab
>>    }
>>  };
>>
>> -} // namespace llvm
>> -} // namespace yaml
>> +} // end namespace llvm
>> +} // end namespace yaml
>>
>>  RefNameResolver::RefNameResolver(const lld::File *file, IO &io) :
>> _io(io) {
>>    typedef MappingTraits<const lld::DefinedAtom *>::NormalizedAtom
>> @@ -1371,7 +1382,7 @@ private:
>>    const Registry &_registry;
>>  };
>>
>> -} // anonymous namespace
>> +} // end anonymous namespace
>>
>>  void Registry::addSupportYamlFiles() {
>>    add(std::unique_ptr<Reader>(new YAMLReader(*this)));
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160429/ed4f304c/attachment.html>


More information about the llvm-commits mailing list