summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/clang/lib/Frontend/DependencyGraph.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2019-01-27 16:42:12 +0000
committerpatrick <patrick@openbsd.org>2019-01-27 16:42:12 +0000
commitb773203fb58f3ef282fb69c832d8710cab5bc82d (patch)
treee75913f147570fbd75169647b144df85b88a038c /gnu/llvm/tools/clang/lib/Frontend/DependencyGraph.cpp
parenttweak errno in previous (diff)
downloadwireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.tar.xz
wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.zip
Import LLVM 7.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/tools/clang/lib/Frontend/DependencyGraph.cpp')
-rw-r--r--gnu/llvm/tools/clang/lib/Frontend/DependencyGraph.cpp41
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);