126266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar//===--- FrontendOptions.h --------------------------------------*- C++ -*-===//
226266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar//
326266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar//                     The LLVM Compiler Infrastructure
426266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar//
526266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar// This file is distributed under the University of Illinois Open Source
626266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar// License. See LICENSE.TXT for details.
726266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar//
826266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar//===----------------------------------------------------------------------===//
926266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar
1026266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar#ifndef LLVM_CLANG_FRONTEND_FRONTENDOPTIONS_H
1126266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar#define LLVM_CLANG_FRONTEND_FRONTENDOPTIONS_H
1226266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar
13c86804bc9c3f1953520b59084c9ad75104aba123Daniel Dunbar#include "clang/Frontend/CommandLineSourceLoc.h"
14d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko#include "clang/Sema/CodeCompleteOptions.h"
15fbe2fafe317a757031e4f24026a77dd305607d32Daniel Dunbar#include "llvm/ADT/StringRef.h"
1626266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar#include <string>
1726266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar#include <vector>
1826266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar
198616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidisnamespace llvm {
208616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidisclass MemoryBuffer;
218616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis}
228616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis
2326266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbarnamespace clang {
2426266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar
259a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbarnamespace frontend {
269a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar  enum ActionKind {
27171af64ef10ae816ed2a4f15f5d17aca1d71769fAlexander Kornienko    ASTDeclList,            ///< Parse ASTs and list Decl nodes.
289a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    ASTDump,                ///< Parse ASTs and dump them.
299a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    ASTPrint,               ///< Parse ASTs and print them.
309a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    ASTView,                ///< Parse ASTs and view them in Graphviz.
319a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    DumpRawTokens,          ///< Dump out raw tokens.
329a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    DumpTokens,             ///< Dump out preprocessed tokens.
339a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    EmitAssembly,           ///< Emit a .s file.
349a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    EmitBC,                 ///< Emit a .bc file.
359a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    EmitHTML,               ///< Translate input source into HTML.
369a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    EmitLLVM,               ///< Emit a .ll file.
3732148cef25570a4fbe3ad0ec497ce3ae2cf1b774Daniel Dunbar    EmitLLVMOnly,           ///< Generate LLVM IR, but do not emit anything.
3832148cef25570a4fbe3ad0ec497ce3ae2cf1b774Daniel Dunbar    EmitCodeGenOnly,        ///< Generate machine code, but don't emit anything.
39da1573f95902a42aa4d11e8f45ab98ec7e27bc28Daniel Dunbar    EmitObj,                ///< Emit a .o file.
409a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    FixIt,                  ///< Parse and apply any fixits to the source.
41467dc88512b4ba4bb16e274ea3771dc1415d31daDouglas Gregor    GenerateModule,         ///< Generate pre-compiled module.
429a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    GeneratePCH,            ///< Generate pre-compiled header.
439a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    GeneratePTH,            ///< Generate pre-tokenized header.
442758595023c5c7c0495f19260089f975022c50dcDaniel Dunbar    InitOnly,               ///< Only execute frontend initialization.
45c544ba09695e300f31355af342258bd57619e737Douglas Gregor    ModuleFileInfo,         ///< Dump information about a module file.
46651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines    VerifyPCH,              ///< Load and verify that a PCH file is usable.
479a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    ParseSyntaxOnly,        ///< Parse and perform semantic analysis.
48d10c5b88334d860d19284032a7126dc2219f57edDaniel Dunbar    PluginAction,           ///< Run a plugin action, \see ActionName.
499a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    PrintDeclContext,       ///< Print DeclContext and their Decls.
50f033f1da4a34f8df6e95e9929dc04ff54bb8fb01Douglas Gregor    PrintPreamble,          ///< Print the "preamble" of the input file
519a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    PrintPreprocessedInput, ///< -E mode.
52809d1be9820039b4cf6efa48246a0d70ffa13394James Dennett    RewriteMacros,          ///< Expand macros but not \#includes.
539a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    RewriteObjC,            ///< ObjC->C Rewriter.
549a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    RewriteTest,            ///< Rewriter playground
559a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    RunAnalysis,            ///< Run one or more source code analyses.
5630660a898545416f0fea2d717f16f75640001e38Ted Kremenek    MigrateSource,          ///< Run migrator.
579a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar    RunPreprocessorOnly     ///< Just lex, no output.
589a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar  };
599a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar}
609a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar
611f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregorenum InputKind {
621f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  IK_None,
631f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  IK_Asm,
641f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  IK_C,
651f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  IK_CXX,
661f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  IK_ObjC,
671f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  IK_ObjCXX,
681f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  IK_PreprocessedC,
691f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  IK_PreprocessedCXX,
701f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  IK_PreprocessedObjC,
711f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  IK_PreprocessedObjCXX,
721f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  IK_OpenCL,
731f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  IK_CUDA,
741f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  IK_AST,
751f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  IK_LLVM_IR
761f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor};
771f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor
781f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor
791f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor/// \brief An input file for the front end.
808616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidisclass FrontendInputFile {
811f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  /// \brief The file name, or "-" to read from standard input.
821f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  std::string File;
831f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor
848616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis  llvm::MemoryBuffer *Buffer;
858616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis
861f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  /// \brief The kind of input, e.g., C source, AST file, LLVM IR.
871f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  InputKind Kind;
881f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor
89a1f1fad8b60e1cb9d21a40a37f2e03150bcbeb6fDouglas Gregor  /// \brief Whether we're dealing with a 'system' input (vs. a 'user' input).
90a1f1fad8b60e1cb9d21a40a37f2e03150bcbeb6fDouglas Gregor  bool IsSystem;
918616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis
928616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidispublic:
936bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines  FrontendInputFile() : Buffer(nullptr), Kind(IK_None) { }
94a1f1fad8b60e1cb9d21a40a37f2e03150bcbeb6fDouglas Gregor  FrontendInputFile(StringRef File, InputKind Kind, bool IsSystem = false)
956bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines    : File(File.str()), Buffer(nullptr), Kind(Kind), IsSystem(IsSystem) { }
968616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis  FrontendInputFile(llvm::MemoryBuffer *buffer, InputKind Kind,
978616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis                    bool IsSystem = false)
988616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis    : Buffer(buffer), Kind(Kind), IsSystem(IsSystem) { }
998616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis
1008616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis  InputKind getKind() const { return Kind; }
1018616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis  bool isSystem() const { return IsSystem; }
1028616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis
1036bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines  bool isEmpty() const { return File.empty() && Buffer == nullptr; }
1048616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis  bool isFile() const { return !isBuffer(); }
1056bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines  bool isBuffer() const { return Buffer != nullptr; }
1068616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis
1078616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis  StringRef getFile() const {
1088616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis    assert(isFile());
1098616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis    return File;
1108616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis  }
1118616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis  llvm::MemoryBuffer *getBuffer() const {
1128616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis    assert(isBuffer());
1138616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis    return Buffer;
1148616f9af65b9a3662f2c9dfed38eeabc509f8446Argyrios Kyrtzidis  }
1151f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor};
116d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko
11726266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar/// FrontendOptions - Options for controlling the behavior of the frontend.
11826266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbarclass FrontendOptions {
11926266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbarpublic:
120914474ca51d202369241a81013208833a6bb3f12Daniel Dunbar  unsigned DisableFree : 1;                ///< Disable memory freeing on exit.
121914474ca51d202369241a81013208833a6bb3f12Daniel Dunbar  unsigned RelocatablePCH : 1;             ///< When generating PCH files,
1223c7f4134603d04b44f997b43c0a9def270f25386Sebastian Redl                                           /// instruct the AST writer to create
123914474ca51d202369241a81013208833a6bb3f12Daniel Dunbar                                           /// relocatable PCH files.
1249b5e9ae08defd14441acca1d7d4502b933bf6c5aDaniel Dunbar  unsigned ShowHelp : 1;                   ///< Show the -help text.
125914474ca51d202369241a81013208833a6bb3f12Daniel Dunbar  unsigned ShowStats : 1;                  ///< Show frontend performance
126914474ca51d202369241a81013208833a6bb3f12Daniel Dunbar                                           /// metrics and statistics.
127914474ca51d202369241a81013208833a6bb3f12Daniel Dunbar  unsigned ShowTimers : 1;                 ///< Show timers for individual
128914474ca51d202369241a81013208833a6bb3f12Daniel Dunbar                                           /// actions.
1299b5e9ae08defd14441acca1d7d4502b933bf6c5aDaniel Dunbar  unsigned ShowVersion : 1;                ///< Show the -version text.
1301450f265fcc84a7ca64dd9f3b8d4492c5bd55e23Nick Lewycky  unsigned FixWhatYouCan : 1;              ///< Apply fixes even if there are
1311450f265fcc84a7ca64dd9f3b8d4492c5bd55e23Nick Lewycky                                           /// unfixable errors.
13261d679ab2831b161c857cf3f974312fbd4ef1efdArgyrios Kyrtzidis  unsigned FixOnlyWarnings : 1;            ///< Apply fixes only for warnings.
13361d679ab2831b161c857cf3f974312fbd4ef1efdArgyrios Kyrtzidis  unsigned FixAndRecompile : 1;            ///< Apply fixes and recompile.
13461d679ab2831b161c857cf3f974312fbd4ef1efdArgyrios Kyrtzidis  unsigned FixToTemporaries : 1;           ///< Apply fixes to temporary files.
1357ee2049278b98d42709380054eb83f4952af1200Argyrios Kyrtzidis  unsigned ARCMTMigrateEmitARCErrors : 1;  /// Emit ARC errors even if the
1367ee2049278b98d42709380054eb83f4952af1200Argyrios Kyrtzidis                                           /// migrator can fix them
1376a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen  unsigned SkipFunctionBodies : 1;         ///< Skip over function bodies to
1386a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen                                           /// speed up parsing in cases you do
1396a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen                                           /// not need them (e.g. with code
1406a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen                                           /// completion).
141f575d6e7c3b887ea4c5394d2c7e322c7a929a57eDouglas Gregor  unsigned UseGlobalModuleIndex : 1;       ///< Whether we can use the
142f575d6e7c3b887ea4c5394d2c7e322c7a929a57eDouglas Gregor                                           ///< global module index if available.
143f575d6e7c3b887ea4c5394d2c7e322c7a929a57eDouglas Gregor  unsigned GenerateGlobalModuleIndex : 1;  ///< Whether we can generate the
144f575d6e7c3b887ea4c5394d2c7e322c7a929a57eDouglas Gregor                                           ///< global module index if needed.
145ab297ccbcc51d5197d4ddb4e99b7bc8868d38314Richard Smith  unsigned ASTDumpLookups : 1;             ///< Whether we include lookup table
146ab297ccbcc51d5197d4ddb4e99b7bc8868d38314Richard Smith                                           ///< dumps in AST dumps.
147f575d6e7c3b887ea4c5394d2c7e322c7a929a57eDouglas Gregor
148d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko  CodeCompleteOptions CodeCompleteOpts;
149d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko
150f85e193739c953358c865005855253af4f68a497John McCall  enum {
151f85e193739c953358c865005855253af4f68a497John McCall    ARCMT_None,
152f85e193739c953358c865005855253af4f68a497John McCall    ARCMT_Check,
15369325d5b7cfecf1b3128745efc33612aedf1b8b4Argyrios Kyrtzidis    ARCMT_Modify,
15469325d5b7cfecf1b3128745efc33612aedf1b8b4Argyrios Kyrtzidis    ARCMT_Migrate
155f85e193739c953358c865005855253af4f68a497John McCall  } ARCMTAction;
156f85e193739c953358c865005855253af4f68a497John McCall
15730660a898545416f0fea2d717f16f75640001e38Ted Kremenek  enum {
15830660a898545416f0fea2d717f16f75640001e38Ted Kremenek    ObjCMT_None = 0,
15930660a898545416f0fea2d717f16f75640001e38Ted Kremenek    /// \brief Enable migration to modern ObjC literals.
16030660a898545416f0fea2d717f16f75640001e38Ted Kremenek    ObjCMT_Literals = 0x1,
16130660a898545416f0fea2d717f16f75640001e38Ted Kremenek    /// \brief Enable migration to modern ObjC subscripting.
162d412999a3da6387dbfaf00f7647132082e94310eFariborz Jahanian    ObjCMT_Subscripting = 0x2,
1635b98aba1d74184923da32016c3abbc20e9a7686dFariborz Jahanian    /// \brief Enable migration to modern ObjC readonly property.
164081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian    ObjCMT_ReadonlyProperty = 0x4,
165081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian    /// \brief Enable migration to modern ObjC readwrite property.
166081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian    ObjCMT_ReadwriteProperty = 0x8,
167081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian    /// \brief Enable migration to modern ObjC property.
168081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian    ObjCMT_Property = (ObjCMT_ReadonlyProperty | ObjCMT_ReadwriteProperty),
169081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian    /// \brief Enable annotation of ObjCMethods of all kinds.
170081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian    ObjCMT_Annotation = 0x10,
171081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian    /// \brief Enable migration of ObjC methods to 'instancetype'.
172081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian    ObjCMT_Instancetype = 0x20,
173081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian    /// \brief Enable migration to NS_ENUM/NS_OPTIONS macros.
174081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian    ObjCMT_NsMacros = 0x40,
175081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian    /// \brief Enable migration to add conforming protocols.
176081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian    ObjCMT_ProtocolConformance = 0x80,
17739ebb02cb0bd342ced56de6d19aa9992aa0371b8Fariborz Jahanian    /// \brief prefer 'atomic' property over 'nonatomic'.
17839ebb02cb0bd342ced56de6d19aa9992aa0371b8Fariborz Jahanian    ObjCMT_AtomicProperty = 0x100,
179cd569f2788ece55b9f790b6900164e2b2d5d966cFariborz Jahanian    /// \brief annotate property with NS_RETURNS_INNER_POINTER
180cd569f2788ece55b9f790b6900164e2b2d5d966cFariborz Jahanian    ObjCMT_ReturnsInnerPointerProperty = 0x200,
1815d2a20671954f55f765b96375e8bcd38367cb3baFariborz Jahanian    /// \brief use NS_NONATOMIC_IOSONLY for property 'atomic' attribute
1825d2a20671954f55f765b96375e8bcd38367cb3baFariborz Jahanian    ObjCMT_NsAtomicIOSOnlyProperty = 0x400,
183651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines    /// \brief Enable inferring NS_DESIGNATED_INITIALIZER for ObjC methods.
184651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines    ObjCMT_DesignatedInitializer = 0x800,
185081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian    ObjCMT_MigrateDecls = (ObjCMT_ReadonlyProperty | ObjCMT_ReadwriteProperty |
186081099d302b79d1746c7a39da14e3265971eb718Fariborz Jahanian                           ObjCMT_Annotation | ObjCMT_Instancetype |
1875d2a20671954f55f765b96375e8bcd38367cb3baFariborz Jahanian                           ObjCMT_NsMacros | ObjCMT_ProtocolConformance |
188651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                           ObjCMT_NsAtomicIOSOnlyProperty |
189651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines                           ObjCMT_DesignatedInitializer),
1905d2a20671954f55f765b96375e8bcd38367cb3baFariborz Jahanian    ObjCMT_MigrateAll = (ObjCMT_Literals | ObjCMT_Subscripting | ObjCMT_MigrateDecls)
19130660a898545416f0fea2d717f16f75640001e38Ted Kremenek  };
19230660a898545416f0fea2d717f16f75640001e38Ted Kremenek  unsigned ObjCMTAction;
1932c050f6a68c4f871d26be63f8d598f1b64a8e16fArgyrios Kyrtzidis  std::string ObjCMTWhiteListPath;
19430660a898545416f0fea2d717f16f75640001e38Ted Kremenek
19530660a898545416f0fea2d717f16f75640001e38Ted Kremenek  std::string MTMigrateDir;
1967ee2049278b98d42709380054eb83f4952af1200Argyrios Kyrtzidis  std::string ARCMTMigrateReportOut;
19769325d5b7cfecf1b3128745efc33612aedf1b8b4Argyrios Kyrtzidis
198fbe2fafe317a757031e4f24026a77dd305607d32Daniel Dunbar  /// The input files and their types.
1991f6b2b5c82b2d2d3935b0db76352a04e9877b73fDouglas Gregor  std::vector<FrontendInputFile> Inputs;
20026266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar
20126266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar  /// The output file, if any.
20226266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar  std::string OutputFile;
20326266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar
204ba5f6eced29937e4e4851a2c0980744768413d66Nick Lewycky  /// If given, the new suffix for fix-it rewritten files.
205ba5f6eced29937e4e4851a2c0980744768413d66Nick Lewycky  std::string FixItSuffix;
206c86804bc9c3f1953520b59084c9ad75104aba123Daniel Dunbar
207e34a052d642ba7830174b1a51787251d7f704f80Alexander Kornienko  /// If given, filter dumped AST Decl nodes by this substring.
208e34a052d642ba7830174b1a51787251d7f704f80Alexander Kornienko  std::string ASTDumpFilter;
209e34a052d642ba7830174b1a51787251d7f704f80Alexander Kornienko
210914474ca51d202369241a81013208833a6bb3f12Daniel Dunbar  /// If given, enable code completion at the provided location.
211914474ca51d202369241a81013208833a6bb3f12Daniel Dunbar  ParsedSourceLocation CodeCompletionAt;
212914474ca51d202369241a81013208833a6bb3f12Daniel Dunbar
2139a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar  /// The frontend action to perform.
2149a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar  frontend::ActionKind ProgramAction;
2159a8a83b8fe5be9a4ca20ec6eeaafaf201ce594f9Daniel Dunbar
216d10c5b88334d860d19284032a7126dc2219f57edDaniel Dunbar  /// The name of the action to run when using a plugin action.
217d10c5b88334d860d19284032a7126dc2219f57edDaniel Dunbar  std::string ActionName;
218d10c5b88334d860d19284032a7126dc2219f57edDaniel Dunbar
219f25649c74397d2620e6ac61f1045261644707c80Nico Weber  /// Args to pass to the plugin
2203177aae51a21f61ab483c52f97124bdb707da7f1Daniel Dunbar  std::vector<std::string> PluginArgs;
2213177aae51a21f61ab483c52f97124bdb707da7f1Daniel Dunbar
2225aa74affa5d61d04c4b034b3722ca41aec0cba6eNico Weber  /// The list of plugin actions to run in addition to the normal action.
2235aa74affa5d61d04c4b034b3722ca41aec0cba6eNico Weber  std::vector<std::string> AddPluginActions;
2245aa74affa5d61d04c4b034b3722ca41aec0cba6eNico Weber
225f25649c74397d2620e6ac61f1045261644707c80Nico Weber  /// Args to pass to the additional plugins
226f25649c74397d2620e6ac61f1045261644707c80Nico Weber  std::vector<std::vector<std::string> > AddPluginArgs;
227f25649c74397d2620e6ac61f1045261644707c80Nico Weber
228efba227cc5459554eca466aafe786b5132dcb68cDaniel Dunbar  /// The list of plugins to load.
229efba227cc5459554eca466aafe786b5132dcb68cDaniel Dunbar  std::vector<std::string> Plugins;
230efba227cc5459554eca466aafe786b5132dcb68cDaniel Dunbar
2319bed8798964d9f07599c2c9199701f86fbc70e20Douglas Gregor  /// \brief The list of AST files to merge.
2329bed8798964d9f07599c2c9199701f86fbc70e20Douglas Gregor  std::vector<std::string> ASTMergeFiles;
2339bed8798964d9f07599c2c9199701f86fbc70e20Douglas Gregor
2343f87fb08dd502309960646db01099fb4c1be9a7cDaniel Dunbar  /// \brief A list of arguments to forward to LLVM's option processing; this
2353f87fb08dd502309960646db01099fb4c1be9a7cDaniel Dunbar  /// should only be used for debugging and experimental features.
2363f87fb08dd502309960646db01099fb4c1be9a7cDaniel Dunbar  std::vector<std::string> LLVMArgs;
2373f87fb08dd502309960646db01099fb4c1be9a7cDaniel Dunbar
238453dbcbe30093fbf947a0bec2fbd46e9694eafe9Douglas Gregor  /// \brief File name of the file that will provide record layouts
239453dbcbe30093fbf947a0bec2fbd46e9694eafe9Douglas Gregor  /// (in the format produced by -fdump-record-layouts).
240453dbcbe30093fbf947a0bec2fbd46e9694eafe9Douglas Gregor  std::string OverrideRecordLayoutsFile;
241453dbcbe30093fbf947a0bec2fbd46e9694eafe9Douglas Gregor
24226266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbarpublic:
24396e12a264f9268a5fb73020a5d318474f0bfe429Richard Smith  FrontendOptions() :
24496e12a264f9268a5fb73020a5d318474f0bfe429Richard Smith    DisableFree(false), RelocatablePCH(false), ShowHelp(false),
24596e12a264f9268a5fb73020a5d318474f0bfe429Richard Smith    ShowStats(false), ShowTimers(false), ShowVersion(false),
24696e12a264f9268a5fb73020a5d318474f0bfe429Richard Smith    FixWhatYouCan(false), FixOnlyWarnings(false), FixAndRecompile(false),
24796e12a264f9268a5fb73020a5d318474f0bfe429Richard Smith    FixToTemporaries(false), ARCMTMigrateEmitARCErrors(false),
24820c6f2eae500242d3aef5daaa55d440a0786a1fdDouglas Gregor    SkipFunctionBodies(false), UseGlobalModuleIndex(true),
249ab297ccbcc51d5197d4ddb4e99b7bc8868d38314Richard Smith    GenerateGlobalModuleIndex(true), ASTDumpLookups(false),
250a6b00fc97669aa25d89ae9f202b05dfadfd0e324Douglas Gregor    ARCMTAction(ARCMT_None), ObjCMTAction(ObjCMT_None),
251a6b00fc97669aa25d89ae9f202b05dfadfd0e324Douglas Gregor    ProgramAction(frontend::ParseSyntaxOnly)
25296e12a264f9268a5fb73020a5d318474f0bfe429Richard Smith  {}
253fbe2fafe317a757031e4f24026a77dd305607d32Daniel Dunbar
254fbe2fafe317a757031e4f24026a77dd305607d32Daniel Dunbar  /// getInputKindForExtension - Return the appropriate input kind for a file
255fbe2fafe317a757031e4f24026a77dd305607d32Daniel Dunbar  /// extension. For example, "c" would return IK_C.
256fbe2fafe317a757031e4f24026a77dd305607d32Daniel Dunbar  ///
257fbe2fafe317a757031e4f24026a77dd305607d32Daniel Dunbar  /// \return The input kind for the extension, or IK_None if the extension is
258fbe2fafe317a757031e4f24026a77dd305607d32Daniel Dunbar  /// not recognized.
259686775deca8b8685eb90801495880e3abdd844c2Chris Lattner  static InputKind getInputKindForExtension(StringRef Extension);
26026266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar};
26126266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar
26226266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar}  // end namespace clang
26326266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar
26426266885d6eba8ee197577dd42a8e68a0e4dd2e8Daniel Dunbar#endif
265