diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-01-15 15:39:40 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-01-15 15:39:40 +0000 |
commit | ee791dde723a2089c681d2ab6a9d4f96379d5f49 (patch) | |
tree | a6082d4d1d1e9ddaea09a6a04bb4a47da95d642d /include/clang/Frontend/Utils.h | |
parent | abe15e553e58165e7692c0d0842865c488ed7b45 (diff) |
Notes
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 27c14c9170159..c8df4941cc213 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. |