aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-02-19 19:58:45 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-02-19 19:58:45 +0000
commit0be5e567e3a48592fd6b11f88cc77efb20c76f26 (patch)
tree44969ef50b8a00adb5d6a11ad78652e1a98b85c1 /lib/Lex
parent21a0004d80f50808ee343ae70092f6260a4c9477 (diff)
[modules] Const'ify some functions of ModuleMap.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175552 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex')
-rw-r--r--lib/Lex/ModuleMap.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp
index 1ceed54a0a..81cb94de51 100644
--- a/lib/Lex/ModuleMap.cpp
+++ b/lib/Lex/ModuleMap.cpp
@@ -37,7 +37,7 @@ using namespace clang;
Module::ExportDecl
ModuleMap::resolveExport(Module *Mod,
const Module::UnresolvedExportDecl &Unresolved,
- bool Complain) {
+ bool Complain) const {
// We may have just a wildcard.
if (Unresolved.Id.empty()) {
assert(Unresolved.Wildcard && "Invalid unresolved export");
@@ -239,8 +239,8 @@ Module *ModuleMap::findModuleForHeader(const FileEntry *File) {
return 0;
}
-bool ModuleMap::isHeaderInUnavailableModule(const FileEntry *Header) {
- HeadersMap::iterator Known = Headers.find(Header);
+bool ModuleMap::isHeaderInUnavailableModule(const FileEntry *Header) const {
+ HeadersMap::const_iterator Known = Headers.find(Header);
if (Known != Headers.end())
return !Known->second.isAvailable();
@@ -251,7 +251,7 @@ bool ModuleMap::isHeaderInUnavailableModule(const FileEntry *Header) {
// Keep walking up the directory hierarchy, looking for a directory with
// an umbrella header.
do {
- llvm::DenseMap<const DirectoryEntry *, Module *>::iterator KnownDir
+ llvm::DenseMap<const DirectoryEntry *, Module *>::const_iterator KnownDir
= UmbrellaDirs.find(Dir);
if (KnownDir != UmbrellaDirs.end()) {
Module *Found = KnownDir->second;
@@ -305,15 +305,16 @@ bool ModuleMap::isHeaderInUnavailableModule(const FileEntry *Header) {
return false;
}
-Module *ModuleMap::findModule(StringRef Name) {
- llvm::StringMap<Module *>::iterator Known = Modules.find(Name);
+Module *ModuleMap::findModule(StringRef Name) const {
+ llvm::StringMap<Module *>::const_iterator Known = Modules.find(Name);
if (Known != Modules.end())
return Known->getValue();
return 0;
}
-Module *ModuleMap::lookupModuleUnqualified(StringRef Name, Module *Context) {
+Module *ModuleMap::lookupModuleUnqualified(StringRef Name,
+ Module *Context) const {
for(; Context; Context = Context->Parent) {
if (Module *Sub = lookupModuleQualified(Name, Context))
return Sub;
@@ -322,7 +323,7 @@ Module *ModuleMap::lookupModuleUnqualified(StringRef Name, Module *Context) {
return findModule(Name);
}
-Module *ModuleMap::lookupModuleQualified(StringRef Name, Module *Context) {
+Module *ModuleMap::lookupModuleQualified(StringRef Name, Module *Context) const{
if (!Context)
return findModule(Name);
@@ -345,10 +346,10 @@ ModuleMap::findOrCreateModule(StringRef Name, Module *Parent, bool IsFramework,
}
bool ModuleMap::canInferFrameworkModule(const DirectoryEntry *ParentDir,
- StringRef Name, bool &IsSystem) {
+ StringRef Name, bool &IsSystem) const {
// Check whether we have already looked into the parent directory
// for a module map.
- llvm::DenseMap<const DirectoryEntry *, InferredDirectory>::iterator
+ llvm::DenseMap<const DirectoryEntry *, InferredDirectory>::const_iterator
inferred = InferredDirectories.find(ParentDir);
if (inferred == InferredDirectories.end())
return false;
@@ -415,7 +416,7 @@ ModuleMap::inferFrameworkModule(StringRef ModuleName,
if (const DirectoryEntry *ParentDir = FileMgr.getDirectory(Parent)) {
// Check whether we have already looked into the parent directory
// for a module map.
- llvm::DenseMap<const DirectoryEntry *, InferredDirectory>::iterator
+ llvm::DenseMap<const DirectoryEntry *, InferredDirectory>::const_iterator
inferred = InferredDirectories.find(ParentDir);
if (inferred == InferredDirectories.end()) {
// We haven't looked here before. Load a module map, if there is
@@ -560,7 +561,7 @@ void ModuleMap::addHeader(Module *Mod, const FileEntry *Header,
}
const FileEntry *
-ModuleMap::getContainingModuleMapFile(Module *Module) {
+ModuleMap::getContainingModuleMapFile(Module *Module) const {
if (Module->DefinitionLoc.isInvalid() || !SourceMgr)
return 0;