@@ -5064,29 +5064,23 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
50645064 getReferencedTypeIds (FS, ReferencedTypeIds);
50655065 }
50665066
5067- for (auto &S : Index.cfiFunctionDefs ()) {
5068- if (DefOrUseGUIDs.contains (
5069- GlobalValue::getGUID (GlobalValue::dropLLVMManglingEscape (S)))) {
5070- NameVals.push_back (StrtabBuilder.add (S));
5071- NameVals.push_back (S.size ());
5067+ auto EmitCfiFunctions = [&](const CfiFunctionIndex &CfiIndex,
5068+ bitc::GlobalValueSummarySymtabCodes Code) {
5069+ for (auto &S : CfiIndex) {
5070+ if (DefOrUseGUIDs.contains (
5071+ GlobalValue::getGUID (GlobalValue::dropLLVMManglingEscape (S)))) {
5072+ NameVals.push_back (StrtabBuilder.add (S));
5073+ NameVals.push_back (S.size ());
5074+ }
50725075 }
5073- }
5074- if (!NameVals.empty ()) {
5075- Stream.EmitRecord (bitc::FS_CFI_FUNCTION_DEFS, NameVals);
5076- NameVals.clear ();
5077- }
5078-
5079- for (auto &S : Index.cfiFunctionDecls ()) {
5080- if (DefOrUseGUIDs.contains (
5081- GlobalValue::getGUID (GlobalValue::dropLLVMManglingEscape (S)))) {
5082- NameVals.push_back (StrtabBuilder.add (S));
5083- NameVals.push_back (S.size ());
5076+ if (!NameVals.empty ()) {
5077+ Stream.EmitRecord (Code, NameVals);
5078+ NameVals.clear ();
50845079 }
5085- }
5086- if (!NameVals.empty ()) {
5087- Stream.EmitRecord (bitc::FS_CFI_FUNCTION_DECLS, NameVals);
5088- NameVals.clear ();
5089- }
5080+ };
5081+
5082+ EmitCfiFunctions (Index.cfiFunctionDefs (), bitc::FS_CFI_FUNCTION_DEFS);
5083+ EmitCfiFunctions (Index.cfiFunctionDecls (), bitc::FS_CFI_FUNCTION_DECLS);
50905084
50915085 // Walk the GUIDs that were referenced, and write the
50925086 // corresponding type id records.
0 commit comments