diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-01-15 15:39:40 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-01-15 15:39:40 +0000 |
commit | a3fa5c7f1b5e2ba4d6ec033dc0e2376326b05824 (patch) | |
tree | a6082d4d1d1e9ddaea09a6a04bb4a47da95d642d /include/clang/Frontend/Utils.h | |
parent | bb1e3bc1e0be2b8f891db46457a8943451bf4d8b (diff) | |
download | FreeBSD-src-a3fa5c7f1b5e2ba4d6ec033dc0e2376326b05824.zip FreeBSD-src-a3fa5c7f1b5e2ba4d6ec033dc0e2376326b05824.tar.gz |
Update clang to r93512.
Diffstat (limited to 'include/clang/Frontend/Utils.h')
-rw-r--r-- | include/clang/Frontend/Utils.h | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h index 27c14c9..c8df494 100644 --- a/include/clang/Frontend/Utils.h +++ b/include/clang/Frontend/Utils.h @@ -15,13 +15,11 @@ #define LLVM_CLANG_FRONTEND_UTILS_H #include "llvm/ADT/StringRef.h" -#include <vector> -#include <string> +#include "llvm/ADT/Twine.h" +#include "llvm/Support/raw_ostream.h" namespace llvm { class Triple; -class raw_ostream; -class raw_fd_ostream; } namespace clang { @@ -41,6 +39,29 @@ class PreprocessorOutputOptions; class SourceManager; class Stmt; class TargetInfo; +class FrontendOptions; + +class MacroBuilder { + llvm::raw_ostream &Out; +public: + MacroBuilder(llvm::raw_ostream &Output) : Out(Output) {} + + /// Append a #define line for macro of the form "#define Name Value\n". + void defineMacro(const llvm::Twine &Name, const llvm::Twine &Value = "1") { + Out << "#define " << Name << ' ' << Value << '\n'; + } + + /// Append a #undef line for Name. Name should be of the form XXX + /// and we emit "#undef XXX". + void undefineMacro(const llvm::Twine &Name) { + Out << "#undef " << Name << '\n'; + } + + /// Directly append Str and a newline to the underlying buffer. + void append(const llvm::Twine &Str) { + Out << Str << '\n'; + } +}; /// Normalize \arg File for use in a user defined #include directive (in the /// predefines buffer). @@ -56,7 +77,8 @@ void ApplyHeaderSearchOptions(HeaderSearch &HS, /// environment ready to process a single file. void InitializePreprocessor(Preprocessor &PP, const PreprocessorOptions &PPOpts, - const HeaderSearchOptions &HSOpts); + const HeaderSearchOptions &HSOpts, + const FrontendOptions &FEOpts); /// ProcessWarningOptions - Initialize the diagnostic client and process the /// warning options specified on the command line. |