@@ -176,13 +176,14 @@ struct StackIdData {
176176 // unique ID.
177177 SmallVector<TrieNode<StackIdData> *, 4 > siblings;
178178};
179+ } // namespace
179180
180181using StackTrieNode = TrieNode<StackIdData>;
181182
182183// A helper function to find the sibling nodes for an encountered function in a
183184// thread of execution. Relies on the invariant that each time a new node is
184185// traversed in a thread, sibling bidirectional pointers are maintained.
185- SmallVector<StackTrieNode *, 4 >
186+ static SmallVector<StackTrieNode *, 4 >
186187findSiblings (StackTrieNode *parent, int32_t FnId, uint32_t TId,
187188 const DenseMap<uint32_t , SmallVector<StackTrieNode *, 4 >>
188189 &StackRootsByThreadId) {
@@ -213,7 +214,7 @@ findSiblings(StackTrieNode *parent, int32_t FnId, uint32_t TId,
213214// StackTrie representing the function call stack. If no node exists, creates
214215// the node. Assigns unique IDs to stacks newly encountered among all threads
215216// and keeps sibling links up to when creating new nodes.
216- StackTrieNode *findOrCreateStackNode (
217+ static StackTrieNode *findOrCreateStackNode (
217218 StackTrieNode *Parent, int32_t FuncId, uint32_t TId,
218219 DenseMap<uint32_t , SmallVector<StackTrieNode *, 4 >> &StackRootsByThreadId,
219220 DenseMap<unsigned , StackTrieNode *> &StacksByStackId, unsigned *id_counter,
@@ -244,12 +245,13 @@ StackTrieNode *findOrCreateStackNode(
244245 return CurrentStack;
245246}
246247
247- void writeTraceViewerRecord (uint16_t Version, raw_ostream &OS, int32_t FuncId,
248- uint32_t TId, uint32_t PId, bool Symbolize,
249- const FuncIdConversionHelper &FuncIdHelper,
250- double EventTimestampUs,
251- const StackTrieNode &StackCursor,
252- StringRef FunctionPhenotype) {
248+ static void writeTraceViewerRecord (uint16_t Version, raw_ostream &OS,
249+ int32_t FuncId, uint32_t TId, uint32_t PId,
250+ bool Symbolize,
251+ const FuncIdConversionHelper &FuncIdHelper,
252+ double EventTimestampUs,
253+ const StackTrieNode &StackCursor,
254+ StringRef FunctionPhenotype) {
253255 OS << " " ;
254256 if (Version >= 3 ) {
255257 OS << llvm::formatv (
@@ -269,8 +271,6 @@ void writeTraceViewerRecord(uint16_t Version, raw_ostream &OS, int32_t FuncId,
269271 }
270272}
271273
272- } // namespace
273-
274274void TraceConverter::exportAsChromeTraceEventFormat (const Trace &Records,
275275 raw_ostream &OS) {
276276 const auto &FH = Records.getFileHeader ();
@@ -364,9 +364,6 @@ void TraceConverter::exportAsChromeTraceEventFormat(const Trace &Records,
364364 OS << " }\n " ; // Close the JSON entry.
365365}
366366
367- namespace llvm {
368- namespace xray {
369-
370367static CommandRegistration Unused (&Convert, []() -> Error {
371368 // FIXME: Support conversion to BINARY when upgrading XRay trace versions.
372369 InstrumentationMap Map;
@@ -386,9 +383,9 @@ static CommandRegistration Unused(&Convert, []() -> Error {
386383 if (Demangle.getPosition () < NoDemangle.getPosition ())
387384 SymbolizerOpts.Demangle = false ;
388385 symbolize::LLVMSymbolizer Symbolizer (SymbolizerOpts);
389- llvm::xray:: FuncIdConversionHelper FuncIdHelper (ConvertInstrMap, Symbolizer,
390- FunctionAddresses);
391- llvm::xray:: TraceConverter TC (FuncIdHelper, ConvertSymbolize);
386+ FuncIdConversionHelper FuncIdHelper (ConvertInstrMap, Symbolizer,
387+ FunctionAddresses);
388+ TraceConverter TC (FuncIdHelper, ConvertSymbolize);
392389 std::error_code EC;
393390 raw_fd_ostream OS (ConvertOutput, EC,
394391 ConvertOutputFormat == ConvertFormats::BINARY
@@ -420,6 +417,3 @@ static CommandRegistration Unused(&Convert, []() -> Error {
420417 }
421418 return Error::success ();
422419});
423-
424- } // namespace xray
425- } // namespace llvm
0 commit comments