diff options
author | dim <dim@FreeBSD.org> | 2012-04-14 14:01:31 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-04-14 14:01:31 +0000 |
commit | 50b73317314e889cf39c7b1d6cbf419fa7502f22 (patch) | |
tree | be1815eb79b42ff482a8562b13c2dcbf0c5dcbee /include/clang/Frontend/FrontendAction.h | |
parent | dc04cb328508e61aad809d9b53b12f9799a00e7d (diff) | |
download | FreeBSD-src-50b73317314e889cf39c7b1d6cbf419fa7502f22.zip FreeBSD-src-50b73317314e889cf39c7b1d6cbf419fa7502f22.tar.gz |
Vendor import of clang trunk r154661:
http://llvm.org/svn/llvm-project/cfe/trunk@r154661
Diffstat (limited to 'include/clang/Frontend/FrontendAction.h')
-rw-r--r-- | include/clang/Frontend/FrontendAction.h | 57 |
1 files changed, 20 insertions, 37 deletions
diff --git a/include/clang/Frontend/FrontendAction.h b/include/clang/Frontend/FrontendAction.h index f85cc7e..6839028 100644 --- a/include/clang/Frontend/FrontendAction.h +++ b/include/clang/Frontend/FrontendAction.h @@ -12,6 +12,7 @@ #include "clang/Basic/LLVM.h" #include "clang/Basic/LangOptions.h" +#include "clang/Frontend/FrontendOptions.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/OwningPtr.h" #include <string> @@ -23,30 +24,11 @@ class ASTMergeAction; class ASTUnit; class CompilerInstance; -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_CUDA, - IK_AST, - IK_LLVM_IR -}; - - /// FrontendAction - Abstract base class for actions which can be performed by /// the frontend. class FrontendAction { - std::string CurrentFile; - InputKind CurrentFileKind; - llvm::OwningPtr<ASTUnit> CurrentASTUnit; + FrontendInputFile CurrentInput; + OwningPtr<ASTUnit> CurrentASTUnit; CompilerInstance *Instance; friend class ASTMergeAction; friend class WrapperFrontendAction; @@ -103,7 +85,7 @@ protected: /// EndSourceFileAction - Callback at the end of processing a single input; /// this is guaranteed to only be called following a successful call to - /// BeginSourceFileAction (and BeingSourceFile). + /// BeginSourceFileAction (and BeginSourceFile). virtual void EndSourceFileAction() {} /// @} @@ -127,18 +109,22 @@ public: /// @{ bool isCurrentFileAST() const { - assert(!CurrentFile.empty() && "No current file!"); + assert(!CurrentInput.File.empty() && "No current file!"); return CurrentASTUnit != 0; } + const FrontendInputFile &getCurrentInput() const { + return CurrentInput; + } + const std::string &getCurrentFile() const { - assert(!CurrentFile.empty() && "No current file!"); - return CurrentFile; + assert(!CurrentInput.File.empty() && "No current file!"); + return CurrentInput.File; } InputKind getCurrentFileKind() const { - assert(!CurrentFile.empty() && "No current file!"); - return CurrentFileKind; + assert(!CurrentInput.File.empty() && "No current file!"); + return CurrentInput.Kind; } ASTUnit &getCurrentASTUnit() const { @@ -150,7 +136,7 @@ public: return CurrentASTUnit.take(); } - void setCurrentFile(StringRef Value, InputKind Kind, ASTUnit *AST = 0); + void setCurrentInput(const FrontendInputFile &CurrentInput, ASTUnit *AST = 0); /// @} /// @name Supported Modes @@ -189,10 +175,7 @@ public: /// action may store and use this object up until the matching EndSourceFile /// action. /// - /// \param Filename - The input filename, which will be made available to - /// clients via \see getCurrentFile(). - /// - /// \param InputKind - The type of input. Some input kinds are handled + /// \param Input - The input filename and kind. Some input kinds are handled /// specially, for example AST inputs, since the AST file itself contains /// several objects which would normally be owned by the /// CompilerInstance. When processing AST input files, these objects should @@ -200,10 +183,9 @@ public: /// automatically be shared with the AST file in between \see /// BeginSourceFile() and \see EndSourceFile(). /// - /// \return True on success; the compilation of this file should be aborted - /// and neither Execute nor EndSourceFile should be called. - bool BeginSourceFile(CompilerInstance &CI, StringRef Filename, - InputKind Kind); + /// \return True on success; on failure the compilation of this file should + /// be aborted and neither Execute nor EndSourceFile should be called. + bool BeginSourceFile(CompilerInstance &CI, const FrontendInputFile &Input); /// Execute - Set the source managers main input file, and run the action. void Execute(); @@ -231,6 +213,7 @@ public: }; class PluginASTAction : public ASTFrontendAction { + virtual void anchor(); protected: virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, StringRef InFile) = 0; @@ -265,7 +248,7 @@ public: /// implements every virtual method in the FrontendAction interface by /// forwarding to the wrapped action. class WrapperFrontendAction : public FrontendAction { - llvm::OwningPtr<FrontendAction> WrappedAction; + OwningPtr<FrontendAction> WrappedAction; protected: virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, |