summaryrefslogtreecommitdiffstats
path: root/styleguide
Commit message (Collapse)AuthorAgeFilesLines
* Replace base::Tuple implementation with std::tupletzik2016-02-111-8/+10
| | | | | | | | | | | * Remove base::Tuple and make base::Tuple as an alias of std::tuple. * Expand the alias where it's used in a class template specialization to avoid MSVC2013 internal compiler error. BUG=554987 Review URL: https://codereview.chromium.org/1673563002 Cr-Commit-Position: refs/heads/master@{#374878}
* Allow use of container cbegin() and cend() methods, plus sample uses.pkasting2016-02-111-15/+12
| | | | | | | | | | | This also fixes a small bug in the histogram recording of TabStripModelStatsRecorder::ActiveTabChanged() I spotted while doing this. BUG=none TEST=none Review URL: https://codereview.chromium.org/1675483002 Cr-Commit-Position: refs/heads/master@{#374827}
* Allow string::front() and back() and update the codebase to use back().pkasting2016-02-051-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | I searched for "length() - 1]", which won't find all potential sites to use back(), but should hit a reasonable number. These were all converted. I don't consider str.front() to be vastly more readable than str[0], so I made no effort to seek these out and change them. I did change code to use front() when it would make for better parallel structure with a place I was making use back(), e.g.: if (str[0] == 'x' && str[str.length() - 1] == 'y') { ...was transformed to: if (str.front() == 'x' && str.back() == 'y') { ...and not: if (str[0] == 'x' && str.back() == 'y') { I also added front() and back() methods to StringPiece so people wouldn't need to distinguish between string and StringPiece for these purposes. BUG=none TEST=none Review URL: https://codereview.chromium.org/1663253004 Cr-Commit-Position: refs/heads/master@{#373672}
* Allow emplacement methods for containers, with some cautions.pkasting2016-02-041-11/+8
| | | | | | | | | BUG=none TEST=none Review URL: https://codereview.chromium.org/1664943003 Cr-Commit-Position: refs/heads/master@{#373637}
* styleguide: Fix/clarify the cbegin/cend rules are for container methodsdanakj2016-02-041-3/+3
| | | | | | | | | | Not for the global std::cbegin/cend, which are in C++14. R=Nico, jbroman Review URL: https://codereview.chromium.org/1669683002 Cr-Commit-Position: refs/heads/master@{#373604}
* Allow <algorithm>.pkasting2016-02-041-36/+40
| | | | | | | | | | | | | This also makes the language consistent for the three "allow <library>" items and removes some more-specific entries that are subsumed by the more general items. BUG=none TEST=none Review URL: https://codereview.chromium.org/1662933002 Cr-Commit-Position: refs/heads/master@{#373418}
* Allow std::unordered_*.davidben2016-01-221-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of https://codereview.chromium.org/1502373009 with some fixes for components/metrics/leak_detector allocator type mismatches. Original issue's description: > Allow std::unordered_*. > > base::hash_* is, as a transition step, implemented in terms of > std::unordered_*. Later commits will convert existing uses. > > Also fix a host of IWYU problems that arose from this CL. > > (NOPRESUBMIT because the wstring presubmit check is overzealous > and complains about the reference to wstring in the comment.) > > Committed: https://crrev.com/3f37f7f1459e7b5a452c0e433493e0a6e9649ca7 > Cr-Commit-Position: refs/heads/master@{#370553} BUG=576864 TBR=derat@chromium.org,danakj@chromium.org,dalecurtis@chromium.org,jbauman@chromium.org,blundell@chromium.org NOPRESUBMIT=true CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1615713003 Cr-Commit-Position: refs/heads/master@{#370867}
* Revert of Allow std::unordered_*. (patchset #15 id:280001 of ↵davidben2016-01-211-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/1502373009/ ) Reason for revert: MSan build failure. https://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20Linux%20ChromeOS%20MSan%20Builder/builds/12498 Original issue's description: > Allow std::unordered_*. > > base::hash_* is, as a transition step, implemented in terms of > std::unordered_*. Later commits will convert existing uses. > > Also fix a host of IWYU problems that arose from this CL. > > (NOPRESUBMIT because the wstring presubmit check is overzealous > and complains about the reference to wstring in the comment.) > > NOPRESUBMIT=true > BUG=576864 > TBR=derat@chromium.org,blundell@chromium.org,jbauman@chromium.org,dalecurtis@chromium.org > CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel > > Committed: https://crrev.com/3f37f7f1459e7b5a452c0e433493e0a6e9649ca7 > Cr-Commit-Position: refs/heads/master@{#370553} TBR=danakj@chromium.org,thakis@chromium.org,derat@chromium.org,blundell@chromium.org,dalecurtis@chromium.org,jbauman@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=576864 Review URL: https://codereview.chromium.org/1610023003 Cr-Commit-Position: refs/heads/master@{#370559}
* Allow std::unordered_*.davidben2016-01-211-22/+22
| | | | | | | | | | | | | | | | | | | base::hash_* is, as a transition step, implemented in terms of std::unordered_*. Later commits will convert existing uses. Also fix a host of IWYU problems that arose from this CL. (NOPRESUBMIT because the wstring presubmit check is overzealous and complains about the reference to wstring in the comment.) NOPRESUBMIT=true BUG=576864 TBR=derat@chromium.org,blundell@chromium.org,jbauman@chromium.org,dalecurtis@chromium.org CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1502373009 Cr-Commit-Position: refs/heads/master@{#370553}
* styleguide: Ban ref-qualified member functions, <atomic>, std::shared_ptr ↵jbroman2016-01-071-34/+43
| | | | | | | | | | and std::initializer_list. NOTRY=true Review URL: https://codereview.chromium.org/1570443005 Cr-Commit-Position: refs/heads/master@{#368198}
* styleguide: Allow std::forward with guidance.jbroman2016-01-071-0/+11
| | | | | | | | | | Uses already exist in Chromium, so this works on our platforms. NOTRY=true Review URL: https://codereview.chromium.org/1571483002 Cr-Commit-Position: refs/heads/master@{#368189}
* Replace jamesr with jbroman in styleguide/c++/OWNERS.danakj2015-12-091-1/+1
| | | | | | Review URL: https://codereview.chromium.org/1506203007 Cr-Commit-Position: refs/heads/master@{#364217}
* Correct &amp; entity typo in C++11 guide.jbroman2015-12-091-2/+2
| | | | | | Review URL: https://codereview.chromium.org/1516693002 Cr-Commit-Position: refs/heads/master@{#364210}
* styleguide: Make default function template arguments an allowed feature.vmpstr2015-12-091-10/+10
| | | | | | | | | | | This patch moves default function template arguments from being "to be discussed" to being allowed. R=thakis@chromium.org Review URL: https://codereview.chromium.org/1515493003 Cr-Commit-Position: refs/heads/master@{#364132}
* C++11 style guide: Ban alignas/alignof for now.yutak2015-12-081-10/+19
| | | | | | | | | | | | | | | | | This patch moves C++11 alignment features (alignas/alignof) to the banned language features section, since MSVS 2013 does not support them. MSVS 2015 seems to support them, so we can revisit once MSVS 2015 is rolled out. Discussion thread: https://groups.google.com/a/chromium.org/forum/#!msg/cxx/rwXN02jzzq0/CpUc1ZzMBQAJ BUG=none Review URL: https://codereview.chromium.org/1509123002 Cr-Commit-Position: refs/heads/master@{#363798}
* style: Allow std::move, the std::copy counterpart.vmpstr2015-12-071-0/+8
| | | | | | | | | | | | This patch allows the algorithm std::move usage. CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel R=thakis@chromium.org Review URL: https://codereview.chromium.org/1506943002 Cr-Commit-Position: refs/heads/master@{#363579}
* Move Rvalue references to the allowed section of the C++11 styleguide.danakj2015-12-071-10/+19
| | | | | | | | | | | They were in the library area, but they are a language feature, so moved to the language area. R=Nico Review URL: https://codereview.chromium.org/1499293002 Cr-Commit-Position: refs/heads/master@{#363568}
* Allow <cmath>.pkasting2015-12-061-28/+23
| | | | | | | | | | | While here, this also * Alphabetizes the section * Eliminates a period after "Discussion thread" in one place (since none of the other entries had one) * Formats the file one-cell-per-line (since most of the entries were already like this) Review URL: https://codereview.chromium.org/1498333002 Cr-Commit-Position: refs/heads/master@{#363351}
* Add std::make_move_iterator to "C++11 use in Chromium"ricea2015-12-041-0/+9
| | | | | | | | | | | | | | Permit the use of the C++11 library function std::make_move_iterator. Discussion thread: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/lccnUljOHQU Tested in crrev.com/1483913002 BUG=none Review URL: https://codereview.chromium.org/1495953002 Cr-Commit-Position: refs/heads/master@{#363203}
* Update C++11 Style Guide to allow std::arrayericrk2015-12-011-9/+9
| | | | | | | | | | | Discussion thread here: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/pVRQCRWHEU8 Test CQ here: crrev.com/1482463003 BUG= Review URL: https://codereview.chromium.org/1483183002 Cr-Commit-Position: refs/heads/master@{#362301}
* [StyleGuide] Allow begin and end non-member functionsruuda2015-11-231-12/+12
| | | | | | | | | | | | | | | Allow usage of |std::begin| and |std::end|. This is useful for iterating fixed-size arrays. Discussion thread: https://groups.google.com/a/chromium.org/d/topic/cxx/5iFNE8P5qT4/discussion Furthermore, this CL replaces home-brewn |std::end|-like functions in base/trace_event with |std::end| to verify that <iterator> is supported on all platforms. Review URL: https://codereview.chromium.org/1471683002 Cr-Commit-Position: refs/heads/master@{#361192}
* Make vector_as_array use std::vector::data and switch a few directories.davidben2015-11-191-0/+8
| | | | | | | | | | | Get //base and //crypto. This revealed an IWYU problem in //components/policy, so go and convert that too. BUG=556678 Review URL: https://codereview.chromium.org/1441543002 Cr-Commit-Position: refs/heads/master@{#360639}
* Add a table of contents to the c++11 style guide.danakj2015-11-181-7/+23
| | | | | | | | | | | | It's hard/annoying to find the library allowed features by scrolling, now we can link to them all, yay. R=thakis@chromium.org BUG=554287 Review URL: https://codereview.chromium.org/1452373002 Cr-Commit-Position: refs/heads/master@{#360409}
* styleguide: Allow enable_if, conditional, and other type_traits.vmpstr2015-11-181-20/+20
| | | | | | | | R=thakis@chromium.org Review URL: https://codereview.chromium.org/1457673002 Cr-Commit-Position: refs/heads/master@{#360310}
* styleguide: Allow std::move for move semantics.vmpstr2015-11-161-9/+10
| | | | | | | | R=danakj@chromium.org, thakis@chromium.org Review URL: https://codereview.chromium.org/1450013002 Cr-Commit-Position: refs/heads/master@{#359949}
* Use std::tie for multi-member comparisonsjsbell2015-11-131-2/+10
| | | | | | | | | | | | | | | | | Per discussion on cxx@chromium.org, update C++ style guide to allow limited use of std::tie() for implementing lexicographical comparisons of structures, which are conceptually simple but verbose and easy to get wrong. This first CL updates a handful of cases as a proof-of- concept; a tracking bug is filed to audit the code base. BUG=555171 R=thakis@chromium.org Review URL: https://codereview.chromium.org/1438073002 Cr-Commit-Position: refs/heads/master@{#359467}
* Update Google C++ Style guide URL in c++11.htmlvabr2015-11-121-13/+12
| | | | | | | | | | | | | | | | The Google C++ style guide moved: https://google-styleguide.googlecode.com/svn/trunk/cppguide.html -> https://google.github.io/styleguide/cppguide.html. While that redirect works on server-side, it discards the fragment identifier, making the links less useful. This CL changes the Styleguide links to the new URL. The only issue has been with #Initialization, which does not have a corresponding entry in the new Styleguide. Looking at similar entries, there is https://google.github.io/styleguide/cppguide.html#Delegating_and_inheriting_constructors which mentions in-class member initialization, but does not seem to explicitly comment on that. This CL therefore drops the #Initialization Styleguide link from c++11.html completely. R=thakis@chromium.org BUG=None Review URL: https://codereview.chromium.org/1434123003 Cr-Commit-Position: refs/heads/master@{#359325}
* styleguide: Document google style exceptions for C++11 library.danakj2015-11-121-12/+16
| | | | | | | | | | | | Some features are banned by the public google guide, some by internal guide. Mention these in our list and the reasons given. R=thakis@chromium.org BUG=554287 Review URL: https://codereview.chromium.org/1428373009 Cr-Commit-Position: refs/heads/master@{#359268}
* Add ref-qualified member functions as undiscussed in the C++11 guide.danakj2015-11-111-0/+9
| | | | | | | | | R=thakis@chromium.org BUG=554287 Review URL: https://codereview.chromium.org/1431423002 Cr-Commit-Position: refs/heads/master@{#358983}
* Prepare chromium-cpp.appspot.com for c++11 library stuff.Nico Weber2015-11-111-46/+81
| | | | | | | | | BUG=554287 R=danakj@chromium.org Review URL: https://codereview.chromium.org/1436693002 . Cr-Commit-Position: refs/heads/master@{#358972}
* Fix reference to non-existent MSVS versionbrucedawson2015-11-061-1/+1
| | | | | | | | | | | MSVS2014 does not exist. MSVS2013 has the bugs with raw string literals. They might work in MSVS2015 - we'll see. R=thakis@chromium.org Review URL: https://codereview.chromium.org/1416033004 Cr-Commit-Position: refs/heads/master@{#358358}
* styleguide: mention "alignof" operation under "Alignment Features"mdempsky2015-09-171-0/+1
| | | | | | | | For completeness. Review URL: https://codereview.chromium.org/1312813007 Cr-Commit-Position: refs/heads/master@{#349525}
* c++11: Fill in several documentation link TODOsdhsharp2015-08-181-8/+16
| | | | | | | | | | | | | Fill in documentation links for automatic types, nullptr, range-for, variadic templates, constexpr, raw strings, rvalue references, and user-defined literals. All links are to the relevant section of cppreference.com. R=thakis@chromium.org Review URL: https://codereview.chromium.org/1296373002 Cr-Commit-Position: refs/heads/master@{#343776}
* Add discussion thread link to C++11 rvalue feature status rowalancutter2015-07-021-1/+1
| | | | | | | | | Updates rvalue feature status row on http://chromium-cpp.appspot.com/ to include discussion thread link. Review URL: https://codereview.chromium.org/1216303003 Cr-Commit-Position: refs/heads/master@{#337145}
* Add Dana to C++ styleguide owners, remove Albertjamesr2015-03-311-1/+1
| | | | | | | | | | ajwong is (unfortunately) no longer active on this project. R=danakj@chromium.org,ajwong@chromium.org Review URL: https://codereview.chromium.org/1021673004 Cr-Commit-Position: refs/heads/master@{#323044}
* c++11: Allow in-class member initializationhashimoto2015-01-221-14/+17
| | | | | | | | | | | Move this feature to the allowed section. Try using it in timer_unittest.cc R=thakis@chromium.org Review URL: https://codereview.chromium.org/866663002 Cr-Commit-Position: refs/heads/master@{#312621}
* Add another discussion thread under auto in the c++11 style guide.danakj2014-12-191-1/+1
| | | | | | | | | | | This thread was very useful and will probably be useful for others in the future. R=Nico Review URL: https://codereview.chromium.org/817003002 Cr-Commit-Position: refs/heads/master@{#309244}
* Add HTML title to C++11 style guide.bratell2014-12-171-0/+1
| | | | | | | | | R=thakis@chromium.org BUG= Review URL: https://codereview.chromium.org/814543003 Cr-Commit-Position: refs/heads/master@{#308813}
* Allow C++11 Delegated Constructors.andersr2014-11-071-10/+10
| | | | | | | | | | | An as-small-as-possible change has been made to JSONReader to test this feature. R=jamesr@chromium.org Review URL: https://codereview.chromium.org/685603005 Cr-Commit-Position: refs/heads/master@{#303245}
* styleguide: Allow "= default" and "= delete"mdempsky2014-11-071-19/+20
| | | | | | | | NOTRY=true Review URL: https://codereview.chromium.org/685933004 Cr-Commit-Position: refs/heads/master@{#303191}
* c++11: Allow lambdas, with some restrictions.thakis2014-11-041-8/+17
| | | | | | | | | | | Thanks to David Michael <dmichael@chromium.org> for condensing the discussion thread to a recommendation! BUG=none Review URL: https://codereview.chromium.org/699283002 Cr-Commit-Position: refs/heads/master@{#302708}
* styleguide: ban inherited constructorsmdempsky2014-10-301-1/+12
| | | | | | Review URL: https://codereview.chromium.org/691803004 Cr-Commit-Position: refs/heads/master@{#302188}
* Clarify that enum classes include explicit underlying types.thakis2014-10-291-5/+7
| | | | | | | | | | | Also use that in one place to forward-declare an enum, to make sure it actually works. No behavior change. BUG=none Review URL: https://codereview.chromium.org/678333004 Cr-Commit-Position: refs/heads/master@{#301766}
* Update C++11 feature page.thakis2014-10-281-37/+37
| | | | | | | | | | | | Allow decltype. Disallow long long, uniform initialization, raw string literals. BUG=427584 NOTRY=true Review URL: https://codereview.chromium.org/685663002 Cr-Commit-Position: refs/heads/master@{#301562}
* styleguide: Allow C++11 "enum class"mdempsky2014-10-201-10/+12
| | | | | | Review URL: https://codereview.chromium.org/667483003 Cr-Commit-Position: refs/heads/master@{#300291}
* Fix a broken link in the c++11 guide.yhirano2014-10-141-1/+1
| | | | | | | | | BUG=None NOTRY=true Review URL: https://codereview.chromium.org/653683003 Cr-Commit-Position: refs/heads/master@{#299574}
* c++11: Alphabetize c++11.htmldavidben2014-10-101-8/+8
| | | | | | | | | | Missed that they were alphabetized earlier. BUG=none Review URL: https://codereview.chromium.org/647773002 Cr-Commit-Position: refs/heads/master@{#299212}
* c++11: Allow type aliases.davidben2014-10-101-8/+8
| | | | | | | | BUG=none Review URL: https://codereview.chromium.org/644833002 Cr-Commit-Position: refs/heads/master@{#299018}
* Move explicit conversion operators to the banned section.dcheng2014-09-261-11/+11
| | | | | | | | Unfortunately, they are broken as implemented in MSVS 2013. Review URL: https://codereview.chromium.org/609963004 Cr-Commit-Position: refs/heads/master@{#297066}
* Consolidate all banned features into one table.avi2014-09-261-23/+9
| | | | | | | | | | This is a slight cleanup after d9a02e76127634286ff0c760f87db260b367492a. BUG= Review URL: https://codereview.chromium.org/611623002 Cr-Commit-Position: refs/heads/master@{#297052}