[clang] 84aee95 - [clang][NFC] Remove `const_cast` from `Preprocessor::addModuleMacro()`
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Fri May 17 08:11:56 PDT 2024
Author: Vlad Serebrennikov
Date: 2024-05-17T18:11:49+03:00
New Revision: 84aee95124549c5d13e22053af254e3fcc02bc84
URL: https://github.com/llvm/llvm-project/commit/84aee95124549c5d13e22053af254e3fcc02bc84
DIFF: https://github.com/llvm/llvm-project/commit/84aee95124549c5d13e22053af254e3fcc02bc84.diff
LOG: [clang][NFC] Remove `const_cast` from `Preprocessor::addModuleMacro()`
Added:
Modified:
clang/include/clang/Lex/Preprocessor.h
clang/lib/Lex/PPLexerChange.cpp
clang/lib/Lex/PPMacroExpansion.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index e89b4a2c5230e..c0850a8fa9f7f 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -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.
@@ -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);
diff --git a/clang/lib/Lex/PPLexerChange.cpp b/clang/lib/Lex/PPLexerChange.cpp
index 2ca2122ac7109..8221db46e06ac 100644
--- a/clang/lib/Lex/PPLexerChange.cpp
+++ b/clang/lib/Lex/PPLexerChange.cpp
@@ -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;
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index a478e0badb0c7..8af4a97d00cb8 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -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) {
@@ -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;
More information about the cfe-commits
mailing list