Assigning and copying command line option objects shouldn't be allowed.

Summary:
The default copy and assignment operators for these objects probably don't actually do what the clients intend, so they should be deleted.

Places using the assignment operator to set the value of an option should cast to the option's data type first to call into the override for operator=. Places using the copy constructor just need to be changed to not copy (i.e. passing by const reference instead of value).

Reviewers: dexonsmith, chandlerc

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D7114

llvm-svn: 226762
This commit is contained in:
Chris Bieneman
2015-01-22 01:49:59 +00:00
parent 5156c38570
commit e71fb5ce05
4 changed files with 22 additions and 4 deletions

View File

@@ -38,7 +38,8 @@ static void exitWithError(const Twine &Message, StringRef Whence = "") {
enum ProfileKinds { instr, sample };
void mergeInstrProfile(cl::list<std::string> Inputs, StringRef OutputFilename) {
void mergeInstrProfile(const cl::list<std::string> &Inputs,
StringRef OutputFilename) {
if (OutputFilename.compare("-") == 0)
exitWithError("Cannot write indexed profdata format to stdout.");
@@ -64,7 +65,8 @@ void mergeInstrProfile(cl::list<std::string> Inputs, StringRef OutputFilename) {
Writer.write(Output);
}
void mergeSampleProfile(cl::list<std::string> Inputs, StringRef OutputFilename,
void mergeSampleProfile(const cl::list<std::string> &Inputs,
StringRef OutputFilename,
sampleprof::SampleProfileFormat OutputFormat) {
using namespace sampleprof;
auto WriterOrErr = SampleProfileWriter::create(OutputFilename, OutputFormat);