[clang] 722c514 - [clang][AST] Make `getLocalOrImportedSubmoduleID` work with const `Module*`. NFC.

Volodymyr Sapsai via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 17 17:30:01 PDT 2021


Author: Volodymyr Sapsai
Date: 2021-06-17T17:29:12-07:00
New Revision: 722c51473c7a3bfe13d929734615a3b46d44c09a

URL: https://github.com/llvm/llvm-project/commit/722c51473c7a3bfe13d929734615a3b46d44c09a
DIFF: https://github.com/llvm/llvm-project/commit/722c51473c7a3bfe13d929734615a3b46d44c09a.diff

LOG: [clang][AST] Make `getLocalOrImportedSubmoduleID` work with const `Module*`. NFC.

Differential Revision: https://reviews.llvm.org/D104350

Added: 
    

Modified: 
    clang/include/clang/Serialization/ASTWriter.h
    clang/lib/Serialization/ASTWriter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Serialization/ASTWriter.h b/clang/include/clang/Serialization/ASTWriter.h
index a7a659637902e..e4d92f0b0515c 100644
--- a/clang/include/clang/Serialization/ASTWriter.h
+++ b/clang/include/clang/Serialization/ASTWriter.h
@@ -450,7 +450,7 @@ class ASTWriter : public ASTDeserializationListener,
 
   /// A mapping from each known submodule to its ID number, which will
   /// be a positive integer.
-  llvm::DenseMap<Module *, unsigned> SubmoduleIDs;
+  llvm::DenseMap<const Module *, unsigned> SubmoduleIDs;
 
   /// A list of the module file extension writers.
   std::vector<std::unique_ptr<ModuleFileExtensionWriter>>
@@ -671,7 +671,7 @@ class ASTWriter : public ASTDeserializationListener,
   /// Retrieve or create a submodule ID for this module, or return 0 if
   /// the submodule is neither local (a submodle of the currently-written module)
   /// nor from an imported module.
-  unsigned getLocalOrImportedSubmoduleID(Module *Mod);
+  unsigned getLocalOrImportedSubmoduleID(const Module *Mod);
 
   /// Note that the identifier II occurs at the given offset
   /// within the identifier table.

diff  --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 4cdcf53775de1..ca169c010555c 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -2476,11 +2476,11 @@ void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec,
   }
 }
 
-unsigned ASTWriter::getLocalOrImportedSubmoduleID(Module *Mod) {
+unsigned ASTWriter::getLocalOrImportedSubmoduleID(const Module *Mod) {
   if (!Mod)
     return 0;
 
-  llvm::DenseMap<Module *, unsigned>::iterator Known = SubmoduleIDs.find(Mod);
+  auto Known = SubmoduleIDs.find(Mod);
   if (Known != SubmoduleIDs.end())
     return Known->second;
 


        


More information about the cfe-commits mailing list