Skip to content

Commit 8c86863

Browse files
author
Hal Finkel
committed
Rename Module -> PCModule (pre-compiled module).
Fortran has its own use of the term Module, and we'll want to use some of the PCModule infrastructure to support Fortran module interface files.
1 parent 568c332 commit 8c86863

File tree

101 files changed

+1790
-1790
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+1790
-1790
lines changed

docs/PCHInternals.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
========================================
2-
Precompiled Header and Modules Internals
2+
Precompiled Header and PCModules Internals
33
========================================
44

55
.. contents::
@@ -56,7 +56,7 @@ A precompiled header implementation improves performance when:
5656
important on multi-core systems, because PCH file generation serializes the
5757
build when all compilations require the PCH file to be up-to-date.
5858

59-
Modules, as implemented in LFort, use the same mechanisms as precompiled
59+
PCModules, as implemented in LFort, use the same mechanisms as precompiled
6060
headers to save a serialized AST file (one per module) and use those AST
6161
modules. From an implementation standpoint, modules are a generalization of
6262
precompiled headers, lifting a number of restrictions placed on precompiled
@@ -518,10 +518,10 @@ Update records
518518

519519
.. _pchinternals-modules:
520520

521-
Modules
521+
PCModules
522522
-------
523523

524-
Modules generalize the chained precompiled header model yet further, from a
524+
PCModules generalize the chained precompiled header model yet further, from a
525525
linear chain of precompiled headers to an arbitrary directed acyclic graph
526526
(DAG) of AST files. All of the same techniques used to make chained
527527
precompiled headers work --- ID number, name lookup, update records --- are
@@ -556,7 +556,7 @@ Declaration merging
556556
is as if one of the headers had been included before the other.
557557

558558
Name Visibility
559-
Modules allow certain names that occur during module creation to be "hidden",
559+
PCModules allow certain names that occur during module creation to be "hidden",
560560
so that they are not part of the public interface of the module and are not
561561
visible to its clients. The AST reader maintains a "visible" bit on various
562562
AST nodes (declarations, macros, etc.) to indicate whether that particular

examples/lfort-interpreter/main.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static int Execute(llvm::Module *Mod, char * const *envp) {
6060

6161
// FIXME: Support passing arguments.
6262
std::vector<std::string> Args;
63-
Args.push_back(Mod->getModuleIdentifier());
63+
Args.push_back(Mod->getPCModuleIdentifier());
6464

6565
return EE->runSubprogramAsMain(EntrySubPgm, Args, envp);
6666
}
@@ -145,8 +145,8 @@ int main(int argc, const char **argv, char * const *envp) {
145145
return 1;
146146

147147
int Res = 255;
148-
if (llvm::Module *Module = Act->takeModule())
149-
Res = Execute(Module, envp);
148+
if (llvm::Module *PCModule = Act->takePCModule())
149+
Res = Execute(PCModule, envp);
150150

151151
// Shutdown.
152152

include/lfort-c/Index.h

+19-19
Original file line numberDiff line numberDiff line change
@@ -2075,9 +2075,9 @@ enum CXCursorKind {
20752075
/**
20762076
* \brief A module import declaration.
20772077
*/
2078-
CXCursor_ModuleImportDecl = 600,
2079-
CXCursor_FirstExtraDecl = CXCursor_ModuleImportDecl,
2080-
CXCursor_LastExtraDecl = CXCursor_ModuleImportDecl
2078+
CXCursor_PCModuleImportDecl = 600,
2079+
CXCursor_FirstExtraDecl = CXCursor_PCModuleImportDecl,
2080+
CXCursor_LastExtraDecl = CXCursor_PCModuleImportDecl
20812081
};
20822082

20832083
/**
@@ -3279,59 +3279,59 @@ CINDEX_LINKAGE CXComment lfort_Cursor_getParsedComment(CXCursor C);
32793279
*/
32803280

32813281
/**
3282-
* \defgroup CINDEX_MODULE Module introspection
3282+
* \defgroup CINDEX_MODULE PCModule introspection
32833283
*
32843284
* The functions in this group provide access to information about modules.
32853285
*
32863286
* @{
32873287
*/
32883288

3289-
typedef void *CXModule;
3289+
typedef void *CXPCModule;
32903290

32913291
/**
3292-
* \brief Given a CXCursor_ModuleImportDecl cursor, return the associated module.
3292+
* \brief Given a CXCursor_PCModuleImportDecl cursor, return the associated module.
32933293
*/
3294-
CINDEX_LINKAGE CXModule lfort_Cursor_getModule(CXCursor C);
3294+
CINDEX_LINKAGE CXPCModule lfort_Cursor_getPCModule(CXCursor C);
32953295

32963296
/**
3297-
* \param Module a module object.
3297+
* \param PCModule a module object.
32983298
*
32993299
* \returns the parent of a sub-module or NULL if the given module is top-level,
33003300
* e.g. for 'std.vector' it will return the 'std' module.
33013301
*/
3302-
CINDEX_LINKAGE CXModule lfort_Module_getParent(CXModule Module);
3302+
CINDEX_LINKAGE CXPCModule lfort_PCModule_getParent(CXPCModule PCModule);
33033303

33043304
/**
3305-
* \param Module a module object.
3305+
* \param PCModule a module object.
33063306
*
33073307
* \returns the name of the module, e.g. for the 'std.vector' sub-module it
33083308
* will return "vector".
33093309
*/
3310-
CINDEX_LINKAGE CXString lfort_Module_getName(CXModule Module);
3310+
CINDEX_LINKAGE CXString lfort_PCModule_getName(CXPCModule PCModule);
33113311

33123312
/**
3313-
* \param Module a module object.
3313+
* \param PCModule a module object.
33143314
*
33153315
* \returns the full name of the module, e.g. "std.vector".
33163316
*/
3317-
CINDEX_LINKAGE CXString lfort_Module_getFullName(CXModule Module);
3317+
CINDEX_LINKAGE CXString lfort_PCModule_getFullName(CXPCModule PCModule);
33183318

33193319
/**
3320-
* \param Module a module object.
3320+
* \param PCModule a module object.
33213321
*
33223322
* \returns the number of top level headers associated with this module.
33233323
*/
3324-
CINDEX_LINKAGE unsigned lfort_Module_getNumTopLevelHeaders(CXModule Module);
3324+
CINDEX_LINKAGE unsigned lfort_PCModule_getNumTopLevelHeaders(CXPCModule PCModule);
33253325

33263326
/**
3327-
* \param Module a module object.
3327+
* \param PCModule a module object.
33283328
*
33293329
* \param Index top level header index (zero-based).
33303330
*
33313331
* \returns the specified top level header associated with the module.
33323332
*/
33333333
CINDEX_LINKAGE
3334-
CXFile lfort_Module_getTopLevelHeader(CXModule Module, unsigned Index);
3334+
CXFile lfort_PCModule_getTopLevelHeader(CXPCModule PCModule, unsigned Index);
33353335

33363336
/**
33373337
* @}
@@ -5060,7 +5060,7 @@ typedef struct {
50605060
* \brief Non-zero if the directive was automatically turned into a module
50615061
* import.
50625062
*/
5063-
int isModuleImport;
5063+
int isPCModuleImport;
50645064
} CXIdxIncludedFileInfo;
50655065

50665066
/**
@@ -5074,7 +5074,7 @@ typedef struct {
50745074
/**
50755075
* \brief The imported module or NULL if the AST file is a PCH.
50765076
*/
5077-
CXModule module;
5077+
CXPCModule module;
50785078
/**
50795079
* \brief Location where the file is imported. Applicable only for modules.
50805080
*/

include/lfort/AST/Decl.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class SubprogramTemplateDecl;
3535
class SubprogramTemplateSpecializationInfo;
3636
class LabelStmt;
3737
class MemberSpecializationInfo;
38-
class Module;
38+
class PCModule;
3939
class NestedNameSpecifier;
4040
class Stmt;
4141
class StringLiteral;
@@ -189,8 +189,8 @@ class NamedDecl : public Decl {
189189
/// \brief Determine whether this declaration has linkage.
190190
bool hasLinkage() const;
191191

192-
using Decl::isModulePrivate;
193-
using Decl::setModulePrivate;
192+
using Decl::isPCModulePrivate;
193+
using Decl::setPCModulePrivate;
194194

195195
/// \brief Determine whether this declaration is hidden from name lookup.
196196
bool isHidden() const { return Hidden; }
@@ -3296,7 +3296,7 @@ class ImportDecl : public Decl {
32963296
///
32973297
/// When the bit is false, we only have a single source location for the
32983298
/// end of the import declaration.
3299-
llvm::PointerIntPair<Module *, 1, bool> ImportedAndComplete;
3299+
llvm::PointerIntPair<PCModule *, 1, bool> ImportedAndComplete;
33003300

33013301
/// \brief The next import in the list of imports local to the translation
33023302
/// unit being parsed (not loaded from an AST file).
@@ -3306,32 +3306,32 @@ class ImportDecl : public Decl {
33063306
friend class ASTDeclReader;
33073307
friend class ASTContext;
33083308

3309-
ImportDecl(DeclContext *DC, SourceLocation StartLoc, Module *Imported,
3309+
ImportDecl(DeclContext *DC, SourceLocation StartLoc, PCModule *Imported,
33103310
ArrayRef<SourceLocation> IdentifierLocs);
33113311

3312-
ImportDecl(DeclContext *DC, SourceLocation StartLoc, Module *Imported,
3312+
ImportDecl(DeclContext *DC, SourceLocation StartLoc, PCModule *Imported,
33133313
SourceLocation EndLoc);
33143314

33153315
ImportDecl(EmptyShell Empty) : Decl(Import, Empty), NextLocalImport() { }
33163316

33173317
public:
33183318
/// \brief Create a new module import declaration.
33193319
static ImportDecl *Create(ASTContext &C, DeclContext *DC,
3320-
SourceLocation StartLoc, Module *Imported,
3320+
SourceLocation StartLoc, PCModule *Imported,
33213321
ArrayRef<SourceLocation> IdentifierLocs);
33223322

33233323
/// \brief Create a new module import declaration for an implicitly-generated
33243324
/// import.
33253325
static ImportDecl *CreateImplicit(ASTContext &C, DeclContext *DC,
3326-
SourceLocation StartLoc, Module *Imported,
3326+
SourceLocation StartLoc, PCModule *Imported,
33273327
SourceLocation EndLoc);
33283328

33293329
/// \brief Create a new, deserialized module import declaration.
33303330
static ImportDecl *CreateDeserialized(ASTContext &C, unsigned ID,
33313331
unsigned NumLocations);
33323332

33333333
/// \brief Retrieve the module that was imported by the import declaration.
3334-
Module *getImportedModule() const { return ImportedAndComplete.getPointer(); }
3334+
PCModule *getImportedPCModule() const { return ImportedAndComplete.getPointer(); }
33353335

33363336
/// \brief Retrieves the locations of each of the identifiers that make up
33373337
/// the complete module name in the import declaration.

include/lfort/AST/DeclBase.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,15 @@ class Decl {
193193

194194
/// \brief Whether this declaration is private to the module in which it was
195195
/// defined.
196-
ModulePrivateFlag = 0x02
196+
PCModulePrivateFlag = 0x02
197197
};
198198

199199
/// \brief The next declaration within the same lexical
200200
/// DeclContext. These pointers form the linked list that is
201201
/// traversed via DeclContext's decls_begin()/decls_end().
202202
///
203203
/// The extra two bits are used for the TopLevelDeclInObjCContainer and
204-
/// ModulePrivate bits.
204+
/// PCModulePrivate bits.
205205
llvm::PointerIntPair<Decl *, 2, unsigned> NextInContextAndBits;
206206

207207
private:
@@ -504,23 +504,23 @@ class Decl {
504504
protected:
505505
/// \brief Whether this declaration was marked as being private to the
506506
/// module in which it was defined.
507-
bool isModulePrivate() const {
508-
return NextInContextAndBits.getInt() & ModulePrivateFlag;
507+
bool isPCModulePrivate() const {
508+
return NextInContextAndBits.getInt() & PCModulePrivateFlag;
509509
}
510510

511511
/// \brief Specify whether this declaration was marked as being private
512512
/// to the module in which it was defined.
513-
void setModulePrivate(bool MP = true) {
513+
void setPCModulePrivate(bool MP = true) {
514514
unsigned Bits = NextInContextAndBits.getInt();
515515
if (MP)
516-
Bits |= ModulePrivateFlag;
516+
Bits |= PCModulePrivateFlag;
517517
else
518-
Bits &= ~ModulePrivateFlag;
518+
Bits &= ~PCModulePrivateFlag;
519519
NextInContextAndBits.setInt(Bits);
520520
}
521521

522522
/// \brief Set the owning module ID.
523-
void setOwningModuleID(unsigned ID) {
523+
void setOwningPCModuleID(unsigned ID) {
524524
assert(isFromASTFile() && "Only works on a deserialized declaration");
525525
*((unsigned*)this - 2) = ID;
526526
}
@@ -587,7 +587,7 @@ class Decl {
587587

588588
/// \brief Retrieve the global ID of the module that owns this particular
589589
/// declaration.
590-
unsigned getOwningModuleID() const {
590+
unsigned getOwningPCModuleID() const {
591591
if (isFromASTFile())
592592
return *((const unsigned*)this - 2);
593593

include/lfort/Basic/Attr.td

+1-1
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ def Ownership : InheritableAttr {
554554
let Args = [EnumArgument<"OwnKind", "OwnershipKind",
555555
["ownership_holds", "ownership_returns", "ownership_takes"],
556556
["Holds", "Returns", "Takes"]>,
557-
StringArgument<"Module">, VariadicUnsignedArgument<"Args">];
557+
StringArgument<"PCModule">, VariadicUnsignedArgument<"Args">];
558558
}
559559

560560
def Packed : InheritableAttr {

include/lfort/Basic/DiagnosticLexKinds.td

+1-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ def err_pp_include_in_arc_cf_code_audited : Error<
462462
def err_pp_eof_in_arc_cf_code_audited : Error<
463463
"'#pragma lfort arc_cf_code_audited' was not ended within this file">;
464464

465-
// Module map parsing
465+
// PCModule map parsing
466466
def err_mmap_unknown_token : Error<"skipping stray token">;
467467
def err_mmap_expected_module : Error<"expected module declaration">;
468468
def err_mmap_expected_module_name : Error<"expected module name">;

include/lfort/Basic/DiagnosticParseKinds.td

+1-1
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ def err_seh___finally_block : Error<
770770

771771
} // end of Parse Issue category.
772772

773-
let CategoryName = "Modules Issue" in {
773+
let CategoryName = "PCModules Issue" in {
774774
def err_module_expected_ident : Error<
775775
"expected a module name after module import">;
776776
def err_module_expected_semi : Error<

include/lfort/Basic/DiagnosticSemaKinds.td

+1-1
Original file line numberDiff line numberDiff line change
@@ -6062,7 +6062,7 @@ def note_related_result_type_inferred : Note<
60626062

60636063
}
60646064

6065-
let CategoryName = "Modules Issue" in {
6065+
let CategoryName = "PCModules Issue" in {
60666066
def err_module_private_specialization : Error<
60676067
"%select{template|partial|member}0 specialization cannot be "
60686068
"declared __module_private__">;

include/lfort/Basic/IdentifierTable.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class IdentifierInfo {
6868
bool OutOfDate : 1; // True if there may be additional
6969
// information about this identifier
7070
// stored externally.
71-
bool IsModulesImport : 1; // True if this is the 'import' contextual
71+
bool IsPCModulesImport : 1; // True if this is the 'import' contextual
7272
// keyword.
7373
// 32-bit word is filled.
7474

@@ -298,12 +298,12 @@ class IdentifierInfo {
298298

299299
/// \brief Determine whether this is the contextual keyword
300300
/// 'import'.
301-
bool isModulesImport() const { return IsModulesImport; }
301+
bool isPCModulesImport() const { return IsPCModulesImport; }
302302

303303
/// \brief Set whether this identifier is the contextual keyword
304304
/// 'import'.
305-
void setModulesImport(bool I) {
306-
IsModulesImport = I;
305+
void setPCModulesImport(bool I) {
306+
IsPCModulesImport = I;
307307
if (I)
308308
NeedsHandleIdentifier = true;
309309
else
@@ -322,7 +322,7 @@ class IdentifierInfo {
322322
NeedsHandleIdentifier =
323323
(isPoisoned() | hasMacroDefinition() | isCPlusPlusOperatorKeyword() |
324324
isExtensionToken() | isCXX11CompatKeyword() || isOutOfDate() ||
325-
isModulesImport());
325+
isPCModulesImport());
326326
}
327327
};
328328

@@ -508,7 +508,7 @@ class IdentifierTable {
508508

509509
// If this is the 'import' contextual keyword, mark it as such.
510510
if (Name.equals("import"))
511-
II->setModulesImport(true);
511+
II->setPCModulesImport(true);
512512
}
513513

514514
return *II;

include/lfort/Basic/LangOptions.def

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ LANGOPT(Blocks , 1, 0, "blocks extension to C")
9898
BENIGN_LANGOPT(EmitAllDecls , 1, 0, "support for emitting all declarations")
9999
LANGOPT(MathErrno , 1, 1, "errno support for math functions")
100100
BENIGN_LANGOPT(HeinousExtensions , 1, 0, "Extensions that we really don't like and may be ripped out at any time")
101-
LANGOPT(Modules , 1, 0, "modules extension to C")
101+
LANGOPT(PCModules , 1, 0, "modules extension to C")
102102
LANGOPT(Optimize , 1, 0, "__OPTIMIZE__ predefined macro")
103103
LANGOPT(OptimizeSize , 1, 0, "__OPTIMIZE_SIZE__ predefined macro")
104104
LANGOPT(Static , 1, 0, "__STATIC__ predefined macro (as opposed to __DYNAMIC__)")

include/lfort/Basic/LangOptions.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class LangOptions : public RefCountedBase<LangOptions>, public LangOptionsBase {
6868
std::string OverflowHandler;
6969

7070
/// \brief The name of the current module.
71-
std::string CurrentModule;
71+
std::string CurrentPCModule;
7272

7373
LangOptions();
7474

@@ -119,7 +119,7 @@ enum ProgramKind {
119119
/// not complete.
120120
PGM_Prefix,
121121
/// \brief The program is a module.
122-
PGM_Module
122+
PGM_PCModule
123123
};
124124

125125
} // end namespace lfort

0 commit comments

Comments
 (0)