Skip to content

Commit 3d016cf

Browse files
author
Hal Finkel
committed
Rename Function to Subprogram
In Fortran, a function is only a particular kind of subprogram. However, what we'd call a function in C/C++ can be any kind of subprogram in Fortran (even the main program, which is not really a kind of subprogram, but acts like one in almost every way).
1 parent b16a193 commit 3d016cf

File tree

306 files changed

+8166
-8166
lines changed

Some content is hidden

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

306 files changed

+8166
-8166
lines changed

examples/PrintFunctionNames/PrintFunctionNames.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- PrintFunctionNames.cpp ---------------------------------------------===//
1+
//===- PrintSubprogramNames.cpp ---------------------------------------------===//
22
//
33
// The LLVM Compiler Infrastructure
44
//
@@ -21,7 +21,7 @@ using namespace lfort;
2121

2222
namespace {
2323

24-
class PrintFunctionsConsumer : public ASTConsumer {
24+
class PrintSubprogramsConsumer : public ASTConsumer {
2525
public:
2626
virtual bool HandleTopLevelDecl(DeclGroupRef DG) {
2727
for (DeclGroupRef::iterator i = DG.begin(), e = DG.end(); i != e; ++i) {
@@ -34,16 +34,16 @@ class PrintFunctionsConsumer : public ASTConsumer {
3434
}
3535
};
3636

37-
class PrintFunctionNamesAction : public PluginASTAction {
37+
class PrintSubprogramNamesAction : public PluginASTAction {
3838
protected:
3939
ASTConsumer *CreateASTConsumer(CompilerInstance &CI, llvm::StringRef) {
40-
return new PrintFunctionsConsumer();
40+
return new PrintSubprogramsConsumer();
4141
}
4242

4343
bool ParseArgs(const CompilerInstance &CI,
4444
const std::vector<std::string>& args) {
4545
for (unsigned i = 0, e = args.size(); i != e; ++i) {
46-
llvm::errs() << "PrintFunctionNames arg = " << args[i] << "\n";
46+
llvm::errs() << "PrintSubprogramNames arg = " << args[i] << "\n";
4747

4848
// Example error handling.
4949
if (args[i] == "-an-error") {
@@ -60,12 +60,12 @@ class PrintFunctionNamesAction : public PluginASTAction {
6060
return true;
6161
}
6262
void PrintHelp(llvm::raw_ostream& ros) {
63-
ros << "Help for PrintFunctionNames plugin goes here\n";
63+
ros << "Help for PrintSubprogramNames plugin goes here\n";
6464
}
6565

6666
};
6767

6868
}
6969

70-
static FrontendPluginRegistry::Add<PrintFunctionNamesAction>
70+
static FrontendPluginRegistry::Add<PrintSubprogramNamesAction>
7171
X("print-fns", "print function names");

examples/analyzer-plugin/MainCallChecker.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void MainCallChecker::checkPreStmt(const CallExpr *CE, CheckerContext &C) const
1919
const ProgramStateRef state = C.getState();
2020
const LocationContext *LC = C.getLocationContext();
2121
const Expr *Callee = CE->getCallee();
22-
const FunctionDecl *FD = state->getSVal(Callee, LC).getAsFunctionDecl();
22+
const SubprogramDecl *FD = state->getSVal(Callee, LC).getAsSubprogramDecl();
2323

2424
if (!FD)
2525
return;

examples/lfort-interpreter/main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static int Execute(llvm::Module *Mod, char * const *envp) {
5252
return 255;
5353
}
5454

55-
llvm::Function *EntryFn = Mod->getFunction("main");
55+
llvm::Function *EntryFn = Mod->getSubprogram("main");
5656
if (!EntryFn) {
5757
llvm::errs() << "'main' function not found in module.\n";
5858
return 255;
@@ -62,7 +62,7 @@ static int Execute(llvm::Module *Mod, char * const *envp) {
6262
std::vector<std::string> Args;
6363
Args.push_back(Mod->getModuleIdentifier());
6464

65-
return EE->runFunctionAsMain(EntryFn, Args, envp);
65+
return EE->runSubprogramAsMain(EntryFn, Args, envp);
6666
}
6767

6868
int main(int argc, const char **argv, char * const *envp) {

include/lfort-c/Index.h

+16-16
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ enum CXTranslationUnit_Flags {
11171117
* This option can be used to search for declarations/definitions while
11181118
* ignoring the usages.
11191119
*/
1120-
CXTranslationUnit_SkipFunctionBodies = 0x40,
1120+
CXTranslationUnit_SkipSubprogramBodies = 0x40,
11211121

11221122
/**
11231123
* \brief Used to indicate that brief documentation comments should be
@@ -1452,7 +1452,7 @@ enum CXCursorKind {
14521452
/** \brief An enumerator constant. */
14531453
CXCursor_EnumConstantDecl = 7,
14541454
/** \brief A function. */
1455-
CXCursor_FunctionDecl = 8,
1455+
CXCursor_SubprogramDecl = 8,
14561456
/** \brief A variable. */
14571457
CXCursor_VarDecl = 9,
14581458
/** \brief A function or method parameter. */
@@ -1488,15 +1488,15 @@ enum CXCursorKind {
14881488
/** \brief A C++ destructor. */
14891489
CXCursor_Destructor = 25,
14901490
/** \brief A C++ conversion function. */
1491-
CXCursor_ConversionFunction = 26,
1491+
CXCursor_ConversionSubprogram = 26,
14921492
/** \brief A C++ template type parameter. */
14931493
CXCursor_TemplateTypeParameter = 27,
14941494
/** \brief A C++ non-type template parameter. */
14951495
CXCursor_NonTypeTemplateParameter = 28,
14961496
/** \brief A C++ template template parameter. */
14971497
CXCursor_TemplateTemplateParameter = 29,
14981498
/** \brief A C++ function template. */
1499-
CXCursor_FunctionTemplate = 30,
1499+
CXCursor_SubprogramTemplate = 30,
15001500
/** \brief A C++ class template. */
15011501
CXCursor_ClassTemplate = 31,
15021502
/** \brief A C++ class template partial specialization. */
@@ -1771,7 +1771,7 @@ enum CXCursorKind {
17711771
* x = int(0.5);
17721772
* \endcode
17731773
*/
1774-
CXCursor_CXXFunctionalCastExpr = 128,
1774+
CXCursor_CXXSubprogramalCastExpr = 128,
17751775

17761776
/** \brief A C++ typeid expression (C++ [expr.typeid]).
17771777
*/
@@ -2636,8 +2636,8 @@ enum CXTypeKind {
26362636
CXType_Typedef = 107,
26372637
CXType_ObjCInterface = 108,
26382638
CXType_ObjCObjectPointer = 109,
2639-
CXType_FunctionNoProto = 110,
2640-
CXType_FunctionProto = 111,
2639+
CXType_SubprogramNoProto = 110,
2640+
CXType_SubprogramProto = 111,
26412641
CXType_ConstantArray = 112,
26422642
CXType_Vector = 113
26432643
};
@@ -2799,7 +2799,7 @@ CINDEX_LINKAGE CXString lfort_getTypeKindSpelling(enum CXTypeKind K);
27992799
*
28002800
* If a non-function type is passed in, CXCallingConv_Invalid is returned.
28012801
*/
2802-
CINDEX_LINKAGE enum CXCallingConv lfort_getFunctionTypeCallingConv(CXType T);
2802+
CINDEX_LINKAGE enum CXCallingConv lfort_getSubprogramTypeCallingConv(CXType T);
28032803

28042804
/**
28052805
* \brief Retrieve the result type associated with a function type.
@@ -2827,7 +2827,7 @@ CINDEX_LINKAGE CXType lfort_getArgType(CXType T, unsigned i);
28272827
/**
28282828
* \brief Return 1 if the CXType is a variadic function type, and 0 otherwise.
28292829
*/
2830-
CINDEX_LINKAGE unsigned lfort_isFunctionTypeVariadic(CXType T);
2830+
CINDEX_LINKAGE unsigned lfort_isSubprogramTypeVariadic(CXType T);
28312831

28322832
/**
28332833
* \brief Retrieve the result type associated with a given cursor.
@@ -3807,7 +3807,7 @@ CINDEX_LINKAGE CXString lfort_HTMLTagComment_getAsString(CXComment Comment);
38073807
* \li "para-returns" for \\returns paragraph and equivalent commands;
38083808
* \li "word-returns" for the "Returns" word in \\returns paragraph.
38093809
*
3810-
* Function argument documentation is rendered as a \<dl\> list with arguments
3810+
* Subprogram argument documentation is rendered as a \<dl\> list with arguments
38113811
* sorted in function prototype order. CSS classes used:
38123812
* \li "param-name-index-NUMBER" for parameter name (\<dt\>);
38133813
* \li "param-descr-index-NUMBER" for parameter description (\<dd\>);
@@ -5090,7 +5090,7 @@ typedef struct {
50905090
typedef enum {
50915091
CXIdxEntity_Unexposed = 0,
50925092
CXIdxEntity_Typedef = 1,
5093-
CXIdxEntity_Function = 2,
5093+
CXIdxEntity_Subprogram = 2,
50945094
CXIdxEntity_Variable = 3,
50955095
CXIdxEntity_Field = 4,
50965096
CXIdxEntity_EnumConstant = 5,
@@ -5116,7 +5116,7 @@ typedef enum {
51165116
CXIdxEntity_CXXInstanceMethod = 21,
51175117
CXIdxEntity_CXXConstructor = 22,
51185118
CXIdxEntity_CXXDestructor = 23,
5119-
CXIdxEntity_CXXConversionFunction = 24,
5119+
CXIdxEntity_CXXConversionSubprogram = 24,
51205120
CXIdxEntity_CXXTypeAlias = 25,
51215121
CXIdxEntity_CXXInterface = 26
51225122

@@ -5131,12 +5131,12 @@ typedef enum {
51315131

51325132
/**
51335133
* \brief Extra C++ template information for an entity. This can apply to:
5134-
* CXIdxEntity_Function
5134+
* CXIdxEntity_Subprogram
51355135
* CXIdxEntity_CXXClass
51365136
* CXIdxEntity_CXXStaticMethod
51375137
* CXIdxEntity_CXXInstanceMethod
51385138
* CXIdxEntity_CXXConstructor
5139-
* CXIdxEntity_CXXConversionFunction
5139+
* CXIdxEntity_CXXConversionSubprogram
51405140
* CXIdxEntity_CXXTypeAlias
51415141
*/
51425142
typedef enum {
@@ -5451,10 +5451,10 @@ typedef enum {
54515451
CXIndexOpt_SuppressRedundantRefs = 0x1,
54525452

54535453
/**
5454-
* \brief Function-local symbols should be indexed. If this is not set
5454+
* \brief Subprogram-local symbols should be indexed. If this is not set
54555455
* function-local symbols will be ignored.
54565456
*/
5457-
CXIndexOpt_IndexFunctionLocalSymbols = 0x2,
5457+
CXIndexOpt_IndexSubprogramLocalSymbols = 0x2,
54585458

54595459
/**
54605460
* \brief Implicit function/class template instantiations should be indexed.

include/lfort/AST/ASTConsumer.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace lfort {
2626
class SemaConsumer; // layering violation required for safe SemaConsumer
2727
class TagDecl;
2828
class VarDecl;
29-
class FunctionDecl;
29+
class SubprogramDecl;
3030
class ImportDecl;
3131

3232
/// ASTConsumer - This is an abstract interface that should be implemented by
@@ -75,7 +75,7 @@ class ASTConsumer {
7575
/// Note that at this point point it does not have a body, its body is
7676
/// instantiated at the end of the translation unit and passed to
7777
/// HandleTopLevelDecl.
78-
virtual void HandleCXXImplicitFunctionInstantiation(FunctionDecl *D) {}
78+
virtual void HandleCXXImplicitSubprogramInstantiation(SubprogramDecl *D) {}
7979

8080
/// \brief Handle the specified top-level declaration that occurred inside
8181
/// and ObjC container.
@@ -133,12 +133,12 @@ class ASTConsumer {
133133
virtual void PrintStats() {}
134134

135135
/// \brief This callback is called for each function if the Parser was
136-
/// initialized with \c SkipFunctionBodies set to \c true.
136+
/// initialized with \c SkipSubprogramBodies set to \c true.
137137
///
138138
/// \return \c true if the function's body should be skipped. The function
139139
/// body may be parsed anyway if it is needed (for instance, if it contains
140140
/// the code completion point or is constexpr).
141-
virtual bool shouldSkipFunctionBody(Decl *D) { return true; }
141+
virtual bool shouldSkipSubprogramBody(Decl *D) { return true; }
142142
};
143143

144144
} // end namespace lfort.

include/lfort/AST/ASTContext.h

+28-28
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
106106
mutable llvm::FoldingSet<DependentSizedExtVectorType>
107107
DependentSizedExtVectorTypes;
108108
mutable llvm::FoldingSet<VectorType> VectorTypes;
109-
mutable llvm::FoldingSet<FunctionNoProtoType> FunctionNoProtoTypes;
110-
mutable llvm::ContextualFoldingSet<FunctionProtoType, ASTContext&>
111-
FunctionProtoTypes;
109+
mutable llvm::FoldingSet<SubprogramNoProtoType> SubprogramNoProtoTypes;
110+
mutable llvm::ContextualFoldingSet<SubprogramProtoType, ASTContext&>
111+
SubprogramProtoTypes;
112112
mutable llvm::FoldingSet<DependentTypeOfExprType> DependentTypeOfExprTypes;
113113
mutable llvm::FoldingSet<DependentDecltypeType> DependentDecltypeTypes;
114114
mutable llvm::FoldingSet<TemplateTypeParmType> TemplateTypeParmTypes;
@@ -160,7 +160,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
160160
mutable TypeInfoMap MemoizedTypeInfo;
161161

162162
/// \brief A cache mapping from CXXRecordDecls to key functions.
163-
llvm::DenseMap<const CXXRecordDecl*, const CXXMethodDecl*> KeyFunctions;
163+
llvm::DenseMap<const CXXRecordDecl*, const CXXMethodDecl*> KeySubprograms;
164164

165165
/// \brief Mapping from ObjCContainers to their ObjCImplementations.
166166
llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*> ObjCImpls;
@@ -174,7 +174,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
174174

175175
/// \brief Mapping from class scope functions specialization to their
176176
/// template patterns.
177-
llvm::DenseMap<const FunctionDecl*, FunctionDecl*>
177+
llvm::DenseMap<const SubprogramDecl*, SubprogramDecl*>
178178
ClassScopeSpecializationPattern;
179179

180180
/// \brief Representation of a "canonical" template template parameter that
@@ -265,7 +265,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
265265
mutable RecordDecl *BlockDescriptorExtendedType;
266266

267267
/// \brief Declaration for the CUDA cudaConfigureCall function.
268-
FunctionDecl *cudaConfigureCallDecl;
268+
SubprogramDecl *cudaConfigureCallDecl;
269269

270270
TypeSourceInfo NullTypeSourceInfo;
271271

@@ -566,10 +566,10 @@ class ASTContext : public RefCountedBase<ASTContext> {
566566
MemberSpecializationInfo *getInstantiatedFromStaticDataMember(
567567
const VarDecl *Var);
568568

569-
FunctionDecl *getClassScopeSpecializationPattern(const FunctionDecl *FD);
569+
SubprogramDecl *getClassScopeSpecializationPattern(const SubprogramDecl *FD);
570570

571-
void setClassScopeSpecializationPattern(FunctionDecl *FD,
572-
FunctionDecl *Pattern);
571+
void setClassScopeSpecializationPattern(SubprogramDecl *FD,
572+
SubprogramDecl *Pattern);
573573

574574
/// \brief Note that the static data member \p Inst is an instantiation of
575575
/// the static data member template \p Tmpl of a class template.
@@ -825,8 +825,8 @@ class ASTContext : public RefCountedBase<ASTContext> {
825825
QualType getConstType(QualType T) const { return T.withConst(); }
826826

827827
/// \brief Change the ExtInfo on a function type.
828-
const FunctionType *adjustFunctionType(const FunctionType *Fn,
829-
FunctionType::ExtInfo EInfo);
828+
const SubprogramType *adjustSubprogramType(const SubprogramType *Fn,
829+
SubprogramType::ExtInfo EInfo);
830830

831831
/// \brief Return the uniqued reference to the type for a complex
832832
/// number with the specified element type.
@@ -858,10 +858,10 @@ class ASTContext : public RefCountedBase<ASTContext> {
858858
/// pointer to blocks.
859859
QualType getBlockDescriptorExtendedType() const;
860860

861-
void setcudaConfigureCallDecl(FunctionDecl *FD) {
861+
void setcudaConfigureCallDecl(SubprogramDecl *FD) {
862862
cudaConfigureCallDecl = FD;
863863
}
864-
FunctionDecl *getcudaConfigureCallDecl() {
864+
SubprogramDecl *getcudaConfigureCallDecl() {
865865
return cudaConfigureCallDecl;
866866
}
867867

@@ -946,17 +946,17 @@ class ASTContext : public RefCountedBase<ASTContext> {
946946
SourceLocation AttrLoc) const;
947947

948948
/// \brief Return a K&R style C function type like 'int()'.
949-
QualType getFunctionNoProtoType(QualType ResultTy,
950-
const FunctionType::ExtInfo &Info) const;
949+
QualType getSubprogramNoProtoType(QualType ResultTy,
950+
const SubprogramType::ExtInfo &Info) const;
951951

952-
QualType getFunctionNoProtoType(QualType ResultTy) const {
953-
return getFunctionNoProtoType(ResultTy, FunctionType::ExtInfo());
952+
QualType getSubprogramNoProtoType(QualType ResultTy) const {
953+
return getSubprogramNoProtoType(ResultTy, SubprogramType::ExtInfo());
954954
}
955955

956956
/// \brief Return a normal function type with a typed argument list.
957-
QualType getFunctionType(QualType ResultTy,
957+
QualType getSubprogramType(QualType ResultTy,
958958
const QualType *Args, unsigned NumArgs,
959-
const FunctionProtoType::ExtProtoInfo &EPI) const;
959+
const SubprogramProtoType::ExtProtoInfo &EPI) const;
960960

961961
/// \brief Return the unique reference to the type for the specified type
962962
/// declaration.
@@ -1265,7 +1265,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
12651265
///
12661266
/// \returns true if an error occurred (e.g., because one of the parameter
12671267
/// types is incomplete), false otherwise.
1268-
bool getObjCEncodingForFunctionDecl(const FunctionDecl *Decl, std::string& S);
1268+
bool getObjCEncodingForSubprogramDecl(const SubprogramDecl *Decl, std::string& S);
12691269

12701270
/// \brief Emit the encoded type for the method declaration \p Decl into
12711271
/// \p S.
@@ -1569,7 +1569,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
15691569
///
15701570
/// ...the first non-pure virtual function that is not inline at the point
15711571
/// of class definition.
1572-
const CXXMethodDecl *getKeyFunction(const CXXRecordDecl *RD);
1572+
const CXXMethodDecl *getKeySubprogram(const CXXRecordDecl *RD);
15731573

15741574
/// Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
15751575
uint64_t getFieldOffset(const ValueDecl *FD) const;
@@ -1863,12 +1863,12 @@ class ASTContext : public RefCountedBase<ASTContext> {
18631863
const ObjCObjectPointerType *RHSOPT);
18641864
bool canBindObjCObjectType(QualType To, QualType From);
18651865

1866-
// Functions for calculating composite types
1866+
// Subprograms for calculating composite types
18671867
QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false,
18681868
bool Unqualified = false, bool BlockReturnType = false);
1869-
QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false,
1869+
QualType mergeSubprogramTypes(QualType, QualType, bool OfBlockPointer=false,
18701870
bool Unqualified = false);
1871-
QualType mergeFunctionArgumentTypes(QualType, QualType,
1871+
QualType mergeSubprogramArgumentTypes(QualType, QualType,
18721872
bool OfBlockPointer=false,
18731873
bool Unqualified = false);
18741874
QualType mergeTransparentUnionType(QualType, QualType,
@@ -1877,9 +1877,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
18771877

18781878
QualType mergeObjCGCQualifiers(QualType, QualType);
18791879

1880-
bool FunctionTypesMatchOnNSConsumedAttrs(
1881-
const FunctionProtoType *FromFunctionType,
1882-
const FunctionProtoType *ToFunctionType);
1880+
bool SubprogramTypesMatchOnNSConsumedAttrs(
1881+
const SubprogramProtoType *FromSubprogramType,
1882+
const SubprogramProtoType *ToSubprogramType);
18831883

18841884
void ResetObjCLayout(const ObjCContainerDecl *CD) {
18851885
ObjCLayouts[CD] = 0;
@@ -1999,7 +1999,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
19991999
/// when it is called.
20002000
void AddDeallocation(void (*Callback)(void*), void *Data);
20012001

2002-
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD);
2002+
GVALinkage GetGVALinkageForSubprogram(const SubprogramDecl *FD);
20032003
GVALinkage GetGVALinkageForVariable(const VarDecl *VD);
20042004

20052005
/// \brief Determines if the decl can be CodeGen'ed or deserialized from PCH

0 commit comments

Comments
 (0)