summaryrefslogtreecommitdiffstats
path: root/include/clang/Lex
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2009-12-15 18:49:47 +0000
committerrdivacky <rdivacky@FreeBSD.org>2009-12-15 18:49:47 +0000
commit77212133072dc40f070a280af8217032f55a9eb4 (patch)
tree2fd5819f49caecc5f520219b6b9254fe94ebb138 /include/clang/Lex
parent4b08eb6308ca90a6c08e2fc79d100821b1b1f6aa (diff)
downloadFreeBSD-src-77212133072dc40f070a280af8217032f55a9eb4.zip
FreeBSD-src-77212133072dc40f070a280af8217032f55a9eb4.tar.gz
Update clang to 91430.
Diffstat (limited to 'include/clang/Lex')
-rw-r--r--include/clang/Lex/Lexer.h16
-rw-r--r--include/clang/Lex/Preprocessor.h43
2 files changed, 43 insertions, 16 deletions
diff --git a/include/clang/Lex/Lexer.h b/include/clang/Lex/Lexer.h
index 52bf194..fc65b1f 100644
--- a/include/clang/Lex/Lexer.h
+++ b/include/clang/Lex/Lexer.h
@@ -38,8 +38,8 @@ class Lexer : public PreprocessorLexer {
const char *BufferEnd; // End of the buffer.
SourceLocation FileLoc; // Location for start of file.
LangOptions Features; // Features enabled by this language (cache).
- bool Is_PragmaLexer; // True if lexer for _Pragma handling.
- bool IsEofCodeCompletion; // True if EOF is treated as a code-completion.
+ bool Is_PragmaLexer : 1; // True if lexer for _Pragma handling.
+ bool IsInConflictMarker : 1; // True if in a VCS conflict marker '<<<<<<<'
//===--------------------------------------------------------------------===//
// Context-specific lexing flags set by the preprocessor.
@@ -180,15 +180,6 @@ public:
ExtendedTokenMode = Mode ? 1 : 0;
}
- /// \brief Specify that end-of-file is to be considered a code-completion
- /// token.
- ///
- /// When in this mode, the end-of-file token will be immediately preceded
- /// by a code-completion token.
- void SetEofIsCodeCompletion(bool Val = true) {
- IsEofCodeCompletion = Val;
- }
-
const char *getBufferStart() const { return BufferStart; }
/// ReadToEndOfLine - Read the rest of the current preprocessor line as an
@@ -379,6 +370,9 @@ private:
bool SkipBCPLComment (Token &Result, const char *CurPtr);
bool SkipBlockComment (Token &Result, const char *CurPtr);
bool SaveBCPLComment (Token &Result, const char *CurPtr);
+
+ bool IsStartOfConflictMarker(const char *CurPtr);
+ bool HandleEndOfConflictMarker(const char *CurPtr);
};
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index edd34b7..7c838ff 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -91,12 +91,14 @@ class Preprocessor {
bool KeepMacroComments : 1;
// State that changes while the preprocessor runs:
- bool DisableMacroExpansion : 1; // True if macro expansion is disabled.
bool InMacroArgs : 1; // True if parsing fn macro invocation args.
/// Whether the preprocessor owns the header search object.
bool OwnsHeaderSearch : 1;
+ /// DisableMacroExpansion - True if macro expansion is disabled.
+ bool DisableMacroExpansion : 1;
+
/// Identifiers - This is mapping/lookup information for all identifiers in
/// the program, including program keywords.
mutable IdentifierTable Identifiers;
@@ -121,6 +123,9 @@ class Preprocessor {
/// with this preprocessor.
std::vector<CommentHandler *> CommentHandlers;
+ /// \brief The file that we're performing code-completion for, if any.
+ const FileEntry *CodeCompletionFile;
+
/// CurLexer - This is the current top of the stack that we're lexing from if
/// not expanding a macro and we are lexing directly from source code.
/// Only one of CurLexer, CurPTHLexer, or CurTokenLexer will be non-null.
@@ -134,7 +139,7 @@ class Preprocessor {
/// CurPPLexer - This is the current top of the stack what we're lexing from
/// if not expanding a macro. This is an alias for either CurLexer or
/// CurPTHLexer.
- PreprocessorLexer* CurPPLexer;
+ PreprocessorLexer *CurPPLexer;
/// CurLookup - The DirectoryLookup structure used to find the current
/// FileEntry, if CurLexer is non-null and if applicable. This allows us to
@@ -171,8 +176,14 @@ class Preprocessor {
llvm::DenseMap<IdentifierInfo*, MacroInfo*> Macros;
/// MICache - A "freelist" of MacroInfo objects that can be reused for quick
- /// allocation.
+ /// 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;
+ friend class MacroArgs;
// Various statistics we track for performance analysis.
unsigned NumDirectives, NumIncluded, NumDefined, NumUndefined, NumPragma;
@@ -330,8 +341,9 @@ public:
/// EnterSourceFile - Add a source file to the top of the include stack and
/// start lexing tokens from it instead of the current buffer. Return true
- /// on failure.
- bool EnterSourceFile(FileID CurFileID, const DirectoryLookup *Dir);
+ /// and fill in ErrorStr with the error information on failure.
+ bool EnterSourceFile(FileID CurFileID, const DirectoryLookup *Dir,
+ std::string &ErrorStr);
/// EnterMacro - Add a Macro to the top of the include stack and start lexing
/// tokens from it instead of the current buffer. Args specifies the
@@ -484,6 +496,27 @@ public:
CachedTokens[CachedLexPos-1] = Tok;
}
+ /// \brief Specify the point at which code-completion will be performed.
+ ///
+ /// \param File the file in which code completion should occur. If
+ /// this file is included multiple times, code-completion will
+ /// perform completion the first time it is included. If NULL, this
+ /// function clears out the code-completion point.
+ ///
+ /// \param Line the line at which code completion should occur
+ /// (1-based).
+ ///
+ /// \param Column the column at which code completion should occur
+ /// (1-based).
+ ///
+ /// \returns true if an error occurred, false otherwise.
+ bool SetCodeCompletionPoint(const FileEntry *File,
+ unsigned Line, unsigned Column);
+
+ /// \brief Determine if this source location refers into the file
+ /// for which we are performing code completion.
+ bool isCodeCompletionFile(SourceLocation FileLoc) const;
+
/// Diag - Forwarding function for diagnostics. This emits a diagnostic at
/// the specified Token's location, translating the token's start
/// position in the current buffer into a SourcePosition object for rendering.
OpenPOWER on IntegriCloud