diff options
author | dim <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
commit | 056abd2059c65a3e908193aeae16fad98017437c (patch) | |
tree | 2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /include/clang/Frontend/FrontendOptions.h | |
parent | cc73504950eb7b5dff2dded9bedd67bc36d64641 (diff) | |
download | FreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.zip FreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.tar.gz |
Vendor import of clang release_32 branch r168974 (effectively, 3.2 RC2):
http://llvm.org/svn/llvm-project/cfe/branches/release_32@168974
Diffstat (limited to 'include/clang/Frontend/FrontendOptions.h')
-rw-r--r-- | include/clang/Frontend/FrontendOptions.h | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h index ce1cd9b..db2f5a5 100644 --- a/include/clang/Frontend/FrontendOptions.h +++ b/include/clang/Frontend/FrontendOptions.h @@ -16,6 +16,10 @@ #include <string> #include <vector> +namespace llvm { +class MemoryBuffer; +} + namespace clang { namespace frontend { @@ -72,19 +76,41 @@ enum InputKind { /// \brief An input file for the front end. -struct FrontendInputFile { +class FrontendInputFile { /// \brief The file name, or "-" to read from standard input. std::string File; + llvm::MemoryBuffer *Buffer; + /// \brief The kind of input, e.g., C source, AST file, LLVM IR. InputKind Kind; /// \brief Whether we're dealing with a 'system' input (vs. a 'user' input). bool IsSystem; - - FrontendInputFile() : Kind(IK_None) { } + +public: + FrontendInputFile() : Buffer(0), Kind(IK_None) { } FrontendInputFile(StringRef File, InputKind Kind, bool IsSystem = false) - : File(File.str()), Kind(Kind), IsSystem(IsSystem) { } + : File(File.str()), Buffer(0), Kind(Kind), IsSystem(IsSystem) { } + FrontendInputFile(llvm::MemoryBuffer *buffer, InputKind Kind, + bool IsSystem = false) + : Buffer(buffer), Kind(Kind), IsSystem(IsSystem) { } + + InputKind getKind() const { return Kind; } + bool isSystem() const { return IsSystem; } + + bool isEmpty() const { return File.empty() && Buffer == 0; } + bool isFile() const { return !isBuffer(); } + bool isBuffer() const { return Buffer != 0; } + + StringRef getFile() const { + assert(isFile()); + return File; + } + llvm::MemoryBuffer *getBuffer() const { + assert(isBuffer()); + return Buffer; + } }; /// FrontendOptions - Options for controlling the behavior of the frontend. |