diff options
author | Eugene Zelenko <eugene.zelenko@gmail.com> | 2017-11-11 00:08:50 +0000 |
---|---|---|
committer | Eugene Zelenko <eugene.zelenko@gmail.com> | 2017-11-11 00:08:50 +0000 |
commit | b7d89107cd32a293023ce307e3f4600565a7357c (patch) | |
tree | 57f0262ad27108c109bf0850aced937a4cfeac14 /clang/lib/Serialization/ModuleManager.cpp | |
parent | 56def791bc245fd92e07825857facfeba05b266b (diff) | |
download | llvm-b7d89107cd32a293023ce307e3f4600565a7357c.zip llvm-b7d89107cd32a293023ce307e3f4600565a7357c.tar.gz llvm-b7d89107cd32a293023ce307e3f4600565a7357c.tar.bz2 |
[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 317953
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
-rw-r--r-- | clang/lib/Serialization/ModuleManager.cpp | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index 7563440..b512fa4 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/lib/Serialization/ModuleManager.cpp @@ -1,4 +1,4 @@ -//===--- ModuleManager.cpp - Module Manager ---------------------*- C++ -*-===// +//===- ModuleManager.cpp - Module Manager ---------------------------------===// // // The LLVM Compiler Infrastructure // @@ -11,20 +11,34 @@ // modules for the ASTReader. // //===----------------------------------------------------------------------===// + #include "clang/Serialization/ModuleManager.h" +#include "clang/Basic/FileManager.h" +#include "clang/Basic/LLVM.h" #include "clang/Basic/MemoryBufferCache.h" +#include "clang/Basic/VirtualFileSystem.h" #include "clang/Frontend/PCHContainerOperations.h" #include "clang/Lex/HeaderSearch.h" #include "clang/Lex/ModuleMap.h" #include "clang/Serialization/GlobalModuleIndex.h" +#include "clang/Serialization/Module.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/SetVector.h" +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/iterator.h" +#include "llvm/Support/Chrono.h" +#include "llvm/Support/DOTGraphTraits.h" +#include "llvm/Support/ErrorOr.h" +#include "llvm/Support/GraphWriter.h" #include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/Path.h" +#include <algorithm> +#include <cassert> +#include <memory> +#include <string> #include <system_error> -#ifndef NDEBUG -#include "llvm/Support/GraphWriter.h" -#endif - using namespace clang; using namespace serialization; @@ -208,7 +222,6 @@ void ModuleManager::removeModules( if (First == Last) return; - // Explicitly clear VisitOrder since we might not notice it is stale. VisitOrder.clear(); @@ -267,7 +280,6 @@ void ModuleManager::removeModules( void ModuleManager::addInMemoryBuffer(StringRef FileName, std::unique_ptr<llvm::MemoryBuffer> Buffer) { - const FileEntry *Entry = FileMgr.getVirtualFile(FileName, Buffer->getBufferSize(), 0); InMemoryBuffers[Entry] = std::move(Buffer); @@ -317,8 +329,7 @@ ModuleManager::ModuleManager(FileManager &FileMgr, MemoryBufferCache &PCMCache, const PCHContainerReader &PCHContainerRdr, const HeaderSearch& HeaderSearchInfo) : FileMgr(FileMgr), PCMCache(&PCMCache), PCHContainerRdr(PCHContainerRdr), - HeaderSearchInfo (HeaderSearchInfo), GlobalIndex(), - FirstVisitState(nullptr) {} + HeaderSearchInfo(HeaderSearchInfo) {} ModuleManager::~ModuleManager() { delete FirstVisitState; } @@ -452,11 +463,12 @@ bool ModuleManager::lookupModuleFile(StringRef FileName, #ifndef NDEBUG namespace llvm { + template<> struct GraphTraits<ModuleManager> { - typedef ModuleFile *NodeRef; - typedef llvm::SetVector<ModuleFile *>::const_iterator ChildIteratorType; - typedef pointer_iterator<ModuleManager::ModuleConstIterator> nodes_iterator; + using NodeRef = ModuleFile *; + using ChildIteratorType = llvm::SetVector<ModuleFile *>::const_iterator; + using nodes_iterator = pointer_iterator<ModuleManager::ModuleConstIterator>; static ChildIteratorType child_begin(NodeRef Node) { return Node->Imports.begin(); @@ -478,17 +490,16 @@ namespace llvm { template<> struct DOTGraphTraits<ModuleManager> : public DefaultDOTGraphTraits { explicit DOTGraphTraits(bool IsSimple = false) - : DefaultDOTGraphTraits(IsSimple) { } + : DefaultDOTGraphTraits(IsSimple) {} - static bool renderGraphFromBottomUp() { - return true; - } + static bool renderGraphFromBottomUp() { return true; } std::string getNodeLabel(ModuleFile *M, const ModuleManager&) { return M->ModuleName; } }; -} + +} // namespace llvm void ModuleManager::viewGraph() { llvm::ViewGraph(*this, "Modules"); |