aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Frontend/FrontendOptions.h
blob: 23a170209831bff20e38a359e22650ff6e0d1d04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//===--- FrontendOptions.h --------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_FRONTEND_FRONTENDOPTIONS_H
#define LLVM_CLANG_FRONTEND_FRONTENDOPTIONS_H

#include "clang/Frontend/CommandLineSourceLoc.h"
#include "llvm/ADT/StringRef.h"
#include <string>
#include <vector>

namespace clang {

/// FrontendOptions - Options for controlling the behavior of the frontend.
class FrontendOptions {
public:
  enum InputKind {
    IK_None,
    IK_Asm,
    IK_C,
    IK_CXX,
    IK_ObjC,
    IK_ObjCXX,
    IK_PreprocessedC,
    IK_PreprocessedCXX,
    IK_PreprocessedObjC,
    IK_PreprocessedObjCXX,
    IK_OpenCL,
    IK_AST
  };

  unsigned DebugCodeCompletionPrinter : 1; ///< Use the debug printer for code
                                           /// completion results.
  unsigned DisableFree : 1;                ///< Disable memory freeing on exit.
  unsigned EmptyInputOnly : 1;             ///< Force input files to be treated
                                           /// as if they were empty, for timing
                                           /// the frontend startup.
  unsigned RelocatablePCH : 1;             ///< When generating PCH files,
                                           /// instruct the PCH writer to create
                                           /// relocatable PCH files.
  unsigned ShowMacrosInCodeCompletion : 1; ///< Show macros in code completion
                                           /// results.
  unsigned ShowStats : 1;                  ///< Show frontend performance
                                           /// metrics and statistics.
  unsigned ShowTimers : 1;                 ///< Show timers for individual
                                           /// actions.

  /// If given, the name of the target triple to compile for. If not given the
  /// target will be selected to match the host.
  std::string TargetTriple;

  /// If given, the name of the target ABI to use.
  std::string TargetABI;

  /// The input files and their types.
  std::vector<std::pair<InputKind, std::string> > Inputs;

  /// The output file, if any.
  std::string OutputFile;

  /// If given, the name for a C++ class to view the inheritance of.
  std::string ViewClassInheritance;

  /// A list of locations to apply fix-its at.
  std::vector<ParsedSourceLocation> FixItLocations;

  /// If given, enable code completion at the provided location.
  ParsedSourceLocation CodeCompletionAt;

public:
  FrontendOptions() {
    DebugCodeCompletionPrinter = 0;
    DisableFree = 0;
    EmptyInputOnly = 0;
    RelocatablePCH = 0;
    ShowMacrosInCodeCompletion = 0;
    ShowStats = 0;
    ShowTimers = 0;
  }

  /// getInputKindForExtension - Return the appropriate input kind for a file
  /// extension. For example, "c" would return IK_C.
  ///
  /// \return The input kind for the extension, or IK_None if the extension is
  /// not recognized.
  static InputKind getInputKindForExtension(llvm::StringRef Extension);
};

}  // end namespace clang

#endif