Skip to content

Commit 968504d

Browse files
author
Nathan Hawes
committed
[SymbolGraphGen] Address review comments on new printSymbolGraphForDecl entrypoint.
Change it to use EXIT_SUCCESS/FAILURE rather than a bool to match emitSymbolGraphForModule.
1 parent 6b1722e commit 968504d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

include/swift/SymbolGraphGen/SymbolGraphGen.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ namespace symbolgraphgen {
2626
int emitSymbolGraphForModule(ModuleDecl *M, const SymbolGraphOptions &Options);
2727

2828
/// Print a Symbol Graph containing a single node for the given decl.
29-
/// \returns true without printing if the provided node kind is unsupported.
30-
bool printSymbolGraphForDecl(const ValueDecl *D, Type BaseTy,
29+
///
30+
/// \returns \c EXIT_SUCCESS if the kind of the provided node is supported and
31+
/// its Symbo lGraph was printed, or \c EXIT_FAILURE otherwise.
32+
int printSymbolGraphForDecl(const ValueDecl *D, Type BaseTy,
3133
bool InSynthesizedExtensions,
3234
const SymbolGraphOptions &Options,
3335
llvm::raw_ostream &OS);

lib/SymbolGraphGen/SymbolGraphGen.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ symbolgraphgen::emitSymbolGraphForModule(ModuleDecl *M,
100100
return Success;
101101
}
102102

103-
bool symbolgraphgen::
103+
int symbolgraphgen::
104104
printSymbolGraphForDecl(const ValueDecl *D, Type BaseTy,
105105
bool InSynthesizedExtension,
106106
const SymbolGraphOptions &Options,
107107
llvm::raw_ostream &OS) {
108108
if (!Symbol::supportsKind(D->getKind()))
109-
return true;
109+
return EXIT_FAILURE;
110110

111111
llvm::json::OStream JOS(OS, Options.PrettyPrint ? 2 : 0);
112112
ModuleDecl *MD = D->getModuleContext();
@@ -121,5 +121,5 @@ printSymbolGraphForDecl(const ValueDecl *D, Type BaseTy,
121121
Symbol MySym(&Graph, D, NTD, BaseTy);
122122
Graph.recordNode(MySym);
123123
Graph.serialize(JOS);
124-
return false;
124+
return EXIT_SUCCESS;
125125
}

0 commit comments

Comments
 (0)