diff options
author | mitchell <unknown> | 2018-05-05 21:09:21 -0400 |
---|---|---|
committer | mitchell <unknown> | 2018-05-05 21:09:21 -0400 |
commit | c60d0059738eb49622dfe94e69d371856748ec18 (patch) | |
tree | 05661173868a8404e68720bdacec575292a7a896 | |
parent | 50e62c7c057261b8d1bd10c05216486549a9b604 (diff) | |
download | scintilla-mirror-c60d0059738eb49622dfe94e69d371856748ec18.tar.gz |
Backport: Make some changes recommended by clang-tidy.
Backport of changeset 6687:4cbf987c7590.
-rw-r--r-- | include/Platform.h | 4 | ||||
-rw-r--r-- | lexers/LexCPP.cxx | 19 | ||||
-rw-r--r-- | lexers/LexPython.cxx | 8 | ||||
-rw-r--r-- | lexlib/LexerSimple.h | 6 | ||||
-rw-r--r-- | lexlib/PropSetSimple.cxx | 2 | ||||
-rw-r--r-- | src/CaseConvert.cxx | 2 | ||||
-rw-r--r-- | src/CaseFolder.h | 2 | ||||
-rw-r--r-- | src/CellBuffer.cxx | 2 | ||||
-rw-r--r-- | src/ContractionState.cxx | 2 | ||||
-rw-r--r-- | src/Decoration.cxx | 4 | ||||
-rw-r--r-- | src/Document.h | 2 | ||||
-rw-r--r-- | src/Editor.h | 4 | ||||
-rw-r--r-- | src/PerLine.h | 10 | ||||
-rw-r--r-- | src/ScintillaBase.h | 2 | ||||
-rw-r--r-- | src/Selection.cxx | 2 | ||||
-rw-r--r-- | src/SparseVector.h | 4 | ||||
-rw-r--r-- | src/Style.h | 2 |
17 files changed, 39 insertions, 38 deletions
diff --git a/include/Platform.h b/include/Platform.h index e1c8a4c76..92180b354 100644 --- a/include/Platform.h +++ b/include/Platform.h @@ -406,10 +406,10 @@ public: class ListBox : public Window { public: ListBox(); - virtual ~ListBox(); + ~ListBox() override; static ListBox *Allocate(); - virtual void SetFont(Font &font)=0; + void SetFont(Font &font) override =0; virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_, int technology_)=0; virtual void SetAverageCharWidth(int width)=0; virtual void SetVisibleRows(int rows)=0; diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index 0b15a6c29..db8bf5d86 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -14,6 +14,7 @@ #include <ctype.h> #include <string> +#include <utility> #include <vector> #include <map> #include <algorithm> @@ -101,7 +102,7 @@ std::vector<std::string> StringSplit(const std::string &text, int separator) { std::vector<std::string> vs(text.empty() ? 0 : 1); for (const char ch : text) { if (ch == separator) { - vs.push_back(std::string()); + vs.emplace_back(); } else { vs.back() += ch; } @@ -228,8 +229,8 @@ struct PPDefinition { std::string value; bool isUndef; std::string arguments; - PPDefinition(Sci_Position line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, const std::string &arguments_="") : - line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) { + PPDefinition(Sci_Position line_, std::string key_, std::string value_, bool isUndef_ = false, std::string arguments_="") : + line(line_), key(std::move(key_)), value(std::move(value_)), isUndef(isUndef_), arguments(std::move(arguments_)) { } }; @@ -484,7 +485,7 @@ class LexerCPP : public ILexerWithMetaData { struct SymbolValue { std::string value; std::string arguments; - SymbolValue(const std::string &value_="", const std::string &arguments_="") : value(value_), arguments(arguments_) { + SymbolValue(std::string value_="", std::string arguments_="") : value(std::move(value_)), arguments(std::move(arguments_)) { } SymbolValue &operator = (const std::string &value_) { value = value_; @@ -1145,7 +1146,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i } break; case SCE_C_TRIPLEVERBATIM: - if (sc.Match("\"\"\"")) { + if (sc.Match(R"(""")")) { while (sc.Match('"')) { sc.Forward(); } @@ -1176,7 +1177,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i if (sc.Match('@', '\"')) { sc.SetState(SCE_C_VERBATIM|activitySet); sc.Forward(); - } else if (options.triplequotedStrings && sc.Match("\"\"\"")) { + } else if (options.triplequotedStrings && sc.Match(R"(""")")) { sc.SetState(SCE_C_TRIPLEVERBATIM|activitySet); sc.Forward(2); } else if (options.hashquotedStrings && sc.Match('#', '\"')) { @@ -1323,7 +1324,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i if (startValue < restOfLine.length()) value = restOfLine.substr(startValue); preprocessorDefinitions[key] = SymbolValue(value, args); - ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value, false, args)); + ppDefineHistory.emplace_back(lineCurrent, key, value, false, args); definitionsChanged = true; } else { // Value @@ -1334,7 +1335,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i if (OnlySpaceOrTab(value)) value = "1"; // No value defaults to 1 preprocessorDefinitions[key] = value; - ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value)); + ppDefineHistory.emplace_back(lineCurrent, key, value); definitionsChanged = true; } } @@ -1345,7 +1346,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i if (tokens.size() >= 1) { const std::string key = tokens[0]; preprocessorDefinitions.erase(key); - ppDefineHistory.push_back(PPDefinition(lineCurrent, key, "", true)); + ppDefineHistory.emplace_back(lineCurrent, key, "", true); definitionsChanged = true; } } diff --git a/lexers/LexPython.cxx b/lexers/LexPython.cxx index abe1c4be2..df80e499b 100644 --- a/lexers/LexPython.cxx +++ b/lexers/LexPython.cxx @@ -346,7 +346,7 @@ public: DefaultLexer(lexicalClasses, ELEMENTS(lexicalClasses)), subStyles(styleSubable, 0x80, 0x40, 0) { } - virtual ~LexerPython() { + ~LexerPython() override { } void SCI_METHOD Release() override { delete this; @@ -683,7 +683,7 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in } else if ((sc.state == SCE_P_TRIPLE) || (sc.state == SCE_P_FTRIPLE)) { if (sc.ch == '\\') { sc.Forward(); - } else if (sc.Match("\'\'\'")) { + } else if (sc.Match(R"(''')")) { sc.Forward(); sc.Forward(); sc.ForwardSetState(SCE_P_DEFAULT); @@ -692,7 +692,7 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in } else if ((sc.state == SCE_P_TRIPLEDOUBLE) || (sc.state == SCE_P_FTRIPLEDOUBLE)) { if (sc.ch == '\\') { sc.Forward(); - } else if (sc.Match("\"\"\"")) { + } else if (sc.Match(R"(""")")) { sc.Forward(); sc.Forward(); sc.ForwardSetState(SCE_P_DEFAULT); @@ -723,7 +723,7 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in if (sc.ch == quote) { if (IsPySingleQuoteStringState(stack_state)) { matching_stack_i = stack_i; - } else if (quote == '"' ? sc.Match("\"\"\"") : sc.Match("'''")) { + } else if (quote == '"' ? sc.Match(R"(""")") : sc.Match("'''")) { matching_stack_i = stack_i; } } diff --git a/lexlib/LexerSimple.h b/lexlib/LexerSimple.h index 0edeabe8f..87882eaeb 100644 --- a/lexlib/LexerSimple.h +++ b/lexlib/LexerSimple.h @@ -16,9 +16,9 @@ class LexerSimple : public LexerBase { std::string wordLists; public: explicit LexerSimple(const LexerModule *module_); - const char * SCI_METHOD DescribeWordListSets(); - void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess); - void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess); + const char * SCI_METHOD DescribeWordListSets() override; + void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) override; + void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) override; }; } diff --git a/lexlib/PropSetSimple.cxx b/lexlib/PropSetSimple.cxx index e8f0364fa..ed473bc3b 100644 --- a/lexlib/PropSetSimple.cxx +++ b/lexlib/PropSetSimple.cxx @@ -100,7 +100,7 @@ struct VarChain { static int ExpandAllInPlace(const PropSetSimple &props, std::string &withVars, int maxExpands, const VarChain &blankVars) { size_t varStart = withVars.find("$("); while ((varStart != std::string::npos) && (maxExpands > 0)) { - const size_t varEnd = withVars.find(")", varStart+2); + const size_t varEnd = withVars.find(')', varStart+2); if (varEnd == std::string::npos) { break; } diff --git a/src/CaseConvert.cxx b/src/CaseConvert.cxx index 49205cb3e..ce191f574 100644 --- a/src/CaseConvert.cxx +++ b/src/CaseConvert.cxx @@ -593,7 +593,7 @@ public: return characters.size() > 0; } void Add(int character, const char *conversion) { - characterToConversion.push_back(CharacterConversion(character, conversion)); + characterToConversion.emplace_back(character, conversion); } const char *Find(int character) { const std::vector<int>::iterator it = std::lower_bound(characters.begin(), characters.end(), character); diff --git a/src/CaseFolder.h b/src/CaseFolder.h index 790da0b29..5fa65870e 100644 --- a/src/CaseFolder.h +++ b/src/CaseFolder.h @@ -21,7 +21,7 @@ protected: char mapping[256]; public: CaseFolderTable(); - virtual ~CaseFolderTable(); + ~CaseFolderTable() override; size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override; void SetTranslation(char ch, char chTranslation); void StandardASCII(); diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index d751e5f28..d15745fd2 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -52,7 +52,7 @@ public: LineVector() : starts(256), perLine(0) { Init(); } - ~LineVector() { + ~LineVector() override { starts.DeleteAll(); } void Init() override { diff --git a/src/ContractionState.cxx b/src/ContractionState.cxx index 0b4125b6a..a360deb56 100644 --- a/src/ContractionState.cxx +++ b/src/ContractionState.cxx @@ -55,7 +55,7 @@ public: void operator=(const ContractionState &) = delete; ContractionState(ContractionState &&) = delete; void operator=(ContractionState &&) = delete; - ~ContractionState(); + ~ContractionState() override; void Clear() noexcept override; diff --git a/src/Decoration.cxx b/src/Decoration.cxx index 6a3269214..1ca1d9c90 100644 --- a/src/Decoration.cxx +++ b/src/Decoration.cxx @@ -35,7 +35,7 @@ public: explicit Decoration(int indicator_) : indicator(indicator_) { } - ~Decoration() { + ~Decoration() override { } bool Empty() const override { @@ -85,7 +85,7 @@ class DecorationList : public IDecorationList { public: DecorationList(); - ~DecorationList(); + ~DecorationList() override; const std::vector<const IDecoration*> &View() const override { return decorationView; diff --git a/src/Document.h b/src/Document.h index 15f9b6b44..ba811b8da 100644 --- a/src/Document.h +++ b/src/Document.h @@ -267,7 +267,7 @@ public: // Deleted so Document objects can not be copied. Document(const Document &) = delete; void operator=(const Document &) = delete; - virtual ~Document(); + ~Document() override; int AddRef(); int SCI_METHOD Release() override; diff --git a/src/Editor.h b/src/Editor.h index 2e8ac1503..db070916d 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -271,14 +271,14 @@ protected: // ScintillaBase subclass needs access to much of Editor // The top left visible point in main window coordinates. Will be 0,0 except for // scroll views where it will be equivalent to the current scroll position. - virtual Point GetVisibleOriginInMain() const override; + Point GetVisibleOriginInMain() const override; PointDocument DocumentPointFromView(Point ptView) const; // Convert a point from view space to document Sci::Line TopLineOfMain() const override; // Return the line at Main's y coordinate 0 virtual PRectangle GetClientRectangle() const; virtual PRectangle GetClientDrawingRectangle(); PRectangle GetTextRectangle() const; - virtual Sci::Line LinesOnScreen() const override; + Sci::Line LinesOnScreen() const override; Sci::Line LinesToScroll() const; Sci::Line MaxScrollPos() const; SelectionPosition ClampPositionIntoDocument(SelectionPosition sp) const; diff --git a/src/PerLine.h b/src/PerLine.h index f1df0c31d..66990799a 100644 --- a/src/PerLine.h +++ b/src/PerLine.h @@ -51,7 +51,7 @@ public: // Deleted so Worker objects can not be copied. LineMarkers(const LineMarkers &) = delete; void operator=(const LineMarkers &) = delete; - virtual ~LineMarkers(); + ~LineMarkers() override; void Init() override; void InsertLine(Sci::Line line) override; void RemoveLine(Sci::Line line) override; @@ -73,7 +73,7 @@ public: // Deleted so Worker objects can not be copied. LineLevels(const LineLevels &) = delete; void operator=(const LineLevels &) = delete; - virtual ~LineLevels(); + ~LineLevels() override; void Init() override; void InsertLine(Sci::Line line) override; void RemoveLine(Sci::Line line) override; @@ -92,7 +92,7 @@ public: // Deleted so Worker objects can not be copied. LineState(const LineState &) = delete; void operator=(const LineState &) = delete; - virtual ~LineState(); + ~LineState() override; void Init() override; void InsertLine(Sci::Line line) override; void RemoveLine(Sci::Line line) override; @@ -110,7 +110,7 @@ public: // Deleted so Worker objects can not be copied. LineAnnotation(const LineAnnotation &) = delete; void operator=(const LineAnnotation &) = delete; - virtual ~LineAnnotation(); + ~LineAnnotation() override; void Init() override; void InsertLine(Sci::Line line) override; void RemoveLine(Sci::Line line) override; @@ -137,7 +137,7 @@ public: // Deleted so Worker objects can not be copied. LineTabstops(const LineTabstops &) = delete; void operator=(const LineTabstops &) = delete; - virtual ~LineTabstops(); + ~LineTabstops() override; void Init() override; void InsertLine(Sci::Line line) override; void RemoveLine(Sci::Line line) override; diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h index f2633ba90..202098129 100644 --- a/src/ScintillaBase.h +++ b/src/ScintillaBase.h @@ -55,7 +55,7 @@ protected: // Deleted so ScintillaBase objects can not be copied. explicit ScintillaBase(const ScintillaBase &) = delete; ScintillaBase &operator=(const ScintillaBase &) = delete; - virtual ~ScintillaBase(); + ~ScintillaBase() override; void Initialise() override {} void Finalise() override; diff --git a/src/Selection.cxx b/src/Selection.cxx index f6e4bdad0..dc4d179d9 100644 --- a/src/Selection.cxx +++ b/src/Selection.cxx @@ -403,7 +403,7 @@ Sci::Position Selection::VirtualSpaceFor(Sci::Position pos) const { void Selection::Clear() { ranges.clear(); - ranges.push_back(SelectionRange()); + ranges.emplace_back(); mainRange = ranges.size() - 1; selType = selStream; moveExtends = false; diff --git a/src/SparseVector.h b/src/SparseVector.h index 867409895..1b59f3570 100644 --- a/src/SparseVector.h +++ b/src/SparseVector.h @@ -26,8 +26,8 @@ private: } public: SparseVector() : empty() { - starts.reset(new Partitioning<Sci::Position>(8)); - values.reset(new SplitVector<T>()); + starts = std::unique_ptr<Partitioning<Sci::Position>>(new Partitioning<Sci::Position>(8)); + values = std::unique_ptr<SplitVector<T>>(new SplitVector<T>()); values->InsertEmpty(0, 2); } ~SparseVector() { diff --git a/src/Style.h b/src/Style.h index f2d70039f..e119bc65e 100644 --- a/src/Style.h +++ b/src/Style.h @@ -36,7 +36,7 @@ public: // FontAlias objects can not be assigned except for initialization FontAlias &operator=(const FontAlias &) = delete; FontAlias(const FontAlias &); - virtual ~FontAlias(); + ~FontAlias() override; void MakeAlias(Font &fontOrigin); void ClearFont(); }; |