[clang-tidy] Make ClangTidyOptionsProvider::getOptions return by value.

Returning by reference limits possible implementations and doesn't bring any
benefits as all callers make copies of the returned value anyway.

llvm-svn: 226553
This commit is contained in:
Alexander Kornienko 2015-01-20 09:48:51 +00:00
parent bb917683b6
commit 9115a3af02
2 changed files with 4 additions and 4 deletions

View File

@ -159,7 +159,7 @@ FileOptionsProvider::FileOptionsProvider(
// FIXME: This method has some common logic with clang::format::getStyle().
// Consider pulling out common bits to a findParentFileWithName function or
// similar.
const ClangTidyOptions &FileOptionsProvider::getOptions(StringRef FileName) {
ClangTidyOptions FileOptionsProvider::getOptions(StringRef FileName) {
DEBUG(llvm::dbgs() << "Getting options for file " << FileName << "...\n");
SmallString<256> FilePath(FileName);

View File

@ -95,7 +95,7 @@ public:
/// \brief Returns options applying to a specific translation unit with the
/// specified \p FileName.
virtual const ClangTidyOptions &getOptions(llvm::StringRef FileName) = 0;
virtual ClangTidyOptions getOptions(llvm::StringRef FileName) = 0;
};
/// \brief Implementation of the \c ClangTidyOptionsProvider interface, which
@ -108,7 +108,7 @@ public:
const ClangTidyGlobalOptions &getGlobalOptions() override {
return GlobalOptions;
}
const ClangTidyOptions &getOptions(llvm::StringRef /*FileName*/) override {
ClangTidyOptions getOptions(llvm::StringRef /*FileName*/) override {
return DefaultOptions;
}
@ -187,7 +187,7 @@ public:
const ClangTidyOptions &OverrideOptions,
const ConfigFileHandlers &ConfigHandlers);
const ClangTidyOptions &getOptions(llvm::StringRef FileName) override;
ClangTidyOptions getOptions(llvm::StringRef FileName) override;
private:
/// \brief Try to read configuration files from \p Directory using registered