clang API Documentation

Frontend/Utils.h

Go to the documentation of this file.
00001 //===--- Utils.h - Misc utilities for the front-end -------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  This header contains miscellaneous utilities for various front-end actions.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_CLANG_FRONTEND_UTILS_H
00015 #define LLVM_CLANG_FRONTEND_UTILS_H
00016 
00017 #include "llvm/ADT/StringRef.h"
00018 #include "llvm/Support/raw_ostream.h"
00019 
00020 namespace llvm {
00021 class Triple;
00022 }
00023 
00024 namespace clang {
00025 class ASTConsumer;
00026 class Decl;
00027 class DependencyOutputOptions;
00028 class Diagnostic;
00029 class DiagnosticOptions;
00030 class HeaderSearch;
00031 class HeaderSearchOptions;
00032 class IdentifierTable;
00033 class LangOptions;
00034 class MinimalAction;
00035 class Preprocessor;
00036 class PreprocessorOptions;
00037 class PreprocessorOutputOptions;
00038 class SourceManager;
00039 class Stmt;
00040 class TargetInfo;
00041 class FrontendOptions;
00042 
00043 /// Normalize \arg File for use in a user defined #include directive (in the
00044 /// predefines buffer).
00045 std::string NormalizeDashIncludePath(llvm::StringRef File);
00046 
00047 /// Apply the header search options to get given HeaderSearch object.
00048 void ApplyHeaderSearchOptions(HeaderSearch &HS,
00049                               const HeaderSearchOptions &HSOpts,
00050                               const LangOptions &Lang,
00051                               const llvm::Triple &triple);
00052 
00053 /// InitializePreprocessor - Initialize the preprocessor getting it and the
00054 /// environment ready to process a single file.
00055 void InitializePreprocessor(Preprocessor &PP,
00056                             const PreprocessorOptions &PPOpts,
00057                             const HeaderSearchOptions &HSOpts,
00058                             const FrontendOptions &FEOpts);
00059 
00060 /// ProcessWarningOptions - Initialize the diagnostic client and process the
00061 /// warning options specified on the command line.
00062 void ProcessWarningOptions(Diagnostic &Diags, const DiagnosticOptions &Opts);
00063 
00064 /// DoPrintPreprocessedInput - Implement -E mode.
00065 void DoPrintPreprocessedInput(Preprocessor &PP, llvm::raw_ostream* OS,
00066                               const PreprocessorOutputOptions &Opts);
00067 
00068 /// CreatePrintParserActionsAction - Return the actions implementation that
00069 /// implements the -parse-print-callbacks option.
00070 MinimalAction *CreatePrintParserActionsAction(Preprocessor &PP,
00071                                               llvm::raw_ostream* OS);
00072 
00073 /// CheckDiagnostics - Gather the expected diagnostics and check them.
00074 bool CheckDiagnostics(Preprocessor &PP);
00075 
00076 /// AttachDependencyFileGen - Create a dependency file generator, and attach
00077 /// it to the given preprocessor.  This takes ownership of the output stream.
00078 void AttachDependencyFileGen(Preprocessor &PP,
00079                              const DependencyOutputOptions &Opts);
00080 
00081 /// CacheTokens - Cache tokens for use with PCH. Note that this requires
00082 /// a seekable stream.
00083 void CacheTokens(Preprocessor &PP, llvm::raw_fd_ostream* OS);
00084 
00085 }  // end namespace clang
00086 
00087 #endif