forked from OSchip/llvm-project
Apply clang-tidy's performance-unnecessary-value-param to parts of clang.
No functionality change intended. llvm-svn: 298443
This commit is contained in:
parent
a079cdbeb8
commit
f6021ecddc
|
@ -99,7 +99,9 @@ private:
|
|||
mutable llvm::Triple EffectiveTriple;
|
||||
|
||||
/// Set the toolchain's effective clang triple.
|
||||
void setEffectiveTriple(llvm::Triple ET) const { EffectiveTriple = ET; }
|
||||
void setEffectiveTriple(llvm::Triple ET) const {
|
||||
EffectiveTriple = std::move(ET);
|
||||
}
|
||||
|
||||
friend class RegisterEffectiveTriple;
|
||||
|
||||
|
@ -476,7 +478,7 @@ class RegisterEffectiveTriple {
|
|||
|
||||
public:
|
||||
RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T) : TC(TC) {
|
||||
TC.setEffectiveTriple(T);
|
||||
TC.setEffectiveTriple(std::move(T));
|
||||
}
|
||||
|
||||
~RegisterEffectiveTriple() { TC.setEffectiveTriple(llvm::Triple()); }
|
||||
|
|
|
@ -1585,7 +1585,7 @@ public:
|
|||
const LangOptions &LangOpts,
|
||||
const TargetOptions &TargetOpts,
|
||||
const PreprocessorOptions &PPOpts,
|
||||
std::string ExistingModuleCachePath);
|
||||
StringRef ExistingModuleCachePath);
|
||||
|
||||
/// \brief Returns the suggested contents of the predefines buffer,
|
||||
/// which contains a (typically-empty) subset of the predefines
|
||||
|
|
|
@ -350,7 +350,8 @@ namespace {
|
|||
MostDerivedArraySize = 2;
|
||||
MostDerivedPathLength = Entries.size();
|
||||
}
|
||||
void diagnosePointerArithmetic(EvalInfo &Info, const Expr *E, APSInt N);
|
||||
void diagnosePointerArithmetic(EvalInfo &Info, const Expr *E,
|
||||
const APSInt &N);
|
||||
/// Add N to the address of this subobject.
|
||||
void adjustIndex(EvalInfo &Info, const Expr *E, APSInt N) {
|
||||
if (Invalid || !N) return;
|
||||
|
@ -1071,7 +1072,8 @@ bool SubobjectDesignator::checkSubobject(EvalInfo &Info, const Expr *E,
|
|||
}
|
||||
|
||||
void SubobjectDesignator::diagnosePointerArithmetic(EvalInfo &Info,
|
||||
const Expr *E, APSInt N) {
|
||||
const Expr *E,
|
||||
const APSInt &N) {
|
||||
// If we're complaining, we must be able to statically determine the size of
|
||||
// the most derived array.
|
||||
if (MostDerivedPathLength == Entries.size() && MostDerivedIsArrayElement)
|
||||
|
@ -1296,8 +1298,8 @@ namespace {
|
|||
void clearIsNullPointer() {
|
||||
IsNullPtr = false;
|
||||
}
|
||||
void adjustOffsetAndIndex(EvalInfo &Info, const Expr *E, APSInt Index,
|
||||
CharUnits ElementSize) {
|
||||
void adjustOffsetAndIndex(EvalInfo &Info, const Expr *E,
|
||||
const APSInt &Index, CharUnits ElementSize) {
|
||||
// An index of 0 has no effect. (In C, adding 0 to a null pointer is UB,
|
||||
// but we're not required to diagnose it and it's valid in C++.)
|
||||
if (!Index)
|
||||
|
@ -8072,7 +8074,8 @@ bool DataRecursiveIntBinOpEvaluator::
|
|||
return true;
|
||||
}
|
||||
|
||||
static void addOrSubLValueAsInteger(APValue &LVal, APSInt Index, bool IsSub) {
|
||||
static void addOrSubLValueAsInteger(APValue &LVal, const APSInt &Index,
|
||||
bool IsSub) {
|
||||
// Compute the new offset in the appropriate width, wrapping at 64 bits.
|
||||
// FIXME: When compiling for a 32-bit target, we should use 32-bit
|
||||
// offsets.
|
||||
|
|
|
@ -50,14 +50,14 @@ using namespace clang;
|
|||
|
||||
FileManager::FileManager(const FileSystemOptions &FSO,
|
||||
IntrusiveRefCntPtr<vfs::FileSystem> FS)
|
||||
: FS(FS), FileSystemOpts(FSO),
|
||||
SeenDirEntries(64), SeenFileEntries(64), NextFileUID(0) {
|
||||
: FS(std::move(FS)), FileSystemOpts(FSO), SeenDirEntries(64),
|
||||
SeenFileEntries(64), NextFileUID(0) {
|
||||
NumDirLookups = NumFileLookups = 0;
|
||||
NumDirCacheMisses = NumFileCacheMisses = 0;
|
||||
|
||||
// If the caller doesn't provide a virtual file system, just grab the real
|
||||
// file system.
|
||||
if (!FS)
|
||||
if (!this->FS)
|
||||
this->FS = vfs::getRealFileSystem();
|
||||
}
|
||||
|
||||
|
|
|
@ -953,7 +953,7 @@ static void runThinLTOBackend(ModuleSummaryIndex *CombinedIndex, Module *M,
|
|||
return llvm::make_unique<lto::NativeObjectStream>(std::move(OS));
|
||||
};
|
||||
lto::Config Conf;
|
||||
Conf.SampleProfile = SampleProfile;
|
||||
Conf.SampleProfile = std::move(SampleProfile);
|
||||
if (Error E = thinBackend(
|
||||
Conf, 0, AddStream, *M, *CombinedIndex, ImportList,
|
||||
ModuleToDefinedGVSummaries[M->getModuleIdentifier()], ModuleMap)) {
|
||||
|
|
|
@ -4732,11 +4732,12 @@ bool ASTReader::readASTFileControlBlock(
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ASTReader::isAcceptableASTFile(
|
||||
StringRef Filename, FileManager &FileMgr,
|
||||
const PCHContainerReader &PCHContainerRdr, const LangOptions &LangOpts,
|
||||
const TargetOptions &TargetOpts, const PreprocessorOptions &PPOpts,
|
||||
std::string ExistingModuleCachePath) {
|
||||
bool ASTReader::isAcceptableASTFile(StringRef Filename, FileManager &FileMgr,
|
||||
const PCHContainerReader &PCHContainerRdr,
|
||||
const LangOptions &LangOpts,
|
||||
const TargetOptions &TargetOpts,
|
||||
const PreprocessorOptions &PPOpts,
|
||||
StringRef ExistingModuleCachePath) {
|
||||
SimplePCHValidator validator(LangOpts, TargetOpts, PPOpts,
|
||||
ExistingModuleCachePath, FileMgr);
|
||||
return !readASTFileControlBlock(Filename, FileMgr, PCHContainerRdr,
|
||||
|
|
|
@ -27,11 +27,11 @@ PCHGenerator::PCHGenerator(
|
|||
ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
|
||||
bool AllowASTWithErrors, bool IncludeTimestamps)
|
||||
: PP(PP), OutputFile(OutputFile), isysroot(isysroot.str()),
|
||||
SemaPtr(nullptr), Buffer(Buffer), Stream(Buffer->Data),
|
||||
Writer(Stream, Buffer->Data, PP.getPCMCache(), Extensions,
|
||||
SemaPtr(nullptr), Buffer(std::move(Buffer)), Stream(this->Buffer->Data),
|
||||
Writer(Stream, this->Buffer->Data, PP.getPCMCache(), Extensions,
|
||||
IncludeTimestamps),
|
||||
AllowASTWithErrors(AllowASTWithErrors) {
|
||||
Buffer->IsComplete = false;
|
||||
this->Buffer->IsComplete = false;
|
||||
}
|
||||
|
||||
PCHGenerator::~PCHGenerator() {
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace tooling {
|
|||
RefactoringTool::RefactoringTool(
|
||||
const CompilationDatabase &Compilations, ArrayRef<std::string> SourcePaths,
|
||||
std::shared_ptr<PCHContainerOperations> PCHContainerOps)
|
||||
: ClangTool(Compilations, SourcePaths, PCHContainerOps) {}
|
||||
: ClangTool(Compilations, SourcePaths, std::move(PCHContainerOps)) {}
|
||||
|
||||
std::map<std::string, Replacements> &RefactoringTool::getReplacements() {
|
||||
return FileToReplaces;
|
||||
|
|
|
@ -320,7 +320,8 @@ AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults(
|
|||
: CXCodeCompleteResults(), DiagOpts(new DiagnosticOptions),
|
||||
Diag(new DiagnosticsEngine(
|
||||
IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs), &*DiagOpts)),
|
||||
FileMgr(FileMgr), SourceMgr(new SourceManager(*Diag, *FileMgr)),
|
||||
FileMgr(std::move(FileMgr)),
|
||||
SourceMgr(new SourceManager(*Diag, *this->FileMgr)),
|
||||
CodeCompletionAllocator(
|
||||
std::make_shared<clang::GlobalCodeCompletionAllocator>()),
|
||||
Contexts(CXCompletionContext_Unknown),
|
||||
|
|
Loading…
Reference in New Issue