Squashed 'third_party/googletest/' changes from 2fe3bd994..f5e592d8e

f5e592d8e Googletest export
065a0c814 Googletest export
680a5aa33 Googletest export
719fd2d36 Googletest export
6e8a8623f Googletest export
252ce9c52 Googletest export
11da093e0 Merge pull request #3174 from sebkraemer:issue-15644
23ef29555 Merge pull request #3314 from Vollstrecker:master
f16d43cd3 Googletest export
0d9daa993 Googletest export
566fdcc92 Merge pull request #3364 from jbampton:fix-spelling
8043818e1 Use URL instead of git-repo
eaf9a3fd7 Googletest export
831bc0350 Googletest export
124e87a30 Apply missing suggestions from code review for GTEST_SKIP
1de97fd1c Apply suggestions from code review for GTEST_SKIP documentation
c4ed56eb7 Add subsection for GTEST_SKIP documentation
050b51751 chore: fix spelling
c79eb87c1 Mention to explicitely set the option to it's default.
8d664b94b Googletest export
38c316fc5 Changes like Requested.
4400d68de Googletest export
486a4a6be Googletest export
c3fc92f0b Googletest export
ec7fa96f2 Merge pull request #3158 from GauthamBanasandra:patch-1
965f8ecbf Googletest export
ad462b70c Merge pull request #3319 from a-sully:patch-1
6a5eb8074 Googletest export
8a65bc030 Googletest export
d0303e40c Googletest export
601a68150 Googletest export
54689b193 Googletest export
5c8ca58ed Googletest export
4048829db Googletest export
6c5c4554a Merge pull request #3155 from ZedThree:cmake-alias-libraries
df7fee587 Googletest export
c0dd0817c Googletest export
66836f0a9 Googletest export
6dabd081e Googletest export
5142ccd2d Googletest export
4595745f7 Googletest export
53cc7cd1e Googletest export
d4e3b8ced Googletest export
32ad3c8c3 Googletest export
1a8ecf181 Googletest export
3ff1e8b98 Merge pull request #3315 from zaucy:master
9c047902a Update nicestrictnaggy gmock cook_book links
b7d472f12 Merge pull request #3291 from Be-ing:remove_zi_msvc
ac1d60c2b Googletest export
3bd41ab23 Internal change
d0dbf0f6c Googletest export
98ca42067 Googletest export
5c08f92c8 Use @platforms instead of @bazel_tools for windows constraint
5065389aa Use Fetchcontent instead of ExternalProject
e8512bc38 Googletest export
861d535e2 Googletest export
763eaa430 Googletest export
bb4f87e6c Googletest export
bf465ff05 Internal change
bcfcf75ef Merge pull request #3184 from N-Dekker:PrintTo-type_index-overload
79b556eff Googletest export
e7e591764 Googletest export
32983d211 Googletest export
de41f8223 Googletest export
e8b478a73 Googletest export
3832a41ef Googletest export
497db77a0 remove -Zi from MSVC compiler options
ac3c2a8d0 overload PrintTo for std::type_info and std::type_index
1de637fbd Googletest export
d9c309fda Googletest export
daa0df7b4 Googletest export
7fb047bca Googletest export
589377871 Googletest export
bc32a8745 Googletest export
1a5a78b9a Googletest export
9e2c7ab0d Googletest export
0a3a3a845 Googletest export
e935e6c38 Googletest export
609281088 Googletest export
eac6a02cc Googletest export
e09d2b6a7 Merge pull request #3216 from corentinmusard:master
d4144d4ee Googletest export
0b4ecf54c Internal change
e16577341 Merge pull request #3262 from platisd:master
af058521a Googletest export
9c2293af0 Googletest export
36b779204 Googletest export
46b188577 Do not include void into mocked method arguments
f3ef7e173 Googletest export
9e975a022 Googletest export
7e73533ab Googletest export
b6323d216 Googletest export
aea7f60bf Googletest export
8599d312c Googletest export
fd873f6d7 Googletest export
f4e7727cf Googletest export
8c269618a Googletest export
f23cf0002 Googletest export
726118846 Googletest export
d11439880 Googletest export
273f8cb05 Googletest export
8a7618672 Googletest export
3351eba0a Googletest export
0fe14e2cd Merge pull request #3231 from dreamer:po/fix-primer-link
e3827e4e4 Googletest export
a1dde9b18 Googletest export
59dea67b8 Googletest export
997c36c18 Googletest export
4898cdacf Merge pull request #3204 from kuzkry:CmpHelperXX-overloads-removal
2c06d021d Googletest export
17922f344 Googletest export
14098f201 Googletest export
f31c82efe Fix link to Google Test Primer
d128fc825 Googletest export
5ae6e6e7e Merge pull request #3214 from kuzkry:broken-link
41ecb1025 Googletest export
b0eaf9d84 Googletest export
a3c9bb99f Merge pull request #3206 from davidben:format-attr-2
a2f906be6 Googletest export
1b4e47767 fix a broken link
6c58c11d5 Googletest export
0186caf75 Googletest export
6b2e74905 Googletest export
50ce52016 Googletest export
c13c27a51 Googletest export
489283524 Googletest export
996b65e64 Googletest export
f8304d762 Googletest export
95a9bdd9f Googletest export
d72813110 Merge pull request #3189 from ellert:gtest-help-test-GNU/kFreeBSD
e6e2f3f45 Simplify cmake install file
28041f642 Restore GTEST_ATTRIBUTE_PRINTF_ on ColoredPrintf
100ffc33f remove explicit function overloads of CmpHelper?? for BiggestInt arguments
389cb68b8 Merge pull request #3094 from chuckatkins:update-deprecated-cmake-version
ed1bf8684 Fix gtest-help-test failure on GNU/kFreeBSD
ca4b7c9ff Googletest export
4f6fa7087 Googletest export
18f8200e3 Googletest export
5a509dbd2 Googletest export
fb4b3b6b9 Googletest export
e5644f5f1 Googletest export
8779937dd Googletest export
a02a59160 Googletest export
7bf5057a0 Merge pull request #3159 from malcops:master
d0e0529af Googletest export
4fac06b45 Fix typo in CLI help message
626ce00be Fix typo
2292b6d85 CMake: Add namespaced ALIAS library
93748a946 Googletest export
141e95949 Googletest export
73979ee1b Googletest export
b8c4edf95 Googletest export
d73706911 Googletest export
1544828d2 Googletest export
b1fbd33c0 Googletest export
efe703618 Googletest export
60b8906d1 Merge pull request #3114 from marbre:FindPython
36d8eb532 Merge pull request #3118 from vinsonlee:initialize-TestInfo-is_in_another_shard_
341429be3 Initialize TestInfo member is_in_another_shard_ in constructor.
9dce5e5d8 Googletest export
0e202cdbe Googletest export
a1adec799 Googletest export
e7ed50fd1 Googletest export
d385a7729 Googletest export
336fd36fe Googletest export
b4999a1e2 Googletest export
826e9f25a Refactor finding python
035de8c7f Merge pull request #3109 from hyukmyeong:typo
cda390645 Merge pull request #3090 from knutpett:working_dir_on_diskless
fbef0711c Googletest export
0c400f67f Googletest export
e5686bb18 Only save original working directory if death tests are enabled
87347d545 fix typos
d89b36302 Googletest export
710f9c11c Googletest export
fb98f7447 Merge pull request #3008 from hyukmyeong:update_tutorial
9fd284386 Merge pull request #2714 from kuzkry:remove-repeated-include
ee2c62a6d Merge pull request #3086 from sfc-gh-ebrossard:master
282877317 Googletest export
32f4f52d9 Bump CMake minimum to 2.8.12
bd619dee0 Add instructions for sanitizer integration
3005672db Merge pull request #3044 from manavrion:improve_file_path_normalize
1845b85a0 Googletest export
a6dfd3aca Merge pull request #3073 from ArthurSonzogni:fix-typo
fe0ee53fe Fix typo "definedin in" => "defined in"
620659ed9 Googletest export
252ee42d3 Googletest export
3c95bf552 Googletest export
ebbeee39f Merge pull request #3042 from Aralox:Issue-2135-modify-mock-template-args-AX-to-TArgX
a46218886 Googletest export
f3dbe3ec4 Googletest export
7e7e94429 Googletest export
8ccc5ec5c Googletest export
79dc0f231 Googletest export
b2cb220eb Googletest export
fb239f0e4 Googletest export
b55f834c5 Googletest export
6abcfac2f Merge pull request #3050 from peternewman:patch-1
d4df326d6 Googletest export
d11c76175 Googletest export
2cf1f99b9 Googletest export
0555b0eac Googletest export
72512aa89 Googletest export
4abb012c7 Merge pull request #2837 from inazarenko:duck_type_protos
870a6b556 Fix a typo
113ca75c3 Improve FilePath::Normalize method
07f486922 Merge pull request #3030 from ranodeepbanerjee:patch-1
ee66065bc Issue 2135: Change template args in NiceMock, NaggyMock and StrictMock from A1, A2, ... to TArg1, TArg2,... to avoid clash with legacy header files
1fb1bb23b Googletest export
ed17c8ccc A slight Gramatical change.
477998eef Googletest export
2ff8d94d0 Googletest export
a0cbbba13 Merge pull request #3024 from Thomas-Barbier-1A:fix_warning_maybe_unintialized
f278076ef Merge pull request #3027 from keshavgbpecdelhi:patch-2
705b9c1af Googletest export
1f3484a2b Update cook_book.md
fe4d5f108 Googletest export
df94fc5f7 Googletest export
634c52d99 Merge pull request #3014 from JethroSama:patch-1
b5687db55 Googletest export
4679637f1 Fix warning maybe-uninitialized
7aca84427 Googletest export
bb2725346 Googletest export
4181d7a16 Update README.md, added missing 'a'
242ee2720 Remove spaces between Google Test and Google Mock
5afcb3ca4 Add follow-up patch for more natural reading
2d1a18ff3 Apply the reviewed comment
32437f41e Remove a space
7aae2ac34 Improve the tutorial that may be confusing
a4ab0abb9 Googletest export
646603961 Merge pull request #2994 from xerus2000:gmock-docs
5f8fcf4aa Googletest export
7b1cf6dd5 Googletest export
af1e75ce0 Googletest export
df6b75949 Googletest export
296c9d29b Add timestamp to in old method mock macro guide
1e315c5b1 Merge pull request #2895 from lantw44:wip/lantw/Avoid-using-environ-on-FreeBSD
ec9be15bf Googletest export
655bff5d3 Merge pull request #2984 from earhart:master
aa4cbcdcb Merge pull request #2904 from AmatanHead:throw-matchers
fc1e77889 Googletest export
adeef1929 Googletest export
025e1a484 Export LICENSE
10ade8473 Googletest export
6c655699c Googletest export
3d93f8808 Googletest export
3af06fe16 Merge pull request #2961 from FranciscoThiesen:patch-1
ce654c2ff Merge pull request #2972 from srz-zumix:fix/remove_legacy_testcase_api_
d0de618a5 Googletest export
5a5caab35 Googletest export
48ec64092 Googletest export
b612003c3 fix endif comment
7f1c8bb44 Remove ThrowsMessageHasSubstr and fix some nits after review
a899cecb1 Cleanup a bulky expression, document implementation details
4ebbfea62 Fix build under msvc
c46bdea43 Update tests after changing an error message
0a80845e7 Fix build under msvc
92d0a6f7e Add a test to ensure that the `Throws` matcher only invokes its argument once.
69c510fb5 Add a test for duplicate catch clauses in throw matchers, fix a couple of nitpicks.
49d1201a7 Add missing documentation piece
46734d9a6 Small improvements: code style and property name
9ac4cd0f4 Add matchers for testing exception properties
7d4707724 fix tests
e6e2d3b76 Merge pull request #2952 from jasjuang:master
e61125f05 Merge pull request #2920 from ongjunjie:fix-death-test-regex
7b2f00d9d Removing tiny-dnn from "Who is using.."
68ca04c26 Googletest export
317ec2f29 fix GTEST_REMOVE_LEGACY_TEST_CASEAPI_ typo
18a9aeda7 Googletest export
c64309924 Googletest export
7bde252cb fix clang tidy modernize-use-equals-default warnings
a781fe29b Merge pull request #2937 from Ashikpaul:patch-1
eb660507f Googletest export
af287b4ff Merge pull request #2903 from AmatanHead:informative-exception-asserts
c4a5ee3ac Fixed some minor typos
70b90929b Googletest export
c7f05e08a Merge pull request #2872 from elindsey:master
592d46424 Merge pull request #2808 from OlivierLDff:cmake-cpp11-feature
017c8d56b Merge pull request #2682 from mjvankampen:cmake-QNX-fix
08b787796 Googletest export
9aaaaf3f3 Googletest export
b9a8afcf2 Googletest export
356f2d264 Googletest export
131878ce9 use target_compile_features to use c++11 if cmake > 3.8
5c0ef1cb8 Fix test failing when simple regex is used
aee0f9d9b Googletest export
e5613588a Googletest export
05c4a036b Googletest export
849ed6b17 Merge pull request #2902 from mshingote:master
a4007e944 Googletest export
5e0cf72b7 Merge pull request #2718 from NINI1988:master
62f388e15 Merge pull request #2891 from zoddicus:fixMinGW
0d2830b28 Make EXPECT_THROW and EXPECT_NO_THROW macros more informative
93dc015a8 Updated googletest issue tracker url.
c6e309b26 Googletest export
549c5d061 Googletest export
2e8ebe69d Avoid using environ on FreeBSD
8567b0929 Googletest export
82e568737 remove a duplicated include
13a433a94 Googletest export
9f287b46d Googletest export
ec94d9f24 Googletest export
1b0cdaae5 Googletest export
1eda5d825 Fix build issue for MinGW
4fe018038 Googletest export
07d4a6e93 Merge pull request #2742 from kuzkry:c++17-type-printers
210aab09d Googletest export
cb44c86c1 Merge pull request #2755 from Conan-Kudo:set-version-for-libs
26dadc224 Googletest export
df6813f5e Googletest export
a2533417c fix compilation on OpenBSD 6.7
eb3953f80 make UniversalPrinter<std::any> support RTTI
843267f0f specialize UniversalPrinter<> for std::any (without support for RTTI)
95b0ea2cf specialize UniversalPrinter<> for std::optional
33b44c4b3 specialize UniversalPrinter<> for std::variant
859bfe898 Googletest export
fd32ba66e Googletest export
85a463194 Googletest export
07beabd61 Merge pull request #2767 from mvoorsluys:OutputXmlSkipped
8f3854e20 Googletest export
130ae78b9 Merge pull request #2862 from prehistoric-penguin:prehistoric-penguin-patch-1
69fb7e5da Merge pull request #2845 from matepek:readme-update-with-opensource-proj
731d908c0 Merge pull request #2677 from IYP-Programer-Yeah:fix-file-path-normalize-function
99ea9ca3f Merge pull request #2698 from aribibek:patch-1
6b08b41e5 Googletest export
f3a59610f Googletest export
a0669e070 Googletest export
1397db9e5 Googletest export
63713e1ce Googletest export
80d5177dd Use count function instead of handwritten loop
73fdce3b6 Merge remote-tracking branch 'original/master' into readme-update-with-opensource-proj
7d3946133 README.dm: Renamed related open source project name: Catch2 and Google Test Explorer -> C++ TestMate
011959aaf Googletest export
8a32680ce Googletest export
48bf552cb Merge pull request #2778 from lvjp:issue-2777
77b8d767d Merge pull request #2844 from mstorsjo:windows-includes
fe5300ebf Googletest export
d86e9e23c Remove an explicit include of debugapi.h
09f587512 Revert "Googletest export"
a09ea700d Googletest export
e589a3371 Merge pull request #2751 from calumr:quiet-flag
1a9c3e441 Merge pull request #2830 from keshavgbpecdelhi:patch-1
a9f6c1ed1 Googletest export
4c9ad191e Detect proto messages based on presense of DebugString.
0eea2e9fc Googletest export
3cfb4117f Googletest export
472cd8fd8 Merge pull request #2818 from inazarenko:master
b99b421d8 Merge pull request #2818 from inazarenko:master
129329787 Googletest export
ef25d27d4 Merge pull request #2815 from Quuxplusone:simple
955552518 Googletest export
d7ca9af00 Googletest export
b0e53e2d6 Merge pull request #2797 from Jyun-Neng:master
1b3eb6ef3 Googletest export
fb5d9b66c Googletest export
a67701056 Googletest export
4bab55dc5 Removed a typo in README.md
1b066f4ed Add -Wdeprecated to the build configuration.
c7d8ec72c Fix a -Wdeprecated warning.
01c0ff5e2 Fix a -Wdeprecated warning.
11b3cec17 Fix a -Wdeprecated warning.
766ac2e1a Remove all uses of GTEST_DISALLOW_{MOVE_,}ASSIGN_.
7c8ab528b Fix test with stack.
9d580ea80 Enable protobuf printing for open-source proto messages.
4f002f1e2 VariadicMatcher needs a non-defaulted move constructor for compile-time performance.
dcc92d0ab Merge pull request #2805 from pepsiman:patch-1
71d5df6c6 Merge pull request #2802 from e-i-n-s:fix_clang_warning
4c8e6a9fe Merge pull request #2810 from ptahmose:master
373d72b69 Googletest export
4fe5ac533 Merge pull request #2756 from Conan-Kudo:fix-pkgconfig-reqs
c2032090f Merge pull request #2772 from Quuxplusone:travis
b51a49e0c Merge pull request #2773 from Quuxplusone:replace-noexcept
ee0149122 Merge branch 'master' of https://github.com/google/googletest into cmake-QNX-fix
be3ac45cf fix signed/unsigned comparison issue (on OpenBSD)
0b6d56761 Remove redundant .c_str()
644f3a992 gtest-unittest-api_test - fix warning in clang build
e3f0319d8 Merge pull request #2715 from kuzkry:document-premature-exit-file-protocol
7084afda5 Merge pull request #2762 from pkryger:avoid_sigprof
c344cb5a8 Googletest export
879fd9b45 Remove duplicate codes existed in get-nprocessors.sh
61f010d70 Googletest export
dc82a3347 Merge pull request #2765 from kuzkry:unsupported-build-systems
01e4fbf5c Merge pull request #2764 from kuzkry:googletest-output-test-dead-code
e3c25c169 Fix --gtest_print_time coloring
6ed4e7168 Replace the last instance of `throw()` with `noexcept`. NFC.
5504ded3a Fix a typo in .travis.yml
189299e95 Merge branch 'master' into quiet-flag
c447b2166 Fixed xml unit-tests and added extra tests
23dadb847 Fix multiple \n characters in xml file when using GTEST_SKIP.
d28d05cc6 Only write ">\n" once when there is failure and skipped tests.
59e5b401a Output skipped information in the xml file.
67cc66080 Merge pull request #2350 from adambadura:MockFunctionFromStdFunction
1ced315a4 Googletest export
acabdf65f remove chapters on Autotools, Meson and plain Makefiles
82e5767f7 remove dead code in googletest-output-test
08347d7a1 Swap settimer and sigaction calls to avoid SIGPROF
354923795 Ensure that gtest/gmock pkgconfig requirements specify version
94a7cf8c5 Set the version for the libraries
749148f1a Googletest export
dbe804f98 Merge pull request #2746 from Romain-Geissler-1A:master
fb19f5788 Add GTEST_BRIEF option
53740ebc2 Add support for std::function in MockFunction (#2277)
e41f31f2a Add tests for MockFunction deduction (#2277)
482ac6ee6 Googletest export
c43f7100f Googletest export
227faf41d Googletest export
230afdb24 Googletest export
0bf8ea306 Googletest export
3de76551e Merge pull request #2722 from JohanMabille:warnings
878bd92e0 Merge pull request #2716 from kuzkry:autotools-leftover
cfb5ef4e7 Googletest export
a1b0173df Make sure IsATTY does not clobber errno.
e588eb1ff Googletest export
909b1ccfc Googletest export
fd538161f Googletest export
ff4872659 Add missing call for gtest_list_output_unittest_ unitTest. Add unitTest for fixed TEST_P line number. Use CodeLocation TestInfo struct.
04e52ebe7 Fixed warnings
25385c23e Fix: shadow member
921972cba Add correct line number to TEST_P test cases for gtest_output.
937b3ce9f Merge branch 'master' of https://github.com/google/googletest into cmake-QNX-fix
23b2a3b1c Googletest export
6f5fd0d71 Googletest export
d0930731d Googletest export
56de7cc8b Googletest export
360f5f70a Googletest export
139fa202c Googletest export
41b5f149a Googletest export
2d6d7a01c Googletest export
fbf67a70d Googletest export
11d9834e9 Googletest export
d02e27727 Googletest export
4f6609129 Googletest export
74b44b2d0 Googletest export
572e261b6 Googletest export
7bc671b8e Googletest export
38f6608e8 Googletest export
d6ce39edf Googletest export
7413280c5 Googletest export
87061810f Googletest export
f1a6db9d4 Googletest export
22397f28e Googletest export
461bd03fc fix a link to documentation
c378d7eb9 remove a dead reference to the Autotools script
c09fbb239 Fix always false condition and clean function body
44517f988 Fixes extensions missing for QNX
10b1902d8 Googletest export
d01e356e1 Googletest export
9417fb401 Merge pull request #2665 from bysreg:fix_noshortcircuitfailure_detectsflakyshortcircuit_test
c59c7bab5 Merge pull request #2672 from ivan1993br:ivan1993br-platformio_update
18b67bfc5 Googletest export
8b4817e3d Googletest export
5336106b6 Googletest export
3e79d366e Googletest export
7a8591e6e Googletest export
0b024bd91 Googletest export
ed16134fb Googletest export
aa4315646 Remove exclusion of *-main and*-all targets
c7137f0b8 Use IsReadableTypeName IsReadableTypeName in OfType function in gmock-matchers_test.cc
3aa538cbf fix unit test failure on NoShortCircuitOnFailure and DetectsFlakyShortCircuit when GTEST_HAS_RTTI is 1
d854bd6ac Googletest export
c901f67dd Googletest export
8417b7332 Googletest export
4b9c1691c Googletest export
306f3754a Googletest export
07ab939af Merge pull request #2632 from Kravlalala:cmake/mingw_msys_build
0d98d87e1 Googletest export
153909f09 Googletest export
fbe34cecf Merge pull request #2639 from trzecieu:trzeci/move_ctor_assign
a13a06261 Googletest export
008629ae2 Merge pull request #2624 from ShabbyX:master
d0a521255 Googletest export
6f1a8ffde Googletest export
bf31ed376 Make move operation noexcept.
cc05a3ca0 Define default destructor for test classes
05701fee2 Deleted functions as part of public interface
77b3a250e Review notes: Return T& from assignment operators
9d8222ad6 Disable move constructor and assignment operator for test classes.
d166e0948 Merge pull request #2590 from kuzkry:remove-workaround_g++-stale-comments
0a0c82662 Googletest export
1800a38fb Revert "Googletest export": disallow empty prefix
4b7809c2f Revert "Googletest export": Remove test for empty prefix
d20164690 Workaround VS bug w.r.t empty arguments to macros
5b162a79d Merge pull request #2589 from kuzkry:remove-workaround_g++-no-space-after-first-macro-argument
d16f86ff1 Googletest export
d8eeb9760 Googletest export
d442089d5 Googletest export
88ba008c2 Merge pull request #2595 from kuzkry:remove-workaround_msvc-warning-4355
a3097c826 Merge pull request #2592 from kuzkry:remove-workaround_msvc-error-C2665
6251071a2 Googletest export
20b8e7a1c Activate GNU extensions in case of MSYS generator
78fdd6c00 Merge pull request #2609 from kuzkry:revert-2596
9ed99c6c8 Googletest export
2002f267f Googletest export
1d563578c Merge pull request #2594 from kuzkry:remove-workaround_msvc-unneeded-const-dropping
cf75d4b92 Googletest export
ae8d1fc81 Googletest export
52825d78a Merge pull request #2603 from maximilianschwab:patch-1
11a9482f8 Merge pull request #2607 from oyefremov:patch-1
b155875f3 Merge pull request #2583 from ChristophStrehle:master
3957b8898 Revert "remove MSVC workaround: wmain link error in the static library"
967d8e05c Revert "unify googletest and googlemock main functions"
b8a92f7c8 Rename test case to test suite
34e92be31 Merge pull request #2604 from matepek:readme-update-with-opensource-proj
39803f3c5 Merge pull request #2593 from kuzkry:remove-workaround_msvc-namespace-scope-from-nested-class
0361bdf59 Merge pull request #2596 from kuzkry:remove-workaround_msvc-wmain-link-error
db13ff1f0 Merge pull request #2597 from kuzkry:remove-workaround_Nokia-Sybian-SafeMatcherCastImpl
be74b4b2e Googletest export
7a8a5bcec Merge pull request #2591 from kuzkry:remove-workaround_g++-using-on-operator<<
a32a20009 Merge pull request #2588 from kuzkry:remove-workaround_g++-incorrect-comments
51545ee51 Googletest export
5a62d400e README.md: added Catch2 and Google Test Explorer
838a32845 Fixed typo
679bfec6d Googletest export
af71b6607 Merge pull request #2570 from xieyubo:1.10
717ce7feb Googletest export
a909becdc unify googletest and googlemock main functions
298a40f02 remove MSVC workaround: wmain link error in the static library
bbbc5d8a4 remove Nokia's Symbian compiler workaround: SafeMatcherCastImpl
e0c80b0a6 consistency fix for SafeMatcherCastImpl member functions
6748df1ea remove MSVC workaround: cease const dropping
ecefcbd4a remove MSVC workaround: warning 4355
a5136dbdd remove MSVC workaround: error C2665
21d276b5c remove MSVC workaround: accessing namespace scope from within nested classes
a91e4e73b remove stale comments about older GCC versions
e1dd49835 remove g++ 2.95.0 workaround: no space after first comma in macros
2241be0c3 remove g++ 3.3 workaround: using on operator<<
6a9d6d5c2 Fix compile break for Microsoft Visual Studio 2017 v141
200ff5994 Merge pull request #2569 from bgianfo:master
4bf466236 Googletest export
50cfbb726 Googletest export
dcdb65065 Fix internal memory leak in Windows _Crt report.
0c469a5a0 Fix FlatTuple compilation on older msvc.
c27acebba Merge pull request #2521 from Sinclair-John:master
f73898f3f Merge pull request #2554 from kuzkry:update-gen_gtest_pred_impl
11440f27c Merge pull request #2556 from ienorand:avoid-pkg-config-lpthread-cflag
dee725b05 add documentation for the premature-exit-file protocol
d5707695c Googletest export
681454dae Googletest export
e08a46027 Merge pull request #2549 from kuzkry:pump-support-for-python-3
8aedd597a Merge pull request #2548 from kuzkry:update-pump-manual
54978626b Merge pull request #2547 from kuzkry:typo
3e062a6ef Merge pull request #2373 from Youw:master
6caa879a4 pkg-config: Remove pthread link flag from Cflags
f79ac2ce0 change incorrect comments
f9665846e update gen_gtest_pred_impl.py
8697709e0 Merge pull request #2453 from kuzkry:gtest-port-clean-up_kMaxBiggestInt
f658561ef fix a typo
442f45b37 pump.py: add support for Python 3
523ad489e update pump_manual.md
e8a82dc7e Merge pull request #2453 from kuzkry:gtest-port-clean-up_kMaxBiggestInt
057ee5063 Merge pull request #2533 from thejcannon:noexcept_spec
2db3df9c4 Googletest export
e2fc3a9c9 Googletest export
0a0348082 Googletest export
f626deda1 Added special catch for std::exception in GTEST_TEST_NO_THROW_
ba33a8876 Googletest export
fff8dabbf Googletest export
2bee6da24 Googletest export
755f853c6 Googletest export
757d39a79 Googletest export
b5fb5ba05 Merge pull request #2527 from PiotrNycz:gmock_prevent_return_ref_to_store_temporaries_2
a1f71dd56 Googletest export
a8b1a66cf Merge pull request #2388 from kuzkry:remove-gtest-type-util.pump
1a49b67ae update CONTRIBUTORS
002905f29 move the pumping script to googlemock
a7083564d remove gtest-type-util.h.pump
e3a9a567d replace autogenerated TemplatesX classes by variadic ones
eed64b5fc replace autogenerated TypesX classes by variadic ones
540835fa6 Merge pull request #2515 from ciband:feat/support_esp8266
208c2f6b6 variable names corrected (followed google coding style)
5ff72f529 Apply 80chars limit
d07268211 Tests simplified and names corrected (POD->scalar)
6e87238c9 remove BiggestInt
37f322783 Googletest export
676d0444b Revert "Merge pull request #2498 from thejcannon:noexcept_spec"
1110c471c Merge pull request #2522 from cloudrex:patch-1
8bab7883a Merge pull request #2514 from thejcannon:msvc_macro_issue
aa1146da8 Googletest export
37590da6c Added more tests to verify: ReturnRef not accept temporary
19a3bbce5 Added tests verifying that temporaries are accepted by ReturnRef
f1afeaa64 Googletest export
b11fb80e9 Prevent using ReturnRef on reference to temporary
8c91ecef2 Merge pull request #2517 from snarkmaster:master
de1128355 Merge pull request #2444 from kuzkry:remove-GTEST_ARRAY_SIZE_
611a321a6 Googletest export
a5216dd1a Merge pull request #2511 from kuzkry:PlatformIO-clean-up
8ce64c084 Merge pull request #2454 from kuzkry:gtest-port-clean-up_dead-function
011c4e23d Googletest export
f164a9e23 Remove extra space
5f92697d4 Fix Issue 2418
f966ed158 Googletest export
1f9edcd96 Googletest export
bbe4b7363 Googletest export
2995ca563 Merge pull request #2507 from roblub:master
cbf019de2 [googletest] Output skip message
bdc29d5dc Merge pull request #2421 from kuzkry:cleanup-for-regex
4c25e2b87 Googletest export
9e466f1eb Merge pull request #2510 from ciband:chore/update_pio_version
778733f9e feat: Add ESP8266 support
e1b67b07f Avoid recursive macros
3cddd56e1 Add more override keywords
84a5ae8b8 Update to distinguish prelease purpose of this fork.
3e813465a Removing extraneous parenthesis
f8961b99f Evaluate and cat NARG in different macros
c2206b05a Add ESP8266 configs to PlatformIO build
40a6b9662 feat: Add support for ESP8266 platform
5fe523361 Removing extraneous test
fe112cfee Replace compile-test with preprocessor test
d935e8e3e Fix preprocessor tests
c1e8e71aa Add a compile test
c081ceebf Workaround MSVC VA_ARGS weirdness
ba513d2c9 Merge pull request #2498 from thejcannon:noexcept_spec
a3ca5b9e0 Googletest export
eafd2a91b Merge pull request #2456 from kuzkry:gtest-port-clean-up_breaking-changes
37905b9d8 Merge pull request #2498 from thejcannon:noexcept_spec
a4a5a7c76 Googletest export
ed78e54f3 Googletest export
9b9700247 clean-up broken paths for PlatformIO
31406d790 chore:  update version
bc996e081 Made noexcept condition more exciting
58c719776 Merge pull request #2505 from zebmason:cornichon
20b5b8ecc Googletest export
5395345ca Merge pull request #2497 from thejcannon:handle_null_filename
cb1d5db1a Merge pull request #2448 from kuzkry:bad-googletest-export
de69803b1 Mention Cornichon as a related open source project
cd17fa2ab Merge pull request #2475 from peterbarker:pr/google-add-override
20255e6f4 Use declval in noexcept expression
7f8617a7c Switch to free function to avoid GCC bug
872b9ceb6 Avoid comma operator
0eadff8a9 Fix spacing
10c1d8c4f Use the verbatim noexcept spec in MOCKED_METHOD
3f5a8c6ee Merge pull request #2495 from hyukmyeong:typo
2ed2211db Use FormatFileLocation for streaming file and line
4360e4267 Merge pull request #2491 from SoapGentoo:fix-GNUInstallDirs-pkg-config
b96832a44 Add documentation for pkg-config in cross-compilation settings
5126ff48d Revert "Use pcfiledir for prefix in pkgconfig file"
76a560c81 Googletest export
703bd9caa Googletest export
4105eb726 Googletest export
68319c19e Googletest export
51f7396d4 Fix typo in documents
dc1ca9ae4 Googletest export
72adf7a41 Googletest export
cb3f7ce1d Googletest export
a783ade7c Googletest export
bf0fe874a Googletest export
076c46198 Googletest export
c78ea26f2 Bump llvm version to 4 so brew can work again
2460f9715 Add many missing override keywords
e0d16aa33 remove GTEST_ARRAY_SIZE_
90a8ab70a mention the existing support for wide strings in string matchers
3339b97c6 square away the stuff that hasn't been merged in a manual review
7c2bd3af9 square away the stuff that hasn't been merged in a manual review
f2fb48c3b Googletest export
cad3bc46c Googletest export
c96da8fea change usings
c7a03daa9 Merge pull request #2387 from kuzkry:iff
ac24edd6e Googletest export
274afe50c Googletest export
0cd3fbc8a change includes in gtest-port.h
33a0d4f6d Googletest export
838ea5cea remove GTEST_HAS_STD_STRING
bafa644c1 remove a dead function
3a4503986 Googletest export
62a109a2f Googletest export
c2b2cd888 Googletest export
3f05f651a Googletest export
6123df929 Googletest export
ab8f346b0 Googletest export
565f1b848 Merge pull request #2398 from kuzkry:custom-type-traits-iterator_traits
a648da952 Merge pull request #2420 from kuzkry:remove-autotools-section
eb56ee5a2 Googletest export
d9c55a48e Merge pull request #2426 from kuzkry:#2396-postreview
85f059f03 Merge pull request #3 from google/master
fdd6a1dc8 Merge pull request #2382 from kuzkry:dead-metafunction
6a3d632f4 Googletest export
38ce18e8e post-review to db1b7399 (#2396)
ed2eef654 Googletest export
db1b73994 Googletest export
46525e1e5 Merge pull request #2394 from kuzkry:custom-type-traits-duplication-of-custom-index_sequence
c6d884096 Merge pull request #2401 from kuzkry:custom-type-traits-add_lvalue_reference
9bf34ace7 Merge pull request #2400 from kuzkry:custom-type-traits-enable_if
f8e9b3767 remove references to autotools and combine gTest&gMock sections
fb49e6c16 Merge pull request #2393 from kuzkry:custom-type-traits-remove_const
d1ad644db Googletest export
7bd4a7f3e restore mistakenly removed iffs in their explicit form
c9ccac7cb Googletest export
d5e9e0c38 Merge pull request #2397 from kuzkry:custom-type-traits-is_reference
30e58a89a Merge pull request #2381 from Yannic:fix_bazel
fcffabb5b Googletest export
410b52985 Googletest export
27e17f785 Googletest export
eb78ee170 Googletest export
976b37fe9 Googletest export
44de86978 remove a dead metafunction
e9d5f427b Googletest export
d44b137fd Googletest export
4083746e6 Merge pull request #2391 from adambadura:FixCygwin
9b7040691 Merge pull request #2399 from kuzkry:custom-type-traits-is_same
6aba4a5c4 Merge pull request #2382 from kuzkry:dead-metafunction
c16f57053 Merge pull request #2386 from kuzkry:outdated-comment
a92e4a8e9 Googletest export
3835e15d7 Googletest export
de38f6380 Googletest export
6a015ca1c reuse IndexSequence from googletest
ec49fbca4 remove custom implementations of std::is_same
da76d01b9 remove a custom implementation of std::is_reference
364839ab1 remove a custom implementation of std::remove_const
e2c06aa24 remove a custom implementation of std::iterator_traits
11471da79 remove a custom implementation of std::enable_if
2c2c9e335 remove a custom implementation of std::add_lvalue_reference
6dbddd32b Use -Wa,-mbig-obj for Cygwin/MinGW always
871dcd1ff remove an outdated comment
d51cce4fc remove a dead metafunction
90a443f9c Merge pull request #2378 from kuzkry:markdown-table
f8f5fcab3 Googletest export
dd5402d9d Googletest export
79690c537 Merge pull request #2372 from pitrou:issue2371-windows-crt-asserts
800c9b301 Update Bazel on Windows
6fd262ecf Prepare for Bazel incompatible changes
6aa98d5cd fix an improperly generated table
f64f7bd36 Merge pull request #2375 from kuzkry:broken-links
07ec69a88 Merge pull request #2359 from kuzkry:superfluous-mutable
d0cb77dcc fix broken links
b4961ab1c Googletest export
2f499db00 Merge pull request #2111 from knuto:pr/remove_slash
9f8c3934d Googletest export
c39ee9c46 Fix #2371: Redirect Windows CRT assertions to stderr
11be5f534 Googletest export
4e29e4884 Merge pull request #2358 from kuzkry:adjustment-of-similar-comments
6c7a8bec8 Merge pull request #2341 from ChrisBaish:master
cc34e8fa7 Merge pull request #2357 from kuzkry:obsolete-documentation
47092933f Merge pull request #2361 from guillemglez:master
6a2adc0ee Googletest export
c8d338c62 Merge pull request #2353 from anttsov:patch-1
8756ef905 Googletest export
da28d3019 Googletest export
b15335dfa Googletest export
a3eee98ca Googletest export
2221875d0 Googletest export
210239e80 Fix table formatting in advanced.md
637b0411f remove an excessive mutable type specifier
96c851d05 adjust a comment to the similar section in advanced.md
64b17693e Update README.md
287b37f23 update pre-C++11 paragraphs
9311242db Merge pull request #2356 from kuzkry:typos
0647b90ee Merge pull request #2354 from kuzkry:trailing-whitespaces
4cd6e4d35 Merge pull request #2355 from kuzkry:markdown-numbering
bf6df7eae fix typos
d384b8831 fix numbering of ordered lists in Markdown
28e1dde25 remove trailing whitespaces
579591a35 Update README.md
c205468b6 Merge pull request #2338 from kuzkry:environment-documentation
05747d2ee Merge pull request #2342 from Jauler:master
3821ecd57 Googletest export
a45c24ac1 Googletest export
b2983b2f2 Merge pull request #2331 from adambadura:CMakeCorrection
bb481d2da Manual docs tweaks still in preparation for including docs with code pushes
c4b68b91f Manual docs tweaks still in preparation for including docs with code pushes
1be5ce090 Correct CMake to cover Cygwin
2134e3fd8 Googletest export
373ed74af Googletest export
0a5efc11e Googletest export
e93b5e06b Fix small errors in primer.md
3525e3984 Moved explanation to single line as well
af11cda56 Moved table to single lines
d64e4cf14 Merge remote-tracking branch 'upstream/master' into primer_md_table_update
b77e5c762 Manual docs tweaks still in preparation for including docs with code pushes
a743249a5 Manual docs tweaks still in preparation for including docs with code pushes
15756aa0c Manual docs tweaks still in preparation for including docs with code pushes
34ddfff94 Manual docs tweaks still in preparation for including docs with code pushes
2fa7be932 explicitly show overriding to align examples to their comments
cc49f5b27 document a missing parent class
adb490773 Update primer.md
2ef13f524 remove outdated
96bf3b1af remove outdated
ad52f7d0b Merge branch 'master' of github.com:google/googletest
63e878b62 Preparation for including docs in round-trip with OSS, Manual merge, review and merge docs internal-OSS
0ef404e2e Googletest export
6077f444d Merge pull request #2332 from adambadura:AddMissingInclude
1f809607b Add missing <functional> include
f899e81e4 Preparation for including docs in round-trip with OSS. Manual review and merge docs internal-OSS
4ab6f4d70 Preparation for including docs in round-trip with OSS. Manual review and merge docs internal-OSS
3d9cdd580 Googletest export
f38f4d8f2 Googletest export
e4f097b5f Googletest export
947aeab28 Preparation for including docs in round-trip with OSS
5af948b30 Preparation for including docs in round-trip with OSS
073a2da40 Preparation for including docs in round-trip with OSS
01573aa0e Merge branch 'master' of github.com:google/googletest
afa914325 Merge pull request #2324 from kuzkry/fix-broken-link
31ff59788 Preparation for including docs in round-trip with OSS
b97b96a1a Merge pull request #2309 from cclauss/patch-1
b0568dcb4 fix a broken link
5c4d53fd5 Merge pull request #2326 from kuzkry/missing-references-to-documentation
f81dbd6ce add missing references to DesignDoc and KnownIssues
b138afde1 rename and apply snake_case on KnownIssues.md
1d5b7cc1e rename and apply snake_case on FrequentlyAskedQuestions.md
92d92f2f5 rename and apply snake_case on ForDummies.md
6078089ef rename and apply snake_case on Documentation.md
382cdf916 rename and apply snake_case on DesignDoc.md
275bbc788 rename and apply snake_case on CheatSheet.md
ee3aa8311 Fix bad advice in cook book (#2308)
dfb5e22b8 Travis CI: The sudo: tag is now deprecated in Travis CI
437e1008c Documentation sync in preparation to including docs with full source sync
834dff3b5 Documentation sync in preparation to including docs with full source sync
c1845f65f Update README.md
2a1a3e290 Merge pull request #2296 from rmstar/replace_golinks
ce58a5972 Remove google internal links from documentation on github
b4676595c Incremental doc changes in preparation for doc sync
152c7dfd0 missed the actual file in previous commit
5ed950c9e Renaming doc files to make the file names more palatable and in preparation for including documentation in sync process
ac31db8fa small docs restucture and cleanup
ba68290cb small docs restucture and cleanup
2f42d769a Merge branch 'master' of github.com:google/googletest
39ea9e8a9 Remove outdated from README
1d721a7a9 Googletest export
ee32b72e1 Googletest export
4f0160360 Merge pull request #2290 from gennadiycivil:master
be8d01462 Googletest export
ed43ecf9e Merge pull request #2288 from gennadiycivil:master
60b929865 Fixing CI break by going to bazel 0.26.1
c1a584d30 Merge branch 'master' of https://github.com/google/googletest
02767277b Revert "testing, explicitly specify compiler"
d7003576d Googletest export
d1185b9ff Googletest export
fe3a10b41 revert travis.yml, irrelevant
93d69df46 bazel 0.26.1
4b6a3cc6c bazel 0.26.1
1e5ad17e9 testing with bazel 0.26.1
919142f8a testing with bazel 0.26.1
6c971ca9a testing, explicitly specify compiler
176eccfb8 Merge pull request #2287 from PhilLab/patch-1
fd20d1ecc Merge pull request #2286 from gennadiycivil/master
b72b1bee9 docs/primer: Fixed usage of test case
e110929a7 Documentation sync working on the documentation being included with the code
cd6b9ae32 googlemock/docs/CookBook.md small doc test
41961e9e0 Merge branch 'master' of https://github.com/google/googletest
f7c178ecb Makefiles are no longer supported. Adding pseudo-break with their impending removal to make sure that people who are interested will notice
38d967e88 doc is still valid
7ada9b66b Finish removing autotools
807d590a2 Finish removing autotools
74905ef84 Also remove googlemock/scripts/gmock-config.in
84a498dec Merge pull request #2285 from tomalakgeretkal:c++17-fix
6b8c13815 Removing make and automake. The only supported build systems are Bazel internally and CMake community supported
26afdba79 Merge pull request #2283 from xammy:cmake-cmp0054
d515158d9 Fixed issue #2284 (Incompatibility with C++17)
e580d9919 Setting CMP0054 policy to NEW. This allows to use the string "SHARED" without interpreting it as a variable.
af4c2cb09 Formatting Changes
fa9a47681 Formatting Changes, README
89656ddbe Update README.md
076b7f778 remove obsolete codegear files
fbcb2eb20 removing obsolete language from docs, CMake and Bazel is the only supporeted build methods
6f79a3b8a removing gmock msvc solution, as CMake and Bazel is the only supporeted build methods
527a493fb removing build-aux files , as CMake and Bazel is the only supporeted build methods
b93980dda removing xcode files , as CMake and Bazel is the only supporeted build methods
60a6d5fc3 removing msvc solution, as CMake and Bazel is the only supporeted build methods
da10da05c Merge pull request #2268 from kalaxy/fuse_spi_in_header
577daedd5 Merge pull request #2274 from goudan-er/master
0183a459e Merge pull request #2270 from Peter-Levine:fix-signed-wchar
3ff7cd0f1 fix typo
31200def0 Googletest export
08a68b6fb Googletest export
711fccf83 Don't allow signed/unsigned wchar_t in gcc 9 and later
6044c267e Fuse gtest-spi.h into the resulting header.
8ffb7e5c8 Merge pull request #2264 from mbrobbel:suppress-cmp0048-warning
899c08263 Googletest export
97d8c47df Suppress CMake policy warning (CMP0048)
f5edb4f54 Update CONTRIBUTING.md
a2059b408 Update CONTRIBUTING.md
7f1c0f6f8 Merge pull request #2260 from 741g:master
88f049309 Merge pull request #2259 from ngie-eign:fix-maintainers-typo
dc792bc60 Update README.md
feb55f22c removing msvc
a67e9a848 removing msvc
928f7a342 removing codegear
2f58f41d1 unbreak windows build
699943fe4 Fix typo introduced in 63be3dcc245 (maintaners -> maintainers)
f71fb4f9a Update advanced.md
03273a898 Merge pull request #2254 from chaoran:master
5b4a135f6 add unit test for overload & operator
9d4cde44a Added docs for testing::RegisterTest
2fc238316 Use std::addressof to instead of plain '&'.
529981537 Googletest export
3f5b5b8f8 Googletest export
bf3ef5c9b Merge pull request #2245 from daquexian:fix_wsign_conversion
63be3dcc2 Googletest export
ca642a925 Fix -Wsign-conversion error by adding static_cast
9997a830e Merge pull request #2242 from SylvestreG:master
3c911d2de Removing  obsolete msvc 2005 and 2010
87348c217 Removing  obsolete codegear and msvc 2010
82f9c8d65 Googletest export
61cdca569 Merge pull request #2241 from ngie-eign:fix-wsign-conversion-fallout
9037e9bda Fix compilation on CentOS 7
bd47c09b7 Address fallout from -Wsign-conversion work on Windows
b953e05bc Remove / from parameterized test names if base test name is empty
84d986531 Googletest export
a53e931dc Update README.md
0c68c865f Googletest export
9f4f27b2a Googletest export
fa52cd636 Googletest export
a0d60bed4 Merge pull request #2170 from ngie-eign:issue-2146-ver2
9f893b995 Googletest export
6d6681806 Googletest export
39f72ea6f Merge pull request #2230 from return:style-issue
698d45d3a Sort Haiku platform definition alphabetically.
adc8a88ff Merge pull request #2226 from davidben:msvc-5046
ea9c49b9c Merge pull request #2229 from return:haiku-support
520a1e52a Merge pull request #2228 from rongou/patch-2
0a00ba64d Add Haiku platform support.
f658dcbaa replace test case with test suite in the primer
7473c5ca5 Merge pull request #2225 from rongou/patch-1
8e9297b50 MSVC C5046 warning is unavailable in MSVC 2015.
d622dfe8a add missing period
604ba376c Update README.md
f683de658 Merge pull request #2222 from Ivaylo-Kirov/patch-1
dc62d1e76 Update ForDummies.md
3829b84e9 clang: fix `-Wsign-conversion` errors
5ba69d5cb Merge pull request #2148 from ngie-eign:clang-add-explicit-c++11-rtti-flag
c061ffafd Googletest export
7475ba503 clang: explicitly enable/disable RTTI support with the compiler
1f3b098ef Merge pull request #2203 from ngie-eign:issue-2189
c9e0aed90 Googletest export
b617b2771 Googletest export
2efd659a1 Merge pull request #2163 from ngie-eign:cmake-fix-gtest-binary-prefixing-when-gmock-enabled
d98254313 Googletest export
67c75ff8b Handle GTEST_SKIP() when calling `Environment::SetUp()`
9b6de41b5 Prefix googletest binaries under its own subtree instead of `gtest`
5b752b194 Googletest export
1f64659fb Update CONTRIBUTING.md
1040b342f Update CONTRIBUTING.md
a5532dae7 Merge pull request #2199 from syohex/update-xcode-project-file-again
c651b4528 Update Xcode project file
a18ac392d Merge pull request #2193 from antismap/patch-1
d31151a49 Update googletest/docs/advanced.md
10e98c4f2 Merge pull request #2180 from twam:master
f1883b182 Googletest export
a4b63e7ef Googletest export
f23336093 Note about INSTANTIATE_TEST_SUITE_P / INSTANTIATE_TEST_CASE_P  keyword change
f957bd0c2 Merge pull request #2181 from sethraymond/patch-1
c3ac2655f Remove old_crtdbg_flag_ member if not required
1619ebcf2 DesignDoc Markdown table was broken
8b6d3f9c4 Merge pull request #2158 from CarloWood:master
3dd2e841c Googletest export
a1dd07786 Googletest export
db9b85e27 Googletest export
56ef07a20 Googletest export
fc979623a Minor build system fixes.
efecb0bfa Googletest export
5154386c5 Merge pull request #2152 from rsinnet/patch-1
d70cd4e35 Fix grammatical error in primer.md
37ae1fc5e Merge pull request #2147 from ngie-eign:gtest-test-death-test-dont-hardcode-test-name
b6473fcf9 Merge pull request #2126 from ngie-eign:clang-add-more-strict-warnings
cd09534de Don't hardcode the filename in `CxxExceptionDeathTest.PrintsMessageForStdException`
7203f37f5 Merge pull request #2137 from ngie-eign:clang-ignore-sign-conversion
1411d27a9 Merge pull request #2061 from samolisov:building-with-bazel-as-a-dll-on-windows
c5a792d1b Merge pull request #2125 from ngie-eign:clang-unused-parameter
c37489302 Merge pull request #2123 from ngie-eign:clang-inconsistent-missing-override
873e47981 Googletest export
0e424c759 Googletest export
6d4d2f06b Merge pull request #2141 from dspinellis/index-fix
9dc235b59 Avoid array index out of range
fcf59ca7b Ignore `-Wsign-conversion` issues
1c22797cd Fix clang `-Wunused-parameter` warnings
5388473ac Fix clang `-Winconsistent-missing-override` warnings
2147806d2 Fix clang `-Winconsistent-missing-override` warnings
a4af76cf8 Add `cxx_strict_flags` for clang to match FreeBSD's WARNS flags
d850e1447 Merge pull request #2112 from knuto:pr/fix_null_pointer
54ec41f00 Merge pull request #2121 from ngie-eign:add-dragonflybsd-and-kfreebsd-support
f73b2fb39 Merge pull request #2114 from knuto:pr/libtool_support
ea43be9d1 Merge pull request #2119 from ngie-eign:clang-wunused-private-field
e5e846da7 Merge pull request #2120 from ngie-eign:clang-compile-with-basic-warns-flags
75c339609 Merge pull request #2113 from knuto:pr/set_old_gtest_ver
96826743e Import `patch-bsd-defines` from FreeBSD ports [1]
1ded83195 Compile clang with `-Wall -Wshadow -Werror`
ed2fe122f Fix -Wunused-private-field issues with clang
c4ccab33a Googletest export
b37574c1b Merge pull request #2107 from ciband:feat/finish_platformio_support
b68ec344b Merge pull request #2101 from MaEtUgR:fix-cmake-cygwin
4f79e316a Googletest export
28a96d183 Googletest export
dda0df3b0 Googletest export
60cf03313 Set gtest version correctly for older cmake versions
f4d3cdb65 Generate a libgtest.la to help libtool managing dependencies
48e6f1f38 Stop TestInfo::Run() calling a function through null pointer
47568eade fix:  Correct *-all.cc file paths
9a502a5b1 Merge pull request #2100 from ngie-eign/test-clang-osx-every-travis-run
e28b50609 Merge pull request #2103 from kw-udon/fix-json-in-advanced-md
b3679d856 Fix an invalid example of JSON report in advanced.md
f80d6644d Update .travis.yml
5dfcd1bc4 Update .travis.yml
9df5475b8 Test out changes with clang/OSX each PR using Travis CI
50059a12b Googletest export
52ea4f7be Googletest export
876bdfa56 Googletest export
471f5bc43 Merge pull request #2098 from ciband:feat/finish_platformio_support
f89253434 cmake: detect Cygwin which needs extensions to build
67265e070 cmake: move global project definition to beginning
0ea2d8f8f Googletest export
53798de93 chore: Add PlatformIO supported platforms list
b2b246225 fix: Add Arduino to embedded platform list
fe519d64a fix: Add *_all.cc files to ignore list
4f4c01d8c Merge pull request #2092 from Billy4195/Update_README
1c23efb42 Fix README.md broken link
e04254989 Merge pull request #2091 from google/gennadiycivil-patch-1
acde02c63 Repeat #2090
8e37822b4 Merge pull request #2063 from mathbunnyru:master
ce29e55cf Merge pull request #2090 from KellyWalker/patch-1
2775733ee Update advanced.md casing in example
9318a18cc Added -Wgnu-zero-variadic-macro-arguments" clang
1f42ae735 Merge pull request #2063 from mathbunnyru:master
01148677a Merge pull request #2086 from hugolm84:fix-dynamic/static-runtime-link
718bb65ac Avoid dynamic/static runtime linking (LNK4098) by properly replacing MD(d)->MT(d) in both C and CXX flags, resolves 2074
5ec7f0c4a Merge pull request #2079 from acozzette:fix-dist
46b81732b Fixed "make dist"
bf07131c1 Merge pull request #2041 from ciband:chore/fix_library_json
fdc59ffd0 Googletest export
569fba4d7 Googletest export
91bfc0822 Enable CI on Windows (appveyor) with Bazel
9518a5742 Googletest export
7c4164bf4 Fix INSTANTIATE_TEST_CASE_P with zero variadic arguments
0adeadd28 Googletest export
eb9225ce3 Googletest export
9acd065a9 Googletest export
097407fd3 Googletest export
c868da198 Enable building as a shared library (dll) on Windows with Bazel
0599a7b84 Googletest export
2edadcedf Workaround homebrew issue
6693e85b0 Merge branch 'master' of github.com:google/googletest
bc1023b41 Googletest export
7a7e2bba1 Googletest export
50f1a7795 Merge pull request #2051 from enptfb55:master
f31bf1d36 Googletest export
216c37f05 Googletest export
45c58aa6f fix:  Add Arduino setup()/loop() functions back
644319b9f Merge pull request #2048 from ciband:chore/clang_tidy
b6cd40528 Googletest export
8369b5bbd fixing build errors for unused parameter
ade8baa7d clang-tidy: modernize-deprecated-headers
23e693787 misc:  Reapply Arduino functions
202dcabf3 misc:  Revert formatting changes.
fd1c7976a Merge branch 'chore/fix_library_json' of https://github.com/ciband/googletest into chore/fix_library_json
0ffa5f977 Merge branch 'master' into chore/fix_library_json
23533009b chore:  Add Windows cmake files to .gitignore
adc5045cb chore:  Alphabetize exclude directories.
3880b13e4 Merge pull request #2042 from gennadiycivil/master
58e62f7a9 Merge branch 'master' of https://github.com/google/googletest
5d3a2cd9c Update docs, TestCase->TestSuite
827515f8a Googletest export
3a460a26b Googletest export
0c0ca9038 fix:  Correct *_main.cc paths
4d62b5b9a fix:  Remove Arduino entry points
ac8c102da Update README.md
6e410a3ae Update README.md
8a27d164c Update README.md
bfcc47fc2 Merge pull request #2026 from justin6case/example_makefile_improvements
1bcbd5871 Merge pull request #2037 from ciband:chore/fix_library_json
14c2fba73 Googletest export
f8b1c1af1 Googletest export
933e5df28 Merge pull request #2039 from gennadiycivil/master
8ed34e0f6 Remove outdated scripts
2ace910a3 Revert "test, please ignore"
25905b9f9 Merge branch 'master' of https://github.com/google/googletest
de99386b6 Merge branch 'chore/fix_library_json' of https://github.com/ciband/googletest into chore/fix_library_json
6d5ce40d4 fix:  Add additional source and include directories.
3bedb5a9f Merge pull request #2035 from syohex/update-xcode-project-file
0cf2130c0 Update Xcode project file
6729a1361 Merge #2002
77004096e Update README.md
16269ae2f Merge pull request #2027 from ciband:chore/fix_library_json
c0ef2cbe4 fix:  Correct GitHub paths
150613166 Update README.md
4160336cb Merge pull request #2013 from ciband:chore/fix_library_json
34a99e547 Googletest export
b93a13ec4 Improvements have been made to the example/sample makefiles for both googlemock and googletest. Library files are now created and named like versions produced by Cmake.
a83cc11ab Googletest export
9494c45e7 Googletest export
e26a3fa13 Googletest export
9ab640ce5 Googletest export
7515e3994 Googletest export
85c4172ed Update README.md
ed3f9bb22 Googletest export
b7dd66519 Googletest export
1ec20f87e Googletest export
096fb37a1 Googletest export
0f698c830 chore:  Add .vs to .gitignore for Visual Studio
1496f73cc fix:  correct JSON syntax
130e5aa86 Merge pull request #2 from google/master
b5f5c596a Merge pull request #2000 from ciband:feat/add_support_platformio
c6cb7e033 Googletest export
81f002606 Googletest export
3949c403c Update README.md
6ef591381 Googletest export
b545089f5 Merge pull request #2004 from cotsog/patch-1
3b1f43c2e Use if statements
fc0f92676 Don't cache APT packages on OS X/macOS
ea5e941d8 Change directory ownership earlier
6cbd3753d Googletest export
06bb8d4d6 Googletest export
b5c08cb9f Cache gcc and clang APT packages
31eb5e9b8 chore:  Update version to latest release
d9251df84 fix: Remove global chmod from Travis
39c09043b chore:  Add initial library.json config
695cf7c96 Merge pull request #1997 from gpakosz:GTEST_IS_THREADSAFE
2c8ab3f18 feat:  Add initial support for PlatformIO and Arduino
fe14e3030 Merge pull request #1995 from siddhanjay/patch-1
3d71ab4c3 Googletest export
067aa4c28 Do not define GTEST_IS_THREADSAFE within GTEST_HAS_SEH
3fd66989b Googletest export
214521a14 Update WORKSPACE
a28a71ae4 Update README.md
10e82d01d Update README.md
ba344cbc4 Googletest export
26743363b Googletest export
a42cdf2ab Googletest export
775a17631 Fixed typo
8fbf9d16a Googletest export
b22d23667 Googletest export
191f9336b Merge pull request #1977 from lukasm91:issue_1955_remove_pthread_flags
fca458cab Googletest export
915f6cfef Update .travis.yml
5404fd7d0 Update .travis.yml
2f126c74d Update .travis.yml
87589af5b Update .travis.yml
28a3261fd Create CODE_OF_CONDUCT.md
ce526b870 Issue #1955: Remove THREADS_PREFER_PTHREAD_FLAG
3cf8f514d Update build badge
a3013ccef Googletest export
f7779eb3c Googletest export
64368e058 Googletest export
bb7c0ecbd Googletest export
b49266606 Googletest export
c2989fe29 Googletest export
5dab7be70 Googletest export
45d66d81b Googletest export
8e86f6726 Googletest export
aac18185e Googletest export
e46e87bb1 Googletest export
c5f08bf91 Googletest export
d5932506d Merge pull request #1961 from coppered/patch-1
7a0680dc2 Merge pull request #1959 from robinlinden:remove-msvc-workarounds
09beafcd1 Merge branch 'master' into patch-1
b18d39bd2 Googletest export
1454f301c Update README.md
480213369 Add back warning suppression that shouldn't have been removed
a3a42514f Define GTEST_DISABLE_MSC_WARNINGS_PUSH/POP for all compilers
c43603f28 Remove GTEST_HAS_HASH_SET/MAP check
826656b25 Remove workarounds for unsupported MSVC versions
de5be0eb2 Googletest export
105579a6e Googletest export
529c2c6f4 Merge pull request #1950 from benjamincarman/makefix
9636db6b2 Merge branch 'master' into makefix
88c15b5fd Googletest export
4ea629d31 Added line to sample Makefile in googletest/googletest/make to specify use of C++11 in CXXFLAGS as required by the system
879ac092f Merge pull request #1948 from jerryturcios08/master
11319f1c6 Correct grammatical error in README.md
d1beec402 Merge branch 'master' of https://github.com/google/googletest
71d4fc8d7 Googletest export
e857f9cdd Googletest export
e0d3c3705 Googletest export
cc9dcc541 Merge pull request #1945 from akonradi/optional-matcher-doc
3896e3b59 Merge branch 'master' of https://github.com/google/googletest
39de88cb9 Add Optional() to the cheat sheet doc.
b9347b31c Googletest export
e9085769d Merge pull request #1941 from barkovv:master
80b43d900 Googletest export
b8a03c80a Merge branch 'master' of https://github.com/google/googletest
3feffddd1 Replaced all NULLs with nullptr in googlemock
53d61b5b2 Replaced all NULLs with nullptr in googletest
2e308484d Googletest export
b57c70396 Googletest export
a50e4f05b Googletest export
299d098da Merge branch 'master' of https://github.com/google/googletest
8ec8ce1c8 Merge pull request #1934 from jeffvandyke/patch-2
c45631823 Change CMake googletest download location in docs
6463ee81a Merge pull request #1890 from peterjc123:clang_fix
59f90a338 Googletest export
2801b2380 Merge branch 'master' of https://github.com/google/googletest
478a51859 Disable extensions and force standard
f6dadcf1f Revert previous changes
96824f11c Fix -std=c++11 flag
3bb00b7ea Merge pull request #1929 from goatshriek/cmake-cxx11-flag
6e3720126 Merge branch 'master' of https://github.com/google/googletest
9b637237b add documentation of manual c++11 specification
7b6b3be34 Update advanced.md
20eaf6e3a Merge pull request #1911 from BrukerJWD:isnice
a743780ad Update advanced.md
b974af792 Update advanced.md
90c957c40 Merge pull request #1927 from svg153/patch-1
58a8da64c ACTION table format
3468af9b3 Merge branch 'master' of https://github.com/google/googletest
82987067d Googletest export
32dbcac06 Merge pull request #1839 from Peter-Levine:python3-tests
572050dd2 Merge pull request #1905 from fandjelo:relocatable-pkgconfig-fix
648ac832a Merge branch 'master' of https://github.com/google/googletest
c955e3349 Merge branch 'master' into python3-tests
f410177a8 Update .travis.yml
723f26663 Update .travis.yml
663ef8636 Googletest export
3a7f0934d Merge pull request #1912 from kakkoko:fix-xml-name
29b47e45c Googletest export
2c19680bf Merge branch 'master' into relocatable-pkgconfig-fix
baf6845b1 Fix incorrect XML file name in help message
0cefda774 Removed last reference to internal::kDefault
96d161577 Merge branch 'isnice' of https://github.com/BrukerJWD/googletest into isnice
8c82ba48e Merge branch 'master' into isnice
386391b01 Use existing Mock::GetReactionOnUninterestingCalls()
6bbf911a8 Don't fully qualify enum member
67a240a10 Added Mock::IsNaggy, IsNice, and IsStrict
9424e7b0d Merge branch 'master' of https://github.com/google/googletest
a651a4d44 Merge pull request #1908 from rwoldberg:master
dec3b81a0 Change types to remove cast warnings.
754cb8ed9 Merge branch 'master' into relocatable-pkgconfig-fix
8fad86e75 Merge branch 'master' of https://github.com/google/googletest
864b6c2d3 Remove duplicate functionality PrintValue (in googletest-param-test-test.cc), use testing::PrintToString
b3b19a796 Merge c41b2bf861ef2ac1a975af05ff66d9256f280b01 into f203b2db77161fe54846ea9e839ebec81aeeccac
f203b2db7 Merge pull request #1902 from theryee/typo
ad997b16b Merge 4c92120d6dedb4eeb499a8702faea0224e0a8b23 into 658c6390a5b363f46c6ad448ad1bce9d6e97e53a
e7327c13f Merge 41fc9745d4a448db7d932250d22fac1dda287443 into 658c6390a5b363f46c6ad448ad1bce9d6e97e53a
bc6a4ce38 Project import generated by Copybara.
0e71eb069 Internal Change
095b3113e Use pcfiledir for prefix in pkgconfig file
4d50ab75a Merge branch 'master' into typo
a83429f5d fix typo
658c6390a Merge pull request #1898 from spartucus/master
8193ed069 Update .gitignore
274b39bfa Merge branch 'master' of https://github.com/google/googletest
78761b58f Remove non-variadic pre C++11 AnyOf
7d3b73c85 Unconditionally use std::tuple. Remove all mention of TR1 tuple and our own implementation of tuple.
5434989db Remove testing::internal::BothOfMatcher, no longer needed
b652edb39 Apply [[noreturn]] to Abort()
7a1e9114a Update Makefile.am
689ac9fbd Update BUILD.bazel
5ae4f6222 Update README.md
4665eee10 test, please ignore
272c08380 Delete CHANGES
ac7ed4046 Delete CHANGES
a113467a4 Merge branch 'master' of https://github.com/google/googletest
a31d6f905 Merge c1170881039e859738c62b02a918116fc6d346bc into 27c86f29417e53a622a2902baab2d1d82dafc5f9
4ac07de8d Fixing AllOfMatches test, where it properly belongs
27c86f294 always define define GTEST_LANG_CXX11 1
fab35920a Remove non-variadic pre C++11 AllOf
4327d95b3 Merge branch 'master' of https://github.com/google/googletest
3149e0e88 Merge branch 'master' into python3-tests
40f82ce56 Update primer.md
07c4753a1 Remove pre-C++11 code from gtest-printers
f8a1481c0 Make GTestColor and ColoredPrintF available as internal APIs from gtest.h.  This is for use in abseil exception safety testing.
c28ce4159 Removed pre-C++11 IsContainerTest and IteratorTraits
4bb49ed64 Apply clang-tidy modernize-use-nullptr to googletest.
7caf5ffd1 Merge branch 'master' of https://github.com/google/googletest
f13bbe299 Remove checking for C++ 11 and a pre-C++11 test from googletest tests
4b82df5bb Merge branch 'master' into python3-tests
50ec6ee33 Merge branch 'master' of https://github.com/google/googletest
bea3d6197 Merge d830440d48a9502161448bc78be33a53388dd1f4 into f5260ae757a681566d8f7d0558b8dc0551036506
9f8512d7c Remove compilation option for C++11 in the root CMakeLists.txt
77e0cd75b Resolve code changes from origin repository
f5260ae75 Merge c798e39a4f96f5a985126cc3fab4738b6412cfc1 into e93da23920e5b6887d6a6a291c3a59f83f5b579e
1e893191c Add compilation option for C++11 in the root CMakeLists.txt
e93da2392 Merge 68b8a4c60cd80c78e1875b77807fa13cdd2313f8 into 77962730563eece3525f40b8769e4ca0c6baf64c
779627305 Merge 86fe8a25eb5a6e4546f9e39cf23a5c764217bf85 into 440527a61e1c91188195f7de212c63c77e8f0a45
00938b2b2 Merge 2ce0685f76a4db403b7b2650433a584c150f2108 into 75e834700d19aa373b428c7c746f951737354c28
2e91bbcf6 Merge pull request #1875 from google/9A681768AABE08D1EFA5CA77528236A4
a7b21c950 Googletest export
be429c892 Googletest export
6316d8943 Merge pull request #1872 from jerryturcios08/master
cba347443 Add a cached variable to CMAKE_CXX_STANDARD
d97dea39b Add C++11 support in the root CMakeLists.txt
440527a61 Update appveyor.yml
907ae9eda Merge branch 'master' into python3-tests
75e834700 Merge pull request #1864 from google/revert-1853-appveyor-mingw-enable-tests-again
c2a2f49a3 Revert "[mingw] enable the unittests for gmock and gtest again"
707b3b25c Merge pull request #1855 from zach2good/issue1854_remove_i386_xcode10
a6b5c58ec Merge pull request #1853 from matlo607/appveyor-mingw-enable-tests-again
924146692 Merge branch 'master' into appveyor-mingw-enable-tests-again
0809c6804 Merge pull request #1862 from google/9A681768AABE08D1EFA5CA77528236A4
220e790a9 Keep one MinGW build, remove the others
77301d64c Update appveyor.yml
8286bf223 Update appveyor.yml
24ba1b1b3 Delete m4_ax_cxx_compile_stdcxx_11.m4
239d2691b Delete m4_ax_cxx_compile_stdcxx.m4
12b97f378 Update configure.ac
993f6d896 Update Makefile.am
adcb1f8e8 Update .travis.yml
5b6e40f46 automake
41b16d28d test automake c++11
df2a8dbc6 Update configure.ac
5a4e2b158 Update configure.ac
2ec9923cc typo
c159a7719 autotools c++11
e2f45b1bb autotools c++11
f60de198a test
ecbcd99c4 include c++11 for autotools
70de02bf2 Merge branch 'master' into 9A681768AABE08D1EFA5CA77528236A4
70ed5e5c4 Merge pull request #1863 from google/revert-1857-master
2b016ca49 Googletest export
c34ecf1ff Revert "Add clang format check to one of the builds"
b2788286d Googletest export
ba974c97a Googletest export
0fc5466db Googletest export
0f7f5cd93 Merge pull request #1861 from gennadiycivil/master
db6e8c727 enable MingW on PR
b91eab2fc C++11 autotools build
c26dd53ce adding c++11 to appveyor mingW
5e13fe662 Merge branch 'master' into appveyor-mingw-enable-tests-again
a4f57cf49 Merge branch 'master' into python3-tests
b19266a3e Merge pull request #1857 from gennadiycivil/master
76e104572 typo
2d3466be4 Add clang format check to one of the builds to provide indication that formatting is incorrect
0272ff1aa Issue #1854: remove support for i386 for XCode 10
0e161c3c8 [mingw] enable the unittests for gmock and gtest again
ed6e84cce Merge pull request #1850 from Jonny007-MKD/master
fd17c91ba Merge branch 'master' into master
c7a429a66 Update CONTRIBUTING.md
51945d3cd Update README.md
a2f13308c Add .clang-format
81c0b876b Formatting
659647110 Formatting
529338370 Formatting
78d3bfeb4 Formatting
67d3c0f6d Fix unit test
2b2b8d71c Fix ColoredOutputTest.UsesColorsWhenTermSupportsColors again
cecea92af Rename private member of AdditionalMessage Shorten lines in unit tests
1cb10b357 Readded changes from 6494f5232b130a29321e661166442bac324c4383
90943525c Merge branch 'master' into python3-tests
258def01a Merge pull request #1847 from google/revert-1832-master
a35326be0 Revert "Added special catch for std::exception in GTEST_TEST_NO_THROW_"
8bf297233 Merge pull request #1843 from matlo607/fix-unittest-msys-ColoredOutputTest
09560fba4 Merge pull request #1844 from matlo607/fix-msys-build-gmock-matchers_test
4f5524518 Merge pull request #1846 from google/9A681768AABE08D1EFA5CA77528236A4
8c547cff2 Googletest export
1b20bd176 Googletest export
9ea017285 Merge pull request #1832 from Jonny007-MKD/master
6a1c3d9b7 Removed some newlines
c9fe337ae [msys] fix unittest ColoredOutputTest.UsesColorsWhenTermSupportsColors
0a18c106a [msys] pass big object file option to assembler for target gmock-matchers_test
c40f55a22 Avoid these ambiguities
149c0d241 Fix Python3 support
6494f5232 Print message of unexpected std::exception in EXPECT_THROW, too
631e3a583 Merge branch 'master' into master
bc2d0935b Merge pull request #1838 from google/9A681768AABE08D1EFA5CA77528236A4
fc2caf648 Update .travis.yml
bc9df6ad4 Googletest export
28c2989ee Merge pull request #1837 from google/9A681768AABE08D1EFA5CA77528236A4
1b2da360e Merge branch 'master' into master
f46c174d1 Merge pull request #1835 from google/gennadiycivil-TR1-docs-cleanup
ffc9baeb4 Googletest export
abc803e28 Update README.md
5c89346de Update README.md
3c8055685 Merge branch 'master' into master
cfe0ae867 Merge pull request #1831 from anthraxx/fix/version
2649c2218 Merge pull request #1834 from google/9A681768AABE08D1EFA5CA77528236A4
0cd3c2e8b Googletest export
21d52d3a1 Googletest export
e1b8d82fa Googletest export
82eeb009b Make it public again *sigh*
e86d1df3e Avoid implicit move operator
8c849c584 Try to fix gcc and clang issues
0354ccb04 Added special catch for std::exception in GTEST_TEST_NO_THROW_
c4ef6f3a0 version: fix declared version to be in sync with CMakeLists.txt
5131cf737 Merge pull request #1828 from gdsotirov/patch-1
ca247e179 Merge branch 'master' into patch-1
d25268a55 Merge pull request #1829 from google/gennadiycivil-patch-1
5eee7a343 Update appveyor.yml
94046c91d Return GTEST_ATTRIBUTE_UNUSED_ on record_property_env to avoide comilation error (with -Werror)
4d066127b Merge pull request #1827 from google/9A681768AABE08D1EFA5CA77528236A4
db405ff8c Googletest export
936dae4ef Googletest export
0c799d043 Merge pull request #1820 from Romain-Geissler/fix-gcc-misleading-indentation-warning-again
93b05da26 Fix gcc misleading indentation again.
34d5d22b6 Merge pull request #1814 from google/9A681768AABE08D1EFA5CA77528236A4
0ddb6bf09 Googletest export
0d2262138 Googletest export
dbd55366c Googletest export
51cabc168 Googletest export
0614a539f Merge pull request #1809 from KindDragon/fix-doc-links
e6c407d60 Fix doc links
a2b149b23 Merge pull request #1801 from SoapGentoo/fix-gmock-pkgconfig
990bf4ffd Merge branch 'master' into fix-gmock-pkgconfig
3787a483b Merge pull request #1803 from KindDragon/patch-2
25bf88432 Merge pull request #1806 from asiplas/master
70a701758 Fix #1805: add `.md` to hyperlink
de9675986 Update documentation to syntax highlight code
79875d320 pkgconfig: Unconditionally depend on GTest when using GMock
c7a899855 Update README.md

git-subtree-dir: third_party/googletest
git-subtree-split: f5e592d8ee5ffb1d9af5be7f715ce3576b8bf9c4
Change-Id: Ic19f54048ae9e648e50b5c4c51045d4a19a51948
diff --git a/googlemock/scripts/README.md b/googlemock/scripts/README.md
new file mode 100644
index 0000000..a3301e5
--- /dev/null
+++ b/googlemock/scripts/README.md
@@ -0,0 +1,5 @@
+# Please Note:
+
+Files in this directory are no longer supported by the maintainers. They
+represent mostly historical artifacts and supported by the community only. There
+is no guarantee whatsoever that these scripts still work.
diff --git a/googlemock/scripts/fuse_gmock_files.py b/googlemock/scripts/fuse_gmock_files.py
index 9b6956f..7fa9b3a 100755
--- a/googlemock/scripts/fuse_gmock_files.py
+++ b/googlemock/scripts/fuse_gmock_files.py
@@ -28,8 +28,8 @@
 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+"""fuse_gmock_files.py v0.1.0.
 
-"""fuse_gmock_files.py v0.1.0
 Fuses Google Mock and Google Test source code into two .h files and a .cc file.
 
 SYNOPSIS
@@ -55,27 +55,29 @@
 This tool is experimental.  In particular, it assumes that there is no
 conditional inclusion of Google Mock or Google Test headers.  Please
 report any problems to googlemock@googlegroups.com.  You can read
-https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md for more
+https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md
+for more
 information.
 """
 
-__author__ = 'wan@google.com (Zhanyong Wan)'
+from __future__ import print_function
 
 import os
 import re
-import sets
 import sys
 
+__author__ = 'wan@google.com (Zhanyong Wan)'
+
 # We assume that this file is in the scripts/ directory in the Google
 # Mock root directory.
 DEFAULT_GMOCK_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..')
 
 # We need to call into googletest/scripts/fuse_gtest_files.py.
 sys.path.append(os.path.join(DEFAULT_GMOCK_ROOT_DIR, '../googletest/scripts'))
-import fuse_gtest_files
-gtest = fuse_gtest_files
+import fuse_gtest_files as gtest  # pylint:disable=g-import-not-at-top
 
-# Regex for matching '#include "gmock/..."'.
+# Regex for matching
+# '#include "gmock/..."'.
 INCLUDE_GMOCK_FILE_REGEX = re.compile(r'^\s*#\s*include\s*"(gmock/.+)"')
 
 # Where to find the source seed files.
@@ -98,6 +100,9 @@
   """Makes sure gmock_root points to a valid gmock root directory.
 
   The function aborts the program on failure.
+
+  Args:
+    gmock_root: A string with the mock root directory.
   """
 
   gtest.ValidateGTestRootDir(GetGTestRootDir(gmock_root))
@@ -109,6 +114,9 @@
   """Makes sure output_dir points to a valid output directory.
 
   The function aborts the program on failure.
+
+  Args:
+    output_dir: A string representing the output directory.
   """
 
   gtest.VerifyOutputFile(output_dir, gtest.GTEST_H_OUTPUT)
@@ -119,8 +127,8 @@
 def FuseGMockH(gmock_root, output_dir):
   """Scans folder gmock_root to generate gmock/gmock.h in output_dir."""
 
-  output_file = file(os.path.join(output_dir, GMOCK_H_OUTPUT), 'w')
-  processed_files = sets.Set()  # Holds all gmock headers we've processed.
+  output_file = open(os.path.join(output_dir, GMOCK_H_OUTPUT), 'w')
+  processed_files = set()  # Holds all gmock headers we've processed.
 
   def ProcessFile(gmock_header_path):
     """Processes the given gmock header file."""
@@ -132,25 +140,28 @@
     processed_files.add(gmock_header_path)
 
     # Reads each line in the given gmock header.
-    for line in file(os.path.join(gmock_root, gmock_header_path), 'r'):
-      m = INCLUDE_GMOCK_FILE_REGEX.match(line)
-      if m:
-        # It's '#include "gmock/..."' - let's process it recursively.
-        ProcessFile('include/' + m.group(1))
-      else:
-        m = gtest.INCLUDE_GTEST_FILE_REGEX.match(line)
-        if m:
-          # It's '#include "gtest/foo.h"'.  We translate it to
-          # "gtest/gtest.h", regardless of what foo is, since all
-          # gtest headers are fused into gtest/gtest.h.
 
-          # There is no need to #include gtest.h twice.
-          if not gtest.GTEST_H_SEED in processed_files:
-            processed_files.add(gtest.GTEST_H_SEED)
-            output_file.write('#include "%s"\n' % (gtest.GTEST_H_OUTPUT,))
+    with open(os.path.join(gmock_root, gmock_header_path), 'r') as fh:
+      for line in fh:
+        m = INCLUDE_GMOCK_FILE_REGEX.match(line)
+        if m:
+          # '#include "gmock/..."'
+          # - let's process it recursively.
+          ProcessFile('include/' + m.group(1))
         else:
-          # Otherwise we copy the line unchanged to the output file.
-          output_file.write(line)
+          m = gtest.INCLUDE_GTEST_FILE_REGEX.match(line)
+          if m:
+            # '#include "gtest/foo.h"'
+            # We translate it to "gtest/gtest.h", regardless of what foo is,
+            # since all gtest headers are fused into gtest/gtest.h.
+
+            # There is no need to #include gtest.h twice.
+            if gtest.GTEST_H_SEED not in processed_files:
+              processed_files.add(gtest.GTEST_H_SEED)
+              output_file.write('#include "%s"\n' % (gtest.GTEST_H_OUTPUT,))
+          else:
+            # Otherwise we copy the line unchanged to the output file.
+            output_file.write(line)
 
   ProcessFile(GMOCK_H_SEED)
   output_file.close()
@@ -159,7 +170,7 @@
 def FuseGMockAllCcToFile(gmock_root, output_file):
   """Scans folder gmock_root to fuse gmock-all.cc into output_file."""
 
-  processed_files = sets.Set()
+  processed_files = set()
 
   def ProcessFile(gmock_source_file):
     """Processes the given gmock source file."""
@@ -171,32 +182,37 @@
     processed_files.add(gmock_source_file)
 
     # Reads each line in the given gmock source file.
-    for line in file(os.path.join(gmock_root, gmock_source_file), 'r'):
-      m = INCLUDE_GMOCK_FILE_REGEX.match(line)
-      if m:
-        # It's '#include "gmock/foo.h"'.  We treat it as '#include
-        # "gmock/gmock.h"', as all other gmock headers are being fused
-        # into gmock.h and cannot be #included directly.
 
-        # There is no need to #include "gmock/gmock.h" more than once.
-        if not GMOCK_H_SEED in processed_files:
-          processed_files.add(GMOCK_H_SEED)
-          output_file.write('#include "%s"\n' % (GMOCK_H_OUTPUT,))
-      else:
-        m = gtest.INCLUDE_GTEST_FILE_REGEX.match(line)
+    with open(os.path.join(gmock_root, gmock_source_file), 'r') as fh:
+      for line in fh:
+        m = INCLUDE_GMOCK_FILE_REGEX.match(line)
         if m:
-          # It's '#include "gtest/..."'.
-          # There is no need to #include gtest.h as it has been
-          # #included by gtest-all.cc.
-          pass
+          # '#include "gmock/foo.h"'
+          # We treat it as '#include  "gmock/gmock.h"', as all other gmock
+          # headers are being fused into gmock.h and cannot be
+          # included directly.  No need to
+          # #include "gmock/gmock.h"
+          # more than once.
+
+          if GMOCK_H_SEED not in processed_files:
+            processed_files.add(GMOCK_H_SEED)
+            output_file.write('#include "%s"\n' % (GMOCK_H_OUTPUT,))
         else:
-          m = gtest.INCLUDE_SRC_FILE_REGEX.match(line)
+          m = gtest.INCLUDE_GTEST_FILE_REGEX.match(line)
           if m:
-            # It's '#include "src/foo"' - let's process it recursively.
-            ProcessFile(m.group(1))
+            # '#include "gtest/..."'
+            # There is no need to #include gtest.h as it has been
+            # #included by gtest-all.cc.
+
+            pass
           else:
-            # Otherwise we copy the line unchanged to the output file.
-            output_file.write(line)
+            m = gtest.INCLUDE_SRC_FILE_REGEX.match(line)
+            if m:
+              # It's '#include "src/foo"' - let's process it recursively.
+              ProcessFile(m.group(1))
+            else:
+              # Otherwise we copy the line unchanged to the output file.
+              output_file.write(line)
 
   ProcessFile(GMOCK_ALL_CC_SEED)
 
@@ -204,12 +220,12 @@
 def FuseGMockGTestAllCc(gmock_root, output_dir):
   """Scans folder gmock_root to generate gmock-gtest-all.cc in output_dir."""
 
-  output_file = file(os.path.join(output_dir, GMOCK_GTEST_ALL_CC_OUTPUT), 'w')
-  # First, fuse gtest-all.cc into gmock-gtest-all.cc.
-  gtest.FuseGTestAllCcToFile(GetGTestRootDir(gmock_root), output_file)
-  # Next, append fused gmock-all.cc to gmock-gtest-all.cc.
-  FuseGMockAllCcToFile(gmock_root, output_file)
-  output_file.close()
+  with open(os.path.join(output_dir, GMOCK_GTEST_ALL_CC_OUTPUT),
+            'w') as output_file:
+    # First, fuse gtest-all.cc into gmock-gtest-all.cc.
+    gtest.FuseGTestAllCcToFile(GetGTestRootDir(gmock_root), output_file)
+    # Next, append fused gmock-all.cc to gmock-gtest-all.cc.
+    FuseGMockAllCcToFile(gmock_root, output_file)
 
 
 def FuseGMock(gmock_root, output_dir):
@@ -232,7 +248,7 @@
     # fuse_gmock_files.py GMOCK_ROOT_DIR OUTPUT_DIR
     FuseGMock(sys.argv[1], sys.argv[2])
   else:
-    print __doc__
+    print(__doc__)
     sys.exit(1)
 
 
diff --git a/googlemock/scripts/generator/cpp/ast.py b/googlemock/scripts/generator/cpp/ast.py
index f14728b..0e77016 100755
--- a/googlemock/scripts/generator/cpp/ast.py
+++ b/googlemock/scripts/generator/cpp/ast.py
@@ -17,10 +17,7 @@
 
 """Generate an Abstract Syntax Tree (AST) for C++."""
 
-__author__ = 'nnorwitz@google.com (Neal Norwitz)'
-
-
-# TODO:
+# FIXME:
 #  * Tokens should never be exported, need to convert to Nodes
 #    (return types, parameters, etc.)
 #  * Handle static class data for templatized classes
@@ -33,12 +30,13 @@
 
 
 try:
-    # Python 3.x
-    import builtins
+  # Python 3.x
+  import builtins
 except ImportError:
-    # Python 2.x
-    import __builtin__ as builtins
+  # Python 2.x
+  import __builtin__ as builtins
 
+import collections
 import sys
 import traceback
 
@@ -48,15 +46,15 @@
 
 
 if not hasattr(builtins, 'reversed'):
-    # Support Python 2.3 and earlier.
-    def reversed(seq):
-        for i in range(len(seq)-1, -1, -1):
-            yield seq[i]
+  # Support Python 2.3 and earlier.
+  def reversed(seq):
+    for i in range(len(seq)-1, -1, -1):
+      yield seq[i]
 
 if not hasattr(builtins, 'next'):
-    # Support Python 2.5 and earlier.
-    def next(obj):
-        return obj.next()
+  # Support Python 2.5 and earlier.
+  def next(obj):
+    return obj.next()
 
 
 VISIBILITY_PUBLIC, VISIBILITY_PROTECTED, VISIBILITY_PRIVATE = range(3)
@@ -101,1570 +99,1609 @@
 # TODO(nnorwitz): use this as a singleton for templated_types, etc
 # where we don't want to create a new empty dict each time.  It is also const.
 class _NullDict(object):
-    __contains__ = lambda self: False
-    keys = values = items = iterkeys = itervalues = iteritems = lambda self: ()
+  __contains__ = lambda self: False
+  keys = values = items = iterkeys = itervalues = iteritems = lambda self: ()
 
 
 # TODO(nnorwitz): move AST nodes into a separate module.
 class Node(object):
-    """Base AST node."""
+  """Base AST node."""
 
-    def __init__(self, start, end):
-        self.start = start
-        self.end = end
+  def __init__(self, start, end):
+    self.start = start
+    self.end = end
 
-    def IsDeclaration(self):
-        """Returns bool if this node is a declaration."""
-        return False
+  def IsDeclaration(self):
+    """Returns bool if this node is a declaration."""
+    return False
 
-    def IsDefinition(self):
-        """Returns bool if this node is a definition."""
-        return False
+  def IsDefinition(self):
+    """Returns bool if this node is a definition."""
+    return False
 
-    def IsExportable(self):
-        """Returns bool if this node exportable from a header file."""
-        return False
+  def IsExportable(self):
+    """Returns bool if this node exportable from a header file."""
+    return False
 
-    def Requires(self, node):
-        """Does this AST node require the definition of the node passed in?"""
-        return False
+  def Requires(self, node):
+    """Does this AST node require the definition of the node passed in?"""
+    return False
 
-    def XXX__str__(self):
-        return self._StringHelper(self.__class__.__name__, '')
+  def XXX__str__(self):
+    return self._StringHelper(self.__class__.__name__, '')
 
-    def _StringHelper(self, name, suffix):
-        if not utils.DEBUG:
-            return '%s(%s)' % (name, suffix)
-        return '%s(%d, %d, %s)' % (name, self.start, self.end, suffix)
+  def _StringHelper(self, name, suffix):
+    if not utils.DEBUG:
+      return '%s(%s)' % (name, suffix)
+    return '%s(%d, %d, %s)' % (name, self.start, self.end, suffix)
 
-    def __repr__(self):
-        return str(self)
+  def __repr__(self):
+    return str(self)
 
 
 class Define(Node):
-    def __init__(self, start, end, name, definition):
-        Node.__init__(self, start, end)
-        self.name = name
-        self.definition = definition
+  def __init__(self, start, end, name, definition):
+    Node.__init__(self, start, end)
+    self.name = name
+    self.definition = definition
 
-    def __str__(self):
-        value = '%s %s' % (self.name, self.definition)
-        return self._StringHelper(self.__class__.__name__, value)
+  def __str__(self):
+    value = '%s %s' % (self.name, self.definition)
+    return self._StringHelper(self.__class__.__name__, value)
 
 
 class Include(Node):
-    def __init__(self, start, end, filename, system):
-        Node.__init__(self, start, end)
-        self.filename = filename
-        self.system = system
+  def __init__(self, start, end, filename, system):
+    Node.__init__(self, start, end)
+    self.filename = filename
+    self.system = system
 
-    def __str__(self):
-        fmt = '"%s"'
-        if self.system:
-            fmt = '<%s>'
-        return self._StringHelper(self.__class__.__name__, fmt % self.filename)
+  def __str__(self):
+    fmt = '"%s"'
+    if self.system:
+      fmt = '<%s>'
+    return self._StringHelper(self.__class__.__name__, fmt % self.filename)
 
 
 class Goto(Node):
-    def __init__(self, start, end, label):
-        Node.__init__(self, start, end)
-        self.label = label
+  def __init__(self, start, end, label):
+    Node.__init__(self, start, end)
+    self.label = label
 
-    def __str__(self):
-        return self._StringHelper(self.__class__.__name__, str(self.label))
+  def __str__(self):
+    return self._StringHelper(self.__class__.__name__, str(self.label))
 
 
 class Expr(Node):
-    def __init__(self, start, end, expr):
-        Node.__init__(self, start, end)
-        self.expr = expr
+  def __init__(self, start, end, expr):
+    Node.__init__(self, start, end)
+    self.expr = expr
 
-    def Requires(self, node):
-        # TODO(nnorwitz): impl.
-        return False
+  def Requires(self, node):
+    # TODO(nnorwitz): impl.
+    return False
 
-    def __str__(self):
-        return self._StringHelper(self.__class__.__name__, str(self.expr))
+  def __str__(self):
+    return self._StringHelper(self.__class__.__name__, str(self.expr))
 
 
 class Return(Expr):
-    pass
+  pass
 
 
 class Delete(Expr):
-    pass
+  pass
 
 
 class Friend(Expr):
-    def __init__(self, start, end, expr, namespace):
-        Expr.__init__(self, start, end, expr)
-        self.namespace = namespace[:]
+  def __init__(self, start, end, expr, namespace):
+    Expr.__init__(self, start, end, expr)
+    self.namespace = namespace[:]
 
 
 class Using(Node):
-    def __init__(self, start, end, names):
-        Node.__init__(self, start, end)
-        self.names = names
+  def __init__(self, start, end, names):
+    Node.__init__(self, start, end)
+    self.names = names
 
-    def __str__(self):
-        return self._StringHelper(self.__class__.__name__, str(self.names))
+  def __str__(self):
+    return self._StringHelper(self.__class__.__name__, str(self.names))
 
 
 class Parameter(Node):
-    def __init__(self, start, end, name, parameter_type, default):
-        Node.__init__(self, start, end)
-        self.name = name
-        self.type = parameter_type
-        self.default = default
+  def __init__(self, start, end, name, parameter_type, default):
+    Node.__init__(self, start, end)
+    self.name = name
+    self.type = parameter_type
+    self.default = default
 
-    def Requires(self, node):
-        # TODO(nnorwitz): handle namespaces, etc.
-        return self.type.name == node.name
+  def Requires(self, node):
+    # TODO(nnorwitz): handle namespaces, etc.
+    return self.type.name == node.name
 
-    def __str__(self):
-        name = str(self.type)
-        suffix = '%s %s' % (name, self.name)
-        if self.default:
-            suffix += ' = ' + ''.join([d.name for d in self.default])
-        return self._StringHelper(self.__class__.__name__, suffix)
+  def __str__(self):
+    name = str(self.type)
+    suffix = '%s %s' % (name, self.name)
+    if self.default:
+      suffix += ' = ' + ''.join([d.name for d in self.default])
+    return self._StringHelper(self.__class__.__name__, suffix)
 
 
 class _GenericDeclaration(Node):
-    def __init__(self, start, end, name, namespace):
-        Node.__init__(self, start, end)
-        self.name = name
-        self.namespace = namespace[:]
+  def __init__(self, start, end, name, namespace):
+    Node.__init__(self, start, end)
+    self.name = name
+    self.namespace = namespace[:]
 
-    def FullName(self):
-        prefix = ''
-        if self.namespace and self.namespace[-1]:
-            prefix = '::'.join(self.namespace) + '::'
-        return prefix + self.name
+  def FullName(self):
+    prefix = ''
+    if self.namespace and self.namespace[-1]:
+      prefix = '::'.join(self.namespace) + '::'
+    return prefix + self.name
 
-    def _TypeStringHelper(self, suffix):
-        if self.namespace:
-            names = [n or '<anonymous>' for n in self.namespace]
-            suffix += ' in ' + '::'.join(names)
-        return self._StringHelper(self.__class__.__name__, suffix)
+  def _TypeStringHelper(self, suffix):
+    if self.namespace:
+      names = [n or '<anonymous>' for n in self.namespace]
+      suffix += ' in ' + '::'.join(names)
+    return self._StringHelper(self.__class__.__name__, suffix)
 
 
 # TODO(nnorwitz): merge with Parameter in some way?
 class VariableDeclaration(_GenericDeclaration):
-    def __init__(self, start, end, name, var_type, initial_value, namespace):
-        _GenericDeclaration.__init__(self, start, end, name, namespace)
-        self.type = var_type
-        self.initial_value = initial_value
+  def __init__(self, start, end, name, var_type, initial_value, namespace):
+    _GenericDeclaration.__init__(self, start, end, name, namespace)
+    self.type = var_type
+    self.initial_value = initial_value
 
-    def Requires(self, node):
-        # TODO(nnorwitz): handle namespaces, etc.
-        return self.type.name == node.name
+  def Requires(self, node):
+    # TODO(nnorwitz): handle namespaces, etc.
+    return self.type.name == node.name
 
-    def ToString(self):
-        """Return a string that tries to reconstitute the variable decl."""
-        suffix = '%s %s' % (self.type, self.name)
-        if self.initial_value:
-            suffix += ' = ' + self.initial_value
-        return suffix
+  def ToString(self):
+    """Return a string that tries to reconstitute the variable decl."""
+    suffix = '%s %s' % (self.type, self.name)
+    if self.initial_value:
+      suffix += ' = ' + self.initial_value
+    return suffix
 
-    def __str__(self):
-        return self._StringHelper(self.__class__.__name__, self.ToString())
+  def __str__(self):
+    return self._StringHelper(self.__class__.__name__, self.ToString())
 
 
 class Typedef(_GenericDeclaration):
-    def __init__(self, start, end, name, alias, namespace):
-        _GenericDeclaration.__init__(self, start, end, name, namespace)
-        self.alias = alias
+  def __init__(self, start, end, name, alias, namespace):
+    _GenericDeclaration.__init__(self, start, end, name, namespace)
+    self.alias = alias
 
-    def IsDefinition(self):
+  def IsDefinition(self):
+    return True
+
+  def IsExportable(self):
+    return True
+
+  def Requires(self, node):
+    # TODO(nnorwitz): handle namespaces, etc.
+    name = node.name
+    for token in self.alias:
+      if token is not None and name == token.name:
         return True
+    return False
 
-    def IsExportable(self):
-        return True
-
-    def Requires(self, node):
-        # TODO(nnorwitz): handle namespaces, etc.
-        name = node.name
-        for token in self.alias:
-            if token is not None and name == token.name:
-                return True
-        return False
-
-    def __str__(self):
-        suffix = '%s, %s' % (self.name, self.alias)
-        return self._TypeStringHelper(suffix)
+  def __str__(self):
+    suffix = '%s, %s' % (self.name, self.alias)
+    return self._TypeStringHelper(suffix)
 
 
 class _NestedType(_GenericDeclaration):
-    def __init__(self, start, end, name, fields, namespace):
-        _GenericDeclaration.__init__(self, start, end, name, namespace)
-        self.fields = fields
+  def __init__(self, start, end, name, fields, namespace):
+    _GenericDeclaration.__init__(self, start, end, name, namespace)
+    self.fields = fields
 
-    def IsDefinition(self):
-        return True
+  def IsDefinition(self):
+    return True
 
-    def IsExportable(self):
-        return True
+  def IsExportable(self):
+    return True
 
-    def __str__(self):
-        suffix = '%s, {%s}' % (self.name, self.fields)
-        return self._TypeStringHelper(suffix)
+  def __str__(self):
+    suffix = '%s, {%s}' % (self.name, self.fields)
+    return self._TypeStringHelper(suffix)
 
 
 class Union(_NestedType):
-    pass
+  pass
 
 
 class Enum(_NestedType):
-    pass
+  pass
 
 
 class Class(_GenericDeclaration):
-    def __init__(self, start, end, name, bases, templated_types, body, namespace):
-        _GenericDeclaration.__init__(self, start, end, name, namespace)
-        self.bases = bases
-        self.body = body
-        self.templated_types = templated_types
+  def __init__(self, start, end, name, bases, templated_types, body, namespace):
+    _GenericDeclaration.__init__(self, start, end, name, namespace)
+    self.bases = bases
+    self.body = body
+    self.templated_types = templated_types
 
-    def IsDeclaration(self):
-        return self.bases is None and self.body is None
+  def IsDeclaration(self):
+    return self.bases is None and self.body is None
 
-    def IsDefinition(self):
-        return not self.IsDeclaration()
+  def IsDefinition(self):
+    return not self.IsDeclaration()
 
-    def IsExportable(self):
-        return not self.IsDeclaration()
+  def IsExportable(self):
+    return not self.IsDeclaration()
 
-    def Requires(self, node):
-        # TODO(nnorwitz): handle namespaces, etc.
-        if self.bases:
-            for token_list in self.bases:
-                # TODO(nnorwitz): bases are tokens, do name comparison.
-                for token in token_list:
-                    if token.name == node.name:
-                        return True
-        # TODO(nnorwitz): search in body too.
-        return False
+  def Requires(self, node):
+    # TODO(nnorwitz): handle namespaces, etc.
+    if self.bases:
+      for token_list in self.bases:
+        # TODO(nnorwitz): bases are tokens, do name comparison.
+        for token in token_list:
+          if token.name == node.name:
+            return True
+    # TODO(nnorwitz): search in body too.
+    return False
 
-    def __str__(self):
-        name = self.name
-        if self.templated_types:
-            name += '<%s>' % self.templated_types
-        suffix = '%s, %s, %s' % (name, self.bases, self.body)
-        return self._TypeStringHelper(suffix)
+  def __str__(self):
+    name = self.name
+    if self.templated_types:
+      name += '<%s>' % self.templated_types
+    suffix = '%s, %s, %s' % (name, self.bases, self.body)
+    return self._TypeStringHelper(suffix)
 
 
 class Struct(Class):
-    pass
+  pass
 
 
 class Function(_GenericDeclaration):
-    def __init__(self, start, end, name, return_type, parameters,
-                 modifiers, templated_types, body, namespace):
-        _GenericDeclaration.__init__(self, start, end, name, namespace)
-        converter = TypeConverter(namespace)
-        self.return_type = converter.CreateReturnType(return_type)
-        self.parameters = converter.ToParameters(parameters)
-        self.modifiers = modifiers
-        self.body = body
-        self.templated_types = templated_types
+  def __init__(self, start, end, name, return_type, parameters,
+               modifiers, templated_types, body, namespace):
+    _GenericDeclaration.__init__(self, start, end, name, namespace)
+    converter = TypeConverter(namespace)
+    self.return_type = converter.CreateReturnType(return_type)
+    self.parameters = converter.ToParameters(parameters)
+    self.modifiers = modifiers
+    self.body = body
+    self.templated_types = templated_types
 
-    def IsDeclaration(self):
-        return self.body is None
+  def IsDeclaration(self):
+    return self.body is None
 
-    def IsDefinition(self):
-        return self.body is not None
+  def IsDefinition(self):
+    return self.body is not None
 
-    def IsExportable(self):
-        if self.return_type and 'static' in self.return_type.modifiers:
-            return False
-        return None not in self.namespace
+  def IsExportable(self):
+    if self.return_type and 'static' in self.return_type.modifiers:
+      return False
+    return None not in self.namespace
 
-    def Requires(self, node):
-        if self.parameters:
-            # TODO(nnorwitz): parameters are tokens, do name comparison.
-            for p in self.parameters:
-                if p.name == node.name:
-                    return True
-        # TODO(nnorwitz): search in body too.
-        return False
+  def Requires(self, node):
+    if self.parameters:
+      # TODO(nnorwitz): parameters are tokens, do name comparison.
+      for p in self.parameters:
+        if p.name == node.name:
+          return True
+    # TODO(nnorwitz): search in body too.
+    return False
 
-    def __str__(self):
-        # TODO(nnorwitz): add templated_types.
-        suffix = ('%s %s(%s), 0x%02x, %s' %
-                  (self.return_type, self.name, self.parameters,
-                   self.modifiers, self.body))
-        return self._TypeStringHelper(suffix)
+  def __str__(self):
+    # TODO(nnorwitz): add templated_types.
+    suffix = ('%s %s(%s), 0x%02x, %s' %
+              (self.return_type, self.name, self.parameters,
+               self.modifiers, self.body))
+    return self._TypeStringHelper(suffix)
 
 
 class Method(Function):
-    def __init__(self, start, end, name, in_class, return_type, parameters,
-                 modifiers, templated_types, body, namespace):
-        Function.__init__(self, start, end, name, return_type, parameters,
-                          modifiers, templated_types, body, namespace)
-        # TODO(nnorwitz): in_class could also be a namespace which can
-        # mess up finding functions properly.
-        self.in_class = in_class
+  def __init__(self, start, end, name, in_class, return_type, parameters,
+               modifiers, templated_types, body, namespace):
+    Function.__init__(self, start, end, name, return_type, parameters,
+                      modifiers, templated_types, body, namespace)
+    # TODO(nnorwitz): in_class could also be a namespace which can
+    # mess up finding functions properly.
+    self.in_class = in_class
 
 
 class Type(_GenericDeclaration):
-    """Type used for any variable (eg class, primitive, struct, etc)."""
+  """Type used for any variable (eg class, primitive, struct, etc)."""
 
-    def __init__(self, start, end, name, templated_types, modifiers,
-                 reference, pointer, array):
-        """
+  def __init__(self, start, end, name, templated_types, modifiers,
+               reference, pointer, array):
+    """
         Args:
           name: str name of main type
           templated_types: [Class (Type?)] template type info between <>
           modifiers: [str] type modifiers (keywords) eg, const, mutable, etc.
           reference, pointer, array: bools
         """
-        _GenericDeclaration.__init__(self, start, end, name, [])
-        self.templated_types = templated_types
-        if not name and modifiers:
-            self.name = modifiers.pop()
-        self.modifiers = modifiers
-        self.reference = reference
-        self.pointer = pointer
-        self.array = array
+    _GenericDeclaration.__init__(self, start, end, name, [])
+    self.templated_types = templated_types
+    if not name and modifiers:
+      self.name = modifiers.pop()
+    self.modifiers = modifiers
+    self.reference = reference
+    self.pointer = pointer
+    self.array = array
 
-    def __str__(self):
-        prefix = ''
-        if self.modifiers:
-            prefix = ' '.join(self.modifiers) + ' '
-        name = str(self.name)
-        if self.templated_types:
-            name += '<%s>' % self.templated_types
-        suffix = prefix + name
-        if self.reference:
-            suffix += '&'
-        if self.pointer:
-            suffix += '*'
-        if self.array:
-            suffix += '[]'
-        return self._TypeStringHelper(suffix)
+  def __str__(self):
+    prefix = ''
+    if self.modifiers:
+      prefix = ' '.join(self.modifiers) + ' '
+    name = str(self.name)
+    if self.templated_types:
+      name += '<%s>' % self.templated_types
+    suffix = prefix + name
+    if self.reference:
+      suffix += '&'
+    if self.pointer:
+      suffix += '*'
+    if self.array:
+      suffix += '[]'
+    return self._TypeStringHelper(suffix)
 
-    # By definition, Is* are always False.  A Type can only exist in
-    # some sort of variable declaration, parameter, or return value.
-    def IsDeclaration(self):
-        return False
+  # By definition, Is* are always False.  A Type can only exist in
+  # some sort of variable declaration, parameter, or return value.
+  def IsDeclaration(self):
+    return False
 
-    def IsDefinition(self):
-        return False
+  def IsDefinition(self):
+    return False
 
-    def IsExportable(self):
-        return False
+  def IsExportable(self):
+    return False
 
 
 class TypeConverter(object):
 
-    def __init__(self, namespace_stack):
-        self.namespace_stack = namespace_stack
+  def __init__(self, namespace_stack):
+    self.namespace_stack = namespace_stack
 
-    def _GetTemplateEnd(self, tokens, start):
-        count = 1
-        end = start
-        while 1:
-            token = tokens[end]
-            end += 1
-            if token.name == '<':
-                count += 1
-            elif token.name == '>':
-                count -= 1
-                if count == 0:
-                    break
-        return tokens[start:end-1], end
+  def _GetTemplateEnd(self, tokens, start):
+    count = 1
+    end = start
+    while 1:
+      token = tokens[end]
+      end += 1
+      if token.name == '<':
+        count += 1
+      elif token.name == '>':
+        count -= 1
+        if count == 0:
+          break
+    return tokens[start:end-1], end
 
-    def ToType(self, tokens):
-        """Convert [Token,...] to [Class(...), ] useful for base classes.
+  def ToType(self, tokens):
+    """Convert [Token,...] to [Class(...), ] useful for base classes.
         For example, code like class Foo : public Bar<x, y> { ... };
         the "Bar<x, y>" portion gets converted to an AST.
 
         Returns:
           [Class(...), ...]
         """
-        result = []
-        name_tokens = []
+    result = []
+    name_tokens = []
+    reference = pointer = array = False
+
+    def AddType(templated_types):
+      # Partition tokens into name and modifier tokens.
+      names = []
+      modifiers = []
+      for t in name_tokens:
+        if keywords.IsKeyword(t.name):
+          modifiers.append(t.name)
+        else:
+          names.append(t.name)
+      name = ''.join(names)
+      if name_tokens:
+        result.append(Type(name_tokens[0].start, name_tokens[-1].end,
+                           name, templated_types, modifiers,
+                           reference, pointer, array))
+      del name_tokens[:]
+
+    i = 0
+    end = len(tokens)
+    while i < end:
+      token = tokens[i]
+      if token.name == '<':
+        new_tokens, new_end = self._GetTemplateEnd(tokens, i+1)
+        AddType(self.ToType(new_tokens))
+        # If there is a comma after the template, we need to consume
+        # that here otherwise it becomes part of the name.
+        i = new_end
         reference = pointer = array = False
+      elif token.name == ',':
+        AddType([])
+        reference = pointer = array = False
+      elif token.name == '*':
+        pointer = True
+      elif token.name == '&':
+        reference = True
+      elif token.name == '[':
+        pointer = True
+      elif token.name == ']':
+        pass
+      else:
+        name_tokens.append(token)
+      i += 1
 
-        def AddType(templated_types):
-            # Partition tokens into name and modifier tokens.
-            names = []
-            modifiers = []
-            for t in name_tokens:
-                if keywords.IsKeyword(t.name):
-                    modifiers.append(t.name)
-                else:
-                    names.append(t.name)
-            name = ''.join(names)
-            if name_tokens:
-                result.append(Type(name_tokens[0].start, name_tokens[-1].end,
-                                   name, templated_types, modifiers,
-                                   reference, pointer, array))
-            del name_tokens[:]
+    if name_tokens:
+      # No '<' in the tokens, just a simple name and no template.
+      AddType([])
+    return result
 
-        i = 0
-        end = len(tokens)
-        while i < end:
-            token = tokens[i]
-            if token.name == '<':
-                new_tokens, new_end = self._GetTemplateEnd(tokens, i+1)
-                AddType(self.ToType(new_tokens))
-                # If there is a comma after the template, we need to consume
-                # that here otherwise it becomes part of the name.
-                i = new_end
-                reference = pointer = array = False
-            elif token.name == ',':
-                AddType([])
-                reference = pointer = array = False
-            elif token.name == '*':
-                pointer = True
-            elif token.name == '&':
-                reference = True
-            elif token.name == '[':
-               pointer = True
-            elif token.name == ']':
-                pass
-            else:
-                name_tokens.append(token)
-            i += 1
+  def DeclarationToParts(self, parts, needs_name_removed):
+    name = None
+    default = []
+    if needs_name_removed:
+      # Handle default (initial) values properly.
+      for i, t in enumerate(parts):
+        if t.name == '=':
+          default = parts[i+1:]
+          name = parts[i-1].name
+          if name == ']' and parts[i-2].name == '[':
+            name = parts[i-3].name
+            i -= 1
+          parts = parts[:i-1]
+          break
+      else:
+        if parts[-1].token_type == tokenize.NAME:
+          name = parts.pop().name
+        else:
+          # TODO(nnorwitz): this is a hack that happens for code like
+          # Register(Foo<T>); where it thinks this is a function call
+          # but it's actually a declaration.
+          name = '???'
+    modifiers = []
+    type_name = []
+    other_tokens = []
+    templated_types = []
+    i = 0
+    end = len(parts)
+    while i < end:
+      p = parts[i]
+      if keywords.IsKeyword(p.name):
+        modifiers.append(p.name)
+      elif p.name == '<':
+        templated_tokens, new_end = self._GetTemplateEnd(parts, i+1)
+        templated_types = self.ToType(templated_tokens)
+        i = new_end - 1
+        # Don't add a spurious :: to data members being initialized.
+        next_index = i + 1
+        if next_index < end and parts[next_index].name == '::':
+          i += 1
+      elif p.name in ('[', ']', '='):
+        # These are handled elsewhere.
+        other_tokens.append(p)
+      elif p.name not in ('*', '&', '>'):
+        # Ensure that names have a space between them.
+        if (type_name and type_name[-1].token_type == tokenize.NAME and
+                p.token_type == tokenize.NAME):
+          type_name.append(tokenize.Token(tokenize.SYNTAX, ' ', 0, 0))
+        type_name.append(p)
+      else:
+        other_tokens.append(p)
+      i += 1
+    type_name = ''.join([t.name for t in type_name])
+    return name, type_name, templated_types, modifiers, default, other_tokens
 
-        if name_tokens:
-            # No '<' in the tokens, just a simple name and no template.
-            AddType([])
-        return result
+  def ToParameters(self, tokens):
+    if not tokens:
+      return []
 
-    def DeclarationToParts(self, parts, needs_name_removed):
-        name = None
-        default = []
-        if needs_name_removed:
-            # Handle default (initial) values properly.
-            for i, t in enumerate(parts):
-                if t.name == '=':
-                    default = parts[i+1:]
-                    name = parts[i-1].name
-                    if name == ']' and parts[i-2].name == '[':
-                        name = parts[i-3].name
-                        i -= 1
-                    parts = parts[:i-1]
-                    break
-            else:
-                if parts[-1].token_type == tokenize.NAME:
-                    name = parts.pop().name
-                else:
-                    # TODO(nnorwitz): this is a hack that happens for code like
-                    # Register(Foo<T>); where it thinks this is a function call
-                    # but it's actually a declaration.
-                    name = '???'
-        modifiers = []
-        type_name = []
-        other_tokens = []
-        templated_types = []
-        i = 0
-        end = len(parts)
-        while i < end:
-            p = parts[i]
-            if keywords.IsKeyword(p.name):
-                modifiers.append(p.name)
-            elif p.name == '<':
-                templated_tokens, new_end = self._GetTemplateEnd(parts, i+1)
-                templated_types = self.ToType(templated_tokens)
-                i = new_end - 1
-                # Don't add a spurious :: to data members being initialized.
-                next_index = i + 1
-                if next_index < end and parts[next_index].name == '::':
-                    i += 1
-            elif p.name in ('[', ']', '='):
-                # These are handled elsewhere.
-                other_tokens.append(p)
-            elif p.name not in ('*', '&', '>'):
-                # Ensure that names have a space between them.
-                if (type_name and type_name[-1].token_type == tokenize.NAME and
-                    p.token_type == tokenize.NAME):
-                    type_name.append(tokenize.Token(tokenize.SYNTAX, ' ', 0, 0))
-                type_name.append(p)
-            else:
-                other_tokens.append(p)
-            i += 1
-        type_name = ''.join([t.name for t in type_name])
-        return name, type_name, templated_types, modifiers, default, other_tokens
+    result = []
+    name = type_name = ''
+    type_modifiers = []
+    pointer = reference = array = False
+    first_token = None
+    default = []
 
-    def ToParameters(self, tokens):
-        if not tokens:
-            return []
+    def AddParameter(end):
+      if default:
+        del default[0]  # Remove flag.
+      parts = self.DeclarationToParts(type_modifiers, True)
+      (name, type_name, templated_types, modifiers,
+       unused_default, unused_other_tokens) = parts
+      parameter_type = Type(first_token.start, first_token.end,
+                            type_name, templated_types, modifiers,
+                            reference, pointer, array)
+      p = Parameter(first_token.start, end, name,
+                    parameter_type, default)
+      result.append(p)
 
-        result = []
+    template_count = 0
+    brace_count = 0
+    for s in tokens:
+      if not first_token:
+        first_token = s
+
+      # Check for braces before templates, as we can have unmatched '<>'
+      # inside default arguments.
+      if s.name == '{':
+        brace_count += 1
+      elif s.name == '}':
+        brace_count -= 1
+      if brace_count > 0:
+        type_modifiers.append(s)
+        continue
+
+      if s.name == '<':
+        template_count += 1
+      elif s.name == '>':
+        template_count -= 1
+      if template_count > 0:
+        type_modifiers.append(s)
+        continue
+
+      if s.name == ',':
+        AddParameter(s.start)
         name = type_name = ''
         type_modifiers = []
         pointer = reference = array = False
         first_token = None
         default = []
+      elif s.name == '*':
+        pointer = True
+      elif s.name == '&':
+        reference = True
+      elif s.name == '[':
+        array = True
+      elif s.name == ']':
+        pass  # Just don't add to type_modifiers.
+      elif s.name == '=':
+        # Got a default value.  Add any value (None) as a flag.
+        default.append(None)
+      elif default:
+        default.append(s)
+      else:
+        type_modifiers.append(s)
+    AddParameter(tokens[-1].end)
+    return result
 
-        def AddParameter(end):
-            if default:
-                del default[0]  # Remove flag.
-            parts = self.DeclarationToParts(type_modifiers, True)
-            (name, type_name, templated_types, modifiers,
-             unused_default, unused_other_tokens) = parts
-            parameter_type = Type(first_token.start, first_token.end,
-                                  type_name, templated_types, modifiers,
-                                  reference, pointer, array)
-            p = Parameter(first_token.start, end, name,
-                          parameter_type, default)
-            result.append(p)
+  def CreateReturnType(self, return_type_seq):
+    if not return_type_seq:
+      return None
+    start = return_type_seq[0].start
+    end = return_type_seq[-1].end
+    _, name, templated_types, modifiers, default, other_tokens = \
+        self.DeclarationToParts(return_type_seq, False)
+    names = [n.name for n in other_tokens]
+    reference = '&' in names
+    pointer = '*' in names
+    array = '[' in names
+    return Type(start, end, name, templated_types, modifiers,
+                reference, pointer, array)
 
-        template_count = 0
-        for s in tokens:
-            if not first_token:
-                first_token = s
-            if s.name == '<':
-                template_count += 1
-            elif s.name == '>':
-                template_count -= 1
-            if template_count > 0:
-                type_modifiers.append(s)
-                continue
-
-            if s.name == ',':
-                AddParameter(s.start)
-                name = type_name = ''
-                type_modifiers = []
-                pointer = reference = array = False
-                first_token = None
-                default = []
-            elif s.name == '*':
-                pointer = True
-            elif s.name == '&':
-                reference = True
-            elif s.name == '[':
-                array = True
-            elif s.name == ']':
-                pass  # Just don't add to type_modifiers.
-            elif s.name == '=':
-                # Got a default value.  Add any value (None) as a flag.
-                default.append(None)
-            elif default:
-                default.append(s)
-            else:
-                type_modifiers.append(s)
-        AddParameter(tokens[-1].end)
-        return result
-
-    def CreateReturnType(self, return_type_seq):
-        if not return_type_seq:
-            return None
-        start = return_type_seq[0].start
-        end = return_type_seq[-1].end
-        _, name, templated_types, modifiers, default, other_tokens = \
-           self.DeclarationToParts(return_type_seq, False)
-        names = [n.name for n in other_tokens]
-        reference = '&' in names
-        pointer = '*' in names
-        array = '[' in names
-        return Type(start, end, name, templated_types, modifiers,
-                    reference, pointer, array)
-
-    def GetTemplateIndices(self, names):
-        # names is a list of strings.
-        start = names.index('<')
-        end = len(names) - 1
-        while end > 0:
-            if names[end] == '>':
-                break
-            end -= 1
-        return start, end+1
+  def GetTemplateIndices(self, names):
+    # names is a list of strings.
+    start = names.index('<')
+    end = len(names) - 1
+    while end > 0:
+      if names[end] == '>':
+        break
+      end -= 1
+    return start, end+1
 
 class AstBuilder(object):
-    def __init__(self, token_stream, filename, in_class='', visibility=None,
-                 namespace_stack=[]):
-        self.tokens = token_stream
-        self.filename = filename
-        # TODO(nnorwitz): use a better data structure (deque) for the queue.
-        # Switching directions of the "queue" improved perf by about 25%.
-        # Using a deque should be even better since we access from both sides.
-        self.token_queue = []
-        self.namespace_stack = namespace_stack[:]
-        self.in_class = in_class
-        if in_class is None:
-            self.in_class_name_only = None
+  def __init__(self, token_stream, filename, in_class='', visibility=None,
+               namespace_stack=[]):
+    self.tokens = token_stream
+    self.filename = filename
+    # TODO(nnorwitz): use a better data structure (deque) for the queue.
+    # Switching directions of the "queue" improved perf by about 25%.
+    # Using a deque should be even better since we access from both sides.
+    self.token_queue = []
+    self.namespace_stack = namespace_stack[:]
+    self.in_class = in_class
+    if in_class is None:
+      self.in_class_name_only = None
+    else:
+      self.in_class_name_only = in_class.split('::')[-1]
+    self.visibility = visibility
+    self.in_function = False
+    self.current_token = None
+    # Keep the state whether we are currently handling a typedef or not.
+    self._handling_typedef = False
+
+    self.converter = TypeConverter(self.namespace_stack)
+
+  def HandleError(self, msg, token):
+    printable_queue = list(reversed(self.token_queue[-20:]))
+    sys.stderr.write('Got %s in %s @ %s %s\n' %
+                     (msg, self.filename, token, printable_queue))
+
+  def Generate(self):
+    while 1:
+      token = self._GetNextToken()
+      if not token:
+        break
+
+      # Get the next token.
+      self.current_token = token
+
+      # Dispatch on the next token type.
+      if token.token_type == _INTERNAL_TOKEN:
+        if token.name == _NAMESPACE_POP:
+          self.namespace_stack.pop()
+        continue
+
+      try:
+        result = self._GenerateOne(token)
+        if result is not None:
+          yield result
+      except:
+        self.HandleError('exception', token)
+        raise
+
+  def _CreateVariable(self, pos_token, name, type_name, type_modifiers,
+                      ref_pointer_name_seq, templated_types, value=None):
+    reference = '&' in ref_pointer_name_seq
+    pointer = '*' in ref_pointer_name_seq
+    array = '[' in ref_pointer_name_seq
+    var_type = Type(pos_token.start, pos_token.end, type_name,
+                    templated_types, type_modifiers,
+                    reference, pointer, array)
+    return VariableDeclaration(pos_token.start, pos_token.end,
+                               name, var_type, value, self.namespace_stack)
+
+  def _GenerateOne(self, token):
+    if token.token_type == tokenize.NAME:
+      if (keywords.IsKeyword(token.name) and
+          not keywords.IsBuiltinType(token.name)):
+        if token.name == 'enum':
+          # Pop the next token and only put it back if it's not
+          # 'class'.  This allows us to support the two-token
+          # 'enum class' keyword as if it were simply 'enum'.
+          next = self._GetNextToken()
+          if next.name != 'class':
+            self._AddBackToken(next)
+
+        method = getattr(self, 'handle_' + token.name)
+        return method()
+      elif token.name == self.in_class_name_only:
+        # The token name is the same as the class, must be a ctor if
+        # there is a paren.  Otherwise, it's the return type.
+        # Peek ahead to get the next token to figure out which.
+        next = self._GetNextToken()
+        self._AddBackToken(next)
+        if next.token_type == tokenize.SYNTAX and next.name == '(':
+          return self._GetMethod([token], FUNCTION_CTOR, None, True)
+        # Fall through--handle like any other method.
+
+      # Handle data or function declaration/definition.
+      syntax = tokenize.SYNTAX
+      temp_tokens, last_token = \
+          self._GetVarTokensUpToIgnoringTemplates(syntax,
+                                                  '(', ';', '{', '[')
+      temp_tokens.insert(0, token)
+      if last_token.name == '(':
+        # If there is an assignment before the paren,
+        # this is an expression, not a method.
+        expr = bool([e for e in temp_tokens if e.name == '='])
+        if expr:
+          new_temp = self._GetTokensUpTo(tokenize.SYNTAX, ';')
+          temp_tokens.append(last_token)
+          temp_tokens.extend(new_temp)
+          last_token = tokenize.Token(tokenize.SYNTAX, ';', 0, 0)
+
+      if last_token.name == '[':
+        # Handle array, this isn't a method, unless it's an operator.
+        # TODO(nnorwitz): keep the size somewhere.
+        # unused_size = self._GetTokensUpTo(tokenize.SYNTAX, ']')
+        temp_tokens.append(last_token)
+        if temp_tokens[-2].name == 'operator':
+          temp_tokens.append(self._GetNextToken())
         else:
-            self.in_class_name_only = in_class.split('::')[-1]
-        self.visibility = visibility
-        self.in_function = False
-        self.current_token = None
-        # Keep the state whether we are currently handling a typedef or not.
-        self._handling_typedef = False
+          temp_tokens2, last_token = \
+              self._GetVarTokensUpTo(tokenize.SYNTAX, ';')
+          temp_tokens.extend(temp_tokens2)
 
-        self.converter = TypeConverter(self.namespace_stack)
+      if last_token.name == ';':
+        # Handle data, this isn't a method.
+        parts = self.converter.DeclarationToParts(temp_tokens, True)
+        (name, type_name, templated_types, modifiers, default,
+         unused_other_tokens) = parts
 
-    def HandleError(self, msg, token):
-        printable_queue = list(reversed(self.token_queue[-20:]))
-        sys.stderr.write('Got %s in %s @ %s %s\n' %
-                         (msg, self.filename, token, printable_queue))
-
-    def Generate(self):
-        while 1:
-            token = self._GetNextToken()
-            if not token:
-                break
-
-            # Get the next token.
-            self.current_token = token
-
-            # Dispatch on the next token type.
-            if token.token_type == _INTERNAL_TOKEN:
-                if token.name == _NAMESPACE_POP:
-                    self.namespace_stack.pop()
-                continue
-
-            try:
-                result = self._GenerateOne(token)
-                if result is not None:
-                    yield result
-            except:
-                self.HandleError('exception', token)
-                raise
-
-    def _CreateVariable(self, pos_token, name, type_name, type_modifiers,
-                        ref_pointer_name_seq, templated_types, value=None):
-        reference = '&' in ref_pointer_name_seq
-        pointer = '*' in ref_pointer_name_seq
-        array = '[' in ref_pointer_name_seq
-        var_type = Type(pos_token.start, pos_token.end, type_name,
-                        templated_types, type_modifiers,
-                        reference, pointer, array)
-        return VariableDeclaration(pos_token.start, pos_token.end,
-                                   name, var_type, value, self.namespace_stack)
-
-    def _GenerateOne(self, token):
-        if token.token_type == tokenize.NAME:
-            if (keywords.IsKeyword(token.name) and
-                not keywords.IsBuiltinType(token.name)):
-                method = getattr(self, 'handle_' + token.name)
-                return method()
-            elif token.name == self.in_class_name_only:
-                # The token name is the same as the class, must be a ctor if
-                # there is a paren.  Otherwise, it's the return type.
-                # Peek ahead to get the next token to figure out which.
-                next = self._GetNextToken()
-                self._AddBackToken(next)
-                if next.token_type == tokenize.SYNTAX and next.name == '(':
-                    return self._GetMethod([token], FUNCTION_CTOR, None, True)
-                # Fall through--handle like any other method.
-
-            # Handle data or function declaration/definition.
-            syntax = tokenize.SYNTAX
-            temp_tokens, last_token = \
-                self._GetVarTokensUpTo(syntax, '(', ';', '{', '[')
-            temp_tokens.insert(0, token)
-            if last_token.name == '(':
-                # If there is an assignment before the paren,
-                # this is an expression, not a method.
-                expr = bool([e for e in temp_tokens if e.name == '='])
-                if expr:
-                    new_temp = self._GetTokensUpTo(tokenize.SYNTAX, ';')
-                    temp_tokens.append(last_token)
-                    temp_tokens.extend(new_temp)
-                    last_token = tokenize.Token(tokenize.SYNTAX, ';', 0, 0)
-
-            if last_token.name == '[':
-                # Handle array, this isn't a method, unless it's an operator.
-                # TODO(nnorwitz): keep the size somewhere.
-                # unused_size = self._GetTokensUpTo(tokenize.SYNTAX, ']')
-                temp_tokens.append(last_token)
-                if temp_tokens[-2].name == 'operator':
-                    temp_tokens.append(self._GetNextToken())
-                else:
-                    temp_tokens2, last_token = \
-                        self._GetVarTokensUpTo(tokenize.SYNTAX, ';')
-                    temp_tokens.extend(temp_tokens2)
-
-            if last_token.name == ';':
-                # Handle data, this isn't a method.
-                parts = self.converter.DeclarationToParts(temp_tokens, True)
-                (name, type_name, templated_types, modifiers, default,
-                 unused_other_tokens) = parts
-
-                t0 = temp_tokens[0]
-                names = [t.name for t in temp_tokens]
-                if templated_types:
-                    start, end = self.converter.GetTemplateIndices(names)
-                    names = names[:start] + names[end:]
-                default = ''.join([t.name for t in default])
-                return self._CreateVariable(t0, name, type_name, modifiers,
-                                            names, templated_types, default)
-            if last_token.name == '{':
-                self._AddBackTokens(temp_tokens[1:])
-                self._AddBackToken(last_token)
-                method_name = temp_tokens[0].name
-                method = getattr(self, 'handle_' + method_name, None)
-                if not method:
-                    # Must be declaring a variable.
-                    # TODO(nnorwitz): handle the declaration.
-                    return None
-                return method()
-            return self._GetMethod(temp_tokens, 0, None, False)
-        elif token.token_type == tokenize.SYNTAX:
-            if token.name == '~' and self.in_class:
-                # Must be a dtor (probably not in method body).
-                token = self._GetNextToken()
-                # self.in_class can contain A::Name, but the dtor will only
-                # be Name.  Make sure to compare against the right value.
-                if (token.token_type == tokenize.NAME and
-                    token.name == self.in_class_name_only):
-                    return self._GetMethod([token], FUNCTION_DTOR, None, True)
-            # TODO(nnorwitz): handle a lot more syntax.
-        elif token.token_type == tokenize.PREPROCESSOR:
-            # TODO(nnorwitz): handle more preprocessor directives.
-            # token starts with a #, so remove it and strip whitespace.
-            name = token.name[1:].lstrip()
-            if name.startswith('include'):
-                # Remove "include".
-                name = name[7:].strip()
-                assert name
-                # Handle #include \<newline> "header-on-second-line.h".
-                if name.startswith('\\'):
-                    name = name[1:].strip()
-                assert name[0] in '<"', token
-                assert name[-1] in '>"', token
-                system = name[0] == '<'
-                filename = name[1:-1]
-                return Include(token.start, token.end, filename, system)
-            if name.startswith('define'):
-                # Remove "define".
-                name = name[6:].strip()
-                assert name
-                value = ''
-                for i, c in enumerate(name):
-                    if c.isspace():
-                        value = name[i:].lstrip()
-                        name = name[:i]
-                        break
-                return Define(token.start, token.end, name, value)
-            if name.startswith('if') and name[2:3].isspace():
-                condition = name[3:].strip()
-                if condition.startswith('0') or condition.startswith('(0)'):
-                    self._SkipIf0Blocks()
-        return None
-
-    def _GetTokensUpTo(self, expected_token_type, expected_token):
-        return self._GetVarTokensUpTo(expected_token_type, expected_token)[0]
-
-    def _GetVarTokensUpTo(self, expected_token_type, *expected_tokens):
-        last_token = self._GetNextToken()
-        tokens = []
-        while (last_token.token_type != expected_token_type or
-               last_token.name not in expected_tokens):
-            tokens.append(last_token)
-            last_token = self._GetNextToken()
-        return tokens, last_token
-
-    # TODO(nnorwitz): remove _IgnoreUpTo() it shouldn't be necessary.
-    def _IgnoreUpTo(self, token_type, token):
-        unused_tokens = self._GetTokensUpTo(token_type, token)
-
-    def _SkipIf0Blocks(self):
-        count = 1
-        while 1:
-            token = self._GetNextToken()
-            if token.token_type != tokenize.PREPROCESSOR:
-                continue
-
-            name = token.name[1:].lstrip()
-            if name.startswith('endif'):
-                count -= 1
-                if count == 0:
-                    break
-            elif name.startswith('if'):
-                count += 1
-
-    def _GetMatchingChar(self, open_paren, close_paren, GetNextToken=None):
-        if GetNextToken is None:
-            GetNextToken = self._GetNextToken
-        # Assumes the current token is open_paren and we will consume
-        # and return up to the close_paren.
-        count = 1
-        token = GetNextToken()
-        while 1:
-            if token.token_type == tokenize.SYNTAX:
-                if token.name == open_paren:
-                    count += 1
-                elif token.name == close_paren:
-                    count -= 1
-                    if count == 0:
-                        break
-            yield token
-            token = GetNextToken()
-        yield token
-
-    def _GetParameters(self):
-        return self._GetMatchingChar('(', ')')
-
-    def GetScope(self):
-        return self._GetMatchingChar('{', '}')
-
-    def _GetNextToken(self):
-        if self.token_queue:
-            return self.token_queue.pop()
-        return next(self.tokens)
-
-    def _AddBackToken(self, token):
-        if token.whence == tokenize.WHENCE_STREAM:
-            token.whence = tokenize.WHENCE_QUEUE
-            self.token_queue.insert(0, token)
-        else:
-            assert token.whence == tokenize.WHENCE_QUEUE, token
-            self.token_queue.append(token)
-
-    def _AddBackTokens(self, tokens):
-        if tokens:
-            if tokens[-1].whence == tokenize.WHENCE_STREAM:
-                for token in tokens:
-                    token.whence = tokenize.WHENCE_QUEUE
-                self.token_queue[:0] = reversed(tokens)
-            else:
-                assert tokens[-1].whence == tokenize.WHENCE_QUEUE, tokens
-                self.token_queue.extend(reversed(tokens))
-
-    def GetName(self, seq=None):
-        """Returns ([tokens], next_token_info)."""
-        GetNextToken = self._GetNextToken
-        if seq is not None:
-            it = iter(seq)
-            GetNextToken = lambda: next(it)
-        next_token = GetNextToken()
-        tokens = []
-        last_token_was_name = False
-        while (next_token.token_type == tokenize.NAME or
-               (next_token.token_type == tokenize.SYNTAX and
-                next_token.name in ('::', '<'))):
-            # Two NAMEs in a row means the identifier should terminate.
-            # It's probably some sort of variable declaration.
-            if last_token_was_name and next_token.token_type == tokenize.NAME:
-                break
-            last_token_was_name = next_token.token_type == tokenize.NAME
-            tokens.append(next_token)
-            # Handle templated names.
-            if next_token.name == '<':
-                tokens.extend(self._GetMatchingChar('<', '>', GetNextToken))
-                last_token_was_name = True
-            next_token = GetNextToken()
-        return tokens, next_token
-
-    def GetMethod(self, modifiers, templated_types):
-        return_type_and_name = self._GetTokensUpTo(tokenize.SYNTAX, '(')
-        assert len(return_type_and_name) >= 1
-        return self._GetMethod(return_type_and_name, modifiers, templated_types,
-                               False)
-
-    def _GetMethod(self, return_type_and_name, modifiers, templated_types,
-                   get_paren):
-        template_portion = None
-        if get_paren:
-            token = self._GetNextToken()
-            assert token.token_type == tokenize.SYNTAX, token
-            if token.name == '<':
-                # Handle templatized dtors.
-                template_portion = [token]
-                template_portion.extend(self._GetMatchingChar('<', '>'))
-                token = self._GetNextToken()
-            assert token.token_type == tokenize.SYNTAX, token
-            assert token.name == '(', token
-
-        name = return_type_and_name.pop()
-        # Handle templatized ctors.
-        if name.name == '>':
-            index = 1
-            while return_type_and_name[index].name != '<':
-                index += 1
-            template_portion = return_type_and_name[index:] + [name]
-            del return_type_and_name[index:]
-            name = return_type_and_name.pop()
-        elif name.name == ']':
-            rt = return_type_and_name
-            assert rt[-1].name == '[', return_type_and_name
-            assert rt[-2].name == 'operator', return_type_and_name
-            name_seq = return_type_and_name[-2:]
-            del return_type_and_name[-2:]
-            name = tokenize.Token(tokenize.NAME, 'operator[]',
-                                  name_seq[0].start, name.end)
-            # Get the open paren so _GetParameters() below works.
-            unused_open_paren = self._GetNextToken()
-
-        # TODO(nnorwitz): store template_portion.
-        return_type = return_type_and_name
-        indices = name
-        if return_type:
-            indices = return_type[0]
-
-        # Force ctor for templatized ctors.
-        if name.name == self.in_class and not modifiers:
-            modifiers |= FUNCTION_CTOR
-        parameters = list(self._GetParameters())
-        del parameters[-1]              # Remove trailing ')'.
-
-        # Handling operator() is especially weird.
-        if name.name == 'operator' and not parameters:
-            token = self._GetNextToken()
-            assert token.name == '(', token
-            parameters = list(self._GetParameters())
-            del parameters[-1]          # Remove trailing ')'.
-
+        t0 = temp_tokens[0]
+        names = [t.name for t in temp_tokens]
+        if templated_types:
+          start, end = self.converter.GetTemplateIndices(names)
+          names = names[:start] + names[end:]
+        default = ''.join([t.name for t in default])
+        return self._CreateVariable(t0, name, type_name, modifiers,
+                                    names, templated_types, default)
+      if last_token.name == '{':
+        self._AddBackTokens(temp_tokens[1:])
+        self._AddBackToken(last_token)
+        method_name = temp_tokens[0].name
+        method = getattr(self, 'handle_' + method_name, None)
+        if not method:
+          # Must be declaring a variable.
+          # TODO(nnorwitz): handle the declaration.
+          return None
+        return method()
+      return self._GetMethod(temp_tokens, 0, None, False)
+    elif token.token_type == tokenize.SYNTAX:
+      if token.name == '~' and self.in_class:
+        # Must be a dtor (probably not in method body).
         token = self._GetNextToken()
-        while token.token_type == tokenize.NAME:
-            modifier_token = token
-            token = self._GetNextToken()
-            if modifier_token.name == 'const':
-                modifiers |= FUNCTION_CONST
-            elif modifier_token.name == '__attribute__':
-                # TODO(nnorwitz): handle more __attribute__ details.
-                modifiers |= FUNCTION_ATTRIBUTE
-                assert token.name == '(', token
-                # Consume everything between the (parens).
-                unused_tokens = list(self._GetMatchingChar('(', ')'))
-                token = self._GetNextToken()
-            elif modifier_token.name == 'throw':
-                modifiers |= FUNCTION_THROW
-                assert token.name == '(', token
-                # Consume everything between the (parens).
-                unused_tokens = list(self._GetMatchingChar('(', ')'))
-                token = self._GetNextToken()
-            elif modifier_token.name == 'override':
-                modifiers |= FUNCTION_OVERRIDE
-            elif modifier_token.name == modifier_token.name.upper():
-                # HACK(nnorwitz):  assume that all upper-case names
-                # are some macro we aren't expanding.
-                modifiers |= FUNCTION_UNKNOWN_ANNOTATION
-            else:
-                self.HandleError('unexpected token', modifier_token)
-
-        assert token.token_type == tokenize.SYNTAX, token
-        # Handle ctor initializers.
-        if token.name == ':':
-            # TODO(nnorwitz): anything else to handle for initializer list?
-            while token.name != ';' and token.name != '{':
-                token = self._GetNextToken()
-
-        # Handle pointer to functions that are really data but look
-        # like method declarations.
-        if token.name == '(':
-            if parameters[0].name == '*':
-                # name contains the return type.
-                name = parameters.pop()
-                # parameters contains the name of the data.
-                modifiers = [p.name for p in parameters]
-                # Already at the ( to open the parameter list.
-                function_parameters = list(self._GetMatchingChar('(', ')'))
-                del function_parameters[-1]  # Remove trailing ')'.
-                # TODO(nnorwitz): store the function_parameters.
-                token = self._GetNextToken()
-                assert token.token_type == tokenize.SYNTAX, token
-                assert token.name == ';', token
-                return self._CreateVariable(indices, name.name, indices.name,
-                                            modifiers, '', None)
-            # At this point, we got something like:
-            #  return_type (type::*name_)(params);
-            # This is a data member called name_ that is a function pointer.
-            # With this code: void (sq_type::*field_)(string&);
-            # We get: name=void return_type=[] parameters=sq_type ... field_
-            # TODO(nnorwitz): is return_type always empty?
-            # TODO(nnorwitz): this isn't even close to being correct.
-            # Just put in something so we don't crash and can move on.
-            real_name = parameters[-1]
-            modifiers = [p.name for p in self._GetParameters()]
-            del modifiers[-1]           # Remove trailing ')'.
-            return self._CreateVariable(indices, real_name.name, indices.name,
-                                        modifiers, '', None)
-
-        if token.name == '{':
-            body = list(self.GetScope())
-            del body[-1]                # Remove trailing '}'.
-        else:
-            body = None
-            if token.name == '=':
-                token = self._GetNextToken()
-
-                if token.name == 'default' or token.name == 'delete':
-                    # Ignore explicitly defaulted and deleted special members
-                    # in C++11.
-                    token = self._GetNextToken()
-                else:
-                    # Handle pure-virtual declarations.
-                    assert token.token_type == tokenize.CONSTANT, token
-                    assert token.name == '0', token
-                    modifiers |= FUNCTION_PURE_VIRTUAL
-                    token = self._GetNextToken()
-
-            if token.name == '[':
-                # TODO(nnorwitz): store tokens and improve parsing.
-                # template <typename T, size_t N> char (&ASH(T (&seq)[N]))[N];
-                tokens = list(self._GetMatchingChar('[', ']'))
-                token = self._GetNextToken()
-
-            assert token.name == ';', (token, return_type_and_name, parameters)
-
-        # Looks like we got a method, not a function.
-        if len(return_type) > 2 and return_type[-1].name == '::':
-            return_type, in_class = \
-                         self._GetReturnTypeAndClassName(return_type)
-            return Method(indices.start, indices.end, name.name, in_class,
-                          return_type, parameters, modifiers, templated_types,
-                          body, self.namespace_stack)
-        return Function(indices.start, indices.end, name.name, return_type,
-                        parameters, modifiers, templated_types, body,
-                        self.namespace_stack)
-
-    def _GetReturnTypeAndClassName(self, token_seq):
-        # Splitting the return type from the class name in a method
-        # can be tricky.  For example, Return::Type::Is::Hard::To::Find().
-        # Where is the return type and where is the class name?
-        # The heuristic used is to pull the last name as the class name.
-        # This includes all the templated type info.
-        # TODO(nnorwitz): if there is only One name like in the
-        # example above, punt and assume the last bit is the class name.
-
-        # Ignore a :: prefix, if exists so we can find the first real name.
-        i = 0
-        if token_seq[0].name == '::':
-            i = 1
-        # Ignore a :: suffix, if exists.
-        end = len(token_seq) - 1
-        if token_seq[end-1].name == '::':
-            end -= 1
-
-        # Make a copy of the sequence so we can append a sentinel
-        # value. This is required for GetName will has to have some
-        # terminating condition beyond the last name.
-        seq_copy = token_seq[i:end]
-        seq_copy.append(tokenize.Token(tokenize.SYNTAX, '', 0, 0))
-        names = []
-        while i < end:
-            # Iterate through the sequence parsing out each name.
-            new_name, next = self.GetName(seq_copy[i:])
-            assert new_name, 'Got empty new_name, next=%s' % next
-            # We got a pointer or ref.  Add it to the name.
-            if next and next.token_type == tokenize.SYNTAX:
-                new_name.append(next)
-            names.append(new_name)
-            i += len(new_name)
-
-        # Now that we have the names, it's time to undo what we did.
-
-        # Remove the sentinel value.
-        names[-1].pop()
-        # Flatten the token sequence for the return type.
-        return_type = [e for seq in names[:-1] for e in seq]
-        # The class name is the last name.
-        class_name = names[-1]
-        return return_type, class_name
-
-    def handle_bool(self):
-        pass
-
-    def handle_char(self):
-        pass
-
-    def handle_int(self):
-        pass
-
-    def handle_long(self):
-        pass
-
-    def handle_short(self):
-        pass
-
-    def handle_double(self):
-        pass
-
-    def handle_float(self):
-        pass
-
-    def handle_void(self):
-        pass
-
-    def handle_wchar_t(self):
-        pass
-
-    def handle_unsigned(self):
-        pass
-
-    def handle_signed(self):
-        pass
-
-    def _GetNestedType(self, ctor):
-        name = None
-        name_tokens, token = self.GetName()
-        if name_tokens:
-            name = ''.join([t.name for t in name_tokens])
-
-        # Handle forward declarations.
-        if token.token_type == tokenize.SYNTAX and token.name == ';':
-            return ctor(token.start, token.end, name, None,
-                        self.namespace_stack)
-
-        if token.token_type == tokenize.NAME and self._handling_typedef:
-            self._AddBackToken(token)
-            return ctor(token.start, token.end, name, None,
-                        self.namespace_stack)
-
-        # Must be the type declaration.
-        fields = list(self._GetMatchingChar('{', '}'))
-        del fields[-1]                  # Remove trailing '}'.
-        if token.token_type == tokenize.SYNTAX and token.name == '{':
-            next = self._GetNextToken()
-            new_type = ctor(token.start, token.end, name, fields,
-                            self.namespace_stack)
-            # A name means this is an anonymous type and the name
-            # is the variable declaration.
-            if next.token_type != tokenize.NAME:
-                return new_type
-            name = new_type
-            token = next
-
-        # Must be variable declaration using the type prefixed with keyword.
-        assert token.token_type == tokenize.NAME, token
-        return self._CreateVariable(token, token.name, name, [], '', None)
-
-    def handle_struct(self):
-        # Special case the handling typedef/aliasing of structs here.
-        # It would be a pain to handle in the class code.
-        name_tokens, var_token = self.GetName()
-        if name_tokens:
-            next_token = self._GetNextToken()
-            is_syntax = (var_token.token_type == tokenize.SYNTAX and
-                         var_token.name[0] in '*&')
-            is_variable = (var_token.token_type == tokenize.NAME and
-                           next_token.name == ';')
-            variable = var_token
-            if is_syntax and not is_variable:
-                variable = next_token
-                temp = self._GetNextToken()
-                if temp.token_type == tokenize.SYNTAX and temp.name == '(':
-                    # Handle methods declared to return a struct.
-                    t0 = name_tokens[0]
-                    struct = tokenize.Token(tokenize.NAME, 'struct',
-                                            t0.start-7, t0.start-2)
-                    type_and_name = [struct]
-                    type_and_name.extend(name_tokens)
-                    type_and_name.extend((var_token, next_token))
-                    return self._GetMethod(type_and_name, 0, None, False)
-                assert temp.name == ';', (temp, name_tokens, var_token)
-            if is_syntax or (is_variable and not self._handling_typedef):
-                modifiers = ['struct']
-                type_name = ''.join([t.name for t in name_tokens])
-                position = name_tokens[0]
-                return self._CreateVariable(position, variable.name, type_name,
-                                            modifiers, var_token.name, None)
-            name_tokens.extend((var_token, next_token))
-            self._AddBackTokens(name_tokens)
-        else:
-            self._AddBackToken(var_token)
-        return self._GetClass(Struct, VISIBILITY_PUBLIC, None)
-
-    def handle_union(self):
-        return self._GetNestedType(Union)
-
-    def handle_enum(self):
-        token = self._GetNextToken()
-        if not (token.token_type == tokenize.NAME and token.name == 'class'):
-            self._AddBackToken(token)
-        return self._GetNestedType(Enum)
-
-    def handle_auto(self):
-        # TODO(nnorwitz): warn about using auto?  Probably not since it
-        # will be reclaimed and useful for C++0x.
-        pass
-
-    def handle_register(self):
-        pass
-
-    def handle_const(self):
-        pass
-
-    def handle_inline(self):
-        pass
-
-    def handle_extern(self):
-        pass
-
-    def handle_static(self):
-        pass
-
-    def handle_virtual(self):
-        # What follows must be a method.
-        token = token2 = self._GetNextToken()
-        if token.name == 'inline':
-            # HACK(nnorwitz): handle inline dtors by ignoring 'inline'.
-            token2 = self._GetNextToken()
-        if token2.token_type == tokenize.SYNTAX and token2.name == '~':
-            return self.GetMethod(FUNCTION_VIRTUAL + FUNCTION_DTOR, None)
-        assert token.token_type == tokenize.NAME or token.name == '::', token
-        return_type_and_name = self._GetTokensUpTo(tokenize.SYNTAX, '(')  # )
-        return_type_and_name.insert(0, token)
-        if token2 is not token:
-            return_type_and_name.insert(1, token2)
-        return self._GetMethod(return_type_and_name, FUNCTION_VIRTUAL,
-                               None, False)
-
-    def handle_volatile(self):
-        pass
-
-    def handle_mutable(self):
-        pass
-
-    def handle_public(self):
-        assert self.in_class
-        self.visibility = VISIBILITY_PUBLIC
-
-    def handle_protected(self):
-        assert self.in_class
-        self.visibility = VISIBILITY_PROTECTED
-
-    def handle_private(self):
-        assert self.in_class
-        self.visibility = VISIBILITY_PRIVATE
-
-    def handle_friend(self):
-        tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
-        assert tokens
-        t0 = tokens[0]
-        return Friend(t0.start, t0.end, tokens, self.namespace_stack)
-
-    def handle_static_cast(self):
-        pass
-
-    def handle_const_cast(self):
-        pass
-
-    def handle_dynamic_cast(self):
-        pass
-
-    def handle_reinterpret_cast(self):
-        pass
-
-    def handle_new(self):
-        pass
-
-    def handle_delete(self):
-        tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
-        assert tokens
-        return Delete(tokens[0].start, tokens[0].end, tokens)
-
-    def handle_typedef(self):
-        token = self._GetNextToken()
+        # self.in_class can contain A::Name, but the dtor will only
+        # be Name.  Make sure to compare against the right value.
         if (token.token_type == tokenize.NAME and
+                token.name == self.in_class_name_only):
+          return self._GetMethod([token], FUNCTION_DTOR, None, True)
+      # TODO(nnorwitz): handle a lot more syntax.
+    elif token.token_type == tokenize.PREPROCESSOR:
+      # TODO(nnorwitz): handle more preprocessor directives.
+      # token starts with a #, so remove it and strip whitespace.
+      name = token.name[1:].lstrip()
+      if name.startswith('include'):
+        # Remove "include".
+        name = name[7:].strip()
+        assert name
+        # Handle #include \<newline> "header-on-second-line.h".
+        if name.startswith('\\'):
+          name = name[1:].strip()
+        assert name[0] in '<"', token
+        assert name[-1] in '>"', token
+        system = name[0] == '<'
+        filename = name[1:-1]
+        return Include(token.start, token.end, filename, system)
+      if name.startswith('define'):
+        # Remove "define".
+        name = name[6:].strip()
+        assert name
+        value = ''
+        for i, c in enumerate(name):
+          if c.isspace():
+            value = name[i:].lstrip()
+            name = name[:i]
+            break
+        return Define(token.start, token.end, name, value)
+      if name.startswith('if') and name[2:3].isspace():
+        condition = name[3:].strip()
+        if condition.startswith('0') or condition.startswith('(0)'):
+          self._SkipIf0Blocks()
+    return None
+
+  def _GetTokensUpTo(self, expected_token_type, expected_token):
+    return self._GetVarTokensUpTo(expected_token_type, expected_token)[0]
+
+  def _GetVarTokensUpTo(self, expected_token_type, *expected_tokens):
+    last_token = self._GetNextToken()
+    tokens = []
+    while (last_token.token_type != expected_token_type or
+           last_token.name not in expected_tokens):
+      tokens.append(last_token)
+      last_token = self._GetNextToken()
+    return tokens, last_token
+
+  # Same as _GetVarTokensUpTo, but skips over '<...>' which could contain an
+  # expected token.
+  def _GetVarTokensUpToIgnoringTemplates(self, expected_token_type,
+                                         *expected_tokens):
+    last_token = self._GetNextToken()
+    tokens = []
+    nesting = 0
+    while (nesting > 0 or
+           last_token.token_type != expected_token_type or
+           last_token.name not in expected_tokens):
+      tokens.append(last_token)
+      last_token = self._GetNextToken()
+      if last_token.name == '<':
+        nesting += 1
+      elif last_token.name == '>':
+        nesting -= 1
+    return tokens, last_token
+
+  # TODO(nnorwitz): remove _IgnoreUpTo() it shouldn't be necessary.
+  def _IgnoreUpTo(self, token_type, token):
+    unused_tokens = self._GetTokensUpTo(token_type, token)
+
+  def _SkipIf0Blocks(self):
+    count = 1
+    while 1:
+      token = self._GetNextToken()
+      if token.token_type != tokenize.PREPROCESSOR:
+        continue
+
+      name = token.name[1:].lstrip()
+      if name.startswith('endif'):
+        count -= 1
+        if count == 0:
+          break
+      elif name.startswith('if'):
+        count += 1
+
+  def _GetMatchingChar(self, open_paren, close_paren, GetNextToken=None):
+    if GetNextToken is None:
+      GetNextToken = self._GetNextToken
+    # Assumes the current token is open_paren and we will consume
+    # and return up to the close_paren.
+    count = 1
+    token = GetNextToken()
+    while 1:
+      if token.token_type == tokenize.SYNTAX:
+        if token.name == open_paren:
+          count += 1
+        elif token.name == close_paren:
+          count -= 1
+          if count == 0:
+            break
+      yield token
+      token = GetNextToken()
+    yield token
+
+  def _GetParameters(self):
+    return self._GetMatchingChar('(', ')')
+
+  def GetScope(self):
+    return self._GetMatchingChar('{', '}')
+
+  def _GetNextToken(self):
+    if self.token_queue:
+      return self.token_queue.pop()
+    try:
+      return next(self.tokens)
+    except StopIteration:
+      return
+
+  def _AddBackToken(self, token):
+    if token.whence == tokenize.WHENCE_STREAM:
+      token.whence = tokenize.WHENCE_QUEUE
+      self.token_queue.insert(0, token)
+    else:
+      assert token.whence == tokenize.WHENCE_QUEUE, token
+      self.token_queue.append(token)
+
+  def _AddBackTokens(self, tokens):
+    if tokens:
+      if tokens[-1].whence == tokenize.WHENCE_STREAM:
+        for token in tokens:
+          token.whence = tokenize.WHENCE_QUEUE
+        self.token_queue[:0] = reversed(tokens)
+      else:
+        assert tokens[-1].whence == tokenize.WHENCE_QUEUE, tokens
+        self.token_queue.extend(reversed(tokens))
+
+  def GetName(self, seq=None):
+    """Returns ([tokens], next_token_info)."""
+    GetNextToken = self._GetNextToken
+    if seq is not None:
+      it = iter(seq)
+      GetNextToken = lambda: next(it)
+    next_token = GetNextToken()
+    tokens = []
+    last_token_was_name = False
+    while (next_token.token_type == tokenize.NAME or
+           (next_token.token_type == tokenize.SYNTAX and
+            next_token.name in ('::', '<'))):
+      # Two NAMEs in a row means the identifier should terminate.
+      # It's probably some sort of variable declaration.
+      if last_token_was_name and next_token.token_type == tokenize.NAME:
+        break
+      last_token_was_name = next_token.token_type == tokenize.NAME
+      tokens.append(next_token)
+      # Handle templated names.
+      if next_token.name == '<':
+        tokens.extend(self._GetMatchingChar('<', '>', GetNextToken))
+        last_token_was_name = True
+      next_token = GetNextToken()
+    return tokens, next_token
+
+  def GetMethod(self, modifiers, templated_types):
+    return_type_and_name = self._GetTokensUpTo(tokenize.SYNTAX, '(')
+    assert len(return_type_and_name) >= 1
+    return self._GetMethod(return_type_and_name, modifiers, templated_types,
+                           False)
+
+  def _GetMethod(self, return_type_and_name, modifiers, templated_types,
+                 get_paren):
+    template_portion = None
+    if get_paren:
+      token = self._GetNextToken()
+      assert token.token_type == tokenize.SYNTAX, token
+      if token.name == '<':
+        # Handle templatized dtors.
+        template_portion = [token]
+        template_portion.extend(self._GetMatchingChar('<', '>'))
+        token = self._GetNextToken()
+      assert token.token_type == tokenize.SYNTAX, token
+      assert token.name == '(', token
+
+    name = return_type_and_name.pop()
+    # Handle templatized ctors.
+    if name.name == '>':
+      index = 1
+      while return_type_and_name[index].name != '<':
+        index += 1
+      template_portion = return_type_and_name[index:] + [name]
+      del return_type_and_name[index:]
+      name = return_type_and_name.pop()
+    elif name.name == ']':
+      rt = return_type_and_name
+      assert rt[-1].name == '[', return_type_and_name
+      assert rt[-2].name == 'operator', return_type_and_name
+      name_seq = return_type_and_name[-2:]
+      del return_type_and_name[-2:]
+      name = tokenize.Token(tokenize.NAME, 'operator[]',
+                            name_seq[0].start, name.end)
+      # Get the open paren so _GetParameters() below works.
+      unused_open_paren = self._GetNextToken()
+
+    # TODO(nnorwitz): store template_portion.
+    return_type = return_type_and_name
+    indices = name
+    if return_type:
+      indices = return_type[0]
+
+    # Force ctor for templatized ctors.
+    if name.name == self.in_class and not modifiers:
+      modifiers |= FUNCTION_CTOR
+    parameters = list(self._GetParameters())
+    del parameters[-1]              # Remove trailing ')'.
+
+    # Handling operator() is especially weird.
+    if name.name == 'operator' and not parameters:
+      token = self._GetNextToken()
+      assert token.name == '(', token
+      parameters = list(self._GetParameters())
+      del parameters[-1]          # Remove trailing ')'.
+
+    token = self._GetNextToken()
+    while token.token_type == tokenize.NAME:
+      modifier_token = token
+      token = self._GetNextToken()
+      if modifier_token.name == 'const':
+        modifiers |= FUNCTION_CONST
+      elif modifier_token.name == '__attribute__':
+        # TODO(nnorwitz): handle more __attribute__ details.
+        modifiers |= FUNCTION_ATTRIBUTE
+        assert token.name == '(', token
+        # Consume everything between the (parens).
+        unused_tokens = list(self._GetMatchingChar('(', ')'))
+        token = self._GetNextToken()
+      elif modifier_token.name == 'throw':
+        modifiers |= FUNCTION_THROW
+        assert token.name == '(', token
+        # Consume everything between the (parens).
+        unused_tokens = list(self._GetMatchingChar('(', ')'))
+        token = self._GetNextToken()
+      elif modifier_token.name == 'override':
+        modifiers |= FUNCTION_OVERRIDE
+      elif modifier_token.name == modifier_token.name.upper():
+        # HACK(nnorwitz):  assume that all upper-case names
+        # are some macro we aren't expanding.
+        modifiers |= FUNCTION_UNKNOWN_ANNOTATION
+      else:
+        self.HandleError('unexpected token', modifier_token)
+
+    assert token.token_type == tokenize.SYNTAX, token
+    # Handle ctor initializers.
+    if token.name == ':':
+      # TODO(nnorwitz): anything else to handle for initializer list?
+      while token.name != ';' and token.name != '{':
+        token = self._GetNextToken()
+
+    # Handle pointer to functions that are really data but look
+    # like method declarations.
+    if token.name == '(':
+      if parameters[0].name == '*':
+        # name contains the return type.
+        name = parameters.pop()
+        # parameters contains the name of the data.
+        modifiers = [p.name for p in parameters]
+        # Already at the ( to open the parameter list.
+        function_parameters = list(self._GetMatchingChar('(', ')'))
+        del function_parameters[-1]  # Remove trailing ')'.
+        # TODO(nnorwitz): store the function_parameters.
+        token = self._GetNextToken()
+        assert token.token_type == tokenize.SYNTAX, token
+        assert token.name == ';', token
+        return self._CreateVariable(indices, name.name, indices.name,
+                                    modifiers, '', None)
+      # At this point, we got something like:
+      #  return_type (type::*name_)(params);
+      # This is a data member called name_ that is a function pointer.
+      # With this code: void (sq_type::*field_)(string&);
+      # We get: name=void return_type=[] parameters=sq_type ... field_
+      # TODO(nnorwitz): is return_type always empty?
+      # TODO(nnorwitz): this isn't even close to being correct.
+      # Just put in something so we don't crash and can move on.
+      real_name = parameters[-1]
+      modifiers = [p.name for p in self._GetParameters()]
+      del modifiers[-1]           # Remove trailing ')'.
+      return self._CreateVariable(indices, real_name.name, indices.name,
+                                  modifiers, '', None)
+
+    if token.name == '{':
+      body = list(self.GetScope())
+      del body[-1]                # Remove trailing '}'.
+    else:
+      body = None
+      if token.name == '=':
+        token = self._GetNextToken()
+
+        if token.name == 'default' or token.name == 'delete':
+          # Ignore explicitly defaulted and deleted special members
+          # in C++11.
+          token = self._GetNextToken()
+        else:
+          # Handle pure-virtual declarations.
+          assert token.token_type == tokenize.CONSTANT, token
+          assert token.name == '0', token
+          modifiers |= FUNCTION_PURE_VIRTUAL
+          token = self._GetNextToken()
+
+      if token.name == '[':
+        # TODO(nnorwitz): store tokens and improve parsing.
+        # template <typename T, size_t N> char (&ASH(T (&seq)[N]))[N];
+        tokens = list(self._GetMatchingChar('[', ']'))
+        token = self._GetNextToken()
+
+      assert token.name == ';', (token, return_type_and_name, parameters)
+
+    # Looks like we got a method, not a function.
+    if len(return_type) > 2 and return_type[-1].name == '::':
+      return_type, in_class = \
+          self._GetReturnTypeAndClassName(return_type)
+      return Method(indices.start, indices.end, name.name, in_class,
+                    return_type, parameters, modifiers, templated_types,
+                    body, self.namespace_stack)
+    return Function(indices.start, indices.end, name.name, return_type,
+                    parameters, modifiers, templated_types, body,
+                    self.namespace_stack)
+
+  def _GetReturnTypeAndClassName(self, token_seq):
+    # Splitting the return type from the class name in a method
+    # can be tricky.  For example, Return::Type::Is::Hard::To::Find().
+    # Where is the return type and where is the class name?
+    # The heuristic used is to pull the last name as the class name.
+    # This includes all the templated type info.
+    # TODO(nnorwitz): if there is only One name like in the
+    # example above, punt and assume the last bit is the class name.
+
+    # Ignore a :: prefix, if exists so we can find the first real name.
+    i = 0
+    if token_seq[0].name == '::':
+      i = 1
+    # Ignore a :: suffix, if exists.
+    end = len(token_seq) - 1
+    if token_seq[end-1].name == '::':
+      end -= 1
+
+    # Make a copy of the sequence so we can append a sentinel
+    # value. This is required for GetName will has to have some
+    # terminating condition beyond the last name.
+    seq_copy = token_seq[i:end]
+    seq_copy.append(tokenize.Token(tokenize.SYNTAX, '', 0, 0))
+    names = []
+    while i < end:
+      # Iterate through the sequence parsing out each name.
+      new_name, next = self.GetName(seq_copy[i:])
+      assert new_name, 'Got empty new_name, next=%s' % next
+      # We got a pointer or ref.  Add it to the name.
+      if next and next.token_type == tokenize.SYNTAX:
+        new_name.append(next)
+      names.append(new_name)
+      i += len(new_name)
+
+    # Now that we have the names, it's time to undo what we did.
+
+    # Remove the sentinel value.
+    names[-1].pop()
+    # Flatten the token sequence for the return type.
+    return_type = [e for seq in names[:-1] for e in seq]
+    # The class name is the last name.
+    class_name = names[-1]
+    return return_type, class_name
+
+  def handle_bool(self):
+    pass
+
+  def handle_char(self):
+    pass
+
+  def handle_int(self):
+    pass
+
+  def handle_long(self):
+    pass
+
+  def handle_short(self):
+    pass
+
+  def handle_double(self):
+    pass
+
+  def handle_float(self):
+    pass
+
+  def handle_void(self):
+    pass
+
+  def handle_wchar_t(self):
+    pass
+
+  def handle_unsigned(self):
+    pass
+
+  def handle_signed(self):
+    pass
+
+  def _GetNestedType(self, ctor):
+    name = None
+    name_tokens, token = self.GetName()
+    if name_tokens:
+      name = ''.join([t.name for t in name_tokens])
+
+    # Handle forward declarations.
+    if token.token_type == tokenize.SYNTAX and token.name == ';':
+      return ctor(token.start, token.end, name, None,
+                  self.namespace_stack)
+
+    if token.token_type == tokenize.NAME and self._handling_typedef:
+      self._AddBackToken(token)
+      return ctor(token.start, token.end, name, None,
+                  self.namespace_stack)
+
+    # Must be the type declaration.
+    fields = list(self._GetMatchingChar('{', '}'))
+    del fields[-1]                  # Remove trailing '}'.
+    if token.token_type == tokenize.SYNTAX and token.name == '{':
+      next = self._GetNextToken()
+      new_type = ctor(token.start, token.end, name, fields,
+                      self.namespace_stack)
+      # A name means this is an anonymous type and the name
+      # is the variable declaration.
+      if next.token_type != tokenize.NAME:
+        return new_type
+      name = new_type
+      token = next
+
+    # Must be variable declaration using the type prefixed with keyword.
+    assert token.token_type == tokenize.NAME, token
+    return self._CreateVariable(token, token.name, name, [], '', None)
+
+  def handle_struct(self):
+    # Special case the handling typedef/aliasing of structs here.
+    # It would be a pain to handle in the class code.
+    name_tokens, var_token = self.GetName()
+    if name_tokens:
+      next_token = self._GetNextToken()
+      is_syntax = (var_token.token_type == tokenize.SYNTAX and
+                   var_token.name[0] in '*&')
+      is_variable = (var_token.token_type == tokenize.NAME and
+                     next_token.name == ';')
+      variable = var_token
+      if is_syntax and not is_variable:
+        variable = next_token
+        temp = self._GetNextToken()
+        if temp.token_type == tokenize.SYNTAX and temp.name == '(':
+          # Handle methods declared to return a struct.
+          t0 = name_tokens[0]
+          struct = tokenize.Token(tokenize.NAME, 'struct',
+                                  t0.start-7, t0.start-2)
+          type_and_name = [struct]
+          type_and_name.extend(name_tokens)
+          type_and_name.extend((var_token, next_token))
+          return self._GetMethod(type_and_name, 0, None, False)
+        assert temp.name == ';', (temp, name_tokens, var_token)
+      if is_syntax or (is_variable and not self._handling_typedef):
+        modifiers = ['struct']
+        type_name = ''.join([t.name for t in name_tokens])
+        position = name_tokens[0]
+        return self._CreateVariable(position, variable.name, type_name,
+                                    modifiers, var_token.name, None)
+      name_tokens.extend((var_token, next_token))
+      self._AddBackTokens(name_tokens)
+    else:
+      self._AddBackToken(var_token)
+    return self._GetClass(Struct, VISIBILITY_PUBLIC, None)
+
+  def handle_union(self):
+    return self._GetNestedType(Union)
+
+  def handle_enum(self):
+    return self._GetNestedType(Enum)
+
+  def handle_auto(self):
+    # TODO(nnorwitz): warn about using auto?  Probably not since it
+    # will be reclaimed and useful for C++0x.
+    pass
+
+  def handle_register(self):
+    pass
+
+  def handle_const(self):
+    pass
+
+  def handle_inline(self):
+    pass
+
+  def handle_extern(self):
+    pass
+
+  def handle_static(self):
+    pass
+
+  def handle_virtual(self):
+    # What follows must be a method.
+    token = token2 = self._GetNextToken()
+    if token.name == 'inline':
+      # HACK(nnorwitz): handle inline dtors by ignoring 'inline'.
+      token2 = self._GetNextToken()
+    if token2.token_type == tokenize.SYNTAX and token2.name == '~':
+      return self.GetMethod(FUNCTION_VIRTUAL + FUNCTION_DTOR, None)
+    assert token.token_type == tokenize.NAME or token.name == '::', token
+    return_type_and_name, _ = self._GetVarTokensUpToIgnoringTemplates(
+        tokenize.SYNTAX, '(')  # )
+    return_type_and_name.insert(0, token)
+    if token2 is not token:
+      return_type_and_name.insert(1, token2)
+    return self._GetMethod(return_type_and_name, FUNCTION_VIRTUAL,
+                           None, False)
+
+  def handle_volatile(self):
+    pass
+
+  def handle_mutable(self):
+    pass
+
+  def handle_public(self):
+    assert self.in_class
+    self.visibility = VISIBILITY_PUBLIC
+
+  def handle_protected(self):
+    assert self.in_class
+    self.visibility = VISIBILITY_PROTECTED
+
+  def handle_private(self):
+    assert self.in_class
+    self.visibility = VISIBILITY_PRIVATE
+
+  def handle_friend(self):
+    tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
+    assert tokens
+    t0 = tokens[0]
+    return Friend(t0.start, t0.end, tokens, self.namespace_stack)
+
+  def handle_static_cast(self):
+    pass
+
+  def handle_const_cast(self):
+    pass
+
+  def handle_dynamic_cast(self):
+    pass
+
+  def handle_reinterpret_cast(self):
+    pass
+
+  def handle_new(self):
+    pass
+
+  def handle_delete(self):
+    tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
+    assert tokens
+    return Delete(tokens[0].start, tokens[0].end, tokens)
+
+  def handle_typedef(self):
+    token = self._GetNextToken()
+    if (token.token_type == tokenize.NAME and
             keywords.IsKeyword(token.name)):
-            # Token must be struct/enum/union/class.
-            method = getattr(self, 'handle_' + token.name)
-            self._handling_typedef = True
-            tokens = [method()]
-            self._handling_typedef = False
+      # Token must be struct/enum/union/class.
+      method = getattr(self, 'handle_' + token.name)
+      self._handling_typedef = True
+      tokens = [method()]
+      self._handling_typedef = False
+    else:
+      tokens = [token]
+
+    # Get the remainder of the typedef up to the semi-colon.
+    tokens.extend(self._GetTokensUpTo(tokenize.SYNTAX, ';'))
+
+    # TODO(nnorwitz): clean all this up.
+    assert tokens
+    name = tokens.pop()
+    indices = name
+    if tokens:
+      indices = tokens[0]
+    if not indices:
+      indices = token
+    if name.name == ')':
+      # HACK(nnorwitz): Handle pointers to functions "properly".
+      if (len(tokens) >= 4 and
+              tokens[1].name == '(' and tokens[2].name == '*'):
+        tokens.append(name)
+        name = tokens[3]
+    elif name.name == ']':
+      # HACK(nnorwitz): Handle arrays properly.
+      if len(tokens) >= 2:
+        tokens.append(name)
+        name = tokens[1]
+    new_type = tokens
+    if tokens and isinstance(tokens[0], tokenize.Token):
+      new_type = self.converter.ToType(tokens)[0]
+    return Typedef(indices.start, indices.end, name.name,
+                   new_type, self.namespace_stack)
+
+  def handle_typeid(self):
+    pass  # Not needed yet.
+
+  def handle_typename(self):
+    pass  # Not needed yet.
+
+  def _GetTemplatedTypes(self):
+    result = collections.OrderedDict()
+    tokens = list(self._GetMatchingChar('<', '>'))
+    len_tokens = len(tokens) - 1    # Ignore trailing '>'.
+    i = 0
+    while i < len_tokens:
+      key = tokens[i].name
+      i += 1
+      if keywords.IsKeyword(key) or key == ',':
+        continue
+      type_name = default = None
+      if i < len_tokens:
+        i += 1
+        if tokens[i-1].name == '=':
+          assert i < len_tokens, '%s %s' % (i, tokens)
+          default, unused_next_token = self.GetName(tokens[i:])
+          i += len(default)
         else:
-            tokens = [token]
+          if tokens[i-1].name != ',':
+            # We got something like: Type variable.
+            # Re-adjust the key (variable) and type_name (Type).
+            key = tokens[i-1].name
+            type_name = tokens[i-2]
 
-        # Get the remainder of the typedef up to the semi-colon.
-        tokens.extend(self._GetTokensUpTo(tokenize.SYNTAX, ';'))
+      result[key] = (type_name, default)
+    return result
 
-        # TODO(nnorwitz): clean all this up.
-        assert tokens
-        name = tokens.pop()
-        indices = name
-        if tokens:
-            indices = tokens[0]
-        if not indices:
-            indices = token
-        if name.name == ')':
-            # HACK(nnorwitz): Handle pointers to functions "properly".
-            if (len(tokens) >= 4 and
-                tokens[1].name == '(' and tokens[2].name == '*'):
-                tokens.append(name)
-                name = tokens[3]
-        elif name.name == ']':
-            # HACK(nnorwitz): Handle arrays properly.
-            if len(tokens) >= 2:
-                tokens.append(name)
-                name = tokens[1]
-        new_type = tokens
-        if tokens and isinstance(tokens[0], tokenize.Token):
-            new_type = self.converter.ToType(tokens)[0]
-        return Typedef(indices.start, indices.end, name.name,
-                       new_type, self.namespace_stack)
+  def handle_template(self):
+    token = self._GetNextToken()
+    assert token.token_type == tokenize.SYNTAX, token
+    assert token.name == '<', token
+    templated_types = self._GetTemplatedTypes()
+    # TODO(nnorwitz): for now, just ignore the template params.
+    token = self._GetNextToken()
+    if token.token_type == tokenize.NAME:
+      if token.name == 'class':
+        return self._GetClass(Class, VISIBILITY_PRIVATE, templated_types)
+      elif token.name == 'struct':
+        return self._GetClass(Struct, VISIBILITY_PUBLIC, templated_types)
+      elif token.name == 'friend':
+        return self.handle_friend()
+    self._AddBackToken(token)
+    tokens, last = self._GetVarTokensUpTo(tokenize.SYNTAX, '(', ';')
+    tokens.append(last)
+    self._AddBackTokens(tokens)
+    if last.name == '(':
+      return self.GetMethod(FUNCTION_NONE, templated_types)
+    # Must be a variable definition.
+    return None
 
-    def handle_typeid(self):
-        pass  # Not needed yet.
+  def handle_true(self):
+    pass  # Nothing to do.
 
-    def handle_typename(self):
-        pass  # Not needed yet.
+  def handle_false(self):
+    pass  # Nothing to do.
 
-    def _GetTemplatedTypes(self):
-        result = {}
-        tokens = list(self._GetMatchingChar('<', '>'))
-        len_tokens = len(tokens) - 1    # Ignore trailing '>'.
-        i = 0
-        while i < len_tokens:
-            key = tokens[i].name
-            i += 1
-            if keywords.IsKeyword(key) or key == ',':
-                continue
-            type_name = default = None
-            if i < len_tokens:
-                i += 1
-                if tokens[i-1].name == '=':
-                    assert i < len_tokens, '%s %s' % (i, tokens)
-                    default, unused_next_token = self.GetName(tokens[i:])
-                    i += len(default)
-                else:
-                    if tokens[i-1].name != ',':
-                        # We got something like: Type variable.
-                        # Re-adjust the key (variable) and type_name (Type).
-                        key = tokens[i-1].name
-                        type_name = tokens[i-2]
+  def handle_asm(self):
+    pass  # Not needed yet.
 
-            result[key] = (type_name, default)
-        return result
+  def handle_class(self):
+    return self._GetClass(Class, VISIBILITY_PRIVATE, None)
 
-    def handle_template(self):
-        token = self._GetNextToken()
-        assert token.token_type == tokenize.SYNTAX, token
-        assert token.name == '<', token
-        templated_types = self._GetTemplatedTypes()
-        # TODO(nnorwitz): for now, just ignore the template params.
-        token = self._GetNextToken()
-        if token.token_type == tokenize.NAME:
-            if token.name == 'class':
-                return self._GetClass(Class, VISIBILITY_PRIVATE, templated_types)
-            elif token.name == 'struct':
-                return self._GetClass(Struct, VISIBILITY_PUBLIC, templated_types)
-            elif token.name == 'friend':
-                return self.handle_friend()
+  def _GetBases(self):
+    # Get base classes.
+    bases = []
+    while 1:
+      token = self._GetNextToken()
+      assert token.token_type == tokenize.NAME, token
+      # TODO(nnorwitz): store kind of inheritance...maybe.
+      if token.name not in ('public', 'protected', 'private'):
+        # If inheritance type is not specified, it is private.
+        # Just put the token back so we can form a name.
+        # TODO(nnorwitz): it would be good to warn about this.
         self._AddBackToken(token)
-        tokens, last = self._GetVarTokensUpTo(tokenize.SYNTAX, '(', ';')
-        tokens.append(last)
-        self._AddBackTokens(tokens)
-        if last.name == '(':
-            return self.GetMethod(FUNCTION_NONE, templated_types)
-        # Must be a variable definition.
-        return None
-
-    def handle_true(self):
-        pass  # Nothing to do.
-
-    def handle_false(self):
-        pass  # Nothing to do.
-
-    def handle_asm(self):
-        pass  # Not needed yet.
-
-    def handle_class(self):
-        return self._GetClass(Class, VISIBILITY_PRIVATE, None)
-
-    def _GetBases(self):
-        # Get base classes.
-        bases = []
-        while 1:
-            token = self._GetNextToken()
-            assert token.token_type == tokenize.NAME, token
-            # TODO(nnorwitz): store kind of inheritance...maybe.
-            if token.name not in ('public', 'protected', 'private'):
-                # If inheritance type is not specified, it is private.
-                # Just put the token back so we can form a name.
-                # TODO(nnorwitz): it would be good to warn about this.
-                self._AddBackToken(token)
-            else:
-                # Check for virtual inheritance.
-                token = self._GetNextToken()
-                if token.name != 'virtual':
-                    self._AddBackToken(token)
-                else:
-                    # TODO(nnorwitz): store that we got virtual for this base.
-                    pass
-            base, next_token = self.GetName()
-            bases_ast = self.converter.ToType(base)
-            assert len(bases_ast) == 1, bases_ast
-            bases.append(bases_ast[0])
-            assert next_token.token_type == tokenize.SYNTAX, next_token
-            if next_token.name == '{':
-                token = next_token
-                break
-            # Support multiple inheritance.
-            assert next_token.name == ',', next_token
-        return bases, token
-
-    def _GetClass(self, class_type, visibility, templated_types):
-        class_name = None
-        class_token = self._GetNextToken()
-        if class_token.token_type != tokenize.NAME:
-            assert class_token.token_type == tokenize.SYNTAX, class_token
-            token = class_token
-        else:
-            # Skip any macro (e.g. storage class specifiers) after the
-            # 'class' keyword.
-            next_token = self._GetNextToken()
-            if next_token.token_type == tokenize.NAME:
-                self._AddBackToken(next_token)
-            else:
-                self._AddBackTokens([class_token, next_token])
-            name_tokens, token = self.GetName()
-            class_name = ''.join([t.name for t in name_tokens])
-        bases = None
-        if token.token_type == tokenize.SYNTAX:
-            if token.name == ';':
-                # Forward declaration.
-                return class_type(class_token.start, class_token.end,
-                                  class_name, None, templated_types, None,
-                                  self.namespace_stack)
-            if token.name in '*&':
-                # Inline forward declaration.  Could be method or data.
-                name_token = self._GetNextToken()
-                next_token = self._GetNextToken()
-                if next_token.name == ';':
-                    # Handle data
-                    modifiers = ['class']
-                    return self._CreateVariable(class_token, name_token.name,
-                                                class_name,
-                                                modifiers, token.name, None)
-                else:
-                    # Assume this is a method.
-                    tokens = (class_token, token, name_token, next_token)
-                    self._AddBackTokens(tokens)
-                    return self.GetMethod(FUNCTION_NONE, None)
-            if token.name == ':':
-                bases, token = self._GetBases()
-
-        body = None
-        if token.token_type == tokenize.SYNTAX and token.name == '{':
-            assert token.token_type == tokenize.SYNTAX, token
-            assert token.name == '{', token
-
-            ast = AstBuilder(self.GetScope(), self.filename, class_name,
-                             visibility, self.namespace_stack)
-            body = list(ast.Generate())
-
-            if not self._handling_typedef:
-                token = self._GetNextToken()
-                if token.token_type != tokenize.NAME:
-                    assert token.token_type == tokenize.SYNTAX, token
-                    assert token.name == ';', token
-                else:
-                    new_class = class_type(class_token.start, class_token.end,
-                                           class_name, bases, None,
-                                           body, self.namespace_stack)
-
-                    modifiers = []
-                    return self._CreateVariable(class_token,
-                                                token.name, new_class,
-                                                modifiers, token.name, None)
-        else:
-            if not self._handling_typedef:
-                self.HandleError('non-typedef token', token)
-            self._AddBackToken(token)
-
-        return class_type(class_token.start, class_token.end, class_name,
-                          bases, templated_types, body, self.namespace_stack)
-
-    def handle_namespace(self):
+      else:
+        # Check for virtual inheritance.
         token = self._GetNextToken()
-        # Support anonymous namespaces.
-        name = None
-        if token.token_type == tokenize.NAME:
-            name = token.name
-            token = self._GetNextToken()
-        self.namespace_stack.append(name)
-        assert token.token_type == tokenize.SYNTAX, token
-        # Create an internal token that denotes when the namespace is complete.
-        internal_token = tokenize.Token(_INTERNAL_TOKEN, _NAMESPACE_POP,
-                                        None, None)
-        internal_token.whence = token.whence
-        if token.name == '=':
-            # TODO(nnorwitz): handle aliasing namespaces.
-            name, next_token = self.GetName()
-            assert next_token.name == ';', next_token
-            self._AddBackToken(internal_token)
+        if token.name != 'virtual':
+          self._AddBackToken(token)
         else:
-            assert token.name == '{', token
-            tokens = list(self.GetScope())
-            # Replace the trailing } with the internal namespace pop token.
-            tokens[-1] = internal_token
-            # Handle namespace with nothing in it.
-            self._AddBackTokens(tokens)
-        return None
+          # TODO(nnorwitz): store that we got virtual for this base.
+          pass
+      base, next_token = self.GetName()
+      bases_ast = self.converter.ToType(base)
+      assert len(bases_ast) == 1, bases_ast
+      bases.append(bases_ast[0])
+      assert next_token.token_type == tokenize.SYNTAX, next_token
+      if next_token.name == '{':
+        token = next_token
+        break
+      # Support multiple inheritance.
+      assert next_token.name == ',', next_token
+    return bases, token
 
-    def handle_using(self):
-        tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
-        assert tokens
-        return Using(tokens[0].start, tokens[0].end, tokens)
+  def _GetClass(self, class_type, visibility, templated_types):
+    class_name = None
+    class_token = self._GetNextToken()
+    if class_token.token_type != tokenize.NAME:
+      assert class_token.token_type == tokenize.SYNTAX, class_token
+      token = class_token
+    else:
+      # Skip any macro (e.g. storage class specifiers) after the
+      # 'class' keyword.
+      next_token = self._GetNextToken()
+      if next_token.token_type == tokenize.NAME:
+        self._AddBackToken(next_token)
+      else:
+        self._AddBackTokens([class_token, next_token])
+      name_tokens, token = self.GetName()
+      class_name = ''.join([t.name for t in name_tokens])
+    bases = None
+    if token.token_type == tokenize.SYNTAX:
+      if token.name == ';':
+        # Forward declaration.
+        return class_type(class_token.start, class_token.end,
+                          class_name, None, templated_types, None,
+                          self.namespace_stack)
+      if token.name in '*&':
+        # Inline forward declaration.  Could be method or data.
+        name_token = self._GetNextToken()
+        next_token = self._GetNextToken()
+        if next_token.name == ';':
+          # Handle data
+          modifiers = ['class']
+          return self._CreateVariable(class_token, name_token.name,
+                                      class_name,
+                                      modifiers, token.name, None)
+        else:
+          # Assume this is a method.
+          tokens = (class_token, token, name_token, next_token)
+          self._AddBackTokens(tokens)
+          return self.GetMethod(FUNCTION_NONE, None)
+      if token.name == ':':
+        bases, token = self._GetBases()
 
-    def handle_explicit(self):
-        assert self.in_class
-        # Nothing much to do.
-        # TODO(nnorwitz): maybe verify the method name == class name.
-        # This must be a ctor.
-        return self.GetMethod(FUNCTION_CTOR, None)
+    body = None
+    if token.token_type == tokenize.SYNTAX and token.name == '{':
+      assert token.token_type == tokenize.SYNTAX, token
+      assert token.name == '{', token
 
-    def handle_this(self):
-        pass  # Nothing to do.
+      ast = AstBuilder(self.GetScope(), self.filename, class_name,
+                       visibility, self.namespace_stack)
+      body = list(ast.Generate())
 
-    def handle_operator(self):
-        # Pull off the next token(s?) and make that part of the method name.
-        pass
-
-    def handle_sizeof(self):
-        pass
-
-    def handle_case(self):
-        pass
-
-    def handle_switch(self):
-        pass
-
-    def handle_default(self):
+      if not self._handling_typedef:
         token = self._GetNextToken()
-        assert token.token_type == tokenize.SYNTAX
-        assert token.name == ':'
+        if token.token_type != tokenize.NAME:
+          assert token.token_type == tokenize.SYNTAX, token
+          assert token.name == ';', token
+        else:
+          new_class = class_type(class_token.start, class_token.end,
+                                 class_name, bases, None,
+                                 body, self.namespace_stack)
 
-    def handle_if(self):
-        pass
+          modifiers = []
+          return self._CreateVariable(class_token,
+                                      token.name, new_class,
+                                      modifiers, token.name, None)
+    else:
+      if not self._handling_typedef:
+        self.HandleError('non-typedef token', token)
+      self._AddBackToken(token)
 
-    def handle_else(self):
-        pass
+    return class_type(class_token.start, class_token.end, class_name,
+                      bases, templated_types, body, self.namespace_stack)
 
-    def handle_return(self):
-        tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
-        if not tokens:
-            return Return(self.current_token.start, self.current_token.end, None)
-        return Return(tokens[0].start, tokens[0].end, tokens)
+  def handle_namespace(self):
+    # Support anonymous namespaces.
+    name = None
+    name_tokens, token = self.GetName()
+    if name_tokens:
+      name = ''.join([t.name for t in name_tokens])
+    self.namespace_stack.append(name)
+    assert token.token_type == tokenize.SYNTAX, token
+    # Create an internal token that denotes when the namespace is complete.
+    internal_token = tokenize.Token(_INTERNAL_TOKEN, _NAMESPACE_POP,
+                                    None, None)
+    internal_token.whence = token.whence
+    if token.name == '=':
+      # TODO(nnorwitz): handle aliasing namespaces.
+      name, next_token = self.GetName()
+      assert next_token.name == ';', next_token
+      self._AddBackToken(internal_token)
+    else:
+      assert token.name == '{', token
+      tokens = list(self.GetScope())
+      # Replace the trailing } with the internal namespace pop token.
+      tokens[-1] = internal_token
+      # Handle namespace with nothing in it.
+      self._AddBackTokens(tokens)
+    return None
 
-    def handle_goto(self):
-        tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
-        assert len(tokens) == 1, str(tokens)
-        return Goto(tokens[0].start, tokens[0].end, tokens[0].name)
+  def handle_using(self):
+    tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
+    assert tokens
+    return Using(tokens[0].start, tokens[0].end, tokens)
 
-    def handle_try(self):
-        pass  # Not needed yet.
+  def handle_explicit(self):
+    assert self.in_class
+    # Nothing much to do.
+    # TODO(nnorwitz): maybe verify the method name == class name.
+    # This must be a ctor.
+    return self.GetMethod(FUNCTION_CTOR, None)
 
-    def handle_catch(self):
-        pass  # Not needed yet.
+  def handle_this(self):
+    pass  # Nothing to do.
 
-    def handle_throw(self):
-        pass  # Not needed yet.
+  def handle_operator(self):
+    # Pull off the next token(s?) and make that part of the method name.
+    pass
 
-    def handle_while(self):
-        pass
+  def handle_sizeof(self):
+    pass
 
-    def handle_do(self):
-        pass
+  def handle_case(self):
+    pass
 
-    def handle_for(self):
-        pass
+  def handle_switch(self):
+    pass
 
-    def handle_break(self):
-        self._IgnoreUpTo(tokenize.SYNTAX, ';')
+  def handle_default(self):
+    token = self._GetNextToken()
+    assert token.token_type == tokenize.SYNTAX
+    assert token.name == ':'
 
-    def handle_continue(self):
-        self._IgnoreUpTo(tokenize.SYNTAX, ';')
+  def handle_if(self):
+    pass
+
+  def handle_else(self):
+    pass
+
+  def handle_return(self):
+    tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
+    if not tokens:
+      return Return(self.current_token.start, self.current_token.end, None)
+    return Return(tokens[0].start, tokens[0].end, tokens)
+
+  def handle_goto(self):
+    tokens = self._GetTokensUpTo(tokenize.SYNTAX, ';')
+    assert len(tokens) == 1, str(tokens)
+    return Goto(tokens[0].start, tokens[0].end, tokens[0].name)
+
+  def handle_try(self):
+    pass  # Not needed yet.
+
+  def handle_catch(self):
+    pass  # Not needed yet.
+
+  def handle_throw(self):
+    pass  # Not needed yet.
+
+  def handle_while(self):
+    pass
+
+  def handle_do(self):
+    pass
+
+  def handle_for(self):
+    pass
+
+  def handle_break(self):
+    self._IgnoreUpTo(tokenize.SYNTAX, ';')
+
+  def handle_continue(self):
+    self._IgnoreUpTo(tokenize.SYNTAX, ';')
 
 
 def BuilderFromSource(source, filename):
-    """Utility method that returns an AstBuilder from source code.
+  """Utility method that returns an AstBuilder from source code.
 
     Args:
       source: 'C++ source code'
@@ -1673,64 +1710,64 @@
     Returns:
       AstBuilder
     """
-    return AstBuilder(tokenize.GetTokens(source), filename)
+  return AstBuilder(tokenize.GetTokens(source), filename)
 
 
 def PrintIndentifiers(filename, should_print):
-    """Prints all identifiers for a C++ source file.
+  """Prints all identifiers for a C++ source file.
 
     Args:
       filename: 'file1'
       should_print: predicate with signature: bool Function(token)
     """
-    source = utils.ReadFile(filename, False)
-    if source is None:
-        sys.stderr.write('Unable to find: %s\n' % filename)
-        return
+  source = utils.ReadFile(filename, False)
+  if source is None:
+    sys.stderr.write('Unable to find: %s\n' % filename)
+    return
 
-    #print('Processing %s' % actual_filename)
-    builder = BuilderFromSource(source, filename)
-    try:
-        for node in builder.Generate():
-            if should_print(node):
-                print(node.name)
-    except KeyboardInterrupt:
-        return
-    except:
-        pass
+  #print('Processing %s' % actual_filename)
+  builder = BuilderFromSource(source, filename)
+  try:
+    for node in builder.Generate():
+      if should_print(node):
+        print(node.name)
+  except KeyboardInterrupt:
+    return
+  except:
+    pass
 
 
 def PrintAllIndentifiers(filenames, should_print):
-    """Prints all identifiers for each C++ source file in filenames.
+  """Prints all identifiers for each C++ source file in filenames.
 
     Args:
       filenames: ['file1', 'file2', ...]
       should_print: predicate with signature: bool Function(token)
     """
-    for path in filenames:
-        PrintIndentifiers(path, should_print)
+  for path in filenames:
+    PrintIndentifiers(path, should_print)
 
 
 def main(argv):
-    for filename in argv[1:]:
-        source = utils.ReadFile(filename)
-        if source is None:
-            continue
+  for filename in argv[1:]:
+    source = utils.ReadFile(filename)
+    if source is None:
+      continue
 
-        print('Processing %s' % filename)
-        builder = BuilderFromSource(source, filename)
-        try:
-            entire_ast = filter(None, builder.Generate())
-        except KeyboardInterrupt:
-            return
-        except:
-            # Already printed a warning, print the traceback and continue.
-            traceback.print_exc()
-        else:
-            if utils.DEBUG:
-                for ast in entire_ast:
-                    print(ast)
+    print('Processing %s' % filename)
+    builder = BuilderFromSource(source, filename)
+    try:
+      entire_ast = filter(None, builder.Generate())
+    except KeyboardInterrupt:
+      return
+    except:
+      # Already printed a warning, print the traceback and continue.
+      traceback.print_exc()
+    else:
+      if utils.DEBUG:
+        for ast in entire_ast:
+          print(ast)
 
 
 if __name__ == '__main__':
-    main(sys.argv)
+  main(sys.argv)
diff --git a/googlemock/scripts/generator/cpp/gmock_class.py b/googlemock/scripts/generator/cpp/gmock_class.py
index f9966cb..3e21022 100755
--- a/googlemock/scripts/generator/cpp/gmock_class.py
+++ b/googlemock/scripts/generator/cpp/gmock_class.py
@@ -26,9 +26,6 @@
 Output is sent to stdout.
 """
 
-__author__ = 'nnorwitz@google.com (Neal Norwitz)'
-
-
 import os
 import re
 import sys
@@ -41,6 +38,7 @@
   _dummy = set
 except NameError:
   import sets
+
   set = sets.Set
 
 _VERSION = (1, 0, 1)  # The version of this script.
@@ -48,79 +46,100 @@
 _INDENT = 2
 
 
+def _RenderType(ast_type):
+  """Renders the potentially recursively templated type into a string.
+
+  Args:
+    ast_type: The AST of the type.
+
+  Returns:
+    Rendered string of the type.
+  """
+  # Add modifiers like 'const'.
+  modifiers = ''
+  if ast_type.modifiers:
+    modifiers = ' '.join(ast_type.modifiers) + ' '
+  return_type = modifiers + ast_type.name
+  if ast_type.templated_types:
+    # Collect template args.
+    template_args = []
+    for arg in ast_type.templated_types:
+      rendered_arg = _RenderType(arg)
+      template_args.append(rendered_arg)
+    return_type += '<' + ', '.join(template_args) + '>'
+  if ast_type.pointer:
+    return_type += '*'
+  if ast_type.reference:
+    return_type += '&'
+  return return_type
+
+
+def _GenerateArg(source):
+  """Strips out comments, default arguments, and redundant spaces from a single argument.
+
+  Args:
+    source: A string for a single argument.
+
+  Returns:
+    Rendered string of the argument.
+  """
+  # Remove end of line comments before eliminating newlines.
+  arg = re.sub(r'//.*', '', source)
+
+  # Remove c-style comments.
+  arg = re.sub(r'/\*.*\*/', '', arg)
+
+  # Remove default arguments.
+  arg = re.sub(r'=.*', '', arg)
+
+  # Collapse spaces and newlines into a single space.
+  arg = re.sub(r'\s+', ' ', arg)
+  return arg.strip()
+
+
+def _EscapeForMacro(s):
+  """Escapes a string for use as an argument to a C++ macro."""
+  paren_count = 0
+  for c in s:
+    if c == '(':
+      paren_count += 1
+    elif c == ')':
+      paren_count -= 1
+    elif c == ',' and paren_count == 0:
+      return '(' + s + ')'
+  return s
+
+
 def _GenerateMethods(output_lines, source, class_node):
-  function_type = (ast.FUNCTION_VIRTUAL | ast.FUNCTION_PURE_VIRTUAL |
-                   ast.FUNCTION_OVERRIDE)
+  function_type = (
+      ast.FUNCTION_VIRTUAL | ast.FUNCTION_PURE_VIRTUAL | ast.FUNCTION_OVERRIDE)
   ctor_or_dtor = ast.FUNCTION_CTOR | ast.FUNCTION_DTOR
   indent = ' ' * _INDENT
 
   for node in class_node.body:
     # We only care about virtual functions.
-    if (isinstance(node, ast.Function) and
-        node.modifiers & function_type and
+    if (isinstance(node, ast.Function) and node.modifiers & function_type and
         not node.modifiers & ctor_or_dtor):
       # Pick out all the elements we need from the original function.
-      const = ''
+      modifiers = 'override'
       if node.modifiers & ast.FUNCTION_CONST:
-        const = 'CONST_'
+        modifiers = 'const, ' + modifiers
+
       return_type = 'void'
       if node.return_type:
-        # Add modifiers like 'const'.
-        modifiers = ''
-        if node.return_type.modifiers:
-          modifiers = ' '.join(node.return_type.modifiers) + ' '
-        return_type = modifiers + node.return_type.name
-        template_args = [arg.name for arg in node.return_type.templated_types]
-        if template_args:
-          return_type += '<' + ', '.join(template_args) + '>'
-          if len(template_args) > 1:
-            for line in [
-                '// The following line won\'t really compile, as the return',
-                '// type has multiple template arguments.  To fix it, use a',
-                '// typedef for the return type.']:
-              output_lines.append(indent + line)
-        if node.return_type.pointer:
-          return_type += '*'
-        if node.return_type.reference:
-          return_type += '&'
-        num_parameters = len(node.parameters)
-        if len(node.parameters) == 1:
-          first_param = node.parameters[0]
-          if source[first_param.start:first_param.end].strip() == 'void':
-            # We must treat T(void) as a function with no parameters.
-            num_parameters = 0
-      tmpl = ''
-      if class_node.templated_types:
-        tmpl = '_T'
-      mock_method_macro = 'MOCK_%sMETHOD%d%s' % (const, num_parameters, tmpl)
+        return_type = _EscapeForMacro(_RenderType(node.return_type))
 
-      args = ''
-      if node.parameters:
-        # Due to the parser limitations, it is impossible to keep comments
-        # while stripping the default parameters.  When defaults are
-        # present, we choose to strip them and comments (and produce
-        # compilable code).
-        # TODO(nnorwitz@google.com): Investigate whether it is possible to
-        # preserve parameter name when reconstructing parameter text from
-        # the AST.
-        if len([param for param in node.parameters if param.default]) > 0:
-          args = ', '.join(param.type.name for param in node.parameters)
-        else:
-          # Get the full text of the parameters from the start
-          # of the first parameter to the end of the last parameter.
-          start = node.parameters[0].start
-          end = node.parameters[-1].end
-          # Remove // comments.
-          args_strings = re.sub(r'//.*', '', source[start:end])
-          # Condense multiple spaces and eliminate newlines putting the
-          # parameters together on a single line.  Ensure there is a
-          # space in an argument which is split by a newline without
-          # intervening whitespace, e.g.: int\nBar
-          args = re.sub('  +', ' ', args_strings.replace('\n', ' '))
+      args = []
+      for p in node.parameters:
+        arg = _GenerateArg(source[p.start:p.end])
+        if arg != 'void':
+          args.append(_EscapeForMacro(arg))
 
       # Create the mock method definition.
-      output_lines.extend(['%s%s(%s,' % (indent, mock_method_macro, node.name),
-                           '%s%s(%s));' % (indent*3, return_type, args)])
+      output_lines.extend([
+          '%sMOCK_METHOD(%s, %s, (%s), (%s));' %
+          (indent, return_type, node.name, ', '.join(args), modifiers)
+      ])
 
 
 def _GenerateMocks(filename, source, ast_list, desired_class_names):
@@ -141,12 +160,13 @@
 
       # Add template args for templated classes.
       if class_node.templated_types:
-        # TODO(paulchang): The AST doesn't preserve template argument order,
-        # so we have to make up names here.
         # TODO(paulchang): Handle non-type template arguments (e.g.
         # template<typename T, int N>).
-        template_arg_count = len(class_node.templated_types.keys())
-        template_args = ['T%d' % n for n in range(template_arg_count)]
+
+        # class_node.templated_types is an OrderedDict from strings to a tuples.
+        # The key is the name of the template, and the value is
+        # (type_name, default). Both type_name and default could be None.
+        template_args = class_node.templated_types.keys()
         template_decls = ['typename ' + arg for arg in template_args]
         lines.append('template <' + ', '.join(template_decls) + '>')
         parent_name += '<' + ', '.join(template_args) + '>'
@@ -171,7 +191,7 @@
 
       # Close the namespace.
       if class_node.namespace:
-        for i in range(len(class_node.namespace)-1, -1, -1):
+        for i in range(len(class_node.namespace) - 1, -1, -1):
           lines.append('}  // namespace %s' % class_node.namespace[i])
         lines.append('')  # Add an extra newline.
 
diff --git a/googlemock/scripts/generator/cpp/gmock_class_test.py b/googlemock/scripts/generator/cpp/gmock_class_test.py
index c53e600..eff475f 100755
--- a/googlemock/scripts/generator/cpp/gmock_class_test.py
+++ b/googlemock/scripts/generator/cpp/gmock_class_test.py
@@ -17,9 +17,6 @@
 
 """Tests for gmock.scripts.generator.cpp.gmock_class."""
 
-__author__ = 'nnorwitz@google.com (Neal Norwitz)'
-
-
 import os
 import sys
 import unittest
@@ -34,7 +31,8 @@
 class TestCase(unittest.TestCase):
   """Helper class that adds assert methods."""
 
-  def StripLeadingWhitespace(self, lines):
+  @staticmethod
+  def StripLeadingWhitespace(lines):
     """Strip leading whitespace in each line in 'lines'."""
     return '\n'.join([s.lstrip() for s in lines.split('\n')])
 
@@ -45,7 +43,8 @@
 
 class GenerateMethodsTest(TestCase):
 
-  def GenerateMethodSource(self, cpp_source):
+  @staticmethod
+  def GenerateMethodSource(cpp_source):
     """Convert C++ source to Google Mock output source lines."""
     method_source_lines = []
     # <test> is a pseudo-filename, it is not read or written.
@@ -62,7 +61,7 @@
 };
 """
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD0(Bar,\nint());',
+        'MOCK_METHOD(int, Bar, (), (override));',
         self.GenerateMethodSource(source))
 
   def testSimpleConstructorsAndDestructor(self):
@@ -79,7 +78,7 @@
 """
     # The constructors and destructor should be ignored.
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD0(Bar,\nint());',
+        'MOCK_METHOD(int, Bar, (), (override));',
         self.GenerateMethodSource(source))
 
   def testVirtualDestructor(self):
@@ -92,7 +91,7 @@
 """
     # The destructor should be ignored.
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD0(Bar,\nint());',
+        'MOCK_METHOD(int, Bar, (), (override));',
         self.GenerateMethodSource(source))
 
   def testExplicitlyDefaultedConstructorsAndDestructor(self):
@@ -108,7 +107,7 @@
 """
     # The constructors and destructor should be ignored.
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD0(Bar,\nint());',
+        'MOCK_METHOD(int, Bar, (), (override));',
         self.GenerateMethodSource(source))
 
   def testExplicitlyDeletedConstructorsAndDestructor(self):
@@ -124,7 +123,7 @@
 """
     # The constructors and destructor should be ignored.
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD0(Bar,\nint());',
+        'MOCK_METHOD(int, Bar, (), (override));',
         self.GenerateMethodSource(source))
 
   def testSimpleOverrideMethod(self):
@@ -135,7 +134,7 @@
 };
 """
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD0(Bar,\nint());',
+        'MOCK_METHOD(int, Bar, (), (override));',
         self.GenerateMethodSource(source))
 
   def testSimpleConstMethod(self):
@@ -146,7 +145,7 @@
 };
 """
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_CONST_METHOD1(Bar,\nvoid(bool flag));',
+        'MOCK_METHOD(void, Bar, (bool flag), (const, override));',
         self.GenerateMethodSource(source))
 
   def testExplicitVoid(self):
@@ -157,7 +156,7 @@
 };
 """
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD0(Bar,\nint(void));',
+        'MOCK_METHOD(int, Bar, (), (override));',
         self.GenerateMethodSource(source))
 
   def testStrangeNewlineInParameter(self):
@@ -169,7 +168,7 @@
 };
 """
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD1(Bar,\nvoid(int a));',
+        'MOCK_METHOD(void, Bar, (int a), (override));',
         self.GenerateMethodSource(source))
 
   def testDefaultParameters(self):
@@ -180,18 +179,58 @@
 };
 """
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD2(Bar,\nvoid(int, char));',
+        'MOCK_METHOD(void, Bar, (int a, char c), (override));',
         self.GenerateMethodSource(source))
 
   def testMultipleDefaultParameters(self):
     source = """
 class Foo {
  public:
-  virtual void Bar(int a = 42, char c = 'x') = 0;
+  virtual void Bar(
+        int a = 42, 
+        char c = 'x', 
+        const int* const p = nullptr, 
+        const std::string& s = "42",
+        char tab[] = {'4','2'},
+        int const *& rp = aDefaultPointer) = 0;
 };
 """
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD2(Bar,\nvoid(int, char));',
+        'MOCK_METHOD(void, Bar, '
+        '(int a, char c, const int* const p, const std::string& s, char tab[], int const *& rp), '
+        '(override));', self.GenerateMethodSource(source))
+
+  def testMultipleSingleLineDefaultParameters(self):
+    source = """
+class Foo {
+ public:
+  virtual void Bar(int a = 42, int b = 43, int c = 44) = 0;
+};
+"""
+    self.assertEqualIgnoreLeadingWhitespace(
+        'MOCK_METHOD(void, Bar, (int a, int b, int c), (override));',
+        self.GenerateMethodSource(source))
+
+  def testConstDefaultParameter(self):
+    source = """
+class Test {
+ public:
+  virtual bool Bar(const int test_arg = 42) = 0;
+};
+"""
+    self.assertEqualIgnoreLeadingWhitespace(
+        'MOCK_METHOD(bool, Bar, (const int test_arg), (override));',
+        self.GenerateMethodSource(source))
+
+  def testConstRefDefaultParameter(self):
+    source = """
+class Test {
+ public:
+  virtual bool Bar(const std::string& test_arg = "42" ) = 0;
+};
+"""
+    self.assertEqualIgnoreLeadingWhitespace(
+        'MOCK_METHOD(bool, Bar, (const std::string& test_arg), (override));',
         self.GenerateMethodSource(source))
 
   def testRemovesCommentsWhenDefaultsArePresent(self):
@@ -203,7 +242,7 @@
 };
 """
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD2(Bar,\nvoid(int, char));',
+        'MOCK_METHOD(void, Bar, (int a, char c), (override));',
         self.GenerateMethodSource(source))
 
   def testDoubleSlashCommentsInParameterListAreRemoved(self):
@@ -216,7 +255,7 @@
 };
 """
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_CONST_METHOD2(Bar,\nvoid(int a, int b));',
+        'MOCK_METHOD(void, Bar, (int a, int b), (const, override));',
         self.GenerateMethodSource(source))
 
   def testCStyleCommentsInParameterListAreNotRemoved(self):
@@ -230,7 +269,7 @@
 };
 """
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD2(Bar,\nconst string&(int /* keeper */, int b));',
+        'MOCK_METHOD(const string&, Bar, (int, int b), (override));',
         self.GenerateMethodSource(source))
 
   def testArgsOfTemplateTypes(self):
@@ -240,8 +279,7 @@
   virtual int Bar(const vector<int>& v, map<int, string>* output);
 };"""
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD2(Bar,\n'
-        'int(const vector<int>& v, map<int, string>* output));',
+        'MOCK_METHOD(int, Bar, (const vector<int>& v, (map<int, string>* output)), (override));',
         self.GenerateMethodSource(source))
 
   def testReturnTypeWithOneTemplateArg(self):
@@ -251,7 +289,7 @@
   virtual vector<int>* Bar(int n);
 };"""
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD1(Bar,\nvector<int>*(int n));',
+        'MOCK_METHOD(vector<int>*, Bar, (int n), (override));',
         self.GenerateMethodSource(source))
 
   def testReturnTypeWithManyTemplateArgs(self):
@@ -260,13 +298,8 @@
  public:
   virtual map<int, string> Bar();
 };"""
-    # Comparing the comment text is brittle - we'll think of something
-    # better in case this gets annoying, but for now let's keep it simple.
     self.assertEqualIgnoreLeadingWhitespace(
-        '// The following line won\'t really compile, as the return\n'
-        '// type has multiple template arguments.  To fix it, use a\n'
-        '// typedef for the return type.\n'
-        'MOCK_METHOD0(Bar,\nmap<int, string>());',
+        'MOCK_METHOD((map<int, string>), Bar, (), (override));',
         self.GenerateMethodSource(source))
 
   def testSimpleMethodInTemplatedClass(self):
@@ -278,7 +311,7 @@
 };
 """
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD0_T(Bar,\nint());',
+        'MOCK_METHOD(int, Bar, (), (override));',
         self.GenerateMethodSource(source))
 
   def testPointerArgWithoutNames(self):
@@ -288,7 +321,7 @@
 };
 """
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD1(Bar,\nint(C*));',
+        'MOCK_METHOD(int, Bar, (C*), (override));',
         self.GenerateMethodSource(source))
 
   def testReferenceArgWithoutNames(self):
@@ -298,7 +331,7 @@
 };
 """
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD1(Bar,\nint(C&));',
+        'MOCK_METHOD(int, Bar, (C&), (override));',
         self.GenerateMethodSource(source))
 
   def testArrayArgWithoutNames(self):
@@ -308,13 +341,14 @@
 };
 """
     self.assertEqualIgnoreLeadingWhitespace(
-        'MOCK_METHOD1(Bar,\nint(C[]));',
+        'MOCK_METHOD(int, Bar, (C[]), (override));',
         self.GenerateMethodSource(source))
 
 
 class GenerateMocksTest(TestCase):
 
-  def GenerateMocks(self, cpp_source):
+  @staticmethod
+  def GenerateMocks(cpp_source):
     """Convert C++ source to complete Google Mock output source."""
     # <test> is a pseudo-filename, it is not read or written.
     filename = '<test>'
@@ -327,31 +361,30 @@
     source = """
 namespace Foo {
 namespace Bar { class Forward; }
-namespace Baz {
+namespace Baz::Qux {
 
 class Test {
  public:
   virtual void Foo();
 };
 
-}  // namespace Baz
+}  // namespace Baz::Qux
 }  // namespace Foo
 """
     expected = """\
 namespace Foo {
-namespace Baz {
+namespace Baz::Qux {
 
 class MockTest : public Test {
 public:
-MOCK_METHOD0(Foo,
-void());
+MOCK_METHOD(void, Foo, (), (override));
 };
 
-}  // namespace Baz
+}  // namespace Baz::Qux
 }  // namespace Foo
 """
-    self.assertEqualIgnoreLeadingWhitespace(
-        expected, self.GenerateMocks(source))
+    self.assertEqualIgnoreLeadingWhitespace(expected,
+                                            self.GenerateMocks(source))
 
   def testClassWithStorageSpecifierMacro(self):
     source = """
@@ -363,12 +396,11 @@
     expected = """\
 class MockTest : public Test {
 public:
-MOCK_METHOD0(Foo,
-void());
+MOCK_METHOD(void, Foo, (), (override));
 };
 """
-    self.assertEqualIgnoreLeadingWhitespace(
-        expected, self.GenerateMocks(source))
+    self.assertEqualIgnoreLeadingWhitespace(expected,
+                                            self.GenerateMocks(source))
 
   def testTemplatedForwardDeclaration(self):
     source = """
@@ -381,12 +413,11 @@
     expected = """\
 class MockTest : public Test {
 public:
-MOCK_METHOD0(Foo,
-void());
+MOCK_METHOD(void, Foo, (), (override));
 };
 """
-    self.assertEqualIgnoreLeadingWhitespace(
-        expected, self.GenerateMocks(source))
+    self.assertEqualIgnoreLeadingWhitespace(expected,
+                                            self.GenerateMocks(source))
 
   def testTemplatedClass(self):
     source = """
@@ -397,15 +428,14 @@
 };
 """
     expected = """\
-template <typename T0, typename T1>
-class MockTest : public Test<T0, T1> {
+template <typename S, typename T>
+class MockTest : public Test<S, T> {
 public:
-MOCK_METHOD0_T(Foo,
-void());
+MOCK_METHOD(void, Foo, (), (override));
 };
 """
-    self.assertEqualIgnoreLeadingWhitespace(
-        expected, self.GenerateMocks(source))
+    self.assertEqualIgnoreLeadingWhitespace(expected,
+                                            self.GenerateMocks(source))
 
   def testTemplateInATemplateTypedef(self):
     source = """
@@ -418,12 +448,29 @@
     expected = """\
 class MockTest : public Test {
 public:
-MOCK_METHOD1(Bar,
-void(const FooType& test_arg));
+MOCK_METHOD(void, Bar, (const FooType& test_arg), (override));
 };
 """
-    self.assertEqualIgnoreLeadingWhitespace(
-        expected, self.GenerateMocks(source))
+    self.assertEqualIgnoreLeadingWhitespace(expected,
+                                            self.GenerateMocks(source))
+
+  def testTemplatedClassWithTemplatedArguments(self):
+    source = """
+template <typename S, typename T, typename U, typename V, typename W>
+class Test {
+ public:
+  virtual U Foo(T some_arg);
+};
+"""
+    expected = """\
+template <typename S, typename T, typename U, typename V, typename W>
+class MockTest : public Test<S, T, U, V, W> {
+public:
+MOCK_METHOD(U, Foo, (T some_arg), (override));
+};
+"""
+    self.assertEqualIgnoreLeadingWhitespace(expected,
+                                            self.GenerateMocks(source))
 
   def testTemplateInATemplateTypedefWithComma(self):
     source = """
@@ -437,30 +484,87 @@
     expected = """\
 class MockTest : public Test {
 public:
-MOCK_METHOD1(Bar,
-void(const FooType& test_arg));
+MOCK_METHOD(void, Bar, (const FooType& test_arg), (override));
 };
 """
-    self.assertEqualIgnoreLeadingWhitespace(
-        expected, self.GenerateMocks(source))
+    self.assertEqualIgnoreLeadingWhitespace(expected,
+                                            self.GenerateMocks(source))
 
-  def testEnumClass(self):
+  def testParenthesizedCommaInArg(self):
     source = """
 class Test {
  public:
-  enum class Baz { BAZINGA };
-  virtual void Bar(const FooType& test_arg);
+   virtual void Bar(std::function<void(int, int)> f);
 };
 """
     expected = """\
 class MockTest : public Test {
 public:
-MOCK_METHOD1(Bar,
-void(const FooType& test_arg));
+MOCK_METHOD(void, Bar, (std::function<void(int, int)> f), (override));
 };
 """
-    self.assertEqualIgnoreLeadingWhitespace(
-        expected, self.GenerateMocks(source))
+    self.assertEqualIgnoreLeadingWhitespace(expected,
+                                            self.GenerateMocks(source))
+
+  def testEnumType(self):
+    source = """
+class Test {
+ public:
+  enum Bar {
+    BAZ, QUX, QUUX, QUUUX
+  };
+  virtual void Foo();
+};
+"""
+    expected = """\
+class MockTest : public Test {
+public:
+MOCK_METHOD(void, Foo, (), (override));
+};
+"""
+    self.assertEqualIgnoreLeadingWhitespace(expected,
+                                            self.GenerateMocks(source))
+
+  def testEnumClassType(self):
+    source = """
+class Test {
+ public:
+  enum class Bar {
+    BAZ, QUX, QUUX, QUUUX
+  };
+  virtual void Foo();
+};
+"""
+    expected = """\
+class MockTest : public Test {
+public:
+MOCK_METHOD(void, Foo, (), (override));
+};
+"""
+    self.assertEqualIgnoreLeadingWhitespace(expected,
+                                            self.GenerateMocks(source))
+
+  def testStdFunction(self):
+    source = """
+class Test {
+ public:
+  Test(std::function<int(std::string)> foo) : foo_(foo) {}
+
+  virtual std::function<int(std::string)> foo();
+
+ private:
+  std::function<int(std::string)> foo_;
+};
+"""
+    expected = """\
+class MockTest : public Test {
+public:
+MOCK_METHOD(std::function<int (std::string)>, foo, (), (override));
+};
+"""
+    self.assertEqualIgnoreLeadingWhitespace(expected,
+                                            self.GenerateMocks(source))
+
 
 if __name__ == '__main__':
   unittest.main()
diff --git a/googlemock/scripts/generator/cpp/keywords.py b/googlemock/scripts/generator/cpp/keywords.py
index f694450..e428271 100755
--- a/googlemock/scripts/generator/cpp/keywords.py
+++ b/googlemock/scripts/generator/cpp/keywords.py
@@ -17,9 +17,6 @@
 
 """C++ keywords and helper utilities for determining keywords."""
 
-__author__ = 'nnorwitz@google.com (Neal Norwitz)'
-
-
 try:
     # Python 3.x
     import builtins
diff --git a/googlemock/scripts/generator/cpp/tokenize.py b/googlemock/scripts/generator/cpp/tokenize.py
index 359d556..a75edcb 100755
--- a/googlemock/scripts/generator/cpp/tokenize.py
+++ b/googlemock/scripts/generator/cpp/tokenize.py
@@ -17,9 +17,6 @@
 
 """Tokenize C++ source code."""
 
-__author__ = 'nnorwitz@google.com (Neal Norwitz)'
-
-
 try:
     # Python 3.x
     import builtins
diff --git a/googlemock/scripts/generator/cpp/utils.py b/googlemock/scripts/generator/cpp/utils.py
index eab36ee..6f5fc09 100755
--- a/googlemock/scripts/generator/cpp/utils.py
+++ b/googlemock/scripts/generator/cpp/utils.py
@@ -17,12 +17,8 @@
 
 """Generic utilities for C++ parsing."""
 
-__author__ = 'nnorwitz@google.com (Neal Norwitz)'
-
-
 import sys
 
-
 # Set to True to see the start/end token indices.
 DEBUG = True
 
diff --git a/googlemock/scripts/generator/gmock_gen.py b/googlemock/scripts/generator/gmock_gen.py
index 8cc0d13..9d528a5 100755
--- a/googlemock/scripts/generator/gmock_gen.py
+++ b/googlemock/scripts/generator/gmock_gen.py
@@ -16,7 +16,6 @@
 
 """Driver for starting up Google Mock class generator."""
 
-__author__ = 'nnorwitz@google.com (Neal Norwitz)'
 
 import os
 import sys
diff --git a/googlemock/scripts/gmock-config.in b/googlemock/scripts/gmock-config.in
deleted file mode 100755
index 2baefe9..0000000
--- a/googlemock/scripts/gmock-config.in
+++ /dev/null
@@ -1,303 +0,0 @@
-#!/bin/sh
-
-# These variables are automatically filled in by the configure script.
-name="@PACKAGE_TARNAME@"
-version="@PACKAGE_VERSION@"
-
-show_usage()
-{
-  echo "Usage: gmock-config [OPTIONS...]"
-}
-
-show_help()
-{
-  show_usage
-  cat <<\EOF
-
-The `gmock-config' script provides access to the necessary compile and linking
-flags to connect with Google C++ Mocking Framework, both in a build prior to
-installation, and on the system proper after installation. The installation
-overrides may be issued in combination with any other queries, but will only
-affect installation queries if called on a built but not installed gmock. The
-installation queries may not be issued with any other types of queries, and
-only one installation query may be made at a time. The version queries and
-compiler flag queries may be combined as desired but not mixed. Different
-version queries are always combined with logical "and" semantics, and only the
-last of any particular query is used while all previous ones ignored. All
-versions must be specified as a sequence of numbers separated by periods.
-Compiler flag queries output the union of the sets of flags when combined.
-
- Examples:
-  gmock-config --min-version=1.0 || echo "Insufficient Google Mock version."
-
-  g++ $(gmock-config --cppflags --cxxflags) -o foo.o -c foo.cpp
-  g++ $(gmock-config --ldflags --libs) -o foo foo.o
-
-  # When using a built but not installed Google Mock:
-  g++ $(../../my_gmock_build/scripts/gmock-config ...) ...
-
-  # When using an installed Google Mock, but with installation overrides:
-  export GMOCK_PREFIX="/opt"
-  g++ $(gmock-config --libdir="/opt/lib64" ...) ...
-
- Help:
-  --usage                    brief usage information
-  --help                     display this help message
-
- Installation Overrides:
-  --prefix=<dir>             overrides the installation prefix
-  --exec-prefix=<dir>        overrides the executable installation prefix
-  --libdir=<dir>             overrides the library installation prefix
-  --includedir=<dir>         overrides the header file installation prefix
-
- Installation Queries:
-  --prefix                   installation prefix
-  --exec-prefix              executable installation prefix
-  --libdir                   library installation directory
-  --includedir               header file installation directory
-  --version                  the version of the Google Mock installation
-
- Version Queries:
-  --min-version=VERSION      return 0 if the version is at least VERSION
-  --exact-version=VERSION    return 0 if the version is exactly VERSION
-  --max-version=VERSION      return 0 if the version is at most VERSION
-
- Compilation Flag Queries:
-  --cppflags                 compile flags specific to the C-like preprocessors
-  --cxxflags                 compile flags appropriate for C++ programs
-  --ldflags                  linker flags
-  --libs                     libraries for linking
-
-EOF
-}
-
-# This function bounds our version with a min and a max. It uses some clever
-# POSIX-compliant variable expansion to portably do all the work in the shell
-# and avoid any dependency on a particular "sed" or "awk" implementation.
-# Notable is that it will only ever compare the first 3 components of versions.
-# Further components will be cleanly stripped off. All versions must be
-# unadorned, so "v1.0" will *not* work. The minimum version must be in $1, and
-# the max in $2. TODO(chandlerc@google.com): If this ever breaks, we should
-# investigate expanding this via autom4te from AS_VERSION_COMPARE rather than
-# continuing to maintain our own shell version.
-check_versions()
-{
-  major_version=${version%%.*}
-  minor_version="0"
-  point_version="0"
-  if test "${version#*.}" != "${version}"; then
-    minor_version=${version#*.}
-    minor_version=${minor_version%%.*}
-  fi
-  if test "${version#*.*.}" != "${version}"; then
-    point_version=${version#*.*.}
-    point_version=${point_version%%.*}
-  fi
-
-  min_version="$1"
-  min_major_version=${min_version%%.*}
-  min_minor_version="0"
-  min_point_version="0"
-  if test "${min_version#*.}" != "${min_version}"; then
-    min_minor_version=${min_version#*.}
-    min_minor_version=${min_minor_version%%.*}
-  fi
-  if test "${min_version#*.*.}" != "${min_version}"; then
-    min_point_version=${min_version#*.*.}
-    min_point_version=${min_point_version%%.*}
-  fi
-
-  max_version="$2"
-  max_major_version=${max_version%%.*}
-  max_minor_version="0"
-  max_point_version="0"
-  if test "${max_version#*.}" != "${max_version}"; then
-    max_minor_version=${max_version#*.}
-    max_minor_version=${max_minor_version%%.*}
-  fi
-  if test "${max_version#*.*.}" != "${max_version}"; then
-    max_point_version=${max_version#*.*.}
-    max_point_version=${max_point_version%%.*}
-  fi
-
-  test $(($major_version)) -lt $(($min_major_version)) && exit 1
-  if test $(($major_version)) -eq $(($min_major_version)); then
-    test $(($minor_version)) -lt $(($min_minor_version)) && exit 1
-    if test $(($minor_version)) -eq $(($min_minor_version)); then
-      test $(($point_version)) -lt $(($min_point_version)) && exit 1
-    fi
-  fi
-
-  test $(($major_version)) -gt $(($max_major_version)) && exit 1
-  if test $(($major_version)) -eq $(($max_major_version)); then
-    test $(($minor_version)) -gt $(($max_minor_version)) && exit 1
-    if test $(($minor_version)) -eq $(($max_minor_version)); then
-      test $(($point_version)) -gt $(($max_point_version)) && exit 1
-    fi
-  fi
-
-  exit 0
-}
-
-# Show the usage line when no arguments are specified.
-if test $# -eq 0; then
-  show_usage
-  exit 1
-fi
-
-while test $# -gt 0; do
-  case $1 in
-    --usage)          show_usage;         exit 0;;
-    --help)           show_help;          exit 0;;
-
-    # Installation overrides
-    --prefix=*)       GMOCK_PREFIX=${1#--prefix=};;
-    --exec-prefix=*)  GMOCK_EXEC_PREFIX=${1#--exec-prefix=};;
-    --libdir=*)       GMOCK_LIBDIR=${1#--libdir=};;
-    --includedir=*)   GMOCK_INCLUDEDIR=${1#--includedir=};;
-
-    # Installation queries
-    --prefix|--exec-prefix|--libdir|--includedir|--version)
-      if test -n "${do_query}"; then
-        show_usage
-        exit 1
-      fi
-      do_query=${1#--}
-      ;;
-
-    # Version checking
-    --min-version=*)
-      do_check_versions=yes
-      min_version=${1#--min-version=}
-      ;;
-    --max-version=*)
-      do_check_versions=yes
-      max_version=${1#--max-version=}
-      ;;
-    --exact-version=*)
-      do_check_versions=yes
-      exact_version=${1#--exact-version=}
-      ;;
-
-    # Compiler flag output
-    --cppflags)       echo_cppflags=yes;;
-    --cxxflags)       echo_cxxflags=yes;;
-    --ldflags)        echo_ldflags=yes;;
-    --libs)           echo_libs=yes;;
-
-    # Everything else is an error
-    *)                show_usage;         exit 1;;
-  esac
-  shift
-done
-
-# These have defaults filled in by the configure script but can also be
-# overridden by environment variables or command line parameters.
-prefix="${GMOCK_PREFIX:-@prefix@}"
-exec_prefix="${GMOCK_EXEC_PREFIX:-@exec_prefix@}"
-libdir="${GMOCK_LIBDIR:-@libdir@}"
-includedir="${GMOCK_INCLUDEDIR:-@includedir@}"
-
-# We try and detect if our binary is not located at its installed location. If
-# it's not, we provide variables pointing to the source and build tree rather
-# than to the install tree. We also locate Google Test using the configured
-# gtest-config script rather than searching the PATH and our bindir for one.
-# This allows building against a just-built gmock rather than an installed
-# gmock.
-bindir="@bindir@"
-this_relative_bindir=`dirname $0`
-this_bindir=`cd ${this_relative_bindir}; pwd -P`
-if test "${this_bindir}" = "${this_bindir%${bindir}}"; then
-  # The path to the script doesn't end in the bindir sequence from Autoconf,
-  # assume that we are in a build tree.
-  build_dir=`dirname ${this_bindir}`
-  src_dir=`cd ${this_bindir}/@top_srcdir@; pwd -P`
-
-  # TODO(chandlerc@google.com): This is a dangerous dependency on libtool, we
-  # should work to remove it, and/or remove libtool altogether, replacing it
-  # with direct references to the library and a link path.
-  gmock_libs="${build_dir}/lib/libgmock.la"
-  gmock_ldflags=""
-
-  # We provide hooks to include from either the source or build dir, where the
-  # build dir is always preferred. This will potentially allow us to write
-  # build rules for generated headers and have them automatically be preferred
-  # over provided versions.
-  gmock_cppflags="-I${build_dir}/include -I${src_dir}/include"
-  gmock_cxxflags=""
-
-  # Directly invoke the gtest-config script used during the build process.
-  gtest_config="@GTEST_CONFIG@"
-else
-  # We're using an installed gmock, although it may be staged under some
-  # prefix. Assume (as our own libraries do) that we can resolve the prefix,
-  # and are present in the dynamic link paths.
-  gmock_ldflags="-L${libdir}"
-  gmock_libs="-l${name}"
-  gmock_cppflags="-I${includedir}"
-  gmock_cxxflags=""
-
-  # We also prefer any gtest-config script installed in our prefix. Lacking
-  # one, we look in the PATH for one.
-  gtest_config="${bindir}/gtest-config"
-  if test ! -x "${gtest_config}"; then
-    gtest_config=`which gtest-config`
-  fi
-fi
-
-# Ensure that we have located a Google Test to link against.
-if ! test -x "${gtest_config}"; then
-  echo "Unable to locate Google Test, check your Google Mock configuration" \
-       "and installation" >&2
-  exit 1
-elif ! "${gtest_config}" "--exact-version=@GTEST_VERSION@"; then
-  echo "The Google Test found is not the same version as Google Mock was " \
-       "built against" >&2
-  exit 1
-fi
-
-# Add the necessary Google Test bits into the various flag variables
-gmock_cppflags="${gmock_cppflags} `${gtest_config} --cppflags`"
-gmock_cxxflags="${gmock_cxxflags} `${gtest_config} --cxxflags`"
-gmock_ldflags="${gmock_ldflags} `${gtest_config} --ldflags`"
-gmock_libs="${gmock_libs} `${gtest_config} --libs`"
-
-# Do an installation query if requested.
-if test -n "$do_query"; then
-  case $do_query in
-    prefix)           echo $prefix;       exit 0;;
-    exec-prefix)      echo $exec_prefix;  exit 0;;
-    libdir)           echo $libdir;       exit 0;;
-    includedir)       echo $includedir;   exit 0;;
-    version)          echo $version;      exit 0;;
-    *)                show_usage;         exit 1;;
-  esac
-fi
-
-# Do a version check if requested.
-if test "$do_check_versions" = "yes"; then
-  # Make sure we didn't receive a bad combination of parameters.
-  test "$echo_cppflags" = "yes" && show_usage && exit 1
-  test "$echo_cxxflags" = "yes" && show_usage && exit 1
-  test "$echo_ldflags" = "yes"  && show_usage && exit 1
-  test "$echo_libs" = "yes"     && show_usage && exit 1
-
-  if test "$exact_version" != ""; then
-    check_versions $exact_version $exact_version
-    # unreachable
-  else
-    check_versions ${min_version:-0.0.0} ${max_version:-9999.9999.9999}
-    # unreachable
-  fi
-fi
-
-# Do the output in the correct order so that these can be used in-line of
-# a compiler invocation.
-output=""
-test "$echo_cppflags" = "yes" && output="$output $gmock_cppflags"
-test "$echo_cxxflags" = "yes" && output="$output $gmock_cxxflags"
-test "$echo_ldflags" = "yes"  && output="$output $gmock_ldflags"
-test "$echo_libs" = "yes"     && output="$output $gmock_libs"
-echo $output
-
-exit 0
diff --git a/googlemock/scripts/gmock_doctor.py b/googlemock/scripts/gmock_doctor.py
deleted file mode 100755
index 74992bc..0000000
--- a/googlemock/scripts/gmock_doctor.py
+++ /dev/null
@@ -1,640 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2008, Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-#     * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-#     * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-"""Converts compiler's errors in code using Google Mock to plain English."""
-
-__author__ = 'wan@google.com (Zhanyong Wan)'
-
-import re
-import sys
-
-_VERSION = '1.0.3'
-
-_EMAIL = 'googlemock@googlegroups.com'
-
-_COMMON_GMOCK_SYMBOLS = [
-    # Matchers
-    '_',
-    'A',
-    'AddressSatisfies',
-    'AllOf',
-    'An',
-    'AnyOf',
-    'ContainerEq',
-    'Contains',
-    'ContainsRegex',
-    'DoubleEq',
-    'ElementsAre',
-    'ElementsAreArray',
-    'EndsWith',
-    'Eq',
-    'Field',
-    'FloatEq',
-    'Ge',
-    'Gt',
-    'HasSubstr',
-    'IsInitializedProto',
-    'Le',
-    'Lt',
-    'MatcherCast',
-    'Matches',
-    'MatchesRegex',
-    'NanSensitiveDoubleEq',
-    'NanSensitiveFloatEq',
-    'Ne',
-    'Not',
-    'NotNull',
-    'Pointee',
-    'Property',
-    'Ref',
-    'ResultOf',
-    'SafeMatcherCast',
-    'StartsWith',
-    'StrCaseEq',
-    'StrCaseNe',
-    'StrEq',
-    'StrNe',
-    'Truly',
-    'TypedEq',
-    'Value',
-
-    # Actions
-    'Assign',
-    'ByRef',
-    'DeleteArg',
-    'DoAll',
-    'DoDefault',
-    'IgnoreResult',
-    'Invoke',
-    'InvokeArgument',
-    'InvokeWithoutArgs',
-    'Return',
-    'ReturnNew',
-    'ReturnNull',
-    'ReturnRef',
-    'SaveArg',
-    'SetArgReferee',
-    'SetArgPointee',
-    'SetArgumentPointee',
-    'SetArrayArgument',
-    'SetErrnoAndReturn',
-    'Throw',
-    'WithArg',
-    'WithArgs',
-    'WithoutArgs',
-
-    # Cardinalities
-    'AnyNumber',
-    'AtLeast',
-    'AtMost',
-    'Between',
-    'Exactly',
-
-    # Sequences
-    'InSequence',
-    'Sequence',
-
-    # Misc
-    'DefaultValue',
-    'Mock',
-    ]
-
-# Regex for matching source file path and line number in the compiler's errors.
-_GCC_FILE_LINE_RE = r'(?P<file>.*):(?P<line>\d+):(\d+:)?\s+'
-_CLANG_FILE_LINE_RE = r'(?P<file>.*):(?P<line>\d+):(?P<column>\d+):\s+'
-_CLANG_NON_GMOCK_FILE_LINE_RE = (
-    r'(?P<file>.*[/\\^](?!gmock-)[^/\\]+):(?P<line>\d+):(?P<column>\d+):\s+')
-
-
-def _FindAllMatches(regex, s):
-  """Generates all matches of regex in string s."""
-
-  r = re.compile(regex)
-  return r.finditer(s)
-
-
-def _GenericDiagnoser(short_name, long_name, diagnoses, msg):
-  """Diagnoses the given disease by pattern matching.
-
-  Can provide different diagnoses for different patterns.
-
-  Args:
-    short_name: Short name of the disease.
-    long_name:  Long name of the disease.
-    diagnoses:  A list of pairs (regex, pattern for formatting the diagnosis
-                for matching regex).
-    msg:        Compiler's error messages.
-  Yields:
-    Tuples of the form
-      (short name of disease, long name of disease, diagnosis).
-  """
-  for regex, diagnosis in diagnoses:
-    if re.search(regex, msg):
-      diagnosis = '%(file)s:%(line)s:' + diagnosis
-      for m in _FindAllMatches(regex, msg):
-        yield (short_name, long_name, diagnosis % m.groupdict())
-
-
-def _NeedToReturnReferenceDiagnoser(msg):
-  """Diagnoses the NRR disease, given the error messages by the compiler."""
-
-  gcc_regex = (r'In member function \'testing::internal::ReturnAction<R>.*\n'
-               + _GCC_FILE_LINE_RE + r'instantiated from here\n'
-               r'.*gmock-actions\.h.*error: creating array with negative size')
-  clang_regex = (r'error:.*array.*negative.*\r?\n'
-                 r'(.*\n)*?' +
-                 _CLANG_NON_GMOCK_FILE_LINE_RE +
-                 r'note: in instantiation of function template specialization '
-                 r'\'testing::internal::ReturnAction<(?P<type>.*)>'
-                 r'::operator Action<.*>\' requested here')
-  clang11_re = (r'use_ReturnRef_instead_of_Return_to_return_a_reference.*'
-                r'(.*\n)*?' + _CLANG_NON_GMOCK_FILE_LINE_RE)
-
-  diagnosis = """
-You are using a Return() action in a function that returns a reference to
-%(type)s.  Please use ReturnRef() instead."""
-  return _GenericDiagnoser('NRR', 'Need to Return Reference',
-                           [(clang_regex, diagnosis),
-                            (clang11_re, diagnosis % {'type': 'a type'}),
-                            (gcc_regex, diagnosis % {'type': 'a type'})],
-                           msg)
-
-
-def _NeedToReturnSomethingDiagnoser(msg):
-  """Diagnoses the NRS disease, given the error messages by the compiler."""
-
-  gcc_regex = (_GCC_FILE_LINE_RE + r'(instantiated from here\n.'
-               r'*gmock.*actions\.h.*error: void value not ignored)'
-               r'|(error: control reaches end of non-void function)')
-  clang_regex1 = (_CLANG_FILE_LINE_RE +
-                  r'error: cannot initialize return object '
-                  r'of type \'Result\' \(aka \'(?P<return_type>.*)\'\) '
-                  r'with an rvalue of type \'void\'')
-  clang_regex2 = (_CLANG_FILE_LINE_RE +
-                  r'error: cannot initialize return object '
-                  r'of type \'(?P<return_type>.*)\' '
-                  r'with an rvalue of type \'void\'')
-  diagnosis = """
-You are using an action that returns void, but it needs to return
-%(return_type)s.  Please tell it *what* to return.  Perhaps you can use
-the pattern DoAll(some_action, Return(some_value))?"""
-  return _GenericDiagnoser(
-      'NRS',
-      'Need to Return Something',
-      [(gcc_regex, diagnosis % {'return_type': '*something*'}),
-       (clang_regex1, diagnosis),
-       (clang_regex2, diagnosis)],
-      msg)
-
-
-def _NeedToReturnNothingDiagnoser(msg):
-  """Diagnoses the NRN disease, given the error messages by the compiler."""
-
-  gcc_regex = (_GCC_FILE_LINE_RE + r'instantiated from here\n'
-               r'.*gmock-actions\.h.*error: instantiation of '
-               r'\'testing::internal::ReturnAction<R>::Impl<F>::value_\' '
-               r'as type \'void\'')
-  clang_regex1 = (r'error: field has incomplete type '
-                  r'\'Result\' \(aka \'void\'\)(\r)?\n'
-                  r'(.*\n)*?' +
-                  _CLANG_NON_GMOCK_FILE_LINE_RE + r'note: in instantiation '
-                  r'of function template specialization '
-                  r'\'testing::internal::ReturnAction<(?P<return_type>.*)>'
-                  r'::operator Action<void \(.*\)>\' requested here')
-  clang_regex2 = (r'error: field has incomplete type '
-                  r'\'Result\' \(aka \'void\'\)(\r)?\n'
-                  r'(.*\n)*?' +
-                  _CLANG_NON_GMOCK_FILE_LINE_RE + r'note: in instantiation '
-                  r'of function template specialization '
-                  r'\'testing::internal::DoBothAction<.*>'
-                  r'::operator Action<(?P<return_type>.*) \(.*\)>\' '
-                  r'requested here')
-  diagnosis = """
-You are using an action that returns %(return_type)s, but it needs to return
-void.  Please use a void-returning action instead.
-
-All actions but the last in DoAll(...) must return void.  Perhaps you need
-to re-arrange the order of actions in a DoAll(), if you are using one?"""
-  return _GenericDiagnoser(
-      'NRN',
-      'Need to Return Nothing',
-      [(gcc_regex, diagnosis % {'return_type': '*something*'}),
-       (clang_regex1, diagnosis),
-       (clang_regex2, diagnosis)],
-      msg)
-
-
-def _IncompleteByReferenceArgumentDiagnoser(msg):
-  """Diagnoses the IBRA disease, given the error messages by the compiler."""
-
-  gcc_regex = (_GCC_FILE_LINE_RE + r'instantiated from here\n'
-               r'.*gtest-printers\.h.*error: invalid application of '
-               r'\'sizeof\' to incomplete type \'(?P<type>.*)\'')
-
-  clang_regex = (r'.*gtest-printers\.h.*error: invalid application of '
-                 r'\'sizeof\' to an incomplete type '
-                 r'\'(?P<type>.*)( const)?\'\r?\n'
-                 r'(.*\n)*?' +
-                 _CLANG_NON_GMOCK_FILE_LINE_RE +
-                 r'note: in instantiation of member function '
-                 r'\'testing::internal2::TypeWithoutFormatter<.*>::'
-                 r'PrintValue\' requested here')
-  diagnosis = """
-In order to mock this function, Google Mock needs to see the definition
-of type "%(type)s" - declaration alone is not enough.  Either #include
-the header that defines it, or change the argument to be passed
-by pointer."""
-
-  return _GenericDiagnoser('IBRA', 'Incomplete By-Reference Argument Type',
-                           [(gcc_regex, diagnosis),
-                            (clang_regex, diagnosis)],
-                           msg)
-
-
-def _OverloadedFunctionMatcherDiagnoser(msg):
-  """Diagnoses the OFM disease, given the error messages by the compiler."""
-
-  gcc_regex = (_GCC_FILE_LINE_RE + r'error: no matching function for '
-               r'call to \'Truly\(<unresolved overloaded function type>\)')
-  clang_regex = (_CLANG_FILE_LINE_RE + r'error: no matching function for '
-                 r'call to \'Truly')
-  diagnosis = """
-The argument you gave to Truly() is an overloaded function.  Please tell
-your compiler which overloaded version you want to use.
-
-For example, if you want to use the version whose signature is
-  bool Foo(int n);
-you should write
-  Truly(static_cast<bool (*)(int n)>(Foo))"""
-  return _GenericDiagnoser('OFM', 'Overloaded Function Matcher',
-                           [(gcc_regex, diagnosis),
-                            (clang_regex, diagnosis)],
-                           msg)
-
-
-def _OverloadedFunctionActionDiagnoser(msg):
-  """Diagnoses the OFA disease, given the error messages by the compiler."""
-
-  gcc_regex = (_GCC_FILE_LINE_RE + r'error: no matching function for call to '
-               r'\'Invoke\(<unresolved overloaded function type>')
-  clang_regex = (_CLANG_FILE_LINE_RE + r'error: no matching '
-                 r'function for call to \'Invoke\'\r?\n'
-                 r'(.*\n)*?'
-                 r'.*\bgmock-generated-actions\.h:\d+:\d+:\s+'
-                 r'note: candidate template ignored:\s+'
-                 r'couldn\'t infer template argument \'FunctionImpl\'')
-  diagnosis = """
-Function you are passing to Invoke is overloaded.  Please tell your compiler
-which overloaded version you want to use.
-
-For example, if you want to use the version whose signature is
-  bool MyFunction(int n, double x);
-you should write something like
-  Invoke(static_cast<bool (*)(int n, double x)>(MyFunction))"""
-  return _GenericDiagnoser('OFA', 'Overloaded Function Action',
-                           [(gcc_regex, diagnosis),
-                            (clang_regex, diagnosis)],
-                           msg)
-
-
-def _OverloadedMethodActionDiagnoser(msg):
-  """Diagnoses the OMA disease, given the error messages by the compiler."""
-
-  gcc_regex = (_GCC_FILE_LINE_RE + r'error: no matching function for '
-               r'call to \'Invoke\(.+, <unresolved overloaded function '
-               r'type>\)')
-  clang_regex = (_CLANG_FILE_LINE_RE + r'error: no matching function '
-                 r'for call to \'Invoke\'\r?\n'
-                 r'(.*\n)*?'
-                 r'.*\bgmock-generated-actions\.h:\d+:\d+: '
-                 r'note: candidate function template not viable: '
-                 r'requires .*, but 2 (arguments )?were provided')
-  diagnosis = """
-The second argument you gave to Invoke() is an overloaded method.  Please
-tell your compiler which overloaded version you want to use.
-
-For example, if you want to use the version whose signature is
-  class Foo {
-    ...
-    bool Bar(int n, double x);
-  };
-you should write something like
-  Invoke(foo, static_cast<bool (Foo::*)(int n, double x)>(&Foo::Bar))"""
-  return _GenericDiagnoser('OMA', 'Overloaded Method Action',
-                           [(gcc_regex, diagnosis),
-                            (clang_regex, diagnosis)],
-                           msg)
-
-
-def _MockObjectPointerDiagnoser(msg):
-  """Diagnoses the MOP disease, given the error messages by the compiler."""
-
-  gcc_regex = (_GCC_FILE_LINE_RE + r'error: request for member '
-               r'\'gmock_(?P<method>.+)\' in \'(?P<mock_object>.+)\', '
-               r'which is of non-class type \'(.*::)*(?P<class_name>.+)\*\'')
-  clang_regex = (_CLANG_FILE_LINE_RE + r'error: member reference type '
-                 r'\'(?P<class_name>.*?) *\' is a pointer; '
-                 r'(did you mean|maybe you meant) to use \'->\'\?')
-  diagnosis = """
-The first argument to ON_CALL() and EXPECT_CALL() must be a mock *object*,
-not a *pointer* to it.  Please write '*(%(mock_object)s)' instead of
-'%(mock_object)s' as your first argument.
-
-For example, given the mock class:
-
-  class %(class_name)s : public ... {
-    ...
-    MOCK_METHOD0(%(method)s, ...);
-  };
-
-and the following mock instance:
-
-  %(class_name)s* mock_ptr = ...
-
-you should use the EXPECT_CALL like this:
-
-  EXPECT_CALL(*mock_ptr, %(method)s(...));"""
-
-  return _GenericDiagnoser(
-      'MOP',
-      'Mock Object Pointer',
-      [(gcc_regex, diagnosis),
-       (clang_regex, diagnosis % {'mock_object': 'mock_object',
-                                  'method': 'method',
-                                  'class_name': '%(class_name)s'})],
-       msg)
-
-
-def _NeedToUseSymbolDiagnoser(msg):
-  """Diagnoses the NUS disease, given the error messages by the compiler."""
-
-  gcc_regex = (_GCC_FILE_LINE_RE + r'error: \'(?P<symbol>.+)\' '
-               r'(was not declared in this scope|has not been declared)')
-  clang_regex = (_CLANG_FILE_LINE_RE +
-                 r'error: (use of undeclared identifier|unknown type name|'
-                 r'no template named) \'(?P<symbol>[^\']+)\'')
-  diagnosis = """
-'%(symbol)s' is defined by Google Mock in the testing namespace.
-Did you forget to write
-  using testing::%(symbol)s;
-?"""
-  for m in (list(_FindAllMatches(gcc_regex, msg)) +
-            list(_FindAllMatches(clang_regex, msg))):
-    symbol = m.groupdict()['symbol']
-    if symbol in _COMMON_GMOCK_SYMBOLS:
-      yield ('NUS', 'Need to Use Symbol', diagnosis % m.groupdict())
-
-
-def _NeedToUseReturnNullDiagnoser(msg):
-  """Diagnoses the NRNULL disease, given the error messages by the compiler."""
-
-  gcc_regex = ('instantiated from \'testing::internal::ReturnAction<R>'
-               '::operator testing::Action<Func>\(\) const.*\n' +
-               _GCC_FILE_LINE_RE + r'instantiated from here\n'
-               r'.*error: no matching function for call to \'ImplicitCast_\('
-               r'(:?long )?int&\)')
-  clang_regex = (r'\bgmock-actions.h:.* error: no matching function for '
-                 r'call to \'ImplicitCast_\'\r?\n'
-                 r'(.*\n)*?' +
-                 _CLANG_NON_GMOCK_FILE_LINE_RE + r'note: in instantiation '
-                 r'of function template specialization '
-                 r'\'testing::internal::ReturnAction<(int|long)>::operator '
-                 r'Action<(?P<type>.*)\(\)>\' requested here')
-  diagnosis = """
-You are probably calling Return(NULL) and the compiler isn't sure how to turn
-NULL into %(type)s. Use ReturnNull() instead.
-Note: the line number may be off; please fix all instances of Return(NULL)."""
-  return _GenericDiagnoser(
-      'NRNULL', 'Need to use ReturnNull',
-      [(clang_regex, diagnosis),
-       (gcc_regex, diagnosis % {'type': 'the right type'})],
-      msg)
-
-
-def _TypeInTemplatedBaseDiagnoser(msg):
-  """Diagnoses the TTB disease, given the error messages by the compiler."""
-
-  # This version works when the type is used as the mock function's return
-  # type.
-  gcc_4_3_1_regex_type_in_retval = (
-      r'In member function \'int .*\n' + _GCC_FILE_LINE_RE +
-      r'error: a function call cannot appear in a constant-expression')
-  gcc_4_4_0_regex_type_in_retval = (
-      r'error: a function call cannot appear in a constant-expression'
-      + _GCC_FILE_LINE_RE + r'error: template argument 1 is invalid\n')
-  # This version works when the type is used as the mock function's sole
-  # parameter type.
-  gcc_regex_type_of_sole_param = (
-      _GCC_FILE_LINE_RE +
-      r'error: \'(?P<type>.+)\' was not declared in this scope\n'
-      r'.*error: template argument 1 is invalid\n')
-  # This version works when the type is used as a parameter of a mock
-  # function that has multiple parameters.
-  gcc_regex_type_of_a_param = (
-      r'error: expected `;\' before \'::\' token\n'
-      + _GCC_FILE_LINE_RE +
-      r'error: \'(?P<type>.+)\' was not declared in this scope\n'
-      r'.*error: template argument 1 is invalid\n'
-      r'.*error: \'.+\' was not declared in this scope')
-  clang_regex_type_of_retval_or_sole_param = (
-      _CLANG_FILE_LINE_RE +
-      r'error: use of undeclared identifier \'(?P<type>.*)\'\n'
-      r'(.*\n)*?'
-      r'(?P=file):(?P=line):\d+: error: '
-      r'non-friend class member \'Result\' cannot have a qualified name'
-      )
-  clang_regex_type_of_a_param = (
-      _CLANG_FILE_LINE_RE +
-      r'error: C\+\+ requires a type specifier for all declarations\n'
-      r'(.*\n)*?'
-      r'(?P=file):(?P=line):(?P=column): error: '
-      r'C\+\+ requires a type specifier for all declarations'
-      )
-  clang_regex_unknown_type = (
-      _CLANG_FILE_LINE_RE +
-      r'error: unknown type name \'(?P<type>[^\']+)\''
-      )
-
-  diagnosis = """
-In a mock class template, types or typedefs defined in the base class
-template are *not* automatically visible.  This is how C++ works.  Before
-you can use a type or typedef named %(type)s defined in base class Base<T>, you
-need to make it visible.  One way to do it is:
-
-  typedef typename Base<T>::%(type)s %(type)s;"""
-
-  for diag in _GenericDiagnoser(
-      'TTB', 'Type in Template Base',
-      [(gcc_4_3_1_regex_type_in_retval, diagnosis % {'type': 'Foo'}),
-       (gcc_4_4_0_regex_type_in_retval, diagnosis % {'type': 'Foo'}),
-       (gcc_regex_type_of_sole_param, diagnosis),
-       (gcc_regex_type_of_a_param, diagnosis),
-       (clang_regex_type_of_retval_or_sole_param, diagnosis),
-       (clang_regex_type_of_a_param, diagnosis % {'type': 'Foo'})],
-      msg):
-    yield diag
-  # Avoid overlap with the NUS pattern.
-  for m in _FindAllMatches(clang_regex_unknown_type, msg):
-    type_ = m.groupdict()['type']
-    if type_ not in _COMMON_GMOCK_SYMBOLS:
-      yield ('TTB', 'Type in Template Base', diagnosis % m.groupdict())
-
-
-def _WrongMockMethodMacroDiagnoser(msg):
-  """Diagnoses the WMM disease, given the error messages by the compiler."""
-
-  gcc_regex = (_GCC_FILE_LINE_RE +
-               r'.*this_method_does_not_take_(?P<wrong_args>\d+)_argument.*\n'
-               r'.*\n'
-               r'.*candidates are.*FunctionMocker<[^>]+A(?P<args>\d+)\)>')
-  clang_regex = (_CLANG_NON_GMOCK_FILE_LINE_RE +
-                 r'error:.*array.*negative.*r?\n'
-                 r'(.*\n)*?'
-                 r'(?P=file):(?P=line):(?P=column): error: too few arguments '
-                 r'to function call, expected (?P<args>\d+), '
-                 r'have (?P<wrong_args>\d+)')
-  clang11_re = (_CLANG_NON_GMOCK_FILE_LINE_RE +
-                r'.*this_method_does_not_take_'
-                r'(?P<wrong_args>\d+)_argument.*')
-  diagnosis = """
-You are using MOCK_METHOD%(wrong_args)s to define a mock method that has
-%(args)s arguments. Use MOCK_METHOD%(args)s (or MOCK_CONST_METHOD%(args)s,
-MOCK_METHOD%(args)s_T, MOCK_CONST_METHOD%(args)s_T as appropriate) instead."""
-  return _GenericDiagnoser('WMM', 'Wrong MOCK_METHODn Macro',
-                           [(gcc_regex, diagnosis),
-                            (clang11_re, diagnosis % {'wrong_args': 'm',
-                                                      'args': 'n'}),
-                            (clang_regex, diagnosis)],
-                           msg)
-
-
-def _WrongParenPositionDiagnoser(msg):
-  """Diagnoses the WPP disease, given the error messages by the compiler."""
-
-  gcc_regex = (_GCC_FILE_LINE_RE +
-               r'error:.*testing::internal::MockSpec<.* has no member named \''
-               r'(?P<method>\w+)\'')
-  clang_regex = (_CLANG_NON_GMOCK_FILE_LINE_RE +
-                 r'error: no member named \'(?P<method>\w+)\' in '
-                 r'\'testing::internal::MockSpec<.*>\'')
-  diagnosis = """
-The closing parenthesis of ON_CALL or EXPECT_CALL should be *before*
-".%(method)s".  For example, you should write:
-  EXPECT_CALL(my_mock, Foo(_)).%(method)s(...);
-instead of:
-  EXPECT_CALL(my_mock, Foo(_).%(method)s(...));"""
-  return _GenericDiagnoser('WPP', 'Wrong Parenthesis Position',
-                           [(gcc_regex, diagnosis),
-                            (clang_regex, diagnosis)],
-                           msg)
-
-
-_DIAGNOSERS = [
-    _IncompleteByReferenceArgumentDiagnoser,
-    _MockObjectPointerDiagnoser,
-    _NeedToReturnNothingDiagnoser,
-    _NeedToReturnReferenceDiagnoser,
-    _NeedToReturnSomethingDiagnoser,
-    _NeedToUseReturnNullDiagnoser,
-    _NeedToUseSymbolDiagnoser,
-    _OverloadedFunctionActionDiagnoser,
-    _OverloadedFunctionMatcherDiagnoser,
-    _OverloadedMethodActionDiagnoser,
-    _TypeInTemplatedBaseDiagnoser,
-    _WrongMockMethodMacroDiagnoser,
-    _WrongParenPositionDiagnoser,
-    ]
-
-
-def Diagnose(msg):
-  """Generates all possible diagnoses given the compiler error message."""
-
-  msg = re.sub(r'\x1b\[[^m]*m', '', msg)  # Strips all color formatting.
-  # Assuming the string is using the UTF-8 encoding, replaces the left and
-  # the right single quote characters with apostrophes.
-  msg = re.sub(r'(\xe2\x80\x98|\xe2\x80\x99)', "'", msg)
-
-  diagnoses = []
-  for diagnoser in _DIAGNOSERS:
-    for diag in diagnoser(msg):
-      diagnosis = '[%s - %s]\n%s' % diag
-      if not diagnosis in diagnoses:
-        diagnoses.append(diagnosis)
-  return diagnoses
-
-
-def main():
-  print ('Google Mock Doctor v%s - '
-         'diagnoses problems in code using Google Mock.' % _VERSION)
-
-  if sys.stdin.isatty():
-    print ('Please copy and paste the compiler errors here.  Press c-D when '
-           'you are done:')
-  else:
-    print ('Waiting for compiler errors on stdin . . .')
-
-  msg = sys.stdin.read().strip()
-  diagnoses = Diagnose(msg)
-  count = len(diagnoses)
-  if not count:
-    print ("""
-Your compiler complained:
-8<------------------------------------------------------------
-%s
------------------------------------------------------------->8
-
-Uh-oh, I'm not smart enough to figure out what the problem is. :-(
-However...
-If you send your source code and the compiler's error messages to
-%s, you can be helped and I can get smarter --
-win-win for us!""" % (msg, _EMAIL))
-  else:
-    print ('------------------------------------------------------------')
-    print ('Your code appears to have the following',)
-    if count > 1:
-      print ('%s diseases:' % (count,))
-    else:
-      print ('disease:')
-    i = 0
-    for d in diagnoses:
-      i += 1
-      if count > 1:
-        print ('\n#%s:' % (i,))
-      print (d)
-    print ("""
-How did I do?  If you think I'm wrong or unhelpful, please send your
-source code and the compiler's error messages to %s.
-Then you can be helped and I can get smarter -- I promise I won't be upset!""" %
-           _EMAIL)
-
-
-if __name__ == '__main__':
-  main()
diff --git a/googlemock/scripts/upload.py b/googlemock/scripts/upload.py
deleted file mode 100755
index 95239dc..0000000
--- a/googlemock/scripts/upload.py
+++ /dev/null
@@ -1,1387 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2007 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Tool for uploading diffs from a version control system to the codereview app.
-
-Usage summary: upload.py [options] [-- diff_options]
-
-Diff options are passed to the diff command of the underlying system.
-
-Supported version control systems:
-  Git
-  Mercurial
-  Subversion
-
-It is important for Git/Mercurial users to specify a tree/node/branch to diff
-against by using the '--rev' option.
-"""
-# This code is derived from appcfg.py in the App Engine SDK (open source),
-# and from ASPN recipe #146306.
-
-import cookielib
-import getpass
-import logging
-import md5
-import mimetypes
-import optparse
-import os
-import re
-import socket
-import subprocess
-import sys
-import urllib
-import urllib2
-import urlparse
-
-try:
-  import readline
-except ImportError:
-  pass
-
-# The logging verbosity:
-#  0: Errors only.
-#  1: Status messages.
-#  2: Info logs.
-#  3: Debug logs.
-verbosity = 1
-
-# Max size of patch or base file.
-MAX_UPLOAD_SIZE = 900 * 1024
-
-
-def GetEmail(prompt):
-  """Prompts the user for their email address and returns it.
-
-  The last used email address is saved to a file and offered up as a suggestion
-  to the user. If the user presses enter without typing in anything the last
-  used email address is used. If the user enters a new address, it is saved
-  for next time we prompt.
-
-  """
-  last_email_file_name = os.path.expanduser("~/.last_codereview_email_address")
-  last_email = ""
-  if os.path.exists(last_email_file_name):
-    try:
-      last_email_file = open(last_email_file_name, "r")
-      last_email = last_email_file.readline().strip("\n")
-      last_email_file.close()
-      prompt += " [%s]" % last_email
-    except IOError, e:
-      pass
-  email = raw_input(prompt + ": ").strip()
-  if email:
-    try:
-      last_email_file = open(last_email_file_name, "w")
-      last_email_file.write(email)
-      last_email_file.close()
-    except IOError, e:
-      pass
-  else:
-    email = last_email
-  return email
-
-
-def StatusUpdate(msg):
-  """Print a status message to stdout.
-
-  If 'verbosity' is greater than 0, print the message.
-
-  Args:
-    msg: The string to print.
-  """
-  if verbosity > 0:
-    print msg
-
-
-def ErrorExit(msg):
-  """Print an error message to stderr and exit."""
-  print >>sys.stderr, msg
-  sys.exit(1)
-
-
-class ClientLoginError(urllib2.HTTPError):
-  """Raised to indicate there was an error authenticating with ClientLogin."""
-
-  def __init__(self, url, code, msg, headers, args):
-    urllib2.HTTPError.__init__(self, url, code, msg, headers, None)
-    self.args = args
-    self.reason = args["Error"]
-
-
-class AbstractRpcServer(object):
-  """Provides a common interface for a simple RPC server."""
-
-  def __init__(self, host, auth_function, host_override=None, extra_headers={},
-               save_cookies=False):
-    """Creates a new HttpRpcServer.
-
-    Args:
-      host: The host to send requests to.
-      auth_function: A function that takes no arguments and returns an
-        (email, password) tuple when called. Will be called if authentication
-        is required.
-      host_override: The host header to send to the server (defaults to host).
-      extra_headers: A dict of extra headers to append to every request.
-      save_cookies: If True, save the authentication cookies to local disk.
-        If False, use an in-memory cookiejar instead.  Subclasses must
-        implement this functionality.  Defaults to False.
-    """
-    self.host = host
-    self.host_override = host_override
-    self.auth_function = auth_function
-    self.authenticated = False
-    self.extra_headers = extra_headers
-    self.save_cookies = save_cookies
-    self.opener = self._GetOpener()
-    if self.host_override:
-      logging.info("Server: %s; Host: %s", self.host, self.host_override)
-    else:
-      logging.info("Server: %s", self.host)
-
-  def _GetOpener(self):
-    """Returns an OpenerDirector for making HTTP requests.
-
-    Returns:
-      A urllib2.OpenerDirector object.
-    """
-    raise NotImplementedError()
-
-  def _CreateRequest(self, url, data=None):
-    """Creates a new urllib request."""
-    logging.debug("Creating request for: '%s' with payload:\n%s", url, data)
-    req = urllib2.Request(url, data=data)
-    if self.host_override:
-      req.add_header("Host", self.host_override)
-    for key, value in self.extra_headers.iteritems():
-      req.add_header(key, value)
-    return req
-
-  def _GetAuthToken(self, email, password):
-    """Uses ClientLogin to authenticate the user, returning an auth token.
-
-    Args:
-      email:    The user's email address
-      password: The user's password
-
-    Raises:
-      ClientLoginError: If there was an error authenticating with ClientLogin.
-      HTTPError: If there was some other form of HTTP error.
-
-    Returns:
-      The authentication token returned by ClientLogin.
-    """
-    account_type = "GOOGLE"
-    if self.host.endswith(".google.com"):
-      # Needed for use inside Google.
-      account_type = "HOSTED"
-    req = self._CreateRequest(
-        url="https://www.google.com/accounts/ClientLogin",
-        data=urllib.urlencode({
-            "Email": email,
-            "Passwd": password,
-            "service": "ah",
-            "source": "rietveld-codereview-upload",
-            "accountType": account_type,
-        }),
-    )
-    try:
-      response = self.opener.open(req)
-      response_body = response.read()
-      response_dict = dict(x.split("=")
-                           for x in response_body.split("\n") if x)
-      return response_dict["Auth"]
-    except urllib2.HTTPError, e:
-      if e.code == 403:
-        body = e.read()
-        response_dict = dict(x.split("=", 1) for x in body.split("\n") if x)
-        raise ClientLoginError(req.get_full_url(), e.code, e.msg,
-                               e.headers, response_dict)
-      else:
-        raise
-
-  def _GetAuthCookie(self, auth_token):
-    """Fetches authentication cookies for an authentication token.
-
-    Args:
-      auth_token: The authentication token returned by ClientLogin.
-
-    Raises:
-      HTTPError: If there was an error fetching the authentication cookies.
-    """
-    # This is a dummy value to allow us to identify when we're successful.
-    continue_location = "http://localhost/"
-    args = {"continue": continue_location, "auth": auth_token}
-    req = self._CreateRequest("http://%s/_ah/login?%s" %
-                              (self.host, urllib.urlencode(args)))
-    try:
-      response = self.opener.open(req)
-    except urllib2.HTTPError, e:
-      response = e
-    if (response.code != 302 or
-        response.info()["location"] != continue_location):
-      raise urllib2.HTTPError(req.get_full_url(), response.code, response.msg,
-                              response.headers, response.fp)
-    self.authenticated = True
-
-  def _Authenticate(self):
-    """Authenticates the user.
-
-    The authentication process works as follows:
-     1) We get a username and password from the user
-     2) We use ClientLogin to obtain an AUTH token for the user
-        (see https://developers.google.com/identity/protocols/AuthForInstalledApps).
-     3) We pass the auth token to /_ah/login on the server to obtain an
-        authentication cookie. If login was successful, it tries to redirect
-        us to the URL we provided.
-
-    If we attempt to access the upload API without first obtaining an
-    authentication cookie, it returns a 401 response and directs us to
-    authenticate ourselves with ClientLogin.
-    """
-    for i in range(3):
-      credentials = self.auth_function()
-      try:
-        auth_token = self._GetAuthToken(credentials[0], credentials[1])
-      except ClientLoginError, e:
-        if e.reason == "BadAuthentication":
-          print >>sys.stderr, "Invalid username or password."
-          continue
-        if e.reason == "CaptchaRequired":
-          print >>sys.stderr, (
-              "Please go to\n"
-              "https://www.google.com/accounts/DisplayUnlockCaptcha\n"
-              "and verify you are a human.  Then try again.")
-          break
-        if e.reason == "NotVerified":
-          print >>sys.stderr, "Account not verified."
-          break
-        if e.reason == "TermsNotAgreed":
-          print >>sys.stderr, "User has not agreed to TOS."
-          break
-        if e.reason == "AccountDeleted":
-          print >>sys.stderr, "The user account has been deleted."
-          break
-        if e.reason == "AccountDisabled":
-          print >>sys.stderr, "The user account has been disabled."
-          break
-        if e.reason == "ServiceDisabled":
-          print >>sys.stderr, ("The user's access to the service has been "
-                               "disabled.")
-          break
-        if e.reason == "ServiceUnavailable":
-          print >>sys.stderr, "The service is not available; try again later."
-          break
-        raise
-      self._GetAuthCookie(auth_token)
-      return
-
-  def Send(self, request_path, payload=None,
-           content_type="application/octet-stream",
-           timeout=None,
-           **kwargs):
-    """Sends an RPC and returns the response.
-
-    Args:
-      request_path: The path to send the request to, eg /api/appversion/create.
-      payload: The body of the request, or None to send an empty request.
-      content_type: The Content-Type header to use.
-      timeout: timeout in seconds; default None i.e. no timeout.
-        (Note: for large requests on OS X, the timeout doesn't work right.)
-      kwargs: Any keyword arguments are converted into query string parameters.
-
-    Returns:
-      The response body, as a string.
-    """
-    # TODO: Don't require authentication.  Let the server say
-    # whether it is necessary.
-    if not self.authenticated:
-      self._Authenticate()
-
-    old_timeout = socket.getdefaulttimeout()
-    socket.setdefaulttimeout(timeout)
-    try:
-      tries = 0
-      while True:
-        tries += 1
-        args = dict(kwargs)
-        url = "http://%s%s" % (self.host, request_path)
-        if args:
-          url += "?" + urllib.urlencode(args)
-        req = self._CreateRequest(url=url, data=payload)
-        req.add_header("Content-Type", content_type)
-        try:
-          f = self.opener.open(req)
-          response = f.read()
-          f.close()
-          return response
-        except urllib2.HTTPError, e:
-          if tries > 3:
-            raise
-          elif e.code == 401:
-            self._Authenticate()
-##           elif e.code >= 500 and e.code < 600:
-##             # Server Error - try again.
-##             continue
-          else:
-            raise
-    finally:
-      socket.setdefaulttimeout(old_timeout)
-
-
-class HttpRpcServer(AbstractRpcServer):
-  """Provides a simplified RPC-style interface for HTTP requests."""
-
-  def _Authenticate(self):
-    """Save the cookie jar after authentication."""
-    super(HttpRpcServer, self)._Authenticate()
-    if self.save_cookies:
-      StatusUpdate("Saving authentication cookies to %s" % self.cookie_file)
-      self.cookie_jar.save()
-
-  def _GetOpener(self):
-    """Returns an OpenerDirector that supports cookies and ignores redirects.
-
-    Returns:
-      A urllib2.OpenerDirector object.
-    """
-    opener = urllib2.OpenerDirector()
-    opener.add_handler(urllib2.ProxyHandler())
-    opener.add_handler(urllib2.UnknownHandler())
-    opener.add_handler(urllib2.HTTPHandler())
-    opener.add_handler(urllib2.HTTPDefaultErrorHandler())
-    opener.add_handler(urllib2.HTTPSHandler())
-    opener.add_handler(urllib2.HTTPErrorProcessor())
-    if self.save_cookies:
-      self.cookie_file = os.path.expanduser("~/.codereview_upload_cookies")
-      self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file)
-      if os.path.exists(self.cookie_file):
-        try:
-          self.cookie_jar.load()
-          self.authenticated = True
-          StatusUpdate("Loaded authentication cookies from %s" %
-                       self.cookie_file)
-        except (cookielib.LoadError, IOError):
-          # Failed to load cookies - just ignore them.
-          pass
-      else:
-        # Create an empty cookie file with mode 600
-        fd = os.open(self.cookie_file, os.O_CREAT, 0600)
-        os.close(fd)
-      # Always chmod the cookie file
-      os.chmod(self.cookie_file, 0600)
-    else:
-      # Don't save cookies across runs of update.py.
-      self.cookie_jar = cookielib.CookieJar()
-    opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar))
-    return opener
-
-
-parser = optparse.OptionParser(usage="%prog [options] [-- diff_options]")
-parser.add_option("-y", "--assume_yes", action="store_true",
-                  dest="assume_yes", default=False,
-                  help="Assume that the answer to yes/no questions is 'yes'.")
-# Logging
-group = parser.add_option_group("Logging options")
-group.add_option("-q", "--quiet", action="store_const", const=0,
-                 dest="verbose", help="Print errors only.")
-group.add_option("-v", "--verbose", action="store_const", const=2,
-                 dest="verbose", default=1,
-                 help="Print info level logs (default).")
-group.add_option("--noisy", action="store_const", const=3,
-                 dest="verbose", help="Print all logs.")
-# Review server
-group = parser.add_option_group("Review server options")
-group.add_option("-s", "--server", action="store", dest="server",
-                 default="codereview.appspot.com",
-                 metavar="SERVER",
-                 help=("The server to upload to. The format is host[:port]. "
-                       "Defaults to 'codereview.appspot.com'."))
-group.add_option("-e", "--email", action="store", dest="email",
-                 metavar="EMAIL", default=None,
-                 help="The username to use. Will prompt if omitted.")
-group.add_option("-H", "--host", action="store", dest="host",
-                 metavar="HOST", default=None,
-                 help="Overrides the Host header sent with all RPCs.")
-group.add_option("--no_cookies", action="store_false",
-                 dest="save_cookies", default=True,
-                 help="Do not save authentication cookies to local disk.")
-# Issue
-group = parser.add_option_group("Issue options")
-group.add_option("-d", "--description", action="store", dest="description",
-                 metavar="DESCRIPTION", default=None,
-                 help="Optional description when creating an issue.")
-group.add_option("-f", "--description_file", action="store",
-                 dest="description_file", metavar="DESCRIPTION_FILE",
-                 default=None,
-                 help="Optional path of a file that contains "
-                      "the description when creating an issue.")
-group.add_option("-r", "--reviewers", action="store", dest="reviewers",
-                 metavar="REVIEWERS", default=None,
-                 help="Add reviewers (comma separated email addresses).")
-group.add_option("--cc", action="store", dest="cc",
-                 metavar="CC", default=None,
-                 help="Add CC (comma separated email addresses).")
-# Upload options
-group = parser.add_option_group("Patch options")
-group.add_option("-m", "--message", action="store", dest="message",
-                 metavar="MESSAGE", default=None,
-                 help="A message to identify the patch. "
-                      "Will prompt if omitted.")
-group.add_option("-i", "--issue", type="int", action="store",
-                 metavar="ISSUE", default=None,
-                 help="Issue number to which to add. Defaults to new issue.")
-group.add_option("--download_base", action="store_true",
-                 dest="download_base", default=False,
-                 help="Base files will be downloaded by the server "
-                 "(side-by-side diffs may not work on files with CRs).")
-group.add_option("--rev", action="store", dest="revision",
-                 metavar="REV", default=None,
-                 help="Branch/tree/revision to diff against (used by DVCS).")
-group.add_option("--send_mail", action="store_true",
-                 dest="send_mail", default=False,
-                 help="Send notification email to reviewers.")
-
-
-def GetRpcServer(options):
-  """Returns an instance of an AbstractRpcServer.
-
-  Returns:
-    A new AbstractRpcServer, on which RPC calls can be made.
-  """
-
-  rpc_server_class = HttpRpcServer
-
-  def GetUserCredentials():
-    """Prompts the user for a username and password."""
-    email = options.email
-    if email is None:
-      email = GetEmail("Email (login for uploading to %s)" % options.server)
-    password = getpass.getpass("Password for %s: " % email)
-    return (email, password)
-
-  # If this is the dev_appserver, use fake authentication.
-  host = (options.host or options.server).lower()
-  if host == "localhost" or host.startswith("localhost:"):
-    email = options.email
-    if email is None:
-      email = "test@example.com"
-      logging.info("Using debug user %s.  Override with --email" % email)
-    server = rpc_server_class(
-        options.server,
-        lambda: (email, "password"),
-        host_override=options.host,
-        extra_headers={"Cookie":
-                       'dev_appserver_login="%s:False"' % email},
-        save_cookies=options.save_cookies)
-    # Don't try to talk to ClientLogin.
-    server.authenticated = True
-    return server
-
-  return rpc_server_class(options.server, GetUserCredentials,
-                          host_override=options.host,
-                          save_cookies=options.save_cookies)
-
-
-def EncodeMultipartFormData(fields, files):
-  """Encode form fields for multipart/form-data.
-
-  Args:
-    fields: A sequence of (name, value) elements for regular form fields.
-    files: A sequence of (name, filename, value) elements for data to be
-           uploaded as files.
-  Returns:
-    (content_type, body) ready for httplib.HTTP instance.
-
-  Source:
-    https://web.archive.org/web/20160116052001/code.activestate.com/recipes/146306
-  """
-  BOUNDARY = '-M-A-G-I-C---B-O-U-N-D-A-R-Y-'
-  CRLF = '\r\n'
-  lines = []
-  for (key, value) in fields:
-    lines.append('--' + BOUNDARY)
-    lines.append('Content-Disposition: form-data; name="%s"' % key)
-    lines.append('')
-    lines.append(value)
-  for (key, filename, value) in files:
-    lines.append('--' + BOUNDARY)
-    lines.append('Content-Disposition: form-data; name="%s"; filename="%s"' %
-             (key, filename))
-    lines.append('Content-Type: %s' % GetContentType(filename))
-    lines.append('')
-    lines.append(value)
-  lines.append('--' + BOUNDARY + '--')
-  lines.append('')
-  body = CRLF.join(lines)
-  content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
-  return content_type, body
-
-
-def GetContentType(filename):
-  """Helper to guess the content-type from the filename."""
-  return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
-
-
-# Use a shell for subcommands on Windows to get a PATH search.
-use_shell = sys.platform.startswith("win")
-
-def RunShellWithReturnCode(command, print_output=False,
-                           universal_newlines=True):
-  """Executes a command and returns the output from stdout and the return code.
-
-  Args:
-    command: Command to execute.
-    print_output: If True, the output is printed to stdout.
-                  If False, both stdout and stderr are ignored.
-    universal_newlines: Use universal_newlines flag (default: True).
-
-  Returns:
-    Tuple (output, return code)
-  """
-  logging.info("Running %s", command)
-  p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
-                       shell=use_shell, universal_newlines=universal_newlines)
-  if print_output:
-    output_array = []
-    while True:
-      line = p.stdout.readline()
-      if not line:
-        break
-      print line.strip("\n")
-      output_array.append(line)
-    output = "".join(output_array)
-  else:
-    output = p.stdout.read()
-  p.wait()
-  errout = p.stderr.read()
-  if print_output and errout:
-    print >>sys.stderr, errout
-  p.stdout.close()
-  p.stderr.close()
-  return output, p.returncode
-
-
-def RunShell(command, silent_ok=False, universal_newlines=True,
-             print_output=False):
-  data, retcode = RunShellWithReturnCode(command, print_output,
-                                         universal_newlines)
-  if retcode:
-    ErrorExit("Got error status from %s:\n%s" % (command, data))
-  if not silent_ok and not data:
-    ErrorExit("No output from %s" % command)
-  return data
-
-
-class VersionControlSystem(object):
-  """Abstract base class providing an interface to the VCS."""
-
-  def __init__(self, options):
-    """Constructor.
-
-    Args:
-      options: Command line options.
-    """
-    self.options = options
-
-  def GenerateDiff(self, args):
-    """Return the current diff as a string.
-
-    Args:
-      args: Extra arguments to pass to the diff command.
-    """
-    raise NotImplementedError(
-        "abstract method -- subclass %s must override" % self.__class__)
-
-  def GetUnknownFiles(self):
-    """Return a list of files unknown to the VCS."""
-    raise NotImplementedError(
-        "abstract method -- subclass %s must override" % self.__class__)
-
-  def CheckForUnknownFiles(self):
-    """Show an "are you sure?" prompt if there are unknown files."""
-    unknown_files = self.GetUnknownFiles()
-    if unknown_files:
-      print "The following files are not added to version control:"
-      for line in unknown_files:
-        print line
-      prompt = "Are you sure to continue?(y/N) "
-      answer = raw_input(prompt).strip()
-      if answer != "y":
-        ErrorExit("User aborted")
-
-  def GetBaseFile(self, filename):
-    """Get the content of the upstream version of a file.
-
-    Returns:
-      A tuple (base_content, new_content, is_binary, status)
-        base_content: The contents of the base file.
-        new_content: For text files, this is empty.  For binary files, this is
-          the contents of the new file, since the diff output won't contain
-          information to reconstruct the current file.
-        is_binary: True iff the file is binary.
-        status: The status of the file.
-    """
-
-    raise NotImplementedError(
-        "abstract method -- subclass %s must override" % self.__class__)
-
-
-  def GetBaseFiles(self, diff):
-    """Helper that calls GetBase file for each file in the patch.
-
-    Returns:
-      A dictionary that maps from filename to GetBaseFile's tuple.  Filenames
-      are retrieved based on lines that start with "Index:" or
-      "Property changes on:".
-    """
-    files = {}
-    for line in diff.splitlines(True):
-      if line.startswith('Index:') or line.startswith('Property changes on:'):
-        unused, filename = line.split(':', 1)
-        # On Windows if a file has property changes its filename uses '\'
-        # instead of '/'.
-        filename = filename.strip().replace('\\', '/')
-        files[filename] = self.GetBaseFile(filename)
-    return files
-
-
-  def UploadBaseFiles(self, issue, rpc_server, patch_list, patchset, options,
-                      files):
-    """Uploads the base files (and if necessary, the current ones as well)."""
-
-    def UploadFile(filename, file_id, content, is_binary, status, is_base):
-      """Uploads a file to the server."""
-      file_too_large = False
-      if is_base:
-        type = "base"
-      else:
-        type = "current"
-      if len(content) > MAX_UPLOAD_SIZE:
-        print ("Not uploading the %s file for %s because it's too large." %
-               (type, filename))
-        file_too_large = True
-        content = ""
-      checksum = md5.new(content).hexdigest()
-      if options.verbose > 0 and not file_too_large:
-        print "Uploading %s file for %s" % (type, filename)
-      url = "/%d/upload_content/%d/%d" % (int(issue), int(patchset), file_id)
-      form_fields = [("filename", filename),
-                     ("status", status),
-                     ("checksum", checksum),
-                     ("is_binary", str(is_binary)),
-                     ("is_current", str(not is_base)),
-                    ]
-      if file_too_large:
-        form_fields.append(("file_too_large", "1"))
-      if options.email:
-        form_fields.append(("user", options.email))
-      ctype, body = EncodeMultipartFormData(form_fields,
-                                            [("data", filename, content)])
-      response_body = rpc_server.Send(url, body,
-                                      content_type=ctype)
-      if not response_body.startswith("OK"):
-        StatusUpdate("  --> %s" % response_body)
-        sys.exit(1)
-
-    patches = dict()
-    [patches.setdefault(v, k) for k, v in patch_list]
-    for filename in patches.keys():
-      base_content, new_content, is_binary, status = files[filename]
-      file_id_str = patches.get(filename)
-      if file_id_str.find("nobase") != -1:
-        base_content = None
-        file_id_str = file_id_str[file_id_str.rfind("_") + 1:]
-      file_id = int(file_id_str)
-      if base_content != None:
-        UploadFile(filename, file_id, base_content, is_binary, status, True)
-      if new_content != None:
-        UploadFile(filename, file_id, new_content, is_binary, status, False)
-
-  def IsImage(self, filename):
-    """Returns true if the filename has an image extension."""
-    mimetype =  mimetypes.guess_type(filename)[0]
-    if not mimetype:
-      return False
-    return mimetype.startswith("image/")
-
-
-class SubversionVCS(VersionControlSystem):
-  """Implementation of the VersionControlSystem interface for Subversion."""
-
-  def __init__(self, options):
-    super(SubversionVCS, self).__init__(options)
-    if self.options.revision:
-      match = re.match(r"(\d+)(:(\d+))?", self.options.revision)
-      if not match:
-        ErrorExit("Invalid Subversion revision %s." % self.options.revision)
-      self.rev_start = match.group(1)
-      self.rev_end = match.group(3)
-    else:
-      self.rev_start = self.rev_end = None
-    # Cache output from "svn list -r REVNO dirname".
-    # Keys: dirname, Values: 2-tuple (ouput for start rev and end rev).
-    self.svnls_cache = {}
-    # SVN base URL is required to fetch files deleted in an older revision.
-    # Result is cached to not guess it over and over again in GetBaseFile().
-    required = self.options.download_base or self.options.revision is not None
-    self.svn_base = self._GuessBase(required)
-
-  def GuessBase(self, required):
-    """Wrapper for _GuessBase."""
-    return self.svn_base
-
-  def _GuessBase(self, required):
-    """Returns the SVN base URL.
-
-    Args:
-      required: If true, exits if the url can't be guessed, otherwise None is
-        returned.
-    """
-    info = RunShell(["svn", "info"])
-    for line in info.splitlines():
-      words = line.split()
-      if len(words) == 2 and words[0] == "URL:":
-        url = words[1]
-        scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)
-        username, netloc = urllib.splituser(netloc)
-        if username:
-          logging.info("Removed username from base URL")
-        if netloc.endswith("svn.python.org"):
-          if netloc == "svn.python.org":
-            if path.startswith("/projects/"):
-              path = path[9:]
-          elif netloc != "pythondev@svn.python.org":
-            ErrorExit("Unrecognized Python URL: %s" % url)
-          base = "http://svn.python.org/view/*checkout*%s/" % path
-          logging.info("Guessed Python base = %s", base)
-        elif netloc.endswith("svn.collab.net"):
-          if path.startswith("/repos/"):
-            path = path[6:]
-          base = "http://svn.collab.net/viewvc/*checkout*%s/" % path
-          logging.info("Guessed CollabNet base = %s", base)
-        elif netloc.endswith(".googlecode.com"):
-          path = path + "/"
-          base = urlparse.urlunparse(("http", netloc, path, params,
-                                      query, fragment))
-          logging.info("Guessed Google Code base = %s", base)
-        else:
-          path = path + "/"
-          base = urlparse.urlunparse((scheme, netloc, path, params,
-                                      query, fragment))
-          logging.info("Guessed base = %s", base)
-        return base
-    if required:
-      ErrorExit("Can't find URL in output from svn info")
-    return None
-
-  def GenerateDiff(self, args):
-    cmd = ["svn", "diff"]
-    if self.options.revision:
-      cmd += ["-r", self.options.revision]
-    cmd.extend(args)
-    data = RunShell(cmd)
-    count = 0
-    for line in data.splitlines():
-      if line.startswith("Index:") or line.startswith("Property changes on:"):
-        count += 1
-        logging.info(line)
-    if not count:
-      ErrorExit("No valid patches found in output from svn diff")
-    return data
-
-  def _CollapseKeywords(self, content, keyword_str):
-    """Collapses SVN keywords."""
-    # svn cat translates keywords but svn diff doesn't. As a result of this
-    # behavior patching.PatchChunks() fails with a chunk mismatch error.
-    # This part was originally written by the Review Board development team
-    # who had the same problem (https://reviews.reviewboard.org/r/276/).
-    # Mapping of keywords to known aliases
-    svn_keywords = {
-      # Standard keywords
-      'Date':                ['Date', 'LastChangedDate'],
-      'Revision':            ['Revision', 'LastChangedRevision', 'Rev'],
-      'Author':              ['Author', 'LastChangedBy'],
-      'HeadURL':             ['HeadURL', 'URL'],
-      'Id':                  ['Id'],
-
-      # Aliases
-      'LastChangedDate':     ['LastChangedDate', 'Date'],
-      'LastChangedRevision': ['LastChangedRevision', 'Rev', 'Revision'],
-      'LastChangedBy':       ['LastChangedBy', 'Author'],
-      'URL':                 ['URL', 'HeadURL'],
-    }
-
-    def repl(m):
-       if m.group(2):
-         return "$%s::%s$" % (m.group(1), " " * len(m.group(3)))
-       return "$%s$" % m.group(1)
-    keywords = [keyword
-                for name in keyword_str.split(" ")
-                for keyword in svn_keywords.get(name, [])]
-    return re.sub(r"\$(%s):(:?)([^\$]+)\$" % '|'.join(keywords), repl, content)
-
-  def GetUnknownFiles(self):
-    status = RunShell(["svn", "status", "--ignore-externals"], silent_ok=True)
-    unknown_files = []
-    for line in status.split("\n"):
-      if line and line[0] == "?":
-        unknown_files.append(line)
-    return unknown_files
-
-  def ReadFile(self, filename):
-    """Returns the contents of a file."""
-    file = open(filename, 'rb')
-    result = ""
-    try:
-      result = file.read()
-    finally:
-      file.close()
-    return result
-
-  def GetStatus(self, filename):
-    """Returns the status of a file."""
-    if not self.options.revision:
-      status = RunShell(["svn", "status", "--ignore-externals", filename])
-      if not status:
-        ErrorExit("svn status returned no output for %s" % filename)
-      status_lines = status.splitlines()
-      # If file is in a cl, the output will begin with
-      # "\n--- Changelist 'cl_name':\n".  See
-      # https://web.archive.org/web/20090918234815/svn.collab.net/repos/svn/trunk/notes/changelist-design.txt
-      if (len(status_lines) == 3 and
-          not status_lines[0] and
-          status_lines[1].startswith("--- Changelist")):
-        status = status_lines[2]
-      else:
-        status = status_lines[0]
-    # If we have a revision to diff against we need to run "svn list"
-    # for the old and the new revision and compare the results to get
-    # the correct status for a file.
-    else:
-      dirname, relfilename = os.path.split(filename)
-      if dirname not in self.svnls_cache:
-        cmd = ["svn", "list", "-r", self.rev_start, dirname or "."]
-        out, returncode = RunShellWithReturnCode(cmd)
-        if returncode:
-          ErrorExit("Failed to get status for %s." % filename)
-        old_files = out.splitlines()
-        args = ["svn", "list"]
-        if self.rev_end:
-          args += ["-r", self.rev_end]
-        cmd = args + [dirname or "."]
-        out, returncode = RunShellWithReturnCode(cmd)
-        if returncode:
-          ErrorExit("Failed to run command %s" % cmd)
-        self.svnls_cache[dirname] = (old_files, out.splitlines())
-      old_files, new_files = self.svnls_cache[dirname]
-      if relfilename in old_files and relfilename not in new_files:
-        status = "D   "
-      elif relfilename in old_files and relfilename in new_files:
-        status = "M   "
-      else:
-        status = "A   "
-    return status
-
-  def GetBaseFile(self, filename):
-    status = self.GetStatus(filename)
-    base_content = None
-    new_content = None
-
-    # If a file is copied its status will be "A  +", which signifies
-    # "addition-with-history".  See "svn st" for more information.  We need to
-    # upload the original file or else diff parsing will fail if the file was
-    # edited.
-    if status[0] == "A" and status[3] != "+":
-      # We'll need to upload the new content if we're adding a binary file
-      # since diff's output won't contain it.
-      mimetype = RunShell(["svn", "propget", "svn:mime-type", filename],
-                          silent_ok=True)
-      base_content = ""
-      is_binary = mimetype and not mimetype.startswith("text/")
-      if is_binary and self.IsImage(filename):
-        new_content = self.ReadFile(filename)
-    elif (status[0] in ("M", "D", "R") or
-          (status[0] == "A" and status[3] == "+") or  # Copied file.
-          (status[0] == " " and status[1] == "M")):  # Property change.
-      args = []
-      if self.options.revision:
-        url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start)
-      else:
-        # Don't change filename, it's needed later.
-        url = filename
-        args += ["-r", "BASE"]
-      cmd = ["svn"] + args + ["propget", "svn:mime-type", url]
-      mimetype, returncode = RunShellWithReturnCode(cmd)
-      if returncode:
-        # File does not exist in the requested revision.
-        # Reset mimetype, it contains an error message.
-        mimetype = ""
-      get_base = False
-      is_binary = mimetype and not mimetype.startswith("text/")
-      if status[0] == " ":
-        # Empty base content just to force an upload.
-        base_content = ""
-      elif is_binary:
-        if self.IsImage(filename):
-          get_base = True
-          if status[0] == "M":
-            if not self.rev_end:
-              new_content = self.ReadFile(filename)
-            else:
-              url = "%s/%s@%s" % (self.svn_base, filename, self.rev_end)
-              new_content = RunShell(["svn", "cat", url],
-                                     universal_newlines=True, silent_ok=True)
-        else:
-          base_content = ""
-      else:
-        get_base = True
-
-      if get_base:
-        if is_binary:
-          universal_newlines = False
-        else:
-          universal_newlines = True
-        if self.rev_start:
-          # "svn cat -r REV delete_file.txt" doesn't work. cat requires
-          # the full URL with "@REV" appended instead of using "-r" option.
-          url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start)
-          base_content = RunShell(["svn", "cat", url],
-                                  universal_newlines=universal_newlines,
-                                  silent_ok=True)
-        else:
-          base_content = RunShell(["svn", "cat", filename],
-                                  universal_newlines=universal_newlines,
-                                  silent_ok=True)
-        if not is_binary:
-          args = []
-          if self.rev_start:
-            url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start)
-          else:
-            url = filename
-            args += ["-r", "BASE"]
-          cmd = ["svn"] + args + ["propget", "svn:keywords", url]
-          keywords, returncode = RunShellWithReturnCode(cmd)
-          if keywords and not returncode:
-            base_content = self._CollapseKeywords(base_content, keywords)
-    else:
-      StatusUpdate("svn status returned unexpected output: %s" % status)
-      sys.exit(1)
-    return base_content, new_content, is_binary, status[0:5]
-
-
-class GitVCS(VersionControlSystem):
-  """Implementation of the VersionControlSystem interface for Git."""
-
-  def __init__(self, options):
-    super(GitVCS, self).__init__(options)
-    # Map of filename -> hash of base file.
-    self.base_hashes = {}
-
-  def GenerateDiff(self, extra_args):
-    # This is more complicated than svn's GenerateDiff because we must convert
-    # the diff output to include an svn-style "Index:" line as well as record
-    # the hashes of the base files, so we can upload them along with our diff.
-    if self.options.revision:
-      extra_args = [self.options.revision] + extra_args
-    gitdiff = RunShell(["git", "diff", "--full-index"] + extra_args)
-    svndiff = []
-    filecount = 0
-    filename = None
-    for line in gitdiff.splitlines():
-      match = re.match(r"diff --git a/(.*) b/.*$", line)
-      if match:
-        filecount += 1
-        filename = match.group(1)
-        svndiff.append("Index: %s\n" % filename)
-      else:
-        # The "index" line in a git diff looks like this (long hashes elided):
-        #   index 82c0d44..b2cee3f 100755
-        # We want to save the left hash, as that identifies the base file.
-        match = re.match(r"index (\w+)\.\.", line)
-        if match:
-          self.base_hashes[filename] = match.group(1)
-      svndiff.append(line + "\n")
-    if not filecount:
-      ErrorExit("No valid patches found in output from git diff")
-    return "".join(svndiff)
-
-  def GetUnknownFiles(self):
-    status = RunShell(["git", "ls-files", "--exclude-standard", "--others"],
-                      silent_ok=True)
-    return status.splitlines()
-
-  def GetBaseFile(self, filename):
-    hash = self.base_hashes[filename]
-    base_content = None
-    new_content = None
-    is_binary = False
-    if hash == "0" * 40:  # All-zero hash indicates no base file.
-      status = "A"
-      base_content = ""
-    else:
-      status = "M"
-      base_content, returncode = RunShellWithReturnCode(["git", "show", hash])
-      if returncode:
-        ErrorExit("Got error status from 'git show %s'" % hash)
-    return (base_content, new_content, is_binary, status)
-
-
-class MercurialVCS(VersionControlSystem):
-  """Implementation of the VersionControlSystem interface for Mercurial."""
-
-  def __init__(self, options, repo_dir):
-    super(MercurialVCS, self).__init__(options)
-    # Absolute path to repository (we can be in a subdir)
-    self.repo_dir = os.path.normpath(repo_dir)
-    # Compute the subdir
-    cwd = os.path.normpath(os.getcwd())
-    assert cwd.startswith(self.repo_dir)
-    self.subdir = cwd[len(self.repo_dir):].lstrip(r"\/")
-    if self.options.revision:
-      self.base_rev = self.options.revision
-    else:
-      self.base_rev = RunShell(["hg", "parent", "-q"]).split(':')[1].strip()
-
-  def _GetRelPath(self, filename):
-    """Get relative path of a file according to the current directory,
-    given its logical path in the repo."""
-    assert filename.startswith(self.subdir), filename
-    return filename[len(self.subdir):].lstrip(r"\/")
-
-  def GenerateDiff(self, extra_args):
-    # If no file specified, restrict to the current subdir
-    extra_args = extra_args or ["."]
-    cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args
-    data = RunShell(cmd, silent_ok=True)
-    svndiff = []
-    filecount = 0
-    for line in data.splitlines():
-      m = re.match("diff --git a/(\S+) b/(\S+)", line)
-      if m:
-        # Modify line to make it look like as it comes from svn diff.
-        # With this modification no changes on the server side are required
-        # to make upload.py work with Mercurial repos.
-        # NOTE: for proper handling of moved/copied files, we have to use
-        # the second filename.
-        filename = m.group(2)
-        svndiff.append("Index: %s" % filename)
-        svndiff.append("=" * 67)
-        filecount += 1
-        logging.info(line)
-      else:
-        svndiff.append(line)
-    if not filecount:
-      ErrorExit("No valid patches found in output from hg diff")
-    return "\n".join(svndiff) + "\n"
-
-  def GetUnknownFiles(self):
-    """Return a list of files unknown to the VCS."""
-    args = []
-    status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."],
-        silent_ok=True)
-    unknown_files = []
-    for line in status.splitlines():
-      st, fn = line.split(" ", 1)
-      if st == "?":
-        unknown_files.append(fn)
-    return unknown_files
-
-  def GetBaseFile(self, filename):
-    # "hg status" and "hg cat" both take a path relative to the current subdir
-    # rather than to the repo root, but "hg diff" has given us the full path
-    # to the repo root.
-    base_content = ""
-    new_content = None
-    is_binary = False
-    oldrelpath = relpath = self._GetRelPath(filename)
-    # "hg status -C" returns two lines for moved/copied files, one otherwise
-    out = RunShell(["hg", "status", "-C", "--rev", self.base_rev, relpath])
-    out = out.splitlines()
-    # HACK: strip error message about missing file/directory if it isn't in
-    # the working copy
-    if out[0].startswith('%s: ' % relpath):
-      out = out[1:]
-    if len(out) > 1:
-      # Moved/copied => considered as modified, use old filename to
-      # retrieve base contents
-      oldrelpath = out[1].strip()
-      status = "M"
-    else:
-      status, _ = out[0].split(' ', 1)
-    if status != "A":
-      base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
-        silent_ok=True)
-      is_binary = "\0" in base_content  # Mercurial's heuristic
-    if status != "R":
-      new_content = open(relpath, "rb").read()
-      is_binary = is_binary or "\0" in new_content
-    if is_binary and base_content:
-      # Fetch again without converting newlines
-      base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
-        silent_ok=True, universal_newlines=False)
-    if not is_binary or not self.IsImage(relpath):
-      new_content = None
-    return base_content, new_content, is_binary, status
-
-
-# NOTE: The SplitPatch function is duplicated in engine.py, keep them in sync.
-def SplitPatch(data):
-  """Splits a patch into separate pieces for each file.
-
-  Args:
-    data: A string containing the output of svn diff.
-
-  Returns:
-    A list of 2-tuple (filename, text) where text is the svn diff output
-      pertaining to filename.
-  """
-  patches = []
-  filename = None
-  diff = []
-  for line in data.splitlines(True):
-    new_filename = None
-    if line.startswith('Index:'):
-      unused, new_filename = line.split(':', 1)
-      new_filename = new_filename.strip()
-    elif line.startswith('Property changes on:'):
-      unused, temp_filename = line.split(':', 1)
-      # When a file is modified, paths use '/' between directories, however
-      # when a property is modified '\' is used on Windows.  Make them the same
-      # otherwise the file shows up twice.
-      temp_filename = temp_filename.strip().replace('\\', '/')
-      if temp_filename != filename:
-        # File has property changes but no modifications, create a new diff.
-        new_filename = temp_filename
-    if new_filename:
-      if filename and diff:
-        patches.append((filename, ''.join(diff)))
-      filename = new_filename
-      diff = [line]
-      continue
-    if diff is not None:
-      diff.append(line)
-  if filename and diff:
-    patches.append((filename, ''.join(diff)))
-  return patches
-
-
-def UploadSeparatePatches(issue, rpc_server, patchset, data, options):
-  """Uploads a separate patch for each file in the diff output.
-
-  Returns a list of [patch_key, filename] for each file.
-  """
-  patches = SplitPatch(data)
-  rv = []
-  for patch in patches:
-    if len(patch[1]) > MAX_UPLOAD_SIZE:
-      print ("Not uploading the patch for " + patch[0] +
-             " because the file is too large.")
-      continue
-    form_fields = [("filename", patch[0])]
-    if not options.download_base:
-      form_fields.append(("content_upload", "1"))
-    files = [("data", "data.diff", patch[1])]
-    ctype, body = EncodeMultipartFormData(form_fields, files)
-    url = "/%d/upload_patch/%d" % (int(issue), int(patchset))
-    print "Uploading patch for " + patch[0]
-    response_body = rpc_server.Send(url, body, content_type=ctype)
-    lines = response_body.splitlines()
-    if not lines or lines[0] != "OK":
-      StatusUpdate("  --> %s" % response_body)
-      sys.exit(1)
-    rv.append([lines[1], patch[0]])
-  return rv
-
-
-def GuessVCS(options):
-  """Helper to guess the version control system.
-
-  This examines the current directory, guesses which VersionControlSystem
-  we're using, and returns an instance of the appropriate class.  Exit with an
-  error if we can't figure it out.
-
-  Returns:
-    A VersionControlSystem instance. Exits if the VCS can't be guessed.
-  """
-  # Mercurial has a command to get the base directory of a repository
-  # Try running it, but don't die if we don't have hg installed.
-  # NOTE: we try Mercurial first as it can sit on top of an SVN working copy.
-  try:
-    out, returncode = RunShellWithReturnCode(["hg", "root"])
-    if returncode == 0:
-      return MercurialVCS(options, out.strip())
-  except OSError, (errno, message):
-    if errno != 2:  # ENOENT -- they don't have hg installed.
-      raise
-
-  # Subversion has a .svn in all working directories.
-  if os.path.isdir('.svn'):
-    logging.info("Guessed VCS = Subversion")
-    return SubversionVCS(options)
-
-  # Git has a command to test if you're in a git tree.
-  # Try running it, but don't die if we don't have git installed.
-  try:
-    out, returncode = RunShellWithReturnCode(["git", "rev-parse",
-                                              "--is-inside-work-tree"])
-    if returncode == 0:
-      return GitVCS(options)
-  except OSError, (errno, message):
-    if errno != 2:  # ENOENT -- they don't have git installed.
-      raise
-
-  ErrorExit(("Could not guess version control system. "
-             "Are you in a working copy directory?"))
-
-
-def RealMain(argv, data=None):
-  """The real main function.
-
-  Args:
-    argv: Command line arguments.
-    data: Diff contents. If None (default) the diff is generated by
-      the VersionControlSystem implementation returned by GuessVCS().
-
-  Returns:
-    A 2-tuple (issue id, patchset id).
-    The patchset id is None if the base files are not uploaded by this
-    script (applies only to SVN checkouts).
-  """
-  logging.basicConfig(format=("%(asctime).19s %(levelname)s %(filename)s:"
-                              "%(lineno)s %(message)s "))
-  os.environ['LC_ALL'] = 'C'
-  options, args = parser.parse_args(argv[1:])
-  global verbosity
-  verbosity = options.verbose
-  if verbosity >= 3:
-    logging.getLogger().setLevel(logging.DEBUG)
-  elif verbosity >= 2:
-    logging.getLogger().setLevel(logging.INFO)
-  vcs = GuessVCS(options)
-  if isinstance(vcs, SubversionVCS):
-    # base field is only allowed for Subversion.
-    # Note: Fetching base files may become deprecated in future releases.
-    base = vcs.GuessBase(options.download_base)
-  else:
-    base = None
-  if not base and options.download_base:
-    options.download_base = True
-    logging.info("Enabled upload of base file")
-  if not options.assume_yes:
-    vcs.CheckForUnknownFiles()
-  if data is None:
-    data = vcs.GenerateDiff(args)
-  files = vcs.GetBaseFiles(data)
-  if verbosity >= 1:
-    print "Upload server:", options.server, "(change with -s/--server)"
-  if options.issue:
-    prompt = "Message describing this patch set: "
-  else:
-    prompt = "New issue subject: "
-  message = options.message or raw_input(prompt).strip()
-  if not message:
-    ErrorExit("A non-empty message is required")
-  rpc_server = GetRpcServer(options)
-  form_fields = [("subject", message)]
-  if base:
-    form_fields.append(("base", base))
-  if options.issue:
-    form_fields.append(("issue", str(options.issue)))
-  if options.email:
-    form_fields.append(("user", options.email))
-  if options.reviewers:
-    for reviewer in options.reviewers.split(','):
-      if "@" in reviewer and not reviewer.split("@")[1].count(".") == 1:
-        ErrorExit("Invalid email address: %s" % reviewer)
-    form_fields.append(("reviewers", options.reviewers))
-  if options.cc:
-    for cc in options.cc.split(','):
-      if "@" in cc and not cc.split("@")[1].count(".") == 1:
-        ErrorExit("Invalid email address: %s" % cc)
-    form_fields.append(("cc", options.cc))
-  description = options.description
-  if options.description_file:
-    if options.description:
-      ErrorExit("Can't specify description and description_file")
-    file = open(options.description_file, 'r')
-    description = file.read()
-    file.close()
-  if description:
-    form_fields.append(("description", description))
-  # Send a hash of all the base file so the server can determine if a copy
-  # already exists in an earlier patchset.
-  base_hashes = ""
-  for file, info in files.iteritems():
-    if not info[0] is None:
-      checksum = md5.new(info[0]).hexdigest()
-      if base_hashes:
-        base_hashes += "|"
-      base_hashes += checksum + ":" + file
-  form_fields.append(("base_hashes", base_hashes))
-  # If we're uploading base files, don't send the email before the uploads, so
-  # that it contains the file status.
-  if options.send_mail and options.download_base:
-    form_fields.append(("send_mail", "1"))
-  if not options.download_base:
-    form_fields.append(("content_upload", "1"))
-  if len(data) > MAX_UPLOAD_SIZE:
-    print "Patch is large, so uploading file patches separately."
-    uploaded_diff_file = []
-    form_fields.append(("separate_patches", "1"))
-  else:
-    uploaded_diff_file = [("data", "data.diff", data)]
-  ctype, body = EncodeMultipartFormData(form_fields, uploaded_diff_file)
-  response_body = rpc_server.Send("/upload", body, content_type=ctype)
-  patchset = None
-  if not options.download_base or not uploaded_diff_file:
-    lines = response_body.splitlines()
-    if len(lines) >= 2:
-      msg = lines[0]
-      patchset = lines[1].strip()
-      patches = [x.split(" ", 1) for x in lines[2:]]
-    else:
-      msg = response_body
-  else:
-    msg = response_body
-  StatusUpdate(msg)
-  if not response_body.startswith("Issue created.") and \
-  not response_body.startswith("Issue updated."):
-    sys.exit(0)
-  issue = msg[msg.rfind("/")+1:]
-
-  if not uploaded_diff_file:
-    result = UploadSeparatePatches(issue, rpc_server, patchset, data, options)
-    if not options.download_base:
-      patches = result
-
-  if not options.download_base:
-    vcs.UploadBaseFiles(issue, rpc_server, patches, patchset, options, files)
-    if options.send_mail:
-      rpc_server.Send("/" + issue + "/mail", payload="")
-  return issue, patchset
-
-
-def main():
-  try:
-    RealMain(sys.argv)
-  except KeyboardInterrupt:
-    print
-    StatusUpdate("Interrupted.")
-    sys.exit(1)
-
-
-if __name__ == "__main__":
-  main()
diff --git a/googlemock/scripts/upload_gmock.py b/googlemock/scripts/upload_gmock.py
deleted file mode 100755
index 5dc484b..0000000
--- a/googlemock/scripts/upload_gmock.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2009, Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-#     * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-#     * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-"""upload_gmock.py v0.1.0 -- uploads a Google Mock patch for review.
-
-This simple wrapper passes all command line flags and
---cc=googlemock@googlegroups.com to upload.py.
-
-USAGE: upload_gmock.py [options for upload.py]
-"""
-
-__author__ = 'wan@google.com (Zhanyong Wan)'
-
-import os
-import sys
-
-CC_FLAG = '--cc='
-GMOCK_GROUP = 'googlemock@googlegroups.com'
-
-
-def main():
-  # Finds the path to upload.py, assuming it is in the same directory
-  # as this file.
-  my_dir = os.path.dirname(os.path.abspath(__file__))
-  upload_py_path = os.path.join(my_dir, 'upload.py')
-
-  # Adds Google Mock discussion group to the cc line if it's not there
-  # already.
-  upload_py_argv = [upload_py_path]
-  found_cc_flag = False
-  for arg in sys.argv[1:]:
-    if arg.startswith(CC_FLAG):
-      found_cc_flag = True
-      cc_line = arg[len(CC_FLAG):]
-      cc_list = [addr for addr in cc_line.split(',') if addr]
-      if GMOCK_GROUP not in cc_list:
-        cc_list.append(GMOCK_GROUP)
-      upload_py_argv.append(CC_FLAG + ','.join(cc_list))
-    else:
-      upload_py_argv.append(arg)
-
-  if not found_cc_flag:
-    upload_py_argv.append(CC_FLAG + GMOCK_GROUP)
-
-  # Invokes upload.py with the modified command line flags.
-  os.execv(upload_py_path, upload_py_argv)
-
-
-if __name__ == '__main__':
-  main()