[clang-tools-extra] r277340 - [clang-tidy] remove trailing whitespaces and retab
Kirill Bobyrev via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 1 05:06:19 PDT 2016
Author: omtcyfz
Date: Mon Aug 1 07:06:18 2016
New Revision: 277340
URL: http://llvm.org/viewvc/llvm-project?rev=277340&view=rev
Log:
[clang-tidy] remove trailing whitespaces and retab
Modified:
clang-tools-extra/trunk/clang-tidy/cert/LICENSE.TXT
clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
clang-tools-extra/trunk/clang-tidy/misc/MacroParenthesesCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp
clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.h
clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.h
clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.h
clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.h
clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.h
clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-slicing.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst
Modified: clang-tools-extra/trunk/clang-tidy/cert/LICENSE.TXT
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/LICENSE.TXT?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cert/LICENSE.TXT (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/LICENSE.TXT Mon Aug 1 07:06:18 2016
@@ -7,7 +7,7 @@ additions:
Any file referencing a CERT Secure Coding guideline:
Please allow this letter to serve as confirmation that open source projects on
http://llvm.org are permitted to link via hypertext to the CERT(R) secure coding
-guidelines available at https://www.securecoding.cert.org.
+guidelines available at https://www.securecoding.cert.org.
The foregoing is permitted by the Terms of Use as follows:
"Linking to the Service
Modified: clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp Mon Aug 1 07:06:18 2016
@@ -127,7 +127,7 @@ ConversionKind ClassifyFormatString(Stri
Handler H;
analyze_format_string::ParseScanfString(H, Fmt.begin(), Fmt.end(), LO, TI);
-
+
return H.get();
}
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h Mon Aug 1 07:06:18 2016
@@ -15,7 +15,7 @@
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
-
+
/// This check flags all array to pointer decays
///
/// For the user-facing documentation see:
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp Mon Aug 1 07:06:18 2016
@@ -16,7 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
-
+
void ProTypeConstCastCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h Mon Aug 1 07:06:18 2016
@@ -15,7 +15,7 @@
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
-
+
/// This check flags all instances of const_cast
///
/// For the user-facing documentation see:
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp Mon Aug 1 07:06:18 2016
@@ -16,7 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
-
+
void ProTypeStaticCastDowncastCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h Mon Aug 1 07:06:18 2016
@@ -15,7 +15,7 @@
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
-
+
/// Checks for usages of static_cast, where a base class is downcasted to a derived class.
///
/// For the user-facing documentation see:
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h Mon Aug 1 07:06:18 2016
@@ -30,7 +30,7 @@ public:
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
void onEndOfTranslationUnit() override;
-
+
enum class SpecialMemberFunctionKind {
Destructor,
CopyConstructor,
@@ -44,12 +44,12 @@ public:
using ClassDefiningSpecialMembersMap = llvm::DenseMap<ClassDefId, llvm::SmallVector<SpecialMemberFunctionKind, 5>>;
private:
-
+
static llvm::StringRef toString(SpecialMemberFunctionKind K);
static std::string join(llvm::ArrayRef<SpecialMemberFunctionKind> SMFS,
llvm::StringRef AndOr);
-
+
ClassDefiningSpecialMembersMap ClassWithSpecialMembers;
};
@@ -60,7 +60,7 @@ private:
namespace llvm {
/// Specialisation of DenseMapInfo to allow ClassDefId objects in DenseMaps
/// FIXME: Move this to the corresponding cpp file as is done for
-/// clang-tidy/readability/IdentifierNamingCheck.cpp.
+/// clang-tidy/readability/IdentifierNamingCheck.cpp.
template <>
struct DenseMapInfo<
clang::tidy::cppcoreguidelines::SpecialMemberFunctionsCheck::ClassDefId> {
Modified: clang-tools-extra/trunk/clang-tidy/misc/MacroParenthesesCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MacroParenthesesCheck.cpp?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MacroParenthesesCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MacroParenthesesCheck.cpp Mon Aug 1 07:06:18 2016
@@ -154,7 +154,7 @@ void MacroParenthesesPPCallbacks::replac
void MacroParenthesesPPCallbacks::argument(const Token &MacroNameTok,
const MacroInfo *MI) {
-
+
// Skip variable declaration.
bool VarDecl = possibleVarDecl(MI, MI->tokens_begin());
Modified: clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp Mon Aug 1 07:06:18 2016
@@ -120,7 +120,7 @@ public:
CheckFactories.registerCheck<SuspiciousSemicolonCheck>(
"misc-suspicious-semicolon");
CheckFactories.registerCheck<SuspiciousStringCompareCheck>(
- "misc-suspicious-string-compare");
+ "misc-suspicious-string-compare");
CheckFactories.registerCheck<SwappedArgumentsCheck>(
"misc-swapped-arguments");
CheckFactories.registerCheck<ThrowByValueCatchByReferenceCheck>(
Modified: clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp Mon Aug 1 07:06:18 2016
@@ -133,7 +133,7 @@ void MoveConstructorInitCheck::handleMov
QualType QT = Initializer->getInit()->getType();
if (QT.isTriviallyCopyableType(*Result.Context))
return;
-
+
const auto *RD = QT->getAsCXXRecordDecl();
if (RD && RD->isTriviallyCopyable())
return;
Modified: clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.cpp?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.cpp Mon Aug 1 07:06:18 2016
@@ -15,7 +15,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
-namespace misc {
+namespace misc {
void SizeofContainerCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
Modified: clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp Mon Aug 1 07:06:18 2016
@@ -22,7 +22,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
-namespace misc {
+namespace misc {
StaticAssertCheck::StaticAssertCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
Modified: clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.h?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.h Mon Aug 1 07:06:18 2016
@@ -16,7 +16,7 @@
namespace clang {
namespace tidy {
-namespace misc {
+namespace misc {
/// Replaces `assert()` with `static_assert()` if the condition is evaluatable
/// at compile time.
Modified: clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.cpp?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.cpp Mon Aug 1 07:06:18 2016
@@ -16,7 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
-namespace misc {
+namespace misc {
void StringIntegerAssignmentCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
Modified: clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.h?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/StringIntegerAssignmentCheck.h Mon Aug 1 07:06:18 2016
@@ -14,7 +14,7 @@
namespace clang {
namespace tidy {
-namespace misc {
+namespace misc {
/// Finds instances where an integer is assigned to a string.
///
Modified: clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.cpp?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.cpp Mon Aug 1 07:06:18 2016
@@ -99,7 +99,7 @@ void SuspiciousMissingCommaCheck::check(
const auto *ConcatenatedLiteral =
Result.Nodes.getNodeAs<StringLiteral>("str");
assert(InitializerList && ConcatenatedLiteral);
-
+
// Skip small arrays as they often generate false-positive.
unsigned int Size = InitializerList->getNumInits();
if (Size < SizeThreshold) return;
Modified: clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.h?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.h Mon Aug 1 07:06:18 2016
@@ -23,7 +23,7 @@ namespace misc {
class SuspiciousMissingCommaCheck : public ClangTidyCheck {
public:
SuspiciousMissingCommaCheck(StringRef Name, ClangTidyContext *Context);
- void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
+ void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Modified: clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.cpp Mon Aug 1 07:06:18 2016
@@ -91,7 +91,7 @@ void SwappedArgumentsCheck::check(const
<< RHSFrom->getType()
<< tooling::fixit::createReplacement(*LHS, *RHS, Ctx)
<< tooling::fixit::createReplacement(*RHS, *LHS, Ctx);
-
+
// Remember that we emitted a warning for this argument.
UsedArgs.insert(RHSCast);
}
Modified: clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp Mon Aug 1 07:06:18 2016
@@ -16,7 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
-namespace misc {
+namespace misc {
ThrowByValueCatchByReferenceCheck::ThrowByValueCatchByReferenceCheck(
StringRef Name, ClangTidyContext *Context)
Modified: clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.h?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.h Mon Aug 1 07:06:18 2016
@@ -15,7 +15,7 @@
namespace clang {
namespace tidy {
-namespace misc {
+namespace misc {
/// Finds unused namespace alias declarations.
class UnusedAliasDeclsCheck : public ClangTidyCheck {
Modified: clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.h?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.h Mon Aug 1 07:06:18 2016
@@ -14,7 +14,7 @@
namespace clang {
namespace tidy {
-namespace misc {
+namespace misc {
/// Finds unused parameters and fixes them, so that `-Wunused-parameter` can be
/// turned on.
Modified: clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp Mon Aug 1 07:06:18 2016
@@ -183,7 +183,7 @@ void PassByValueCheck::check(const Match
// If the parameter is trivial to copy, don't move it. Moving a trivivally
// copyable type will cause a problem with misc-move-const-arg
- if (ParamDecl->getType().isTriviallyCopyableType(*Result.Context))
+ if (ParamDecl->getType().isTriviallyCopyableType(*Result.Context))
return;
auto Diag = diag(ParamDecl->getLocStart(), "pass by value and use std::move");
Modified: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp Mon Aug 1 07:06:18 2016
@@ -157,8 +157,8 @@ void UnnecessaryValueParamCheck::handleM
if (CopyArgument.getLocStart().isMacroID())
return;
const auto &SM = Context.getSourceManager();
- auto EndLoc = Lexer::getLocForEndOfToken(CopyArgument.getLocation(), 0, SM,
- Context.getLangOpts());
+ auto EndLoc = Lexer::getLocForEndOfToken(CopyArgument.getLocation(), 0, SM,
+ Context.getLangOpts());
Diag << FixItHint::CreateInsertion(CopyArgument.getLocStart(), "std::move(")
<< FixItHint::CreateInsertion(EndLoc, ")");
if (auto IncludeFixit = Inserter->CreateIncludeInsertion(
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-slicing.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-slicing.rst?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-slicing.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-slicing.rst Mon Aug 1 07:06:18 2016
@@ -10,13 +10,13 @@ This can be misleading especially for me
.. code:: c++
- struct B { int a; virtual int f(); };
- struct D : B { int b; int f() override; };
- void use(B b) { // Missing reference, intended ?
- b.f(); // Calls B::f.
- }
- D d;
- use(d); // Slice.
+ struct B { int a; virtual int f(); };
+ struct D : B { int b; int f() override; };
+ void use(B b) { // Missing reference, intended ?
+ b.f(); // Calls B::f.
+ }
+ D d;
+ use(d); // Slice.
See the relevant CppCoreGuidelines sections for details:
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es63-dont-slice
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst?rev=277340&r1=277339&r2=277340&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst Mon Aug 1 07:06:18 2016
@@ -20,25 +20,25 @@ Before:
.. code:: c++
- std::vector<MyClass> v;
- v.push_back(MyClass(21, 37));
+ std::vector<MyClass> v;
+ v.push_back(MyClass(21, 37));
- std::vector<std::pair<int,int>> w;
+ std::vector<std::pair<int,int>> w;
- w.push_back(std::pair<int,int>(21, 37));
- w.push_back(std::make_pair(21L, 37L));
+ w.push_back(std::pair<int,int>(21, 37));
+ w.push_back(std::make_pair(21L, 37L));
After:
.. code:: c++
- std::vector<MyClass> v;
- v.emplace_back(21, 37);
+ std::vector<MyClass> v;
+ v.emplace_back(21, 37);
- std::vector<std::pair<int,int>> w;
- w.emplace_back(21, 37);
- // This will be fixed to w.push_back(21, 37); in next version
- w.emplace_back(std::make_pair(21L, 37L);
+ std::vector<std::pair<int,int>> w;
+ w.emplace_back(21, 37);
+ // This will be fixed to w.push_back(21, 37); in next version
+ w.emplace_back(std::make_pair(21L, 37L);
The other situation is when we pass arguments that will be converted to a type
inside a container.
@@ -47,15 +47,15 @@ Before:
.. code:: c++
- std::vector<boost::optional<std::string> > v;
- v.push_back("abc");
+ std::vector<boost::optional<std::string> > v;
+ v.push_back("abc");
After:
.. code:: c++
- std::vector<boost::optional<std::string> > v;
- v.emplace_back("abc");
+ std::vector<boost::optional<std::string> > v;
+ v.emplace_back("abc");
In some cases the transformation would be valid, but the code
@@ -63,11 +63,11 @@ wouldn't be exception safe.
In this case the calls of ``push_back`` won't be replaced.
.. code:: c++
-
+
std::vector<std::unique_ptr<int>> v;
- v.push_back(std::unique_ptr<int>(new int(0)));
- auto *ptr = new int(1);
- v.push_back(std::unique_ptr<int>(ptr));
+ v.push_back(std::unique_ptr<int>(new int(0)));
+ auto *ptr = new int(1);
+ v.push_back(std::unique_ptr<int>(ptr));
This is because replacing it with ``emplace_back`` could cause a leak of this
pointer if ``emplace_back`` would throw exception before emplacement
More information about the cfe-commits
mailing list