Skip to content

Commit

Permalink
[clang][NFC] Remove const_cast from Preprocessor::addModuleMacro()
Browse files Browse the repository at this point in the history
  • Loading branch information
Endilll committed May 17, 2024
1 parent c0cdc1d commit 84aee95
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions clang/include/clang/Lex/Preprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ class Preprocessor {
llvm::FoldingSet<ModuleMacro> ModuleMacros;

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

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

/// Register an exported macro for a module and identifier.
ModuleMacro *addModuleMacro(Module *Mod, const IdentifierInfo *II,
ModuleMacro *addModuleMacro(Module *Mod, IdentifierInfo *II,
MacroInfo *Macro,
ArrayRef<ModuleMacro *> Overrides, bool &IsNew);
ModuleMacro *getModuleMacro(Module *Mod, const IdentifierInfo *II);
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Lex/PPLexerChange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ Module *Preprocessor::LeaveSubmodule(bool ForPragma) {
llvm::SmallPtrSet<const IdentifierInfo*, 8> VisitedMacros;
for (unsigned I = Info.OuterPendingModuleMacroNames;
I != PendingModuleMacroNames.size(); ++I) {
const auto *II = PendingModuleMacroNames[I];
auto *II = PendingModuleMacroNames[I];
if (!VisitedMacros.insert(II).second)
continue;

Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Lex/PPMacroExpansion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void Preprocessor::setLoadedMacroDirective(IdentifierInfo *II,
II->setHasMacroDefinition(false);
}

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

New = true;
return MM;
Expand Down

0 comments on commit 84aee95

Please sign in to comment.