Skip to content

Commit 3c344f9

Browse files
authored
[clang][tablegen][NFC]add static for internal linkage function (#117479)
Detected by misc-use-internal-linkage
1 parent 605b8da commit 3c344f9

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

clang/utils/TableGen/ClangASTNodesEmitter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,9 @@ void clang::EmitClangASTNodes(const RecordKeeper &RK, raw_ostream &OS,
207207
ClangASTNodesEmitter(RK, N, S, PriorizeIfSubclassOf).run(OS);
208208
}
209209

210-
void printDeclContext(const std::multimap<const Record *, const Record *> &Tree,
211-
const Record *DeclContext, raw_ostream &OS) {
210+
static void
211+
printDeclContext(const std::multimap<const Record *, const Record *> &Tree,
212+
const Record *DeclContext, raw_ostream &OS) {
212213
if (!DeclContext->getValueAsBit(AbstractFieldName))
213214
OS << "DECL_CONTEXT(" << DeclContext->getName() << ")\n";
214215
auto [II, E] = Tree.equal_range(DeclContext);

clang/utils/TableGen/ClangAttrEmitter.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,9 +1821,9 @@ CreateSemanticSpellings(const std::vector<FlattenedSpelling> &Spellings,
18211821
return Ret;
18221822
}
18231823

1824-
void WriteSemanticSpellingSwitch(StringRef VarName,
1825-
const SemanticSpellingMap &Map,
1826-
raw_ostream &OS) {
1824+
static void WriteSemanticSpellingSwitch(StringRef VarName,
1825+
const SemanticSpellingMap &Map,
1826+
raw_ostream &OS) {
18271827
OS << " switch (" << VarName << ") {\n default: "
18281828
<< "llvm_unreachable(\"Unknown spelling list index\");\n";
18291829
for (const auto &I : Map)
@@ -2367,12 +2367,12 @@ template <typename Fn> static void forEachSpelling(const Record &Attr, Fn &&F) {
23672367
}
23682368
}
23692369

2370-
std::map<StringRef, std::vector<const Record *>> NameToAttrsMap;
2370+
static std::map<StringRef, std::vector<const Record *>> NameToAttrsMap;
23712371

23722372
/// Build a map from the attribute name to the Attrs that use that name. If more
23732373
/// than one Attr use a name, the arguments could be different so a more complex
23742374
/// check is needed in the generated switch.
2375-
void generateNameToAttrsMap(const RecordKeeper &Records) {
2375+
static void generateNameToAttrsMap(const RecordKeeper &Records) {
23762376
for (const auto *A : Records.getAllDerivedDefinitions("Attr")) {
23772377
for (const FlattenedSpelling &S : GetFlattenedSpellings(*A)) {
23782378
auto [It, Inserted] = NameToAttrsMap.try_emplace(S.name());
@@ -3965,9 +3965,9 @@ void EmitClangAttrASTVisitor(const RecordKeeper &Records, raw_ostream &OS) {
39653965
OS << "#endif // ATTR_VISITOR_DECLS_ONLY\n";
39663966
}
39673967

3968-
void EmitClangAttrTemplateInstantiateHelper(ArrayRef<const Record *> Attrs,
3969-
raw_ostream &OS,
3970-
bool AppliesToDecl) {
3968+
static void
3969+
EmitClangAttrTemplateInstantiateHelper(ArrayRef<const Record *> Attrs,
3970+
raw_ostream &OS, bool AppliesToDecl) {
39713971

39723972
OS << " switch (At->getKind()) {\n";
39733973
for (const auto *Attr : Attrs) {
@@ -4622,7 +4622,7 @@ static bool isParamExpr(const Record *Arg) {
46224622
.Default(false);
46234623
}
46244624

4625-
void GenerateIsParamExpr(const Record &Attr, raw_ostream &OS) {
4625+
static void GenerateIsParamExpr(const Record &Attr, raw_ostream &OS) {
46264626
OS << "bool isParamExpr(size_t N) const override {\n";
46274627
OS << " return ";
46284628
auto Args = Attr.getValueAsListOfDefs("Args");
@@ -4633,8 +4633,8 @@ void GenerateIsParamExpr(const Record &Attr, raw_ostream &OS) {
46334633
OS << "}\n\n";
46344634
}
46354635

4636-
void GenerateHandleAttrWithDelayedArgs(const RecordKeeper &Records,
4637-
raw_ostream &OS) {
4636+
static void GenerateHandleAttrWithDelayedArgs(const RecordKeeper &Records,
4637+
raw_ostream &OS) {
46384638
OS << "static void handleAttrWithDelayedArgs(Sema &S, Decl *D, ";
46394639
OS << "const ParsedAttr &Attr) {\n";
46404640
OS << " SmallVector<Expr *, 4> ArgExprs;\n";

0 commit comments

Comments
 (0)