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