r340145 - [Lex] Fix some inconsistent parameter names and duplicate comments. NFC
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 19 15:23:42 PDT 2018
Author: maskray
Date: Sun Aug 19 15:23:42 2018
New Revision: 340145
URL: http://llvm.org/viewvc/llvm-project?rev=340145&view=rev
Log:
[Lex] Fix some inconsistent parameter names and duplicate comments. NFC
Modified:
cfe/trunk/include/clang/Lex/DirectoryLookup.h
cfe/trunk/include/clang/Lex/HeaderSearch.h
cfe/trunk/include/clang/Lex/Lexer.h
cfe/trunk/include/clang/Lex/ModuleMap.h
cfe/trunk/include/clang/Lex/Pragma.h
cfe/trunk/include/clang/Lex/Preprocessor.h
cfe/trunk/include/clang/Lex/PreprocessorLexer.h
cfe/trunk/include/clang/Lex/TokenLexer.h
Modified: cfe/trunk/include/clang/Lex/DirectoryLookup.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/DirectoryLookup.h?rev=340145&r1=340144&r2=340145&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/DirectoryLookup.h (original)
+++ cfe/trunk/include/clang/Lex/DirectoryLookup.h Sun Aug 19 15:23:42 2018
@@ -191,7 +191,7 @@ private:
SmallVectorImpl<char> *RelativePath,
Module *RequestingModule,
ModuleMap::KnownHeader *SuggestedModule,
- bool &InUserSpecifiedSystemHeader) const;
+ bool &InUserSpecifiedSystemFramework) const;
};
Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=340145&r1=340144&r2=340145&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
+++ cfe/trunk/include/clang/Lex/HeaderSearch.h Sun Aug 19 15:23:42 2018
@@ -55,7 +55,7 @@ struct HeaderFileInfo {
/// True if this is a \#pragma once file.
unsigned isPragmaOnce : 1;
- /// DirInfo - Keep track of whether this is a system header, and if so,
+ /// Keep track of whether this is a system header, and if so,
/// whether it is C++ clean or not. This can be set by the include paths or
/// by \#pragma gcc system_header. This is an instance of
/// SrcMgr::CharacteristicKind.
@@ -219,14 +219,14 @@ class HeaderSearch {
/// name like "Carbon" to the Carbon.framework directory.
llvm::StringMap<FrameworkCacheEntry, llvm::BumpPtrAllocator> FrameworkMap;
- /// IncludeAliases - maps include file names (including the quotes or
+ /// Maps include file names (including the quotes or
/// angle brackets) to other include file names. This is used to support the
/// include_alias pragma for Microsoft compatibility.
using IncludeAliasMap =
llvm::StringMap<std::string, llvm::BumpPtrAllocator>;
std::unique_ptr<IncludeAliasMap> IncludeAliases;
- /// HeaderMaps - This is a mapping from FileEntry -> HeaderMap, uniquing
+ /// This is a mapping from FileEntry -> HeaderMap, uniquing
/// headermaps. This vector owns the headermap.
std::vector<std::pair<const FileEntry *, const HeaderMap *>> HeaderMaps;
@@ -314,7 +314,7 @@ public:
(*IncludeAliases)[Source] = Dest;
}
- /// MapHeaderToIncludeAlias - Maps one header file name to a different header
+ /// Maps one header file name to a different header
/// file name, for use with the include_alias pragma. Note that the source
/// file name should include the angle brackets or quotes. Returns StringRef
/// as null if the header cannot be mapped.
@@ -408,7 +408,7 @@ public:
/// HIToolbox is a subframework within Carbon.framework. If so, return
/// the FileEntry for the designated file, otherwise return null.
const FileEntry *LookupSubframeworkHeader(
- StringRef Filename, const FileEntry *RelativeFileEnt,
+ StringRef Filename, const FileEntry *ContextFileEnt,
SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath,
Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule);
@@ -425,7 +425,7 @@ public:
/// if we should include it.
bool ShouldEnterIncludeFile(Preprocessor &PP, const FileEntry *File,
bool isImport, bool ModulesEnabled,
- Module *CorrespondingModule);
+ Module *M);
/// Return whether the specified file is a normal header,
/// a system header, or a C++ friendly system header.
@@ -448,9 +448,9 @@ public:
}
/// Mark the specified file as part of a module.
- void MarkFileModuleHeader(const FileEntry *File,
+ void MarkFileModuleHeader(const FileEntry *FE,
ModuleMap::ModuleHeaderRole Role,
- bool IsCompiledModuleHeader);
+ bool isCompilingModuleHeader);
/// Increment the count for the number of times the specified
/// FileEntry has been entered.
@@ -479,7 +479,7 @@ public:
/// This routine does not consider the effect of \#import
bool isFileMultipleIncludeGuarded(const FileEntry *File);
- /// CreateHeaderMap - This method returns a HeaderMap for the specified
+ /// This method returns a HeaderMap for the specified
/// FileEntry, uniquing them through the 'HeaderMaps' datastructure.
const HeaderMap *CreateHeaderMap(const FileEntry *FE);
@@ -641,7 +641,7 @@ private:
/// \return \c true if the file can be used, \c false if we are not permitted to
/// find this file due to requirements from \p RequestingModule.
bool findUsableModuleForFrameworkHeader(
- const FileEntry *File, StringRef FrameworkDir, Module *RequestingModule,
+ const FileEntry *File, StringRef FrameworkName, Module *RequestingModule,
ModuleMap::KnownHeader *SuggestedModule, bool IsSystemFramework);
/// Look up the file with the specified name and determine its owning
Modified: cfe/trunk/include/clang/Lex/Lexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Lexer.h?rev=340145&r1=340144&r2=340145&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Lexer.h (original)
+++ cfe/trunk/include/clang/Lex/Lexer.h Sun Aug 19 15:23:42 2018
@@ -139,7 +139,7 @@ public:
/// with the specified preprocessor managing the lexing process. This lexer
/// assumes that the associated file buffer and Preprocessor objects will
/// outlive it, so it doesn't take ownership of either of them.
- Lexer(FileID FID, const llvm::MemoryBuffer *InputBuffer, Preprocessor &PP);
+ Lexer(FileID FID, const llvm::MemoryBuffer *InputFile, Preprocessor &PP);
/// Lexer constructor - Create a new raw lexer object. This object is only
/// suitable for calls to 'LexFromRawLexer'. This lexer assumes that the
@@ -150,7 +150,7 @@ public:
/// Lexer constructor - Create a new raw lexer object. This object is only
/// suitable for calls to 'LexFromRawLexer'. This lexer assumes that the
/// text range will outlive it, so it doesn't take ownership of it.
- Lexer(FileID FID, const llvm::MemoryBuffer *InputBuffer,
+ Lexer(FileID FID, const llvm::MemoryBuffer *FromFile,
const SourceManager &SM, const LangOptions &LangOpts);
Lexer(const Lexer &) = delete;
@@ -310,8 +310,8 @@ public:
/// location.
static StringRef getSpelling(SourceLocation loc,
SmallVectorImpl<char> &buffer,
- const SourceManager &SourceMgr,
- const LangOptions &LangOpts,
+ const SourceManager &SM,
+ const LangOptions &options,
bool *invalid = nullptr);
/// MeasureTokenLength - Relex the token at the specified location and return
@@ -339,7 +339,7 @@ public:
/// Get the physical length (including trigraphs and escaped newlines) of the
/// first \p Characters characters of the token starting at TokStart.
static unsigned getTokenPrefixLength(SourceLocation TokStart,
- unsigned Characters,
+ unsigned CharNo,
const SourceManager &SM,
const LangOptions &LangOpts);
@@ -724,7 +724,7 @@ private:
///
/// \return The Unicode codepoint specified by the UCN, or 0 if the UCN is
/// invalid.
- uint32_t tryReadUCN(const char *&CurPtr, const char *SlashLoc, Token *Tok);
+ uint32_t tryReadUCN(const char *&StartPtr, const char *SlashLoc, Token *Result);
/// Try to consume a UCN as part of an identifier at the current
/// location.
Modified: cfe/trunk/include/clang/Lex/ModuleMap.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/ModuleMap.h?rev=340145&r1=340144&r2=340145&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/ModuleMap.h (original)
+++ cfe/trunk/include/clang/Lex/ModuleMap.h Sun Aug 19 15:23:42 2018
@@ -580,7 +580,7 @@ public:
/// getContainingModuleMapFile().
const FileEntry *getModuleMapFileForUniquing(const Module *M) const;
- void setInferredModuleAllowedBy(Module *M, const FileEntry *ModuleMap);
+ void setInferredModuleAllowedBy(Module *M, const FileEntry *ModMap);
/// Get any module map files other than getModuleMapFileForUniquing(M)
/// that define submodules of a top-level module \p M. This is cheaper than
Modified: cfe/trunk/include/clang/Lex/Pragma.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Pragma.h?rev=340145&r1=340144&r2=340145&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Pragma.h (original)
+++ cfe/trunk/include/clang/Lex/Pragma.h Sun Aug 19 15:23:42 2018
@@ -113,7 +113,7 @@ public:
bool IsEmpty() const { return Handlers.empty(); }
void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
- Token &FirstToken) override;
+ Token &Tok) override;
PragmaNamespace *getIfNamespace() override { return this; }
};
Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=340145&r1=340144&r2=340145&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Sun Aug 19 15:23:42 2018
@@ -1160,7 +1160,7 @@ public:
void createPreprocessingRecord();
/// Returns true if the FileEntry is the PCH through header.
- bool isPCHThroughHeader(const FileEntry *File);
+ bool isPCHThroughHeader(const FileEntry *FE);
/// True if creating a PCH with a through header.
bool creatingPCHWithThroughHeader();
@@ -1186,7 +1186,7 @@ public:
/// start lexing tokens from it instead of the current buffer.
///
/// Emits a diagnostic, doesn't enter the file, and returns true on error.
- bool EnterSourceFile(FileID CurFileID, const DirectoryLookup *Dir,
+ bool EnterSourceFile(FileID FID, const DirectoryLookup *Dir,
SourceLocation Loc);
/// Add a Macro to the top of the include stack and start lexing
@@ -1195,7 +1195,7 @@ public:
/// \param Args specifies the tokens input to a function-like macro.
/// \param ILEnd specifies the location of the ')' for a function-like macro
/// or the identifier for an object-like macro.
- void EnterMacro(Token &Identifier, SourceLocation ILEnd, MacroInfo *Macro,
+ void EnterMacro(Token &Tok, SourceLocation ILEnd, MacroInfo *Macro,
MacroArgs *Args);
/// Add a "macro" context to the top of the include stack,
@@ -1749,7 +1749,7 @@ public:
void SetPoisonReason(IdentifierInfo *II, unsigned DiagID);
/// Display reason for poisoned identifier.
- void HandlePoisonedIdentifier(Token & Tok);
+ void HandlePoisonedIdentifier(Token & Identifier);
void MaybeHandlePoisonedIdentifier(Token & Identifier) {
if(IdentifierInfo * II = Identifier.getIdentifierInfo()) {
@@ -1814,7 +1814,7 @@ public:
/// If not, emit a diagnostic and consume up until the eod.
/// If \p EnableMacros is true, then we consider macros that expand to zero
/// tokens as being ok.
- void CheckEndOfDirective(const char *Directive, bool EnableMacros = false);
+ void CheckEndOfDirective(const char *DirType, bool EnableMacros = false);
/// Read and discard all tokens remaining on the current line until
/// the tok::eod token is found.
@@ -1843,7 +1843,7 @@ public:
///
/// \returns true if the input filename was in <>'s or false if it was
/// in ""'s.
- bool GetIncludeFilenameSpelling(SourceLocation Loc,StringRef &Filename);
+ bool GetIncludeFilenameSpelling(SourceLocation Loc,StringRef &Buffer);
/// Given a "foo" or \<foo> reference, look up the indicated file.
///
@@ -1886,7 +1886,7 @@ public:
/// Lex an on-off-switch (C99 6.10.6p2) and verify that it is
/// followed by EOD. Return true if the token is not a valid on-off-switch.
- bool LexOnOffSwitch(tok::OnOffSwitch &OOS);
+ bool LexOnOffSwitch(tok::OnOffSwitch &Result);
bool CheckMacroName(Token &MacroNameTok, MacroUse isDefineUndef,
bool *ShadowFlag = nullptr);
@@ -2006,7 +2006,7 @@ private:
/// If an identifier token is read that is to be expanded as a macro, handle
/// it and return the next token as 'Tok'. If we lexed a token, return true;
/// otherwise the caller should lex again.
- bool HandleMacroExpandedIdentifier(Token &Tok, const MacroDefinition &MD);
+ bool HandleMacroExpandedIdentifier(Token &Identifier, const MacroDefinition &MD);
/// Cache macro expanded tokens for TokenLexers.
//
@@ -2026,7 +2026,7 @@ private:
/// After reading "MACRO(", this method is invoked to read all of the formal
/// arguments specified for the macro invocation. Returns null on error.
MacroArgs *ReadMacroCallArgumentList(Token &MacroName, MacroInfo *MI,
- SourceLocation &ExpansionEnd);
+ SourceLocation &MacroEnd);
/// If an identifier token is read that is to be expanded
/// as a builtin macro, handle it and return the next token as 'Tok'.
@@ -2177,17 +2177,17 @@ private:
void replayPreambleConditionalStack();
// Macro handling.
- void HandleDefineDirective(Token &Tok, bool ImmediatelyAfterTopLevelIfndef);
+ void HandleDefineDirective(Token &Tok, bool ImmediatelyAfterHeaderGuard);
void HandleUndefDirective();
// Conditional Inclusion.
- void HandleIfdefDirective(Token &Tok, const Token &HashToken,
+ void HandleIfdefDirective(Token &Result, const Token &HashToken,
bool isIfndef, bool ReadAnyTokensBeforeDirective);
- void HandleIfDirective(Token &Tok, const Token &HashToken,
+ void HandleIfDirective(Token &IfToken, const Token &HashToken,
bool ReadAnyTokensBeforeDirective);
- void HandleEndifDirective(Token &Tok);
- void HandleElseDirective(Token &Tok, const Token &HashToken);
- void HandleElifDirective(Token &Tok, const Token &HashToken);
+ void HandleEndifDirective(Token &EndifToken);
+ void HandleElseDirective(Token &Result, const Token &HashToken);
+ void HandleElifDirective(Token &ElifToken, const Token &HashToken);
// Pragmas.
void HandlePragmaDirective(SourceLocation IntroducerLoc,
@@ -2207,7 +2207,7 @@ public:
// Return true and store the first token only if any CommentHandler
// has inserted some tokens and getCommentRetentionState() is false.
- bool HandleComment(Token &Token, SourceRange Comment);
+ bool HandleComment(Token &result, SourceRange Comment);
/// A macro is used, update information about macros that need unused
/// warnings.
Modified: cfe/trunk/include/clang/Lex/PreprocessorLexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PreprocessorLexer.h?rev=340145&r1=340144&r2=340145&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/PreprocessorLexer.h (original)
+++ cfe/trunk/include/clang/Lex/PreprocessorLexer.h Sun Aug 19 15:23:42 2018
@@ -135,7 +135,7 @@ public:
///
/// If the sequence parsed is not lexically legal, emit a diagnostic and
/// return a result EOD token.
- void LexIncludeFilename(Token &Result);
+ void LexIncludeFilename(Token &FilenameTok);
/// Inform the lexer whether or not we are currently lexing a
/// preprocessor directive.
Modified: cfe/trunk/include/clang/Lex/TokenLexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/TokenLexer.h?rev=340145&r1=340144&r2=340145&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/TokenLexer.h (original)
+++ cfe/trunk/include/clang/Lex/TokenLexer.h Sun Aug 19 15:23:42 2018
@@ -31,18 +31,17 @@ class VAOptExpansionContext;
class TokenLexer {
friend class Preprocessor;
- /// Macro - The macro we are expanding from. This is null if expanding a
- /// token stream.
+ /// The macro we are expanding from. This is null if expanding a token stream.
MacroInfo *Macro = nullptr;
- /// ActualArgs - The actual arguments specified for a function-like macro, or
- /// null. The TokenLexer owns the pointed-to object.
+ /// The actual arguments specified for a function-like macro, or null. The
+ /// TokenLexer owns the pointed-to object.
MacroArgs *ActualArgs = nullptr;
- /// PP - The current preprocessor object we are expanding for.
+ /// The current preprocessor object we are expanding for.
Preprocessor &PP;
- /// Tokens - This is the pointer to an array of tokens that the macro is
+ /// This is the pointer to an array of tokens that the macro is
/// defined to, with arguments expanded for function-like macros. If this is
/// a token stream, these are the tokens we are returning. This points into
/// the macro definition we are lexing from, a cache buffer that is owned by
@@ -52,14 +51,13 @@ class TokenLexer {
/// may update the pointer as needed.
const Token *Tokens;
- /// NumTokens - This is the length of the Tokens array.
+ /// This is the length of the Tokens array.
unsigned NumTokens;
/// This is the index of the next token that Lex will return.
unsigned CurTokenIdx;
- /// ExpandLocStart/End - The source location range where this macro was
- /// expanded.
+ /// The source location range where this macro was expanded.
SourceLocation ExpandLocStart, ExpandLocEnd;
/// Source location pointing at the source location entry chunk that
@@ -81,7 +79,7 @@ class TokenLexer {
bool AtStartOfLine : 1;
bool HasLeadingSpace : 1;
- // NextTokGetsSpace - When this is true, the next token appended to the
+ // When this is true, the next token appended to the
// output list during function argument expansion will get a leading space,
// regardless of whether it had one to begin with or not. This is used for
// placemarker support. If still true after function argument expansion, the
@@ -89,13 +87,13 @@ class TokenLexer {
// expansion.
bool NextTokGetsSpace : 1;
- /// OwnsTokens - This is true if this TokenLexer allocated the Tokens
+ /// This is true if this TokenLexer allocated the Tokens
/// array, and thus needs to free it when destroyed. For simple object-like
/// macros (for example) we just point into the token buffer of the macro
/// definition, we don't make a copy of it.
bool OwnsTokens : 1;
- /// DisableMacroExpansion - This is true when tokens lexed from the TokenLexer
+ /// This is true when tokens lexed from the TokenLexer
/// should not be subject to further macro expansion.
bool DisableMacroExpansion : 1;
@@ -123,14 +121,14 @@ public:
TokenLexer &operator=(const TokenLexer &) = delete;
~TokenLexer() { destroy(); }
- /// Init - Initialize this TokenLexer to expand from the specified macro
+ /// Initialize this TokenLexer to expand from the specified macro
/// with the specified argument information. Note that this ctor takes
/// ownership of the ActualArgs pointer. ILEnd specifies the location of the
/// ')' for a function-like macro or the identifier for an object-like macro.
- void Init(Token &Tok, SourceLocation ILEnd, MacroInfo *MI,
- MacroArgs *ActualArgs);
+ void Init(Token &Tok, SourceLocation ELEnd, MacroInfo *MI,
+ MacroArgs *Actuals);
- /// Init - Initialize this TokenLexer with the specified token stream.
+ /// Initialize this TokenLexer with the specified token stream.
/// This does not take ownership of the specified token vector.
///
/// DisableExpansion is true when macro expansion of tokens lexed from this
@@ -138,12 +136,12 @@ public:
void Init(const Token *TokArray, unsigned NumToks,
bool DisableMacroExpansion, bool OwnsTokens);
- /// isNextTokenLParen - If the next token lexed will pop this macro off the
+ /// If the next token lexed will pop this macro off the
/// expansion stack, return 2. If the next unexpanded token is a '(', return
/// 1, otherwise return 0.
unsigned isNextTokenLParen() const;
- /// Lex - Lex and return a token from this macro stream.
+ /// Lex and return a token from this macro stream.
bool Lex(Token &Tok);
/// isParsingPreprocessorDirective - Return true if we are in the middle of a
@@ -153,8 +151,8 @@ public:
private:
void destroy();
- /// isAtEnd - Return true if the next lex call will pop this macro off the
- /// include stack.
+ /// Return true if the next lex call will pop this macro off the include
+ /// stack.
bool isAtEnd() const {
return CurTokenIdx == NumTokens;
}
@@ -201,7 +199,7 @@ private:
/// \param[in] VCtx - contains relevant contextual information about the
/// state of the tokens around and including the __VA_OPT__ token, necessary
/// for stringification.
- void stringifyVAOPTContents(SmallVectorImpl<Token> &ReplacementToks,
+ void stringifyVAOPTContents(SmallVectorImpl<Token> &ResultToks,
const VAOptExpansionContext &VCtx,
SourceLocation VAOPTClosingParenLoc);
@@ -209,7 +207,7 @@ private:
/// return preexpanded tokens from Tokens.
void ExpandFunctionArguments();
- /// HandleMicrosoftCommentPaste - In microsoft compatibility mode, /##/ pastes
+ /// In microsoft compatibility mode, /##/ pastes
/// together to form a comment that comments out everything in the current
/// macro, other active macros, and anything left on the current physical
/// source line of the expanded buffer. Handle this by returning the
More information about the cfe-commits
mailing list