summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Introduce loading of shards within auto-indexKadir Cetinkaya2019-01-101-2/+1
| | | | | | | | | | | | | | | | Summary: Whenever a change happens on a CDB, load shards associated with that CDB before issuing re-index actions. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55224 llvm-svn: 350847
* [clang-tidy] fix-up failing testsJonas Toth2019-01-093-10/+11
| | | | llvm-svn: 350761
* [clang-tidy] Adding a new modernize use nodiscard checkerJonas Toth2019-01-097-0/+370
| | | | | | | | | | | | | | | | | | Summary: Adds a checker to clang-tidy to warn when a non void const member function, taking only parameters passed by value or const reference could be marked as '[[nodiscard]]' Patch by MyDeveloperDay. Reviewers: alexfh, stephenkelly, curdeius, aaron.ballman, hokein, JonasToth Reviewed By: curdeius, JonasToth Subscribers: Eugene.Zelenko, lefticus, lebedev.ri, mgorny, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D55433 llvm-svn: 350760
* Fix clang-tidy test after r350714. NFCIlya Biryukov2019-01-091-0/+1
| | | | llvm-svn: 350715
* [clangd] Check preceding char when completion triggers on ':' or '>'Ilya Biryukov2019-01-031-0/+106
| | | | | | | | | | | | | | | | | | Summary: Only run completion when we were trigerred on '->' and '::', otherwise send an error code in return. To avoid automatically invoking completions in cases like 'a >^' or 'a ? b :^'. Reviewers: hokein Reviewed By: hokein Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D55994 llvm-svn: 350304
* [clang-tidy] add IgnoreMacros option to readability-uppercase-literal-suffixMiklos Vajna2018-12-242-1/+7
| | | | | | | | | | | | | | And also enable it by default to be consistent with e.g. modernize-use-using. This helps e.g. when running this check on client code where the macro is provided by the system, so there is no easy way to modify it. Reviewed By: JonasToth, lebedev.ri Differential Revision: https://reviews.llvm.org/D56025 llvm-svn: 350056
* [clang-tidy] Be more liberal about literal zeroes in abseil checksHyrum Wright2018-12-211-0/+14
| | | | | | | | | Summary: Previously, we'd only match on literal floating or integral zeroes, but I've now also learned that some users spell that value as int{0} or float{0}, which also need to be matched. Differential Revision: https://reviews.llvm.org/D56012 llvm-svn: 349953
* [clangd] Expose FileStatus to LSP.Haojian Wu2018-12-201-0/+13
| | | | | | | | | | | | | Summary: Add an LSP extension "textDocument/clangd.fileStatus" to emit file-status information. Reviewers: ilya-biryukov Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D55363 llvm-svn: 349768
* [clang-tidy] Diagnose abseil-duration-comparison on macro argumentsHyrum Wright2018-12-191-0/+27
| | | | | | | | | | | | Summary: This change relaxes the requirements on the utility `rewriteExprFromNumberToDuration` function, and introduces new checking inside of the `abseil-duration-comparison` check to allow macro argument expression transformation. Differential Revision: https://reviews.llvm.org/D55784 llvm-svn: 349636
* [clangd] BackgroundIndex rebuilds symbol index periodically.Eric Liu2018-12-181-1/+1
| | | | | | | | | | | | | | | | | | Summary: Currently, background index rebuilds symbol index on every indexed file, which can be inefficient. This patch makes it only rebuild symbol index periodically. As the rebuild no longer happens too often, we could also build more efficient dex index. Reviewers: ilya-biryukov, kadircet Reviewed By: kadircet Subscribers: dblaikie, MaskRay, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D55770 llvm-svn: 349496
* Revert rCTE349288 'Fix a lit test failure after MallocChecker changes'Kristof Umann2018-12-171-1/+1
| | | | llvm-svn: 349341
* Fix a lit test failure after MallocChecker changesKristof Umann2018-12-161-1/+1
| | | | llvm-svn: 349288
* [clang-tidy] Improve google-objc-function-naming diagnostics 📙Stephane Moore2018-12-142-14/+28
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The diagnostics from google-objc-function-naming check will be more actionable if they provide a brief description of the requirements from the Google Objective-C style guide. The more descriptive diagnostics may help clarify that functions in the global namespace must have an appropriate prefix followed by Pascal case (engineers working previously with static functions might not immediately understand the different requirements of static and non-static functions). Test Notes: Verified against the clang-tidy tests. Reviewers: benhamilton, aaron.ballman Reviewed By: benhamilton Subscribers: MyDeveloperDay, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D55482 llvm-svn: 349123
* [clang-tidy] Add the abseil-duration-subtraction checkHyrum Wright2018-12-131-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This check uses the context of a subtraction expression as well as knowledge about the Abseil Time types, to infer the type of the second operand of some subtraction expressions in Duration conversions. For example: absl::ToDoubleSeconds(duration) - foo can become absl::ToDoubleSeconds(duration - absl::Seconds(foo)) This ensures that time calculations are done in the proper domain, and also makes it easier to further deduce the types of the second operands to these expressions. Reviewed By: JonasToth Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D55245 llvm-svn: 349073
* [clang-tidy] NFC Consolidate test absl::Time implementationJonas Toth2018-12-115-158/+81
| | | | | | | | | | | | | | | | Summary: Several tests re-implement these same prototypes (differently), so we can put them in a common location. Patch by hwright. Reviewers: JonasToth Reviewed By: JonasToth Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D55540 llvm-svn: 348840
* [clang-tidy]: Abseil: new check 'abseil-upgrade-duration-conversions'Eric Fiselier2018-12-071-0/+473
| | | | | | | | | | | | | Patch by Alex Strelnikov. Reviewed as D53830 Introduce a new check to upgrade user code based on upcoming API breaking changes to absl::Duration. The check finds calls to arithmetic operators and factory functions for absl::Duration that rely on an implicit user defined conversion to int64_t. These cases will no longer compile after proposed changes are released. Suggested fixes explicitly cast the argument int64_t. llvm-svn: 348633
* Move detection of libc++ include dirs to Driver on MacOSIlya Biryukov2018-12-052-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The intention is to make the tools replaying compilations from 'compile_commands.json' (clang-tidy, clangd, etc.) find the same standard library as the original compiler specified in 'compile_commands.json'. Previously, the library detection logic was in the frontend (InitHeaderSearch.cpp) and relied on the value of resource dir as an approximation of the compiler install dir. The new logic uses the actual compiler install dir and is performed in the driver. This is consistent with the C++ standard library detection on other platforms and allows to override the resource dir in the tools using the compile_commands.json without altering the standard library detection mechanism. The tools have to override the resource dir to make sure they use a consistent version of the builtin headers. There is still logic in InitHeaderSearch that attemps to add the absolute includes for the the C++ standard library, so we keep passing the -stdlib=libc++ from the driver to the frontend via cc1 args to avoid breaking that. In the long run, we should move this logic to the driver too, but it could potentially break the library detection on other systems, so we don't tackle it in this patch to keep its scope manageable. This is a second attempt to fix the issue, first one was commited in r346652 and reverted in r346675. The original fix relied on an ad-hoc propagation (bypassing the cc1 flags) of the install dir from the driver to the frontend's HeaderSearchOptions. Unsurpisingly, the propagation was incomplete, it broke the libc++ detection in clang itself, which caused LLDB tests to break. The LLDB tests pass with new fix. Reviewers: JDevlieghere, arphaman, EricWF Reviewed By: arphaman Subscribers: mclow.lists, ldionne, dexonsmith, ioeric, christof, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54630 llvm-svn: 348365
* Revert "[clang-tidy] new check: bugprone-branch-clone"Jonas Toth2018-12-051-1017/+0
| | | | | | | The patch broke on buildbot with assertion-failure. Revert until this is figured out. llvm-svn: 348344
* [clang-tidy] new check: bugprone-branch-cloneJonas Toth2018-12-051-0/+1017
| | | | | | | | | | | | | | | | | | | | | | Summary: Implement a check for detecting if/else if/else chains where two or more branches are Type I clones of each other (that is, they contain identical code) and for detecting switch statements where two or more consecutive branches are Type I clones of each other. Patch by donat.nagy. Reviewers: alexfh, hokein, aaron.ballman, JonasToth Reviewed By: JonasToth Subscribers: MTC, lebedev.ri, whisperity, xazax.hun, Eugene.Zelenko, mgorny, rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D54757 llvm-svn: 348343
* Fix a false positive in misplaced-widening-castJonas Toth2018-12-051-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: bugprone-misplaced-widening-cast check used to give a false warning to the following example. enum DaysEnum{ MON = 0, TUE = 1 }; day = (DaysEnum)(day + 1); //warning: either cast from 'int' to 'DaysEnum' is ineffective... But i think int to enum cast is not widening neither ineffective. Patch by dkrupp. Reviewers: JonasToth, alexfh Reviewed By: alexfh Subscribers: rnkovacs, Szelethus, gamesh411, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D55255 llvm-svn: 348341
* [clang-tidy/checks] Update objc-property-declaration check to allow ↵Stephane Moore2018-12-053-33/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | arbitrary acronyms and initialisms 🔧 Summary: §1 Description This changes the objc-property-declaration check to allow arbitrary acronyms and initialisms instead of using whitelisted acronyms. In Objective-C it is relatively common to use project prefixes in property names for the purposes of disambiguation. For example, the CIColor¹ and CGColor² properties on UIColor both represent symbol prefixes being used in proeprty names outside of Apple's accepted acronyms³. The union of Apple's accepted acronyms and all symbol prefixes that might be used for disambiguation in property declarations effectively allows for any arbitrary sequence of capital alphanumeric characters to be acceptable in property declarations. This change updates the check accordingly. The test variants with custom configurations are deleted as part of this change because their configurations no longer impact behavior. The acronym configurations are currently preserved for backwards compatibility of check configuration. [1] https://developer.apple.com/documentation/uikit/uicolor/1621951-cicolor?language=objc [2] https://developer.apple.com/documentation/uikit/uicolor/1621954-cgcolor?language=objc [3] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE §2 Test Notes Changes verified by: • Running clang-tidy unit tests. • Used check_clang_tidy.py to verify expected output of processing objc-property-declaration.m Reviewers: benhamilton, Wizard Reviewed By: benhamilton Subscribers: jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D51832 llvm-svn: 348331
* [clang-tidy] Ignore namespaced and C++ member functions in ↵Stephane Moore2018-12-041-0/+30
| | | | | | | | | | | | | | | | google-objc-function-naming check 🙈 Summary: The google-objc-function-naming check applies to functions that are not namespaced and should not be applied to C++ member functions. Such function declarations should be ignored by the check to avoid false positives in Objective-C++ sources. Reviewers: benhamilton, aaron.ballman Reviewed By: aaron.ballman Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D55101 llvm-svn: 348317
* [clang-tidy] Recommit: Add the abseil-duration-comparison checkJonas Toth2018-12-031-0/+195
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This check finds instances where Duration values are being converted to a numeric value in a comparison expression, and suggests that the conversion happen on the other side of the expression to a Duration. See documentation for examples. This also shuffles some code around so that the new check may perform in sone step simplifications also caught by other checks. Compilation is unbroken, because the hash-function is now directly specified for std::unordered_map, as 'enum class' does not compile as key (seamingly only on some compilers). Patch by hwright. Reviewers: aaron.ballman, JonasToth, alexfh, hokein Reviewed By: JonasToth Subscribers: sammccall, Eugene.Zelenko, xazax.hun, cfe-commits, mgorny Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D54737 llvm-svn: 348169
* Revert "[clang-tidy] Add the abseil-duration-comparison check"Jonas Toth2018-12-031-195/+0
| | | | | | This commit broke buildbots and needs adjustments. llvm-svn: 348165
* [clang-tidy] Add the abseil-duration-comparison checkJonas Toth2018-12-031-0/+195
| | | | | | | | | | | | | | | | | | | | | Summary: This check finds instances where Duration values are being converted to a numeric value in a comparison expression, and suggests that the conversion happen on the other side of the expression to a Duration. See documentation for examples. This also shuffles some code around so that the new check may perform in sone step simplifications also caught by other checks. Patch by hwright. Reviewers: aaron.ballman, JonasToth, alexfh, hokein Reviewed By: JonasToth Subscribers: sammccall, Eugene.Zelenko, xazax.hun, cfe-commits, mgorny Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D54737 llvm-svn: 348161
* [clangd] Recommit the "AnyScope" changes in requests.json by rCTE347753 ↵Fangrui Song2018-12-011-7/+7
| | | | | | | | (reverted by rCTE347792) This fixes IndexBenchmark tests. llvm-svn: 348066
* Adding a FIXME test to document an area for improvement with the ↵Aaron Ballman2018-11-291-0/+12
| | | | | | cert-err58-cpp check; NFC. llvm-svn: 347860
* Ensure that test clang-tidy/export-relpath.cpp works with Windows path ↵Matthew Voss2018-11-281-1/+1
| | | | | | separators. llvm-svn: 347815
* Revert "[clang-tools-extra] r347753 - [clangd] Build and test IndexBenchmark ↵Matthew Voss2018-11-283-11/+8
| | | | | | | | | in check-clangd" This revision was causing failures on the buildbots, and our internal CI. See: http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/20856 llvm-svn: 347792
* Fix false positive with lambda assignments in cert-err58-cpp.Aaron Ballman2018-11-281-2/+27
| | | | | | This check is about preventing exceptions from being thrown before main() executes, and assigning a lambda (rather than calling it) to a global object cannot throw any exceptions. llvm-svn: 347761
* [clang-tidy] Added a test -export-fixes with relative paths.Ilya Biryukov2018-11-281-0/+19
| | | | | | | | | | | | | | Summary: A test for D51864. Reviewers: ioeric, steveire Reviewed By: steveire Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D51865 llvm-svn: 347760
* [clangd] Build and test IndexBenchmark in check-clangdHaojian Wu2018-11-283-8/+11
| | | | | | | | | | | | | | Summary: Include IndexBenchmark in check-clangd to make sure we won't forget to update it when doing breaking changes; also fix an out-of-date test input. Reviewers: ilya-biryukov Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54998 llvm-svn: 347753
* Fix a false-positive with cert-err58-cpp.Aaron Ballman2018-11-281-1/+14
| | | | | | If a variable is declared constexpr then its initializer needs to be a constant expression, and thus, cannot throw. This check is about not throwing exceptions before main() runs, and so it doesn't apply if the initializer cannot throw. This silences the diagnostic when initializing a constexpr variable and fixes PR35457. llvm-svn: 347745
* [clangd] textDocument/SymbolInfo extensionJan Korous2018-11-271-0/+14
| | | | | | | | | | New method returning symbol info for given source position. Differential Revision: https://reviews.llvm.org/D54799 rdar://problem/46050281 llvm-svn: 347675
* [clang-tidy] Ignore bool -> single bit bitfield conversion in ↵Malcolm Parsons2018-11-271-1/+14
| | | | | | | | | | | | | | | | readability-implicit-bool-conversion Summary: There is no ambiguity / information loss in this conversion Reviewers: alexfh, aaron.ballman, hokein Reviewed By: alexfh Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D54941 llvm-svn: 347671
* [clang-tidy] Avoid inconsistent notes in readability-container-size-emptyAlexander Kornienko2018-11-271-2/+7
| | | | | | | | | When a warning is issued in a template instantiation, the check would previously use template arguments in a note, which would result in inconsistent or duplicate warnings (depending on how deduplication was done). This patch removes template arguments from the note. llvm-svn: 347652
* [clang-tidy] Minor fixes in a testAlexander Kornienko2018-11-271-8/+8
| | | | | | | Use CHECK-FIXES where it was intended instead of CHECK-MESSAGES. Fixed compiler warnings to pacify YouCompleteMe. llvm-svn: 347651
* [clang-tidy] Improving narrowing conversionsGuillaume Chatelet2018-11-265-26/+455
| | | | | | | | | | | | | | | | | | | | | Summary: Newly flagged narrowing conversions: - integer to narrower signed integer (this is compiler implementation defined), - integer - floating point narrowing conversions, - floating point - integer narrowing conversions, - constants with narrowing conversions (even in ternary operator). Reviewers: hokein, alexfh, aaron.ballman, JonasToth Reviewed By: aaron.ballman, JonasToth Subscribers: lebedev.ri, courbet, nemanjai, xazax.hun, kbarton, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D53488 llvm-svn: 347570
* [clangd] Enable auto-index behind a flag.Sam McCall2018-11-265-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Ownership and configuration: The auto-index (background index) is maintained by ClangdServer, like Dynamic. (This means ClangdServer will be able to enqueue preamble indexing in future). For now it's enabled by a simple boolean flag in ClangdServer::Options, but we probably want to eventually allow injecting the storage strategy. New 'sync' command: In order to meaningfully test the integration (not just unit-test components) we need a way for tests to ensure the asynchronous index reads/writes occur before a certain point. Because these tests and assertions are few, I think exposing an explicit "sync" command for use in tests is simpler than allowing threading to be completely disabled in the background index (as we do for TUScheduler). Bugs: I fixed a couple of trivial bugs I found while testing, but there's one I can't. JSONCompilationDatabase::getAllFiles() may return relative paths, and currently we trigger an assertion that assumes they are absolute. There's no efficient way to resolve them (you have to retrieve the corresponding command and then resolve against its directory property). In general I think this behavior is broken and we should fix it in JSONCompilationDatabase and require CompilationDatabase::getAllFiles() to be absolute. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D54894 llvm-svn: 347567
* [clang-tidy] No warning for auto new expression in smart checkHaojian Wu2018-11-261-0/+3
| | | | | | | | | | | | Summary: The fix for `auto` new expression is illegal. Reviewers: aaron.ballman Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D54832 llvm-svn: 347551
* [clang-tidy] Don't generate incorrect fixes for class with deleted copy ↵Haojian Wu2018-11-261-0/+59
| | | | | | | | | | | | | | | | | constructor in smart_ptr check. Summary: The fix for aggregate initialization (`std::make_unique<Foo>(Foo {1, 2})` needs to see Foo copy constructor, otherwise we will have a compiler error. So we only emit the check warning. Reviewers: JonasToth, aaron.ballman Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D54745 llvm-svn: 347537
* Remove the optional dependency from libclang to clang-tidy/include-fixerBenjamin Kramer2018-11-232-26/+0
| | | | | | | clangd does a better job on both of these, so don't slow down everyone's build for a poorly working libclang feature. llvm-svn: 347496
* [clang-tidy] Ignore template instantiations in modernize-use-usingAlexander Kornienko2018-11-221-0/+21
| | | | | | | | | | The test I'm adding passes without the change due to the deduplication logic in ClangTidyDiagnosticConsumer::take(). However this bug manifests in our internal integration with clang-tidy. I've verified the fix by locally changing LessClangTidyError to consider replacements. llvm-svn: 347470
* [clangd] Cleanup: stop passing around list of supported URI schemes.Eric Liu2018-11-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Instead of passing around a list of supported URI schemes in clangd, we expose an interface to convert a path to URI using any compatible scheme that has been registered. It favors customized schemes and falls back to "file" when no other scheme works. Changes in this patch are: - URI::create(AbsPath, URISchemes) -> URI::create(AbsPath). The new API finds a compatible scheme from the registry. - Remove URISchemes option everywhere (ClangdServer, SymbolCollecter, FileIndex etc). - Unit tests will use "unittest" by default. - Move "test" scheme from ClangdLSPServer to ClangdMain.cpp, and only register the test scheme when lit-test or enable-lit-scheme is set. (The new flag is added to make lit protocol.test work; I wonder if there is alternative here.) Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54800 llvm-svn: 347467
* [clangd] Cleanup: use index file instead of header in workspace symbols lit ↵Eric Liu2018-11-223-8/+22
| | | | | | | | | | | | | | | | test. Summary: The full path of the input header depends on the execution environment and may result in different behavior (e.g. when different URI schemes are used). Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54833 llvm-svn: 347466
* Move the llvm lit test dependencies to clang-tools-extra.Haojian Wu2018-11-221-0/+11
| | | | | | | | | | | | Summary: Part of revert r343473 Reviewers: mgorny Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D54798 llvm-svn: 347449
* [clang-tidy] Add a test for proper handling of locations in scratch space.Alexander Kornienko2018-11-211-0/+28
| | | | | | This test examines the behavior change of clang::tooling::Diagnostic in r347372. llvm-svn: 347373
* [clang-tidy] Don't generate incorrect fixes for class constructed from ↵Haojian Wu2018-11-201-0/+32
| | | | | | | | | | | | | | | | | | | | | | | list-initialized arguments Summary: Currently the smart_ptr check (modernize-make-unique) generates the fixes that cannot compile for cases like below -- because brace list can not be deduced in `make_unique`. ``` struct Bar { int a, b; }; struct Foo { Foo(Bar); }; auto foo = std::unique_ptr<Foo>(new Foo({1, 2})); ``` Reviewers: aaron.ballman Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D54704 llvm-svn: 347315
* Add the abseil-duration-factory-scale check.Aaron Ballman2018-11-181-0/+130
| | | | | | | | This check removes unneeded scaling of arguments when calling Abseil Time factory functions. Patch by Hyrum Wright. llvm-svn: 347163
* [clang-tidy/checks] Implement a clang-tidy check to verify Google ↵Stephane Moore2018-11-171-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Objective-C function naming conventions 📜 Summary: §1 Description This check finds function names in function declarations in Objective-C files that do not follow the naming pattern described in the Google Objective-C Style Guide. Function names should be in UpperCamelCase and functions that are not of static storage class should have an appropriate prefix as described in the Google Objective-C Style Guide. The function `main` is a notable exception. Function declarations in expansions in system headers are ignored. Example conforming function definitions: ``` static bool IsPositive(int i) { return i > 0; } static bool ABIsPositive(int i) { return i > 0; } bool ABIsNegative(int i) { return i < 0; } ``` A fixit hint is generated for functions of static storage class but otherwise the check does not generate a fixit hint because an appropriate prefix for the function cannot be determined. §2 Test Notes * Verified clang-tidy tests pass successfully. * Used check_clang_tidy.py to verify expected output of processing google-objc-function-naming.m Reviewers: benhamilton, hokein, Wizard, aaron.ballman Reviewed By: benhamilton Subscribers: Eugene.Zelenko, mgorny, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D51575 llvm-svn: 347132
OpenPOWER on IntegriCloud