| 188 | : Name("temp"), Path(Path), Opt(Opt), Type(Type), Generated(false) {} |
| 189 | |
| 190 | CompileHelper::ASTData::ASTData(const SourceFileData &SourceFile) |
| 191 | : Path(SourceFile.Path + ".ast") { |
| 192 | |
| 193 | auto Compiler = CompileHelper::getCompiler(SourceFile.Type); |
| 194 | if (Compiler.empty()) |
| 195 | return; |
| 196 | |
| 197 | auto CMD = Compiler + " " + SourceFile.Opt + " -emit-ast -o " + Path + |
| 198 | " -c " + SourceFile.Path; |
| 199 | if (system(CMD.c_str()) || !fs::exists(Path)) |
| 200 | return; |
| 201 | |
| 202 | Ptr = clang::ASTUnit::LoadFromASTFile( |
| 203 | Path, clang::RawPCHContainerReader(), clang::ASTUnit::LoadASTOnly, |
| 204 | clang::CompilerInstance::createDiagnostics( |
| 205 | new clang::DiagnosticOptions()), |
| 206 | clang::FileSystemOptions()); |
| 207 | if (!Ptr && fs::exists(Path)) |
| 208 | fs::remove(Path); |
| 209 | } |
| 210 | |
| 211 | CompileHelper::ASTData::ASTData(ASTData &&Data) { |
| 212 | |