From ec2b103c267a06a66e926f62cd96767b280f5cf5 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Tue, 2 Jun 2009 17:58:47 +0000 Subject: Import Clang, at r72732. --- include/clang/Frontend/InitPreprocessor.h | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 include/clang/Frontend/InitPreprocessor.h (limited to 'include/clang/Frontend/InitPreprocessor.h') diff --git a/include/clang/Frontend/InitPreprocessor.h b/include/clang/Frontend/InitPreprocessor.h new file mode 100644 index 000000000000..eb03602dc57b --- /dev/null +++ b/include/clang/Frontend/InitPreprocessor.h @@ -0,0 +1,70 @@ +//===--- InitPreprocessor.h - InitializePreprocessor function. --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the clang::InitializePreprocessor function. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_FRONTEND_INIT_PREPROCESSOR_H_ +#define LLVM_CLANG_FRONTEND_INIT_PREPROCESSOR_H_ + +#include +#include + +namespace clang { + +class Preprocessor; +class LangOptions; + +/// PreprocessorInitOptions - This class is used for passing the various +/// options used in preprocessor initialization to InitializePreprocessor(). +class PreprocessorInitOptions { + std::vector > Macros; + std::vector > Includes; + std::vector MacroIncludes; + +public: + + void addMacroDef(const std::string &Name) { + Macros.push_back(std::make_pair(Name, false)); + } + void addMacroUndef(const std::string &Name) { + Macros.push_back(std::make_pair(Name, true)); + } + void addInclude(const std::string &Name, bool isPTH = false) { + Includes.push_back(std::make_pair(Name, isPTH)); + } + void addMacroInclude(const std::string &Name) { + MacroIncludes.push_back(Name); + } + + typedef std::vector >::const_iterator macro_iterator; + macro_iterator macro_begin() const { return Macros.begin(); } + macro_iterator macro_end() const { return Macros.end(); } + + typedef std::vector >::const_iterator include_iterator; + include_iterator include_begin() const { return Includes.begin(); } + include_iterator include_end() const { return Includes.end(); } + + typedef std::vector::const_iterator imacro_iterator; + imacro_iterator imacro_begin() const { return MacroIncludes.begin(); } + imacro_iterator imacro_end() const { return MacroIncludes.end(); } +}; + +/// InitializePreprocessor - Initialize the preprocessor getting it and the +/// environment ready to process a single file. This returns true on error. +/// +bool InitializePreprocessor(Preprocessor &PP, + const PreprocessorInitOptions& InitOptions); + +} // end namespace clang + +#endif -- cgit v1.2.3