aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Frontend
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Frontend')
-rw-r--r--include/clang/Frontend/ASTUnit.h14
-rw-r--r--include/clang/Frontend/CodeGenOptions.h13
-rw-r--r--include/clang/Frontend/DependencyOutputOptions.h2
-rw-r--r--include/clang/Frontend/DiagnosticOptions.h3
-rw-r--r--include/clang/Frontend/FrontendAction.h39
-rw-r--r--include/clang/Frontend/FrontendActions.h6
-rw-r--r--include/clang/Frontend/FrontendOptions.h11
-rw-r--r--include/clang/Frontend/HeaderSearchOptions.h27
-rw-r--r--include/clang/Frontend/PreprocessorOptions.h27
-rw-r--r--include/clang/Frontend/TextDiagnosticPrinter.h19
-rw-r--r--include/clang/Frontend/Utils.h1
11 files changed, 119 insertions, 43 deletions
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index 339297eb9362..58a60a1f9d87 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -249,9 +249,9 @@ private:
/// \brief Whether we should be caching code-completion results.
bool ShouldCacheCodeCompletionResults;
- /// \brief Whether we want to include nested macro instantiations in the
+ /// \brief Whether we want to include nested macro expansions in the
/// detailed preprocessing record.
- bool NestedMacroInstantiations;
+ bool NestedMacroExpansions;
static void ConfigureDiags(llvm::IntrusiveRefCntPtr<Diagnostic> &Diags,
const char **ArgBegin, const char **ArgEnd,
@@ -363,7 +363,7 @@ private:
unsigned MaxLines, bool &CreatedBuffer);
llvm::MemoryBuffer *getMainBufferWithPrecompiledPreamble(
- CompilerInvocation PreambleInvocation,
+ const CompilerInvocation &PreambleInvocationIn,
bool AllowRebuild = true,
unsigned MaxLines = 0);
void RealizeTopLevelDeclsFromPreamble();
@@ -612,7 +612,7 @@ public:
bool PrecompilePreamble = false,
bool CompleteTranslationUnit = true,
bool CacheCodeCompletionResults = false,
- bool NestedMacroInstantiations = true);
+ bool NestedMacroExpansions = true);
/// LoadFromCommandLine - Create an ASTUnit from a vector of command line
/// arguments, which must specify exactly one source file.
@@ -642,7 +642,7 @@ public:
bool CacheCodeCompletionResults = false,
bool CXXPrecompilePreamble = false,
bool CXXChainedPCH = false,
- bool NestedMacroInstantiations = true);
+ bool NestedMacroExpansions = true);
/// \brief Reparse the source files using the same command-line options that
/// were originally used to produce this translation unit.
@@ -680,8 +680,8 @@ public:
/// \brief Save this translation unit to a file with the given name.
///
- /// \returns True if an error occurred, false otherwise.
- bool Save(llvm::StringRef File);
+ /// \returns An indication of whether the save was successful or not.
+ CXSaveError Save(llvm::StringRef File);
/// \brief Serialize this translation unit with the given output stream.
///
diff --git a/include/clang/Frontend/CodeGenOptions.h b/include/clang/Frontend/CodeGenOptions.h
index 1c686c76df5f..5d040b4f266c 100644
--- a/include/clang/Frontend/CodeGenOptions.h
+++ b/include/clang/Frontend/CodeGenOptions.h
@@ -36,6 +36,7 @@ public:
};
unsigned AsmVerbose : 1; /// -dA, -fverbose-asm.
+ unsigned ObjCAutoRefCountExceptions : 1; /// Whether ARC should be EH-safe.
unsigned CXAAtExit : 1; /// Use __cxa_atexit for calling destructors.
unsigned CXXCtorDtorAliases: 1; /// Emit complete ctors/dtors as linker
/// aliases to base ctors when possible.
@@ -69,11 +70,14 @@ public:
unsigned MergeAllConstants : 1; /// Merge identical constants.
unsigned NoCommon : 1; /// Set when -fno-common or C++ is enabled.
unsigned NoDwarf2CFIAsm : 1; /// Set when -fno-dwarf2-cfi-asm is enabled.
+ unsigned NoExecStack : 1; /// Set when -Wa,--noexecstack is enabled.
unsigned NoImplicitFloat : 1; /// Set when -mno-implicit-float is enabled.
unsigned NoInfsFPMath : 1; /// Assume FP arguments, results not +-Inf.
unsigned NoNaNsFPMath : 1; /// Assume FP arguments, results not NaN.
unsigned NoZeroInitializedInBSS : 1; /// -fno-zero-initialized-in-bss
unsigned ObjCDispatchMethod : 2; /// Method of Objective-C dispatch to use.
+ unsigned ObjCRuntimeHasARC : 1; /// The target runtime supports ARC natively
+ unsigned ObjCRuntimeHasTerminate : 1; /// The ObjC runtime has objc_terminate
unsigned OmitLeafFramePointer : 1; /// Set when -momit-leaf-frame-pointer is
/// enabled.
unsigned OptimizationLevel : 3; /// The -O[0-4] option specified.
@@ -89,6 +93,11 @@ public:
unsigned UnrollLoops : 1; /// Control whether loops are unrolled.
unsigned UnsafeFPMath : 1; /// Allow unsafe floating point optzns.
unsigned UnwindTables : 1; /// Emit unwind tables.
+
+ /// Attempt to use register sized accesses to bit-fields in structures, when
+ /// possible.
+ unsigned UseRegisterSizedBitfieldAccess : 1;
+
unsigned VerifyModule : 1; /// Control whether the module should be run
/// through the LLVM Verifier.
@@ -159,7 +168,10 @@ public:
NoNaNsFPMath = 0;
NoZeroInitializedInBSS = 0;
NumRegisterParameters = 0;
+ ObjCAutoRefCountExceptions = 0;
ObjCDispatchMethod = Legacy;
+ ObjCRuntimeHasARC = 0;
+ ObjCRuntimeHasTerminate = 0;
OmitLeafFramePointer = 0;
OptimizationLevel = 0;
OptimizeSize = 0;
@@ -173,6 +185,7 @@ public:
UnrollLoops = 0;
UnsafeFPMath = 0;
UnwindTables = 0;
+ UseRegisterSizedBitfieldAccess = 0;
VerifyModule = 1;
Inlining = NoInlining;
diff --git a/include/clang/Frontend/DependencyOutputOptions.h b/include/clang/Frontend/DependencyOutputOptions.h
index 35aa6c6aace6..1e22c227fcea 100644
--- a/include/clang/Frontend/DependencyOutputOptions.h
+++ b/include/clang/Frontend/DependencyOutputOptions.h
@@ -24,6 +24,7 @@ public:
unsigned UsePhonyTargets : 1; ///< Include phony targets for each
/// dependency, which can avoid some 'make'
/// problems.
+ unsigned AddMissingHeaderDeps : 1; ///< Add missing headers to dependency list
/// The file to write dependency output to.
std::string OutputFile;
@@ -43,6 +44,7 @@ public:
IncludeSystemHeaders = 0;
ShowHeaderIncludes = 0;
UsePhonyTargets = 0;
+ AddMissingHeaderDeps = 0;
}
};
diff --git a/include/clang/Frontend/DiagnosticOptions.h b/include/clang/Frontend/DiagnosticOptions.h
index 56093c3c950c..5ae8eb367788 100644
--- a/include/clang/Frontend/DiagnosticOptions.h
+++ b/include/clang/Frontend/DiagnosticOptions.h
@@ -49,8 +49,7 @@ public:
/// input source file.
unsigned ErrorLimit; /// Limit # errors emitted.
- unsigned MacroBacktraceLimit; /// Limit depth of macro instantiation
- /// backtrace.
+ unsigned MacroBacktraceLimit; /// Limit depth of macro expansion backtrace.
unsigned TemplateBacktraceLimit; /// Limit depth of instantiation backtrace.
/// The distance between tab stops.
diff --git a/include/clang/Frontend/FrontendAction.h b/include/clang/Frontend/FrontendAction.h
index ee0863a4776f..f335475665fd 100644
--- a/include/clang/Frontend/FrontendAction.h
+++ b/include/clang/Frontend/FrontendAction.h
@@ -51,6 +51,7 @@ class FrontendAction {
llvm::OwningPtr<ASTUnit> CurrentASTUnit;
CompilerInstance *Instance;
friend class ASTMergeAction;
+ friend class WrapperFrontendAction;
private:
ASTConsumer* CreateWrappedASTConsumer(CompilerInstance &CI,
@@ -77,6 +78,14 @@ protected:
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
llvm::StringRef InFile) = 0;
+ /// \brief Callback before starting processing a single input, giving the
+ /// opportunity to modify the CompilerInvocation or do some other action
+ /// before BeginSourceFileAction is called.
+ ///
+ /// \return True on success; on failure \see BeginSourceFileAction() and
+ /// ExecutionAction() and EndSourceFileAction() will not be called.
+ virtual bool BeginInvocation(CompilerInstance &CI) { return true; }
+
/// BeginSourceFileAction - Callback at the start of processing a single
/// input.
///
@@ -253,6 +262,36 @@ public:
virtual bool usesPreprocessorOnly() const { return true; }
};
+/// WrapperFrontendAction - A frontend action which simply wraps some other
+/// runtime specified frontend action. Deriving from this class allows an
+/// action to inject custom logic around some existing action's behavior. It
+/// implements every virtual method in the FrontendAction interface by
+/// forwarding to the wrapped action.
+class WrapperFrontendAction : public FrontendAction {
+ llvm::OwningPtr<FrontendAction> WrappedAction;
+
+protected:
+ virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+ llvm::StringRef InFile);
+ virtual bool BeginInvocation(CompilerInstance &CI);
+ virtual bool BeginSourceFileAction(CompilerInstance &CI,
+ llvm::StringRef Filename);
+ virtual void ExecuteAction();
+ virtual void EndSourceFileAction();
+
+public:
+ /// Construct a WrapperFrontendAction from an existing action, taking
+ /// ownership of it.
+ WrapperFrontendAction(FrontendAction *WrappedAction);
+
+ virtual bool usesPreprocessorOnly() const;
+ virtual bool usesCompleteTranslationUnit();
+ virtual bool hasPCHSupport() const;
+ virtual bool hasASTFileSupport() const;
+ virtual bool hasIRSupport() const;
+ virtual bool hasCodeCompletionSupport() const;
+};
+
} // end namespace clang
#endif
diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h
index 4e67449b8549..b409ad1e0963 100644
--- a/include/clang/Frontend/FrontendActions.h
+++ b/include/clang/Frontend/FrontendActions.h
@@ -97,12 +97,6 @@ public:
virtual bool hasCodeCompletionSupport() const { return true; }
};
-class BoostConAction : public SyntaxOnlyAction {
-protected:
- virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
- llvm::StringRef InFile);
-};
-
/**
* \brief Frontend action adaptor that merges ASTs together.
*
diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h
index 02f6f868fe49..225a955b4ac6 100644
--- a/include/clang/Frontend/FrontendOptions.h
+++ b/include/clang/Frontend/FrontendOptions.h
@@ -24,7 +24,6 @@ namespace frontend {
ASTDumpXML, ///< Parse ASTs and dump them in XML.
ASTPrint, ///< Parse ASTs and print them.
ASTView, ///< Parse ASTs and view them in Graphviz.
- BoostCon, ///< BoostCon mode.
CreateModule, ///< Create module definition
DumpRawTokens, ///< Dump out raw tokens.
DumpTokens, ///< Dump out preprocessed tokens.
@@ -77,6 +76,15 @@ public:
unsigned FixWhatYouCan : 1; ///< Apply fixes even if there are
/// unfixable errors.
+ enum {
+ ARCMT_None,
+ ARCMT_Check,
+ ARCMT_Modify,
+ ARCMT_Migrate
+ } ARCMTAction;
+
+ std::string ARCMTMigrateDir;
+
/// The input files and their types.
std::vector<std::pair<InputKind, std::string> > Inputs;
@@ -131,6 +139,7 @@ public:
ShowStats = 0;
ShowTimers = 0;
ShowVersion = 0;
+ ARCMTAction = ARCMT_None;
}
/// getInputKindForExtension - Return the appropriate input kind for a file
diff --git a/include/clang/Frontend/HeaderSearchOptions.h b/include/clang/Frontend/HeaderSearchOptions.h
index b0669eba4ccc..0347f98fd5ba 100644
--- a/include/clang/Frontend/HeaderSearchOptions.h
+++ b/include/clang/Frontend/HeaderSearchOptions.h
@@ -17,10 +17,12 @@ namespace clang {
namespace frontend {
/// IncludeDirGroup - Identifiers the group a include entry belongs to, which
- /// represents its relative positive in the search list.
+ /// represents its relative positive in the search list. A #include of a ""
+ /// path starts at the -iquote group, then searches the Angled group, then
+ /// searches the system group, etc.
enum IncludeDirGroup {
- Quoted = 0, ///< `#include ""` paths. Thing `gcc -iquote`.
- Angled, ///< Paths for both `#include ""` and `#include <>`. (`-I`)
+ Quoted = 0, ///< '#include ""' paths, added by'gcc -iquote'.
+ Angled, ///< Paths for '#include <>' added by '-I'.
System, ///< Like Angled, but marks system directories.
CXXSystem, ///< Like System, but only used for C++.
After ///< Like System, but searched after the system directories.
@@ -37,15 +39,15 @@ public:
unsigned IsUserSupplied : 1;
unsigned IsFramework : 1;
- /// IsSysRootRelative - This is true if an absolute path should be treated
- /// relative to the sysroot, or false if it should always be the absolute
+ /// IgnoreSysRoot - This is false if an absolute path should be treated
+ /// relative to the sysroot, or true if it should always be the absolute
/// path.
- unsigned IsSysRootRelative : 1;
+ unsigned IgnoreSysRoot : 1;
Entry(llvm::StringRef path, frontend::IncludeDirGroup group,
- bool isUserSupplied, bool isFramework, bool isSysRootRelative)
+ bool isUserSupplied, bool isFramework, bool ignoreSysRoot)
: Path(path), Group(group), IsUserSupplied(isUserSupplied),
- IsFramework(isFramework), IsSysRootRelative(isSysRootRelative) {}
+ IsFramework(isFramework), IgnoreSysRoot(ignoreSysRoot) {}
};
/// If non-empty, the directory to use as a "virtual system root" for include
@@ -80,20 +82,23 @@ public:
/// Include the system standard C++ library include search directories.
unsigned UseStandardCXXIncludes : 1;
+ /// Use libc++ instead of the default libstdc++.
+ unsigned UseLibcxx : 1;
+
/// Whether header search information should be output as for -v.
unsigned Verbose : 1;
public:
HeaderSearchOptions(llvm::StringRef _Sysroot = "/")
: Sysroot(_Sysroot), UseBuiltinIncludes(true),
- UseStandardIncludes(true), UseStandardCXXIncludes(true),
+ UseStandardIncludes(true), UseStandardCXXIncludes(true), UseLibcxx(false),
Verbose(false) {}
/// AddPath - Add the \arg Path path to the specified \arg Group list.
void AddPath(llvm::StringRef Path, frontend::IncludeDirGroup Group,
- bool IsUserSupplied, bool IsFramework, bool IsSysRootRelative) {
+ bool IsUserSupplied, bool IsFramework, bool IgnoreSysRoot) {
UserEntries.push_back(Entry(Path, Group, IsUserSupplied, IsFramework,
- IsSysRootRelative));
+ IgnoreSysRoot));
}
};
diff --git a/include/clang/Frontend/PreprocessorOptions.h b/include/clang/Frontend/PreprocessorOptions.h
index e471c5cf1d82..2e16c97e7d43 100644
--- a/include/clang/Frontend/PreprocessorOptions.h
+++ b/include/clang/Frontend/PreprocessorOptions.h
@@ -1,4 +1,4 @@
-//===--- PreprocessorOptionms.h ---------------------------------*- C++ -*-===//
+//===--- PreprocessorOptions.h ----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -26,6 +26,15 @@ namespace clang {
class Preprocessor;
class LangOptions;
+/// \brief Enumerate the kinds of standard library that
+enum ObjCXXARCStandardLibraryKind {
+ ARCXX_nolib,
+ /// \brief libc++
+ ARCXX_libcxx,
+ /// \brief libstdc++
+ ARCXX_libstdcxx
+};
+
/// PreprocessorOptions - This class is used for passing the various options
/// used in preprocessor initialization to InitializePreprocessor().
class PreprocessorOptions {
@@ -39,11 +48,11 @@ public:
unsigned DetailedRecord : 1; /// Whether we should maintain a detailed
/// record of all macro definitions and
- /// instantiations.
+ /// expansions.
/// \brief Whether the detailed preprocessing record includes nested macro
- /// instantiations.
- unsigned DetailedRecordIncludesNestedMacroInstantiations : 1;
+ /// expansions.
+ unsigned DetailedRecordIncludesNestedMacroExpansions : 1;
/// The implicit PCH included at the start of the translation unit, or empty.
std::string ImplicitPCHInclude;
@@ -104,6 +113,11 @@ public:
/// compiler invocation and its buffers will be reused.
bool RetainRemappedFileBuffers;
+ /// \brief The Objective-C++ ARC standard library that we should support,
+ /// by providing appropriate definitions to retrofit the standard library
+ /// with support for lifetime-qualified pointers.
+ ObjCXXARCStandardLibraryKind ObjCXXARCStandardLibrary;
+
typedef std::vector<std::pair<std::string, std::string> >::iterator
remapped_file_iterator;
typedef std::vector<std::pair<std::string, std::string> >::const_iterator
@@ -140,12 +154,13 @@ public:
public:
PreprocessorOptions() : UsePredefines(true), DetailedRecord(false),
- DetailedRecordIncludesNestedMacroInstantiations(true),
+ DetailedRecordIncludesNestedMacroExpansions(true),
DisablePCHValidation(false), DisableStatCache(false),
DumpDeserializedPCHDecls(false),
PrecompiledPreambleBytes(0, true),
RemappedFilesKeepOriginalName(true),
- RetainRemappedFileBuffers(false) { }
+ RetainRemappedFileBuffers(false),
+ ObjCXXARCStandardLibrary(ARCXX_nolib) { }
void addMacroDef(llvm::StringRef Name) {
Macros.push_back(std::make_pair(Name, false));
diff --git a/include/clang/Frontend/TextDiagnosticPrinter.h b/include/clang/Frontend/TextDiagnosticPrinter.h
index d7d2692cb547..79a9916cb435 100644
--- a/include/clang/Frontend/TextDiagnosticPrinter.h
+++ b/include/clang/Frontend/TextDiagnosticPrinter.h
@@ -62,18 +62,17 @@ public:
std::string &CaretLine,
const std::string &SourceLine);
- void EmitCaretDiagnostic(Diagnostic::Level Level, SourceLocation Loc,
- CharSourceRange *Ranges, unsigned NumRanges,
- const SourceManager &SM,
- const FixItHint *Hints,
- unsigned NumHints,
- unsigned Columns,
- unsigned OnMacroInst,
- unsigned MacroSkipStart,
- unsigned MacroSkipEnd);
-
virtual void HandleDiagnostic(Diagnostic::Level Level,
const DiagnosticInfo &Info);
+
+private:
+ void EmitCaretDiagnostic(SourceLocation Loc, CharSourceRange *Ranges,
+ unsigned NumRanges, const SourceManager &SM,
+ const FixItHint *Hints,
+ unsigned NumHints, unsigned Columns,
+ unsigned OnMacroInst, unsigned MacroSkipStart,
+ unsigned MacroSkipEnd);
+
};
} // end namespace clang
diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h
index 3c34c2dce24b..93d2c7d501e7 100644
--- a/include/clang/Frontend/Utils.h
+++ b/include/clang/Frontend/Utils.h
@@ -19,6 +19,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/Support/raw_ostream.h"
+#include "clang/Basic/Diagnostic.h"
namespace llvm {
class Triple;