12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430 |
- //===--- ModuleMap.cpp - Describe the layout of modules ---------*- C++ -*-===//
- //
- // The LLVM Compiler Infrastructure
- //
- // This file is distributed under the University of Illinois Open Source
- // License. See LICENSE.TXT for details.
- //
- //===----------------------------------------------------------------------===//
- //
- // This file defines the ModuleMap implementation, which describes the layout
- // of a module as it relates to headers.
- //
- //===----------------------------------------------------------------------===//
- #include "clang/Lex/ModuleMap.h"
- #include "clang/Lex/Lexer.h"
- #include "clang/Lex/LiteralSupport.h"
- #include "clang/Lex/LexDiagnostic.h"
- #include "clang/Basic/Diagnostic.h"
- #include "clang/Basic/FileManager.h"
- #include "clang/Basic/TargetInfo.h"
- #include "clang/Basic/TargetOptions.h"
- #include "llvm/Support/Allocator.h"
- #include "llvm/Support/FileSystem.h"
- #include "llvm/Support/Host.h"
- #include "llvm/Support/PathV2.h"
- #include "llvm/Support/raw_ostream.h"
- #include "llvm/ADT/StringRef.h"
- #include "llvm/ADT/StringSwitch.h"
- using namespace clang;
- Module::ExportDecl
- ModuleMap::resolveExport(Module *Mod,
- const Module::UnresolvedExportDecl &Unresolved,
- bool Complain) {
- // We may have just a wildcard.
- if (Unresolved.Id.empty()) {
- assert(Unresolved.Wildcard && "Invalid unresolved export");
- return Module::ExportDecl(0, true);
- }
-
- // Find the starting module.
- Module *Context = lookupModuleUnqualified(Unresolved.Id[0].first, Mod);
- if (!Context) {
- if (Complain)
- Diags->Report(Unresolved.Id[0].second,
- diag::err_mmap_missing_module_unqualified)
- << Unresolved.Id[0].first << Mod->getFullModuleName();
-
- return Module::ExportDecl();
- }
- // Dig into the module path.
- for (unsigned I = 1, N = Unresolved.Id.size(); I != N; ++I) {
- Module *Sub = lookupModuleQualified(Unresolved.Id[I].first,
- Context);
- if (!Sub) {
- if (Complain)
- Diags->Report(Unresolved.Id[I].second,
- diag::err_mmap_missing_module_qualified)
- << Unresolved.Id[I].first << Context->getFullModuleName()
- << SourceRange(Unresolved.Id[0].second, Unresolved.Id[I-1].second);
-
- return Module::ExportDecl();
- }
-
- Context = Sub;
- }
-
- return Module::ExportDecl(Context, Unresolved.Wildcard);
- }
- ModuleMap::ModuleMap(FileManager &FileMgr, const DiagnosticConsumer &DC,
- const LangOptions &LangOpts, const TargetInfo *Target)
- : LangOpts(LangOpts), Target(Target), BuiltinIncludeDir(0)
- {
- llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagIDs(new DiagnosticIDs);
- Diags = llvm::IntrusiveRefCntPtr<DiagnosticsEngine>(
- new DiagnosticsEngine(DiagIDs));
- Diags->setClient(DC.clone(*Diags), /*ShouldOwnClient=*/true);
- SourceMgr = new SourceManager(*Diags, FileMgr);
- }
- ModuleMap::~ModuleMap() {
- for (llvm::StringMap<Module *>::iterator I = Modules.begin(),
- IEnd = Modules.end();
- I != IEnd; ++I) {
- delete I->getValue();
- }
-
- delete SourceMgr;
- }
- void ModuleMap::setTarget(const TargetInfo &Target) {
- assert((!this->Target || this->Target == &Target) &&
- "Improper target override");
- this->Target = &Target;
- }
- Module *ModuleMap::findModuleForHeader(const FileEntry *File) {
- llvm::DenseMap<const FileEntry *, Module *>::iterator Known
- = Headers.find(File);
- if (Known != Headers.end()) {
- // If a header corresponds to an unavailable module, don't report
- // that it maps to anything.
- if (!Known->second->isAvailable())
- return 0;
- return Known->second;
- }
-
- const DirectoryEntry *Dir = File->getDir();
- llvm::SmallVector<const DirectoryEntry *, 2> SkippedDirs;
- StringRef DirName = Dir->getName();
- // Keep walking up the directory hierarchy, looking for a directory with
- // an umbrella header.
- do {
- llvm::DenseMap<const DirectoryEntry *, Module *>::iterator KnownDir
- = UmbrellaDirs.find(Dir);
- if (KnownDir != UmbrellaDirs.end()) {
- Module *Result = KnownDir->second;
-
- // Search up the module stack until we find a module with an umbrella
- // directory.
- Module *UmbrellaModule = Result;
- while (!UmbrellaModule->getUmbrellaDir() && UmbrellaModule->Parent)
- UmbrellaModule = UmbrellaModule->Parent;
- if (UmbrellaModule->InferSubmodules) {
- // Infer submodules for each of the directories we found between
- // the directory of the umbrella header and the directory where
- // the actual header is located.
- bool Explicit = UmbrellaModule->InferExplicitSubmodules;
-
- for (unsigned I = SkippedDirs.size(); I != 0; --I) {
- // Find or create the module that corresponds to this directory name.
- StringRef Name = llvm::sys::path::stem(SkippedDirs[I-1]->getName());
- Result = findOrCreateModule(Name, Result, /*IsFramework=*/false,
- Explicit).first;
-
- // Associate the module and the directory.
- UmbrellaDirs[SkippedDirs[I-1]] = Result;
- // If inferred submodules export everything they import, add a
- // wildcard to the set of exports.
- if (UmbrellaModule->InferExportWildcard && Result->Exports.empty())
- Result->Exports.push_back(Module::ExportDecl(0, true));
- }
-
- // Infer a submodule with the same name as this header file.
- StringRef Name = llvm::sys::path::stem(File->getName());
- Result = findOrCreateModule(Name, Result, /*IsFramework=*/false,
- Explicit).first;
-
- // If inferred submodules export everything they import, add a
- // wildcard to the set of exports.
- if (UmbrellaModule->InferExportWildcard && Result->Exports.empty())
- Result->Exports.push_back(Module::ExportDecl(0, true));
- } else {
- // Record each of the directories we stepped through as being part of
- // the module we found, since the umbrella header covers them all.
- for (unsigned I = 0, N = SkippedDirs.size(); I != N; ++I)
- UmbrellaDirs[SkippedDirs[I]] = Result;
- }
-
- Headers[File] = Result;
- // If a header corresponds to an unavailable module, don't report
- // that it maps to anything.
- if (!Result->isAvailable())
- return 0;
- return Result;
- }
-
- SkippedDirs.push_back(Dir);
-
- // Retrieve our parent path.
- DirName = llvm::sys::path::parent_path(DirName);
- if (DirName.empty())
- break;
-
- // Resolve the parent path to a directory entry.
- Dir = SourceMgr->getFileManager().getDirectory(DirName);
- } while (Dir);
-
- return 0;
- }
- bool ModuleMap::isHeaderInUnavailableModule(const FileEntry *Header) {
- llvm::DenseMap<const FileEntry *, Module *>::iterator Known
- = Headers.find(Header);
- if (Known != Headers.end())
- return !Known->second->isAvailable();
-
- const DirectoryEntry *Dir = Header->getDir();
- llvm::SmallVector<const DirectoryEntry *, 2> SkippedDirs;
- StringRef DirName = Dir->getName();
- // Keep walking up the directory hierarchy, looking for a directory with
- // an umbrella header.
- do {
- llvm::DenseMap<const DirectoryEntry *, Module *>::iterator KnownDir
- = UmbrellaDirs.find(Dir);
- if (KnownDir != UmbrellaDirs.end()) {
- Module *Found = KnownDir->second;
- if (!Found->isAvailable())
- return true;
- // Search up the module stack until we find a module with an umbrella
- // directory.
- Module *UmbrellaModule = Found;
- while (!UmbrellaModule->getUmbrellaDir() && UmbrellaModule->Parent)
- UmbrellaModule = UmbrellaModule->Parent;
- if (UmbrellaModule->InferSubmodules) {
- for (unsigned I = SkippedDirs.size(); I != 0; --I) {
- // Find or create the module that corresponds to this directory name.
- StringRef Name = llvm::sys::path::stem(SkippedDirs[I-1]->getName());
- Found = lookupModuleQualified(Name, Found);
- if (!Found)
- return false;
- if (!Found->isAvailable())
- return true;
- }
-
- // Infer a submodule with the same name as this header file.
- StringRef Name = llvm::sys::path::stem(Header->getName());
- Found = lookupModuleQualified(Name, Found);
- if (!Found)
- return false;
- }
- return !Found->isAvailable();
- }
-
- SkippedDirs.push_back(Dir);
-
- // Retrieve our parent path.
- DirName = llvm::sys::path::parent_path(DirName);
- if (DirName.empty())
- break;
-
- // Resolve the parent path to a directory entry.
- Dir = SourceMgr->getFileManager().getDirectory(DirName);
- } while (Dir);
-
- return false;
- }
- Module *ModuleMap::findModule(StringRef Name) {
- llvm::StringMap<Module *>::iterator Known = Modules.find(Name);
- if (Known != Modules.end())
- return Known->getValue();
-
- return 0;
- }
- Module *ModuleMap::lookupModuleUnqualified(StringRef Name, Module *Context) {
- for(; Context; Context = Context->Parent) {
- if (Module *Sub = lookupModuleQualified(Name, Context))
- return Sub;
- }
-
- return findModule(Name);
- }
- Module *ModuleMap::lookupModuleQualified(StringRef Name, Module *Context) {
- if (!Context)
- return findModule(Name);
-
- return Context->findSubmodule(Name);
- }
- std::pair<Module *, bool>
- ModuleMap::findOrCreateModule(StringRef Name, Module *Parent, bool IsFramework,
- bool IsExplicit) {
- // Try to find an existing module with this name.
- if (Module *Sub = lookupModuleQualified(Name, Parent))
- return std::make_pair(Sub, false);
-
- // Create a new module with this name.
- Module *Result = new Module(Name, SourceLocation(), Parent, IsFramework,
- IsExplicit);
- if (!Parent)
- Modules[Name] = Result;
- return std::make_pair(Result, true);
- }
- Module *
- ModuleMap::inferFrameworkModule(StringRef ModuleName,
- const DirectoryEntry *FrameworkDir,
- bool IsSystem,
- Module *Parent) {
- // Check whether we've already found this module.
- if (Module *Mod = lookupModuleQualified(ModuleName, Parent))
- return Mod;
-
- FileManager &FileMgr = SourceMgr->getFileManager();
-
- // Look for an umbrella header.
- SmallString<128> UmbrellaName = StringRef(FrameworkDir->getName());
- llvm::sys::path::append(UmbrellaName, "Headers");
- llvm::sys::path::append(UmbrellaName, ModuleName + ".h");
- const FileEntry *UmbrellaHeader = FileMgr.getFile(UmbrellaName);
-
- // FIXME: If there's no umbrella header, we could probably scan the
- // framework to load *everything*. But, it's not clear that this is a good
- // idea.
- if (!UmbrellaHeader)
- return 0;
-
- Module *Result = new Module(ModuleName, SourceLocation(), Parent,
- /*IsFramework=*/true, /*IsExplicit=*/false);
- if (IsSystem)
- Result->IsSystem = IsSystem;
-
- if (!Parent)
- Modules[ModuleName] = Result;
-
- // umbrella header "umbrella-header-name"
- Result->Umbrella = UmbrellaHeader;
- Headers[UmbrellaHeader] = Result;
- UmbrellaDirs[UmbrellaHeader->getDir()] = Result;
-
- // export *
- Result->Exports.push_back(Module::ExportDecl(0, true));
-
- // module * { export * }
- Result->InferSubmodules = true;
- Result->InferExportWildcard = true;
-
- // Look for subframeworks.
- llvm::error_code EC;
- SmallString<128> SubframeworksDirName
- = StringRef(FrameworkDir->getName());
- llvm::sys::path::append(SubframeworksDirName, "Frameworks");
- SmallString<128> SubframeworksDirNameNative;
- llvm::sys::path::native(SubframeworksDirName.str(),
- SubframeworksDirNameNative);
- for (llvm::sys::fs::directory_iterator
- Dir(SubframeworksDirNameNative.str(), EC), DirEnd;
- Dir != DirEnd && !EC; Dir.increment(EC)) {
- if (!StringRef(Dir->path()).endswith(".framework"))
- continue;
-
- if (const DirectoryEntry *SubframeworkDir
- = FileMgr.getDirectory(Dir->path())) {
- // FIXME: Do we want to warn about subframeworks without umbrella headers?
- inferFrameworkModule(llvm::sys::path::stem(Dir->path()), SubframeworkDir,
- IsSystem, Result);
- }
- }
- return Result;
- }
- void ModuleMap::setUmbrellaHeader(Module *Mod, const FileEntry *UmbrellaHeader){
- Headers[UmbrellaHeader] = Mod;
- Mod->Umbrella = UmbrellaHeader;
- UmbrellaDirs[UmbrellaHeader->getDir()] = Mod;
- }
- void ModuleMap::setUmbrellaDir(Module *Mod, const DirectoryEntry *UmbrellaDir) {
- Mod->Umbrella = UmbrellaDir;
- UmbrellaDirs[UmbrellaDir] = Mod;
- }
- void ModuleMap::addHeader(Module *Mod, const FileEntry *Header) {
- Mod->Headers.push_back(Header);
- Headers[Header] = Mod;
- }
- const FileEntry *
- ModuleMap::getContainingModuleMapFile(Module *Module) {
- if (Module->DefinitionLoc.isInvalid() || !SourceMgr)
- return 0;
- return SourceMgr->getFileEntryForID(
- SourceMgr->getFileID(Module->DefinitionLoc));
- }
- void ModuleMap::dump() {
- llvm::errs() << "Modules:";
- for (llvm::StringMap<Module *>::iterator M = Modules.begin(),
- MEnd = Modules.end();
- M != MEnd; ++M)
- M->getValue()->print(llvm::errs(), 2);
-
- llvm::errs() << "Headers:";
- for (llvm::DenseMap<const FileEntry *, Module *>::iterator
- H = Headers.begin(),
- HEnd = Headers.end();
- H != HEnd; ++H) {
- llvm::errs() << " \"" << H->first->getName() << "\" -> "
- << H->second->getFullModuleName() << "\n";
- }
- }
- bool ModuleMap::resolveExports(Module *Mod, bool Complain) {
- bool HadError = false;
- for (unsigned I = 0, N = Mod->UnresolvedExports.size(); I != N; ++I) {
- Module::ExportDecl Export = resolveExport(Mod, Mod->UnresolvedExports[I],
- Complain);
- if (Export.getPointer() || Export.getInt())
- Mod->Exports.push_back(Export);
- else
- HadError = true;
- }
- Mod->UnresolvedExports.clear();
- return HadError;
- }
- Module *ModuleMap::inferModuleFromLocation(FullSourceLoc Loc) {
- if (Loc.isInvalid())
- return 0;
-
- // Use the expansion location to determine which module we're in.
- FullSourceLoc ExpansionLoc = Loc.getExpansionLoc();
- if (!ExpansionLoc.isFileID())
- return 0;
-
-
- const SourceManager &SrcMgr = Loc.getManager();
- FileID ExpansionFileID = ExpansionLoc.getFileID();
-
- while (const FileEntry *ExpansionFile
- = SrcMgr.getFileEntryForID(ExpansionFileID)) {
- // Find the module that owns this header (if any).
- if (Module *Mod = findModuleForHeader(ExpansionFile))
- return Mod;
-
- // No module owns this header, so look up the inclusion chain to see if
- // any included header has an associated module.
- SourceLocation IncludeLoc = SrcMgr.getIncludeLoc(ExpansionFileID);
- if (IncludeLoc.isInvalid())
- return 0;
-
- ExpansionFileID = SrcMgr.getFileID(IncludeLoc);
- }
-
- return 0;
- }
- //----------------------------------------------------------------------------//
- // Module map file parser
- //----------------------------------------------------------------------------//
- namespace clang {
- /// \brief A token in a module map file.
- struct MMToken {
- enum TokenKind {
- Comma,
- EndOfFile,
- HeaderKeyword,
- Identifier,
- ExplicitKeyword,
- ExportKeyword,
- FrameworkKeyword,
- ModuleKeyword,
- Period,
- UmbrellaKeyword,
- RequiresKeyword,
- Star,
- StringLiteral,
- LBrace,
- RBrace,
- LSquare,
- RSquare
- } Kind;
-
- unsigned Location;
- unsigned StringLength;
- const char *StringData;
-
- void clear() {
- Kind = EndOfFile;
- Location = 0;
- StringLength = 0;
- StringData = 0;
- }
-
- bool is(TokenKind K) const { return Kind == K; }
-
- SourceLocation getLocation() const {
- return SourceLocation::getFromRawEncoding(Location);
- }
-
- StringRef getString() const {
- return StringRef(StringData, StringLength);
- }
- };
-
- class ModuleMapParser {
- Lexer &L;
- SourceManager &SourceMgr;
- DiagnosticsEngine &Diags;
- ModuleMap ⤅
-
- /// \brief The directory that this module map resides in.
- const DirectoryEntry *Directory;
- /// \brief The directory containing Clang-supplied headers.
- const DirectoryEntry *BuiltinIncludeDir;
- /// \brief Whether an error occurred.
- bool HadError;
-
- /// \brief Default target information, used only for string literal
- /// parsing.
- TargetInfo *Target;
-
- /// \brief Stores string data for the various string literals referenced
- /// during parsing.
- llvm::BumpPtrAllocator StringData;
-
- /// \brief The current token.
- MMToken Tok;
-
- /// \brief The active module.
- Module *ActiveModule;
-
- /// \brief Consume the current token and return its location.
- SourceLocation consumeToken();
-
- /// \brief Skip tokens until we reach the a token with the given kind
- /// (or the end of the file).
- void skipUntil(MMToken::TokenKind K);
- typedef llvm::SmallVector<std::pair<std::string, SourceLocation>, 2>
- ModuleId;
- bool parseModuleId(ModuleId &Id);
- void parseModuleDecl();
- void parseRequiresDecl();
- void parseHeaderDecl(SourceLocation UmbrellaLoc);
- void parseUmbrellaDirDecl(SourceLocation UmbrellaLoc);
- void parseExportDecl();
- void parseInferredSubmoduleDecl(bool Explicit);
-
- const DirectoryEntry *getOverriddenHeaderSearchDir();
-
- public:
- explicit ModuleMapParser(Lexer &L, SourceManager &SourceMgr,
- DiagnosticsEngine &Diags,
- ModuleMap &Map,
- const DirectoryEntry *Directory,
- const DirectoryEntry *BuiltinIncludeDir)
- : L(L), SourceMgr(SourceMgr), Diags(Diags), Map(Map),
- Directory(Directory), BuiltinIncludeDir(BuiltinIncludeDir),
- HadError(false), ActiveModule(0)
- {
- TargetOptions TargetOpts;
- TargetOpts.Triple = llvm::sys::getDefaultTargetTriple();
- Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
-
- Tok.clear();
- consumeToken();
- }
-
- bool parseModuleMapFile();
- };
- }
- SourceLocation ModuleMapParser::consumeToken() {
- retry:
- SourceLocation Result = Tok.getLocation();
- Tok.clear();
-
- Token LToken;
- L.LexFromRawLexer(LToken);
- Tok.Location = LToken.getLocation().getRawEncoding();
- switch (LToken.getKind()) {
- case tok::raw_identifier:
- Tok.StringData = LToken.getRawIdentifierData();
- Tok.StringLength = LToken.getLength();
- Tok.Kind = llvm::StringSwitch<MMToken::TokenKind>(Tok.getString())
- .Case("header", MMToken::HeaderKeyword)
- .Case("explicit", MMToken::ExplicitKeyword)
- .Case("export", MMToken::ExportKeyword)
- .Case("framework", MMToken::FrameworkKeyword)
- .Case("module", MMToken::ModuleKeyword)
- .Case("requires", MMToken::RequiresKeyword)
- .Case("umbrella", MMToken::UmbrellaKeyword)
- .Default(MMToken::Identifier);
- break;
- case tok::comma:
- Tok.Kind = MMToken::Comma;
- break;
- case tok::eof:
- Tok.Kind = MMToken::EndOfFile;
- break;
-
- case tok::l_brace:
- Tok.Kind = MMToken::LBrace;
- break;
- case tok::l_square:
- Tok.Kind = MMToken::LSquare;
- break;
-
- case tok::period:
- Tok.Kind = MMToken::Period;
- break;
-
- case tok::r_brace:
- Tok.Kind = MMToken::RBrace;
- break;
-
- case tok::r_square:
- Tok.Kind = MMToken::RSquare;
- break;
-
- case tok::star:
- Tok.Kind = MMToken::Star;
- break;
-
- case tok::string_literal: {
- // Parse the string literal.
- LangOptions LangOpts;
- StringLiteralParser StringLiteral(<oken, 1, SourceMgr, LangOpts, *Target);
- if (StringLiteral.hadError)
- goto retry;
-
- // Copy the string literal into our string data allocator.
- unsigned Length = StringLiteral.GetStringLength();
- char *Saved = StringData.Allocate<char>(Length + 1);
- memcpy(Saved, StringLiteral.GetString().data(), Length);
- Saved[Length] = 0;
-
- // Form the token.
- Tok.Kind = MMToken::StringLiteral;
- Tok.StringData = Saved;
- Tok.StringLength = Length;
- break;
- }
-
- case tok::comment:
- goto retry;
-
- default:
- Diags.Report(LToken.getLocation(), diag::err_mmap_unknown_token);
- HadError = true;
- goto retry;
- }
-
- return Result;
- }
- void ModuleMapParser::skipUntil(MMToken::TokenKind K) {
- unsigned braceDepth = 0;
- unsigned squareDepth = 0;
- do {
- switch (Tok.Kind) {
- case MMToken::EndOfFile:
- return;
- case MMToken::LBrace:
- if (Tok.is(K) && braceDepth == 0 && squareDepth == 0)
- return;
-
- ++braceDepth;
- break;
- case MMToken::LSquare:
- if (Tok.is(K) && braceDepth == 0 && squareDepth == 0)
- return;
-
- ++squareDepth;
- break;
- case MMToken::RBrace:
- if (braceDepth > 0)
- --braceDepth;
- else if (Tok.is(K))
- return;
- break;
- case MMToken::RSquare:
- if (squareDepth > 0)
- --squareDepth;
- else if (Tok.is(K))
- return;
- break;
- default:
- if (braceDepth == 0 && squareDepth == 0 && Tok.is(K))
- return;
- break;
- }
-
- consumeToken();
- } while (true);
- }
- /// \brief Parse a module-id.
- ///
- /// module-id:
- /// identifier
- /// identifier '.' module-id
- ///
- /// \returns true if an error occurred, false otherwise.
- bool ModuleMapParser::parseModuleId(ModuleId &Id) {
- Id.clear();
- do {
- if (Tok.is(MMToken::Identifier)) {
- Id.push_back(std::make_pair(Tok.getString(), Tok.getLocation()));
- consumeToken();
- } else {
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_module_name);
- return true;
- }
-
- if (!Tok.is(MMToken::Period))
- break;
-
- consumeToken();
- } while (true);
-
- return false;
- }
- namespace {
- /// \brief Enumerates the known attributes.
- enum AttributeKind {
- /// \brief An unknown attribute.
- AT_unknown,
- /// \brief The 'system' attribute.
- AT_system
- };
- }
- /// \brief Parse a module declaration.
- ///
- /// module-declaration:
- /// 'explicit'[opt] 'framework'[opt] 'module' module-id attributes[opt]
- /// { module-member* }
- ///
- /// attributes:
- /// attribute attributes
- /// attribute
- ///
- /// attribute:
- /// [ identifier ]
- ///
- /// module-member:
- /// requires-declaration
- /// header-declaration
- /// submodule-declaration
- /// export-declaration
- ///
- /// submodule-declaration:
- /// module-declaration
- /// inferred-submodule-declaration
- void ModuleMapParser::parseModuleDecl() {
- assert(Tok.is(MMToken::ExplicitKeyword) || Tok.is(MMToken::ModuleKeyword) ||
- Tok.is(MMToken::FrameworkKeyword));
- // Parse 'explicit' or 'framework' keyword, if present.
- SourceLocation ExplicitLoc;
- bool Explicit = false;
- bool Framework = false;
- // Parse 'explicit' keyword, if present.
- if (Tok.is(MMToken::ExplicitKeyword)) {
- ExplicitLoc = consumeToken();
- Explicit = true;
- }
- // Parse 'framework' keyword, if present.
- if (Tok.is(MMToken::FrameworkKeyword)) {
- consumeToken();
- Framework = true;
- }
-
- // Parse 'module' keyword.
- if (!Tok.is(MMToken::ModuleKeyword)) {
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_module);
- consumeToken();
- HadError = true;
- return;
- }
- consumeToken(); // 'module' keyword
- // If we have a wildcard for the module name, this is an inferred submodule.
- // Parse it.
- if (Tok.is(MMToken::Star))
- return parseInferredSubmoduleDecl(Explicit);
-
- // Parse the module name.
- ModuleId Id;
- if (parseModuleId(Id)) {
- HadError = true;
- return;
- }
-
- if (ActiveModule) {
- if (Id.size() > 1) {
- Diags.Report(Id.front().second, diag::err_mmap_nested_submodule_id)
- << SourceRange(Id.front().second, Id.back().second);
-
- HadError = true;
- return;
- }
- } else if (Id.size() == 1 && Explicit) {
- // Top-level modules can't be explicit.
- Diags.Report(ExplicitLoc, diag::err_mmap_explicit_top_level);
- Explicit = false;
- ExplicitLoc = SourceLocation();
- HadError = true;
- }
-
- Module *PreviousActiveModule = ActiveModule;
- if (Id.size() > 1) {
- // This module map defines a submodule. Go find the module of which it
- // is a submodule.
- ActiveModule = 0;
- for (unsigned I = 0, N = Id.size() - 1; I != N; ++I) {
- if (Module *Next = Map.lookupModuleQualified(Id[I].first, ActiveModule)) {
- ActiveModule = Next;
- continue;
- }
-
- if (ActiveModule) {
- Diags.Report(Id[I].second, diag::err_mmap_missing_module_qualified)
- << Id[I].first << ActiveModule->getTopLevelModule();
- } else {
- Diags.Report(Id[I].second, diag::err_mmap_expected_module_name);
- }
- HadError = true;
- return;
- }
- }
-
- StringRef ModuleName = Id.back().first;
- SourceLocation ModuleNameLoc = Id.back().second;
-
- // Parse the optional attribute list.
- bool IsSystem = false;
- while (Tok.is(MMToken::LSquare)) {
- // Consume the '['.
- SourceLocation LSquareLoc = consumeToken();
-
- // Check whether we have an attribute name here.
- if (!Tok.is(MMToken::Identifier)) {
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_attribute);
- skipUntil(MMToken::RSquare);
- if (Tok.is(MMToken::RSquare))
- consumeToken();
- continue;
- }
-
- // Decode the attribute name.
- AttributeKind Attribute
- = llvm::StringSwitch<AttributeKind>(Tok.getString())
- .Case("system", AT_system)
- .Default(AT_unknown);
- switch (Attribute) {
- case AT_unknown:
- Diags.Report(Tok.getLocation(), diag::warn_mmap_unknown_attribute)
- << Tok.getString();
- break;
-
- case AT_system:
- IsSystem = true;
- break;
- }
- consumeToken();
-
- // Consume the ']'.
- if (!Tok.is(MMToken::RSquare)) {
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_rsquare);
- Diags.Report(LSquareLoc, diag::note_mmap_lsquare_match);
- skipUntil(MMToken::RSquare);
- }
- if (Tok.is(MMToken::RSquare))
- consumeToken();
- }
-
- // Parse the opening brace.
- if (!Tok.is(MMToken::LBrace)) {
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_lbrace)
- << ModuleName;
- HadError = true;
- return;
- }
- SourceLocation LBraceLoc = consumeToken();
-
- // Determine whether this (sub)module has already been defined.
- if (Module *Existing = Map.lookupModuleQualified(ModuleName, ActiveModule)) {
- if (Existing->DefinitionLoc.isInvalid() && !ActiveModule) {
- // Skip the module definition.
- skipUntil(MMToken::RBrace);
- if (Tok.is(MMToken::RBrace))
- consumeToken();
- else {
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_rbrace);
- Diags.Report(LBraceLoc, diag::note_mmap_lbrace_match);
- HadError = true;
- }
- return;
- }
-
- Diags.Report(ModuleNameLoc, diag::err_mmap_module_redefinition)
- << ModuleName;
- Diags.Report(Existing->DefinitionLoc, diag::note_mmap_prev_definition);
-
- // Skip the module definition.
- skipUntil(MMToken::RBrace);
- if (Tok.is(MMToken::RBrace))
- consumeToken();
-
- HadError = true;
- return;
- }
- // Start defining this module.
- ActiveModule = Map.findOrCreateModule(ModuleName, ActiveModule, Framework,
- Explicit).first;
- ActiveModule->DefinitionLoc = ModuleNameLoc;
- if (IsSystem)
- ActiveModule->IsSystem = true;
-
- bool Done = false;
- do {
- switch (Tok.Kind) {
- case MMToken::EndOfFile:
- case MMToken::RBrace:
- Done = true;
- break;
-
- case MMToken::ExplicitKeyword:
- case MMToken::FrameworkKeyword:
- case MMToken::ModuleKeyword:
- parseModuleDecl();
- break;
-
- case MMToken::ExportKeyword:
- parseExportDecl();
- break;
-
- case MMToken::RequiresKeyword:
- parseRequiresDecl();
- break;
- case MMToken::UmbrellaKeyword: {
- SourceLocation UmbrellaLoc = consumeToken();
- if (Tok.is(MMToken::HeaderKeyword))
- parseHeaderDecl(UmbrellaLoc);
- else
- parseUmbrellaDirDecl(UmbrellaLoc);
- break;
- }
-
- case MMToken::HeaderKeyword:
- parseHeaderDecl(SourceLocation());
- break;
-
- default:
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_member);
- consumeToken();
- break;
- }
- } while (!Done);
- if (Tok.is(MMToken::RBrace))
- consumeToken();
- else {
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_rbrace);
- Diags.Report(LBraceLoc, diag::note_mmap_lbrace_match);
- HadError = true;
- }
- // We're done parsing this module. Pop back to the previous module.
- ActiveModule = PreviousActiveModule;
- }
- /// \brief Parse a requires declaration.
- ///
- /// requires-declaration:
- /// 'requires' feature-list
- ///
- /// feature-list:
- /// identifier ',' feature-list
- /// identifier
- void ModuleMapParser::parseRequiresDecl() {
- assert(Tok.is(MMToken::RequiresKeyword));
- // Parse 'requires' keyword.
- consumeToken();
- // Parse the feature-list.
- do {
- if (!Tok.is(MMToken::Identifier)) {
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_feature);
- HadError = true;
- return;
- }
- // Consume the feature name.
- std::string Feature = Tok.getString();
- consumeToken();
- // Add this feature.
- ActiveModule->addRequirement(Feature, Map.LangOpts, *Map.Target);
- if (!Tok.is(MMToken::Comma))
- break;
- // Consume the comma.
- consumeToken();
- } while (true);
- }
- /// \brief Append to \p Paths the set of paths needed to get to the
- /// subframework in which the given module lives.
- void appendSubframeworkPaths(Module *Mod, llvm::SmallVectorImpl<char> &Path) {
- // Collect the framework names from the given module to the top-level module.
- llvm::SmallVector<StringRef, 2> Paths;
- for (; Mod; Mod = Mod->Parent) {
- if (Mod->IsFramework)
- Paths.push_back(Mod->Name);
- }
-
- if (Paths.empty())
- return;
-
- // Add Frameworks/Name.framework for each subframework.
- for (unsigned I = Paths.size() - 1; I != 0; --I) {
- llvm::sys::path::append(Path, "Frameworks");
- llvm::sys::path::append(Path, Paths[I-1] + ".framework");
- }
- }
- /// \brief Determine whether the given file name is the name of a builtin
- /// header, supplied by Clang to replace, override, or augment existing system
- /// headers.
- static bool isBuiltinHeader(StringRef FileName) {
- return llvm::StringSwitch<bool>(FileName)
- .Case("float.h", true)
- .Case("iso646.h", true)
- .Case("limits.h", true)
- .Case("stdalign.h", true)
- .Case("stdarg.h", true)
- .Case("stdbool.h", true)
- .Case("stddef.h", true)
- .Case("stdint.h", true)
- .Case("tgmath.h", true)
- .Case("unwind.h", true)
- .Default(false);
- }
- /// \brief Parse a header declaration.
- ///
- /// header-declaration:
- /// 'umbrella'[opt] 'header' string-literal
- void ModuleMapParser::parseHeaderDecl(SourceLocation UmbrellaLoc) {
- assert(Tok.is(MMToken::HeaderKeyword));
- consumeToken();
- bool Umbrella = UmbrellaLoc.isValid();
-
- // Parse the header name.
- if (!Tok.is(MMToken::StringLiteral)) {
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_header)
- << "header";
- HadError = true;
- return;
- }
- std::string FileName = Tok.getString();
- SourceLocation FileNameLoc = consumeToken();
-
- // Check whether we already have an umbrella.
- if (Umbrella && ActiveModule->Umbrella) {
- Diags.Report(FileNameLoc, diag::err_mmap_umbrella_clash)
- << ActiveModule->getFullModuleName();
- HadError = true;
- return;
- }
- // Look for this file.
- const FileEntry *File = 0;
- const FileEntry *BuiltinFile = 0;
- SmallString<128> PathName;
- if (llvm::sys::path::is_absolute(FileName)) {
- PathName = FileName;
- File = SourceMgr.getFileManager().getFile(PathName);
- } else if (const DirectoryEntry *Dir = getOverriddenHeaderSearchDir()) {
- PathName = Dir->getName();
- llvm::sys::path::append(PathName, FileName);
- File = SourceMgr.getFileManager().getFile(PathName);
- } else {
- // Search for the header file within the search directory.
- PathName = Directory->getName();
- unsigned PathLength = PathName.size();
-
- if (ActiveModule->isPartOfFramework()) {
- appendSubframeworkPaths(ActiveModule, PathName);
-
- // Check whether this file is in the public headers.
- llvm::sys::path::append(PathName, "Headers");
- llvm::sys::path::append(PathName, FileName);
- File = SourceMgr.getFileManager().getFile(PathName);
-
- if (!File) {
- // Check whether this file is in the private headers.
- PathName.resize(PathLength);
- llvm::sys::path::append(PathName, "PrivateHeaders");
- llvm::sys::path::append(PathName, FileName);
- File = SourceMgr.getFileManager().getFile(PathName);
- }
- } else {
- // Lookup for normal headers.
- llvm::sys::path::append(PathName, FileName);
- File = SourceMgr.getFileManager().getFile(PathName);
-
- // If this is a system module with a top-level header, this header
- // may have a counterpart (or replacement) in the set of headers
- // supplied by Clang. Find that builtin header.
- if (ActiveModule->IsSystem && !Umbrella && BuiltinIncludeDir &&
- BuiltinIncludeDir != Directory && isBuiltinHeader(FileName)) {
- SmallString<128> BuiltinPathName(BuiltinIncludeDir->getName());
- llvm::sys::path::append(BuiltinPathName, FileName);
- BuiltinFile = SourceMgr.getFileManager().getFile(BuiltinPathName);
-
- // If Clang supplies this header but the underlying system does not,
- // just silently swap in our builtin version. Otherwise, we'll end
- // up adding both (later).
- if (!File && BuiltinFile) {
- File = BuiltinFile;
- BuiltinFile = 0;
- }
- }
- }
- }
-
- // FIXME: We shouldn't be eagerly stat'ing every file named in a module map.
- // Come up with a lazy way to do this.
- if (File) {
- if (const Module *OwningModule = Map.Headers[File]) {
- Diags.Report(FileNameLoc, diag::err_mmap_header_conflict)
- << FileName << OwningModule->getFullModuleName();
- HadError = true;
- } else if (Umbrella) {
- const DirectoryEntry *UmbrellaDir = File->getDir();
- if ((OwningModule = Map.UmbrellaDirs[UmbrellaDir])) {
- Diags.Report(UmbrellaLoc, diag::err_mmap_umbrella_clash)
- << OwningModule->getFullModuleName();
- HadError = true;
- } else {
- // Record this umbrella header.
- Map.setUmbrellaHeader(ActiveModule, File);
- }
- } else {
- // Record this header.
- Map.addHeader(ActiveModule, File);
-
- // If there is a builtin counterpart to this file, add it now.
- if (BuiltinFile)
- Map.addHeader(ActiveModule, BuiltinFile);
- }
- } else {
- Diags.Report(FileNameLoc, diag::err_mmap_header_not_found)
- << Umbrella << FileName;
- HadError = true;
- }
- }
- /// \brief Parse an umbrella directory declaration.
- ///
- /// umbrella-dir-declaration:
- /// umbrella string-literal
- void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) {
- // Parse the directory name.
- if (!Tok.is(MMToken::StringLiteral)) {
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_header)
- << "umbrella";
- HadError = true;
- return;
- }
- std::string DirName = Tok.getString();
- SourceLocation DirNameLoc = consumeToken();
-
- // Check whether we already have an umbrella.
- if (ActiveModule->Umbrella) {
- Diags.Report(DirNameLoc, diag::err_mmap_umbrella_clash)
- << ActiveModule->getFullModuleName();
- HadError = true;
- return;
- }
- // Look for this file.
- const DirectoryEntry *Dir = 0;
- if (llvm::sys::path::is_absolute(DirName))
- Dir = SourceMgr.getFileManager().getDirectory(DirName);
- else {
- SmallString<128> PathName;
- PathName = Directory->getName();
- llvm::sys::path::append(PathName, DirName);
- Dir = SourceMgr.getFileManager().getDirectory(PathName);
- }
-
- if (!Dir) {
- Diags.Report(DirNameLoc, diag::err_mmap_umbrella_dir_not_found)
- << DirName;
- HadError = true;
- return;
- }
-
- if (Module *OwningModule = Map.UmbrellaDirs[Dir]) {
- Diags.Report(UmbrellaLoc, diag::err_mmap_umbrella_clash)
- << OwningModule->getFullModuleName();
- HadError = true;
- return;
- }
-
- // Record this umbrella directory.
- Map.setUmbrellaDir(ActiveModule, Dir);
- }
- /// \brief Parse a module export declaration.
- ///
- /// export-declaration:
- /// 'export' wildcard-module-id
- ///
- /// wildcard-module-id:
- /// identifier
- /// '*'
- /// identifier '.' wildcard-module-id
- void ModuleMapParser::parseExportDecl() {
- assert(Tok.is(MMToken::ExportKeyword));
- SourceLocation ExportLoc = consumeToken();
-
- // Parse the module-id with an optional wildcard at the end.
- ModuleId ParsedModuleId;
- bool Wildcard = false;
- do {
- if (Tok.is(MMToken::Identifier)) {
- ParsedModuleId.push_back(std::make_pair(Tok.getString(),
- Tok.getLocation()));
- consumeToken();
-
- if (Tok.is(MMToken::Period)) {
- consumeToken();
- continue;
- }
-
- break;
- }
-
- if(Tok.is(MMToken::Star)) {
- Wildcard = true;
- consumeToken();
- break;
- }
-
- Diags.Report(Tok.getLocation(), diag::err_mmap_export_module_id);
- HadError = true;
- return;
- } while (true);
-
- Module::UnresolvedExportDecl Unresolved = {
- ExportLoc, ParsedModuleId, Wildcard
- };
- ActiveModule->UnresolvedExports.push_back(Unresolved);
- }
- void ModuleMapParser::parseInferredSubmoduleDecl(bool Explicit) {
- assert(Tok.is(MMToken::Star));
- SourceLocation StarLoc = consumeToken();
- bool Failed = false;
-
- // Inferred modules must be submodules.
- if (!ActiveModule) {
- Diags.Report(StarLoc, diag::err_mmap_top_level_inferred_submodule);
- Failed = true;
- }
-
- // Inferred modules must have umbrella directories.
- if (!Failed && !ActiveModule->getUmbrellaDir()) {
- Diags.Report(StarLoc, diag::err_mmap_inferred_no_umbrella);
- Failed = true;
- }
-
- // Check for redefinition of an inferred module.
- if (!Failed && ActiveModule->InferSubmodules) {
- Diags.Report(StarLoc, diag::err_mmap_inferred_redef);
- if (ActiveModule->InferredSubmoduleLoc.isValid())
- Diags.Report(ActiveModule->InferredSubmoduleLoc,
- diag::note_mmap_prev_definition);
- Failed = true;
- }
-
- // If there were any problems with this inferred submodule, skip its body.
- if (Failed) {
- if (Tok.is(MMToken::LBrace)) {
- consumeToken();
- skipUntil(MMToken::RBrace);
- if (Tok.is(MMToken::RBrace))
- consumeToken();
- }
- HadError = true;
- return;
- }
-
- // Note that we have an inferred submodule.
- ActiveModule->InferSubmodules = true;
- ActiveModule->InferredSubmoduleLoc = StarLoc;
- ActiveModule->InferExplicitSubmodules = Explicit;
-
- // Parse the opening brace.
- if (!Tok.is(MMToken::LBrace)) {
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_lbrace_wildcard);
- HadError = true;
- return;
- }
- SourceLocation LBraceLoc = consumeToken();
- // Parse the body of the inferred submodule.
- bool Done = false;
- do {
- switch (Tok.Kind) {
- case MMToken::EndOfFile:
- case MMToken::RBrace:
- Done = true;
- break;
-
- case MMToken::ExportKeyword: {
- consumeToken();
- if (Tok.is(MMToken::Star))
- ActiveModule->InferExportWildcard = true;
- else
- Diags.Report(Tok.getLocation(),
- diag::err_mmap_expected_export_wildcard);
- consumeToken();
- break;
- }
-
- case MMToken::ExplicitKeyword:
- case MMToken::ModuleKeyword:
- case MMToken::HeaderKeyword:
- case MMToken::UmbrellaKeyword:
- default:
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_wildcard_member);
- consumeToken();
- break;
- }
- } while (!Done);
-
- if (Tok.is(MMToken::RBrace))
- consumeToken();
- else {
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_rbrace);
- Diags.Report(LBraceLoc, diag::note_mmap_lbrace_match);
- HadError = true;
- }
- }
- /// \brief If there is a specific header search directory due the presence
- /// of an umbrella directory, retrieve that directory. Otherwise, returns null.
- const DirectoryEntry *ModuleMapParser::getOverriddenHeaderSearchDir() {
- for (Module *Mod = ActiveModule; Mod; Mod = Mod->Parent) {
- // If we have an umbrella directory, use that.
- if (Mod->hasUmbrellaDir())
- return Mod->getUmbrellaDir();
-
- // If we have a framework directory, stop looking.
- if (Mod->IsFramework)
- return 0;
- }
-
- return 0;
- }
- /// \brief Parse a module map file.
- ///
- /// module-map-file:
- /// module-declaration*
- bool ModuleMapParser::parseModuleMapFile() {
- do {
- switch (Tok.Kind) {
- case MMToken::EndOfFile:
- return HadError;
-
- case MMToken::ExplicitKeyword:
- case MMToken::ModuleKeyword:
- case MMToken::FrameworkKeyword:
- parseModuleDecl();
- break;
-
- case MMToken::Comma:
- case MMToken::ExportKeyword:
- case MMToken::HeaderKeyword:
- case MMToken::Identifier:
- case MMToken::LBrace:
- case MMToken::LSquare:
- case MMToken::Period:
- case MMToken::RBrace:
- case MMToken::RSquare:
- case MMToken::RequiresKeyword:
- case MMToken::Star:
- case MMToken::StringLiteral:
- case MMToken::UmbrellaKeyword:
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_module);
- HadError = true;
- consumeToken();
- break;
- }
- } while (true);
- }
- bool ModuleMap::parseModuleMapFile(const FileEntry *File) {
- assert(Target != 0 && "Missing target information");
- FileID ID = SourceMgr->createFileID(File, SourceLocation(), SrcMgr::C_User);
- const llvm::MemoryBuffer *Buffer = SourceMgr->getBuffer(ID);
- if (!Buffer)
- return true;
-
- // Parse this module map file.
- Lexer L(ID, SourceMgr->getBuffer(ID), *SourceMgr, MMapLangOpts);
- Diags->getClient()->BeginSourceFile(MMapLangOpts);
- ModuleMapParser Parser(L, *SourceMgr, *Diags, *this, File->getDir(),
- BuiltinIncludeDir);
- bool Result = Parser.parseModuleMapFile();
- Diags->getClient()->EndSourceFile();
-
- return Result;
- }
|