CSSPGO only supports text and extended binary profile now. Raw binary does not have the metadata section CSSPGO needs, and Compact binary profile needs special handling for GUID based context names, which is not yet implemented.
Disasslow these two format for CSSPGO profile writing to avoid silently generating invalid profiles.
Differential Revision: https://reviews.llvm.org/D101300
std::error_code EC;
std::unique_ptr<SampleProfileWriter> Writer;
+ // Currently only Text and Extended Binary format are supported for CSSPGO.
+ if ((FunctionSamples::ProfileIsCS || FunctionSamples::ProfileIsProbeBased) &&
+ (Format == SPF_Binary || Format == SPF_Compact_Binary))
+ return sampleprof_error::unsupported_writing_format;
+
if (Format == SPF_Binary)
Writer.reset(new SampleProfileWriterRawBinary(OS));
else if (Format == SPF_Ext_Binary)