[clang-tools-extra] r226553 - [clang-tidy] Make ClangTidyOptionsProvider::getOptions return by value.
Alexander Kornienko
alexfh at google.com
Tue Jan 20 01:48:52 PST 2015
Author: alexfh
Date: Tue Jan 20 03:48:51 2015
New Revision: 226553
URL: http://llvm.org/viewvc/llvm-project?rev=226553&view=rev
Log:
[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.
Modified:
clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp
clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h
Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp?rev=226553&r1=226552&r2=226553&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp Tue Jan 20 03:48:51 2015
@@ -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);
Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h?rev=226553&r1=226552&r2=226553&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h Tue Jan 20 03:48:51 2015
@@ -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
More information about the cfe-commits
mailing list