================
@@ -647,6 +648,54 @@ static SmallString<16> determineFileName(Info *I,
SmallString<128> &Path) {
return FileName;
}
+// Creates a JSON file above the global namespace directory.
+// An index can be used to create the top-level HTML index page or the Markdown
+// index file.
+static Error serializeIndex(const ClangDocContext &CDCtx, StringRef RootDir) {
+ if (CDCtx.Idx.Children.empty())
+ return Error::success();
+
+ json::Value ObjVal = Object();
+ Object &Obj = *ObjVal.getAsObject();
+ if (!CDCtx.ProjectName.empty())
+ Obj["ProjectName"] = CDCtx.ProjectName;
----------------
ilovepi wrote:
Seeing this pattern again is making me wonder if we should have helper:
```c++
void insertNonEmpty(StringRef Key, StringRef Val, JSONObject Obj){
if(!Val.empty())
Obj[Key] = Value;
}
```
Do you think that would be useful? or make it easier to reason about?
https://github.com/llvm/llvm-project/pull/171899
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits