Skip to content

Commit 84aee95

Browse files
committed
[clang][NFC] Remove const_cast from Preprocessor::addModuleMacro()
1 parent c0cdc1d commit 84aee95

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

clang/include/clang/Lex/Preprocessor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ class Preprocessor {
10101010
llvm::FoldingSet<ModuleMacro> ModuleMacros;
10111011

10121012
/// The names of potential module macros that we've not yet processed.
1013-
llvm::SmallVector<const IdentifierInfo *, 32> PendingModuleMacroNames;
1013+
llvm::SmallVector<IdentifierInfo *, 32> PendingModuleMacroNames;
10141014

10151015
/// The list of module macros, for each identifier, that are not overridden by
10161016
/// any other module macro.
@@ -1432,7 +1432,7 @@ class Preprocessor {
14321432
MacroDirective *MD);
14331433

14341434
/// Register an exported macro for a module and identifier.
1435-
ModuleMacro *addModuleMacro(Module *Mod, const IdentifierInfo *II,
1435+
ModuleMacro *addModuleMacro(Module *Mod, IdentifierInfo *II,
14361436
MacroInfo *Macro,
14371437
ArrayRef<ModuleMacro *> Overrides, bool &IsNew);
14381438
ModuleMacro *getModuleMacro(Module *Mod, const IdentifierInfo *II);

clang/lib/Lex/PPLexerChange.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ Module *Preprocessor::LeaveSubmodule(bool ForPragma) {
804804
llvm::SmallPtrSet<const IdentifierInfo*, 8> VisitedMacros;
805805
for (unsigned I = Info.OuterPendingModuleMacroNames;
806806
I != PendingModuleMacroNames.size(); ++I) {
807-
const auto *II = PendingModuleMacroNames[I];
807+
auto *II = PendingModuleMacroNames[I];
808808
if (!VisitedMacros.insert(II).second)
809809
continue;
810810

clang/lib/Lex/PPMacroExpansion.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void Preprocessor::setLoadedMacroDirective(IdentifierInfo *II,
129129
II->setHasMacroDefinition(false);
130130
}
131131

132-
ModuleMacro *Preprocessor::addModuleMacro(Module *Mod, const IdentifierInfo *II,
132+
ModuleMacro *Preprocessor::addModuleMacro(Module *Mod, IdentifierInfo *II,
133133
MacroInfo *Macro,
134134
ArrayRef<ModuleMacro *> Overrides,
135135
bool &New) {
@@ -162,7 +162,7 @@ ModuleMacro *Preprocessor::addModuleMacro(Module *Mod, const IdentifierInfo *II,
162162
// The new macro is always a leaf macro.
163163
LeafMacros.push_back(MM);
164164
// The identifier now has defined macros (that may or may not be visible).
165-
const_cast<IdentifierInfo *>(II)->setHasMacroDefinition(true);
165+
II->setHasMacroDefinition(true);
166166

167167
New = true;
168168
return MM;

0 commit comments

Comments
 (0)