1 //===--- Utils.h - Misc utilities for the front-end -------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This header contains miscellaneous utilities for various front-end actions.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_FRONTEND_UTILS_H
15 #define LLVM_CLANG_FRONTEND_UTILS_H
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/Support/raw_ostream.h"
27 class DependencyOutputOptions;
29 class DiagnosticOptions;
31 class HeaderSearchOptions;
32 class IdentifierTable;
36 class PreprocessorOptions;
37 class PreprocessorOutputOptions;
41 class FrontendOptions;
43 /// Normalize \arg File for use in a user defined #include directive (in the
44 /// predefines buffer).
45 std::string NormalizeDashIncludePath(llvm::StringRef File);
47 /// Apply the header search options to get given HeaderSearch object.
48 void ApplyHeaderSearchOptions(HeaderSearch &HS,
49 const HeaderSearchOptions &HSOpts,
50 const LangOptions &Lang,
51 const llvm::Triple &triple);
53 /// InitializePreprocessor - Initialize the preprocessor getting it and the
54 /// environment ready to process a single file.
55 void InitializePreprocessor(Preprocessor &PP,
56 const PreprocessorOptions &PPOpts,
57 const HeaderSearchOptions &HSOpts,
58 const FrontendOptions &FEOpts);
60 /// ProcessWarningOptions - Initialize the diagnostic client and process the
61 /// warning options specified on the command line.
62 void ProcessWarningOptions(Diagnostic &Diags, const DiagnosticOptions &Opts);
64 /// DoPrintPreprocessedInput - Implement -E mode.
65 void DoPrintPreprocessedInput(Preprocessor &PP, llvm::raw_ostream* OS,
66 const PreprocessorOutputOptions &Opts);
68 /// CreatePrintParserActionsAction - Return the actions implementation that
69 /// implements the -parse-print-callbacks option.
70 MinimalAction *CreatePrintParserActionsAction(Preprocessor &PP,
71 llvm::raw_ostream* OS);
73 /// CheckDiagnostics - Gather the expected diagnostics and check them.
74 bool CheckDiagnostics(Preprocessor &PP);
76 /// AttachDependencyFileGen - Create a dependency file generator, and attach
77 /// it to the given preprocessor. This takes ownership of the output stream.
78 void AttachDependencyFileGen(Preprocessor &PP,
79 const DependencyOutputOptions &Opts);
81 /// CacheTokens - Cache tokens for use with PCH. Note that this requires
82 /// a seekable stream.
83 void CacheTokens(Preprocessor &PP, llvm::raw_fd_ostream* OS);
85 } // end namespace clang