Skip to content

Commit c654193

Browse files
committed
[clang][Lex][NFC] Make some local variables const
1 parent e6e9beb commit c654193

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

clang/lib/Lex/Lexer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ using namespace clang;
5757
bool Token::isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const {
5858
if (isAnnotation())
5959
return false;
60-
if (IdentifierInfo *II = getIdentifierInfo())
60+
if (const IdentifierInfo *II = getIdentifierInfo())
6161
return II->getObjCKeywordID() == objcKey;
6262
return false;
6363
}
@@ -66,7 +66,7 @@ bool Token::isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const {
6666
tok::ObjCKeywordKind Token::getObjCKeywordID() const {
6767
if (isAnnotation())
6868
return tok::objc_not_keyword;
69-
IdentifierInfo *specId = getIdentifierInfo();
69+
const IdentifierInfo *specId = getIdentifierInfo();
7070
return specId ? specId->getObjCKeywordID() : tok::objc_not_keyword;
7171
}
7272

@@ -1893,7 +1893,7 @@ bool Lexer::LexIdentifierContinue(Token &Result, const char *CurPtr) {
18931893

18941894
// Fill in Result.IdentifierInfo and update the token kind,
18951895
// looking up the identifier in the identifier table.
1896-
IdentifierInfo *II = PP->LookUpIdentifierInfo(Result);
1896+
const IdentifierInfo *II = PP->LookUpIdentifierInfo(Result);
18971897
// Note that we have to call PP->LookUpIdentifierInfo() even for code
18981898
// completion, it writes IdentifierInfo into Result, and callers rely on it.
18991899

@@ -4458,7 +4458,7 @@ bool Lexer::LexDependencyDirectiveToken(Token &Result) {
44584458
if (Result.is(tok::raw_identifier)) {
44594459
Result.setRawIdentifierData(TokPtr);
44604460
if (!isLexingRawMode()) {
4461-
IdentifierInfo *II = PP->LookUpIdentifierInfo(Result);
4461+
const IdentifierInfo *II = PP->LookUpIdentifierInfo(Result);
44624462
if (II->isHandleIdentifierCase())
44634463
return PP->HandleIdentifier(Result);
44644464
}

clang/lib/Lex/Preprocessor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,8 +817,8 @@ bool Preprocessor::HandleIdentifier(Token &Identifier) {
817817
}
818818

819819
// If this is a macro to be expanded, do it.
820-
if (MacroDefinition MD = getMacroDefinition(&II)) {
821-
auto *MI = MD.getMacroInfo();
820+
if (const MacroDefinition MD = getMacroDefinition(&II)) {
821+
const auto *MI = MD.getMacroInfo();
822822
assert(MI && "macro definition with no macro info?");
823823
if (!DisableMacroExpansion) {
824824
if (!Identifier.isExpandDisabled() && MI->isEnabled()) {

0 commit comments

Comments
 (0)