Without this fix gcc (7.4) complains with
../lib/Remarks/RemarkParser.cpp: In function 'std::unique_ptr<llvm::remarks::ParserImpl> formatToParserImpl(llvm::remarks::ParserFormat, llvm::StringRef)':
../lib/Remarks/RemarkParser.cpp:29:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
../lib/Remarks/RemarkParser.cpp: In function 'std::unique_ptr<llvm::remarks::ParserImpl> formatToParserImpl(llvm::remarks::ParserFormat, llvm::StringRef, const llvm::remarks::ParsedStringTable&)':
../lib/Remarks/RemarkParser.cpp:38:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
The Format enum currently only contains the value YAML which is indeed
already handled in the switches, but gcc complains anyway.
Adding a default case with an llvm_unreachable silences gcc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365118
91177308-0d34-0410-b5e6-
96231b3b80d8
switch (Format) {
case ParserFormat::YAML:
return llvm::make_unique<YAMLParserImpl>(Buf);
+ default:
+ llvm_unreachable("Unknown format encountered!");
};
}
switch (Format) {
case ParserFormat::YAML:
return llvm::make_unique<YAMLParserImpl>(Buf, &StrTab);
+ default:
+ llvm_unreachable("Unknown format encountered!");
};
}