class TargetInfo;
class PPCallbacks;
class DirectoryLookup;
-
+
/// Preprocessor - This object engages in a tight little dance with the lexer to
/// efficiently preprocess tokens. Lexers know only about tokens within a
/// single source file, and don't know anything about preprocessor-level issues
/// \brief External source of macros.
ExternalPreprocessorSource *ExternalSource;
-
+
/// PTH - An optional PTHManager object used for getting tokens from
/// a token cache rather than lexing the original source file.
llvm::OwningPtr<PTHManager> PTH;
/// \brief Whether we have already loaded macros from the external source.
mutable bool ReadMacrosFromExternalSource : 1;
-
+
/// Identifiers - This is mapping/lookup information for all identifiers in
/// the program, including program keywords.
mutable IdentifierTable Identifiers;
/// allocation.
/// FIXME: why not use a singly linked list?
std::vector<MacroInfo*> MICache;
-
+
/// MacroArgCache - This is a "freelist" of MacroArg objects that can be
/// reused for quick allocation.
MacroArgs *MacroArgCache;
void setExternalSource(ExternalPreprocessorSource *Source) {
ExternalSource = Source;
}
-
+
ExternalPreprocessorSource *getExternalSource() const {
return ExternalSource;
}
-
+
/// SetCommentRetentionState - Control whether or not the preprocessor retains
/// comments in output.
void SetCommentRetentionState(bool KeepComments, bool KeepMacroComments) {
/// expansions going on at the time.
PreprocessorLexer *getCurrentFileLexer() const;
- /// getPPCallbacks/setPPCallbacks - Accessors for preprocessor callbacks.
+ /// getPPCallbacks/addPPCallbacks - Accessors for preprocessor callbacks.
/// Note that this class takes ownership of any PPCallbacks object given to
/// it.
PPCallbacks *getPPCallbacks() const { return Callbacks; }
- void setPPCallbacks(PPCallbacks *C) {
+ void addPPCallbacks(PPCallbacks *C) {
if (Callbacks)
C = new PPChainedCallbacks(C, Callbacks);
Callbacks = C;
MacroInfo*>::const_iterator macro_iterator;
macro_iterator macro_begin(bool IncludeExternalMacros = true) const;
macro_iterator macro_end(bool IncludeExternalMacros = true) const;
-
+
const std::string &getPredefines() const { return Predefines; }
/// setPredefines - Set the predefines for this Preprocessor. These
/// predefines are automatically injected when parsing the main file.
/// (1-based).
///
/// \returns true if an error occurred, false otherwise.
- bool SetCodeCompletionPoint(const FileEntry *File,
+ bool SetCodeCompletionPoint(const FileEntry *File,
unsigned Line, unsigned Column);
/// \brief Determine if this source location refers into the file
if (MI.isGNUVarargs())
OS << "..."; // #define foo(x...)
-
+
OS << ')';
}
EmittedMacroOnThisLine = false;
FileType = SrcMgr::C_User;
Initialized = false;
-
+
// If we're in microsoft mode, use normal #line instead of line markers.
UseLineDirective = PP.getLangOptions().Microsoft;
}
OS << '#' << ' ' << LineNo << ' ' << '"';
OS.write(&CurFilename[0], CurFilename.size());
OS << '"';
-
+
if (ExtraLen)
OS.write(Extra, ExtraLen);
PP.AddPragmaHandler("GCC", new UnknownPragmaHandler("#pragma GCC",
Callbacks));
- PP.setPPCallbacks(Callbacks);
+ PP.addPPCallbacks(Callbacks);
// After we have configured the preprocessor, enter the main file.
PP.EnterMainSourceFile();