diff options
Diffstat (limited to 'gnu/llvm/tools/clang/lib/Frontend/DependencyGraph.cpp')
| -rw-r--r-- | gnu/llvm/tools/clang/lib/Frontend/DependencyGraph.cpp | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/gnu/llvm/tools/clang/lib/Frontend/DependencyGraph.cpp b/gnu/llvm/tools/clang/lib/Frontend/DependencyGraph.cpp index 67a977e38be..c6c9ac2ea2f 100644 --- a/gnu/llvm/tools/clang/lib/Frontend/DependencyGraph.cpp +++ b/gnu/llvm/tools/clang/lib/Frontend/DependencyGraph.cpp @@ -33,9 +33,9 @@ class DependencyGraphCallback : public PPCallbacks { llvm::SetVector<const FileEntry *> AllFiles; typedef llvm::DenseMap<const FileEntry *, SmallVector<const FileEntry *, 2> > DependencyMap; - + DependencyMap Dependencies; - + private: raw_ostream &writeNodeReference(raw_ostream &OS, const FileEntry *Node); @@ -50,12 +50,13 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, const FileEntry *File, StringRef SearchPath, StringRef RelativePath, - const Module *Imported) override; + const Module *Imported, + SrcMgr::CharacteristicKind FileType) override; void EndOfMainFile() override { OutputGraphFile(); } - + }; } @@ -65,18 +66,20 @@ void clang::AttachDependencyGraphGen(Preprocessor &PP, StringRef OutputFile, SysRoot)); } -void DependencyGraphCallback::InclusionDirective(SourceLocation HashLoc, - const Token &IncludeTok, - StringRef FileName, - bool IsAngled, - CharSourceRange FilenameRange, - const FileEntry *File, - StringRef SearchPath, - StringRef RelativePath, - const Module *Imported) { +void DependencyGraphCallback::InclusionDirective( + SourceLocation HashLoc, + const Token &IncludeTok, + StringRef FileName, + bool IsAngled, + CharSourceRange FilenameRange, + const FileEntry *File, + StringRef SearchPath, + StringRef RelativePath, + const Module *Imported, + SrcMgr::CharacteristicKind FileType) { if (!File) return; - + SourceManager &SM = PP->getSourceManager(); const FileEntry *FromFile = SM.getFileEntryForID(SM.getFileID(SM.getExpansionLoc(HashLoc))); @@ -84,7 +87,7 @@ void DependencyGraphCallback::InclusionDirective(SourceLocation HashLoc, return; Dependencies[FromFile].push_back(File); - + AllFiles.insert(File); AllFiles.insert(FromFile); } @@ -106,7 +109,7 @@ void DependencyGraphCallback::OutputGraphFile() { } OS << "digraph \"dependencies\" {\n"; - + // Write the nodes for (unsigned I = 0, N = AllFiles.size(); I != N; ++I) { // Write the node itself. @@ -116,15 +119,15 @@ void DependencyGraphCallback::OutputGraphFile() { StringRef FileName = AllFiles[I]->getName(); if (FileName.startswith(SysRoot)) FileName = FileName.substr(SysRoot.size()); - + OS << DOT::EscapeString(FileName) << "\"];\n"; } // Write the edges - for (DependencyMap::iterator F = Dependencies.begin(), + for (DependencyMap::iterator F = Dependencies.begin(), FEnd = Dependencies.end(); - F != FEnd; ++F) { + F != FEnd; ++F) { for (unsigned I = 0, N = F->second.size(); I != N; ++I) { OS.indent(2); writeNodeReference(OS, F->first); |
