FrontendActions.cpp (199482) | FrontendActions.cpp (199990) |
---|---|
1//===--- FrontendActions.cpp ----------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 156 unchanged lines hidden (view full) --- 165 if (BA == Backend_EmitAssembly) 166 OS.reset(CI.createDefaultOutputFile(false, InFile, "s")); 167 else if (BA == Backend_EmitLL) 168 OS.reset(CI.createDefaultOutputFile(false, InFile, "ll")); 169 else if (BA == Backend_EmitBC) 170 OS.reset(CI.createDefaultOutputFile(true, InFile, "bc")); 171 172 return CreateBackendConsumer(BA, CI.getDiagnostics(), CI.getLangOpts(), | 1//===--- FrontendActions.cpp ----------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 156 unchanged lines hidden (view full) --- 165 if (BA == Backend_EmitAssembly) 166 OS.reset(CI.createDefaultOutputFile(false, InFile, "s")); 167 else if (BA == Backend_EmitLL) 168 OS.reset(CI.createDefaultOutputFile(false, InFile, "ll")); 169 else if (BA == Backend_EmitBC) 170 OS.reset(CI.createDefaultOutputFile(true, InFile, "bc")); 171 172 return CreateBackendConsumer(BA, CI.getDiagnostics(), CI.getLangOpts(), |
173 CI.getCodeGenOpts(), CI.getTargetOpts(), InFile, | 173 CI.getCodeGenOpts(), CI.getTargetOpts(), 174 CI.getFrontendOpts().ShowTimers, InFile, |
174 OS.take(), CI.getLLVMContext()); 175} 176 177EmitAssemblyAction::EmitAssemblyAction() 178 : CodeGenAction(Backend_EmitAssembly) {} 179 180EmitBCAction::EmitBCAction() : CodeGenAction(Backend_EmitBC) {} 181 --- 5 unchanged lines hidden (view full) --- 187// Preprocessor Actions 188//===----------------------------------------------------------------------===// 189 190void DumpRawTokensAction::ExecuteAction() { 191 Preprocessor &PP = getCompilerInstance().getPreprocessor(); 192 SourceManager &SM = PP.getSourceManager(); 193 194 // Start lexing the specified input file. | 175 OS.take(), CI.getLLVMContext()); 176} 177 178EmitAssemblyAction::EmitAssemblyAction() 179 : CodeGenAction(Backend_EmitAssembly) {} 180 181EmitBCAction::EmitBCAction() : CodeGenAction(Backend_EmitBC) {} 182 --- 5 unchanged lines hidden (view full) --- 188// Preprocessor Actions 189//===----------------------------------------------------------------------===// 190 191void DumpRawTokensAction::ExecuteAction() { 192 Preprocessor &PP = getCompilerInstance().getPreprocessor(); 193 SourceManager &SM = PP.getSourceManager(); 194 195 // Start lexing the specified input file. |
195 Lexer RawLex(SM.getMainFileID(), SM, PP.getLangOptions()); | 196 const llvm::MemoryBuffer *FromFile = SM.getBuffer(SM.getMainFileID()); 197 Lexer RawLex(SM.getMainFileID(), FromFile, SM, PP.getLangOptions()); |
196 RawLex.SetKeepWhitespaceMode(true); 197 198 Token RawTok; 199 RawLex.LexFromRawLexer(RawTok); 200 while (RawTok.isNot(tok::eof)) { 201 PP.DumpToken(RawTok, true); | 198 RawLex.SetKeepWhitespaceMode(true); 199 200 Token RawTok; 201 RawLex.LexFromRawLexer(RawTok); 202 while (RawTok.isNot(tok::eof)) { 203 PP.DumpToken(RawTok, true); |
202 fprintf(stderr, "\n"); | 204 llvm::errs() << "\n"; |
203 RawLex.LexFromRawLexer(RawTok); 204 } 205} 206 207void DumpTokensAction::ExecuteAction() { 208 Preprocessor &PP = getCompilerInstance().getPreprocessor(); 209 // Start preprocessing the specified input file. 210 Token Tok; 211 PP.EnterMainSourceFile(); 212 do { 213 PP.Lex(Tok); 214 PP.DumpToken(Tok, true); | 205 RawLex.LexFromRawLexer(RawTok); 206 } 207} 208 209void DumpTokensAction::ExecuteAction() { 210 Preprocessor &PP = getCompilerInstance().getPreprocessor(); 211 // Start preprocessing the specified input file. 212 Token Tok; 213 PP.EnterMainSourceFile(); 214 do { 215 PP.Lex(Tok); 216 PP.DumpToken(Tok, true); |
215 fprintf(stderr, "\n"); | 217 llvm::errs() << "\n"; |
216 } while (Tok.isNot(tok::eof)); 217} 218 219void GeneratePTHAction::ExecuteAction() { 220 CompilerInstance &CI = getCompilerInstance(); 221 if (CI.getFrontendOpts().OutputFile.empty() || 222 CI.getFrontendOpts().OutputFile == "-") { 223 // FIXME: Don't fail this way. 224 // FIXME: Verify that we can actually seek in the given file. | 218 } while (Tok.isNot(tok::eof)); 219} 220 221void GeneratePTHAction::ExecuteAction() { 222 CompilerInstance &CI = getCompilerInstance(); 223 if (CI.getFrontendOpts().OutputFile.empty() || 224 CI.getFrontendOpts().OutputFile == "-") { 225 // FIXME: Don't fail this way. 226 // FIXME: Verify that we can actually seek in the given file. |
225 llvm::errs() << "ERROR: PTH requires an seekable file for output!\n"; 226 ::exit(1); | 227 llvm::llvm_report_error("PTH requires a seekable file for output!"); |
227 } 228 llvm::raw_fd_ostream *OS = 229 CI.createDefaultOutputFile(true, getCurrentFile()); 230 CacheTokens(CI.getPreprocessor(), OS); 231} 232 233void ParseOnlyAction::ExecuteAction() { 234 Preprocessor &PP = getCompilerInstance().getPreprocessor(); --- 47 unchanged lines hidden --- | 228 } 229 llvm::raw_fd_ostream *OS = 230 CI.createDefaultOutputFile(true, getCurrentFile()); 231 CacheTokens(CI.getPreprocessor(), OS); 232} 233 234void ParseOnlyAction::ExecuteAction() { 235 Preprocessor &PP = getCompilerInstance().getPreprocessor(); --- 47 unchanged lines hidden --- |