comparison tools/clang/lib/Frontend/DependencyGraph.cpp @ 77:54457678186b LLVM3.6

LLVM 3.6
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Mon, 08 Sep 2014 22:06:00 +0900
parents 95c75e76d11b
children 60c9769439b8
comparison
equal deleted inserted replaced
34:e874dbf0ad9d 77:54457678186b
44 public: 44 public:
45 DependencyGraphCallback(const Preprocessor *_PP, StringRef OutputFile, 45 DependencyGraphCallback(const Preprocessor *_PP, StringRef OutputFile,
46 StringRef SysRoot) 46 StringRef SysRoot)
47 : PP(_PP), OutputFile(OutputFile.str()), SysRoot(SysRoot.str()) { } 47 : PP(_PP), OutputFile(OutputFile.str()), SysRoot(SysRoot.str()) { }
48 48
49 virtual void InclusionDirective(SourceLocation HashLoc, 49 void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
50 const Token &IncludeTok, 50 StringRef FileName, bool IsAngled,
51 StringRef FileName, 51 CharSourceRange FilenameRange, const FileEntry *File,
52 bool IsAngled, 52 StringRef SearchPath, StringRef RelativePath,
53 CharSourceRange FilenameRange, 53 const Module *Imported) override;
54 const FileEntry *File,
55 StringRef SearchPath,
56 StringRef RelativePath,
57 const Module *Imported);
58 54
59 virtual void EndOfMainFile() { 55 void EndOfMainFile() override {
60 OutputGraphFile(); 56 OutputGraphFile();
61 } 57 }
62 58
63 }; 59 };
64 } 60 }
81 return; 77 return;
82 78
83 SourceManager &SM = PP->getSourceManager(); 79 SourceManager &SM = PP->getSourceManager();
84 const FileEntry *FromFile 80 const FileEntry *FromFile
85 = SM.getFileEntryForID(SM.getFileID(SM.getExpansionLoc(HashLoc))); 81 = SM.getFileEntryForID(SM.getFileID(SM.getExpansionLoc(HashLoc)));
86 if (FromFile == 0) 82 if (!FromFile)
87 return; 83 return;
88 84
89 Dependencies[FromFile].push_back(File); 85 Dependencies[FromFile].push_back(File);
90 86
91 AllFiles.insert(File); 87 AllFiles.insert(File);
98 OS << "header_" << Node->getUID(); 94 OS << "header_" << Node->getUID();
99 return OS; 95 return OS;
100 } 96 }
101 97
102 void DependencyGraphCallback::OutputGraphFile() { 98 void DependencyGraphCallback::OutputGraphFile() {
103 std::string Err; 99 std::error_code EC;
104 llvm::raw_fd_ostream OS(OutputFile.c_str(), Err); 100 llvm::raw_fd_ostream OS(OutputFile, EC, llvm::sys::fs::F_Text);
105 if (!Err.empty()) { 101 if (EC) {
106 PP->getDiagnostics().Report(diag::err_fe_error_opening) 102 PP->getDiagnostics().Report(diag::err_fe_error_opening) << OutputFile
107 << OutputFile << Err; 103 << EC.message();
108 return; 104 return;
109 } 105 }
110 106
111 OS << "digraph \"dependencies\" {\n"; 107 OS << "digraph \"dependencies\" {\n";
112 108