zcov: / include/clang/Frontend/FrontendOptions.h


Files: 1 Branches Taken: 0.0% 0 / 0
Generated: 2010-02-10 01:31 Branches Executed: 0.0% 0 / 0
Line Coverage: 100.0% 14 / 14


Programs: 5 Runs 8933


       1                 : //===--- FrontendOptions.h --------------------------------------*- C++ -*-===//
       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                 : //===----------------------------------------------------------------------===//
       9                 : 
      10                 : #ifndef LLVM_CLANG_FRONTEND_FRONTENDOPTIONS_H
      11                 : #define LLVM_CLANG_FRONTEND_FRONTENDOPTIONS_H
      12                 : 
      13                 : #include "clang/Frontend/CommandLineSourceLoc.h"
      14                 : #include "llvm/ADT/StringRef.h"
      15                 : #include <string>
      16                 : #include <vector>
      17                 : 
      18                 : namespace clang {
      19                 : 
      20                 : namespace frontend {
      21                 :   enum ActionKind {
      22                 :     ASTDump,                ///< Parse ASTs and dump them.
      23                 :     ASTPrint,               ///< Parse ASTs and print them.
      24                 :     ASTPrintXML,            ///< Parse ASTs and print them in XML.
      25                 :     ASTView,                ///< Parse ASTs and view them in Graphviz.
      26                 :     DumpRawTokens,          ///< Dump out raw tokens.
      27                 :     DumpRecordLayouts,      ///< Dump record layout information.
      28                 :     DumpTokens,             ///< Dump out preprocessed tokens.
      29                 :     EmitAssembly,           ///< Emit a .s file.
      30                 :     EmitBC,                 ///< Emit a .bc file.
      31                 :     EmitHTML,               ///< Translate input source into HTML.
      32                 :     EmitLLVM,               ///< Emit a .ll file.
      33                 :     EmitLLVMOnly,           ///< Generate LLVM IR, but do not
      34                 :     EmitObj,                ///< Emit a .o file.
      35                 :     FixIt,                  ///< Parse and apply any fixits to the source.
      36                 :     GeneratePCH,            ///< Generate pre-compiled header.
      37                 :     GeneratePTH,            ///< Generate pre-tokenized header.
      38                 :     InheritanceView,        ///< View C++ inheritance for a specified class.
      39                 :     ParseNoop,              ///< Parse with noop callbacks.
      40                 :     ParsePrintCallbacks,    ///< Parse and print each callback.
      41                 :     ParseSyntaxOnly,        ///< Parse and perform semantic analysis.
      42                 :     PluginAction,           ///< Run a plugin action, \see ActionName.
      43                 :     PrintDeclContext,       ///< Print DeclContext and their Decls.
      44                 :     PrintPreprocessedInput, ///< -E mode.
      45                 :     RewriteMacros,          ///< Expand macros but not #includes.
      46                 :     RewriteObjC,            ///< ObjC->C Rewriter.
      47                 :     RewriteTest,            ///< Rewriter playground
      48                 :     RunAnalysis,            ///< Run one or more source code analyses.
      49                 :     RunPreprocessorOnly     ///< Just lex, no output.
      50                 :   };
      51                 : }
      52                 : 
      53                 : /// FrontendOptions - Options for controlling the behavior of the frontend.
      54             2532: class FrontendOptions {
      55                 : public:
      56                 :   enum InputKind {
      57                 :     IK_None,
      58                 :     IK_Asm,
      59                 :     IK_C,
      60                 :     IK_CXX,
      61                 :     IK_ObjC,
      62                 :     IK_ObjCXX,
      63                 :     IK_PreprocessedC,
      64                 :     IK_PreprocessedCXX,
      65                 :     IK_PreprocessedObjC,
      66                 :     IK_PreprocessedObjCXX,
      67                 :     IK_OpenCL,
      68                 :     IK_AST
      69                 :   };
      70                 : 
      71                 :   unsigned DebugCodeCompletionPrinter : 1; ///< Use the debug printer for code
      72                 :                                            /// completion results.
      73                 :   unsigned DisableFree : 1;                ///< Disable memory freeing on exit.
      74                 :   unsigned EmptyInputOnly : 1;             ///< Force input files to be treated
      75                 :                                            /// as if they were empty, for timing
      76                 :                                            /// the frontend startup.
      77                 :   unsigned RelocatablePCH : 1;             ///< When generating PCH files,
      78                 :                                            /// instruct the PCH writer to create
      79                 :                                            /// relocatable PCH files.
      80                 :   unsigned ShowHelp : 1;                   ///< Show the -help text.
      81                 :   unsigned ShowMacrosInCodeCompletion : 1; ///< Show macros in code completion
      82                 :                                            /// results.
      83                 :   unsigned ShowStats : 1;                  ///< Show frontend performance
      84                 :                                            /// metrics and statistics.
      85                 :   unsigned ShowTimers : 1;                 ///< Show timers for individual
      86                 :                                            /// actions.
      87                 :   unsigned ShowVersion : 1;                ///< Show the -version text.
      88                 : 
      89                 :   /// The input files and their types.
      90                 :   std::vector<std::pair<InputKind, std::string> > Inputs;
      91                 : 
      92                 :   /// The output file, if any.
      93                 :   std::string OutputFile;
      94                 : 
      95                 :   /// If given, the name for a C++ class to view the inheritance of.
      96                 :   std::string ViewClassInheritance;
      97                 : 
      98                 :   /// A list of locations to apply fix-its at.
      99                 :   std::vector<ParsedSourceLocation> FixItLocations;
     100                 : 
     101                 :   /// If given, enable code completion at the provided location.
     102                 :   ParsedSourceLocation CodeCompletionAt;
     103                 : 
     104                 :   /// The frontend action to perform.
     105                 :   frontend::ActionKind ProgramAction;
     106                 : 
     107                 :   /// The name of the action to run when using a plugin action.
     108                 :   std::string ActionName;
     109                 : 
     110                 :   /// The list of plugins to load.
     111                 :   std::vector<std::string> Plugins;
     112                 : 
     113                 :   /// \brief The list of AST files to merge.
     114                 :   std::vector<std::string> ASTMergeFiles;
     115                 : 
     116                 : public:
     117             2532:   FrontendOptions() {
     118             2532:     DebugCodeCompletionPrinter = 1;
     119             2532:     DisableFree = 0;
     120             2532:     EmptyInputOnly = 0;
     121             2532:     ProgramAction = frontend::ParseSyntaxOnly;
     122             2532:     ActionName = "";
     123             2532:     RelocatablePCH = 0;
     124             2532:     ShowHelp = 0;
     125             2532:     ShowMacrosInCodeCompletion = 0;
     126             2532:     ShowStats = 0;
     127             2532:     ShowTimers = 0;
     128             2532:     ShowVersion = 0;
     129             2532:   }
     130                 : 
     131                 :   /// getInputKindForExtension - Return the appropriate input kind for a file
     132                 :   /// extension. For example, "c" would return IK_C.
     133                 :   ///
     134                 :   /// \return The input kind for the extension, or IK_None if the extension is
     135                 :   /// not recognized.
     136                 :   static InputKind getInputKindForExtension(llvm::StringRef Extension);
     137                 : };
     138                 : 
     139                 : }  // end namespace clang
     140                 : 
     141                 : #endif

Generated: 2010-02-10 01:31 by zcov