summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests
Commit message (Collapse)AuthorAgeFilesLines
* NFC: Fix trivial typos in commentsKazuaki Ishizaki2020-01-041-2/+2
|
* [clang-tidy] fix linkage with clangSema for FixitHintUtils, undo previous ↵Jonas Toth2020-01-031-1/+0
| | | | wrong fix
* [clang-tidy] quickfix: add -fno-delayed-template-parsing as default argument ↵Jonas Toth2020-01-031-0/+1
| | | | for runCheckOnCode unit-tests to unbreak windows
* [clang-tidy] fix broken linking for AddConstTest with adding clangSema as ↵Jonas Toth2020-01-031-0/+1
| | | | dependency (DeclSpec)
* [clang-tidy] implement utility-function to add 'const' to variablesJonas Toth2020-01-032-0/+1082
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch extends the already existing facility to add 'const' to variables to be more flexible and correct. The previous version did not consider pointers as value AND pointee. For future automatic introduction for const-correctness this shortcoming needs to be fixed. It always allows configuration where the 'const' token is inserted, either on the left side (if possible) or the right side. It adds many unit-tests to the utility-function that did not exist before, as the function was implicitly tested through clang-tidy checks. These tests were not changed, as the API is still compatible. Reviewers: aaron.ballman, hokein, alexfh, shuaiwang, lebedev.ri Reviewed By: aaron.ballman Subscribers: jdoerfert, mgorny, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D54395
* Fix formatting in previous commitsStephen Kelly2019-12-291-6/+10
|
* Fix use of named values surrounded by newlines in clang-queryStephen Kelly2019-12-291-0/+19
|
* Fix newline handling in clang-query parserStephen Kelly2019-12-291-0/+8
| | | | Don't prematurely remove characters from the end of the string
* Fix handling of newlines in clang-queryStephen Kelly2019-12-291-0/+18
| | | | Replace assert with diagnostic for missing newline.
* Allow newlines in AST Matchers in clang-query filesStephen Kelly2019-12-271-0/+101
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71842
* Revert "Allow newlines in AST Matchers in clang-query files" + 1Evgenii Stepanov2019-12-261-101/+0
| | | | | | | | | Revert "Fix -Wunused-lambda-capture warnings." This reverts commit 2369560f4a7720b19edfbf9de14ef061307ff773. This reverts commit 522ee29a4fb3814db604b585c8637247477ec057. clang/lib/ASTMatchers/Dynamic/Parser.cpp:610:13: warning: implicit conversion turns string literal into bool: 'const char [35]' to 'bool' [-Wstring-conversion] assert(!"Newline should never be found here");
* Allow newlines in AST Matchers in clang-query filesStephen Kelly2019-12-261-0/+101
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71842
* Revert "Allow newlines in AST Matchers in clang-query files"Stephen Kelly2019-12-261-101/+0
| | | | This reverts commit 6a3ecf4dc7ec299394e71b3124df2b3a34ed4ac3.
* Allow newlines in AST Matchers in clang-query filesStephen Kelly2019-12-261-0/+101
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71842
* [clang-tidy] Update TransformerClangTidyCheck to use new Transformer bindings.Yitzhak Mandelbaum2019-11-061-14/+13
| | | | | | | | | | | | | | Summary: Updates the relevant source files to use bindings in `clang::transformer` rather than `clang::tooling`. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69804
* [libTooling] Move Transformer files to their own directory/library.Yitzhak Mandelbaum2019-10-102-4/+4
| | | | | | | | | | | | | | | | | | | Summary: The Transformer library has been growing inside of lib/Tooling/Refactoring. However, it's not really related to anything else in that directory. This revision moves all Transformer-related files into their own include & lib directories. A followup revision will (temporarily) add forwarding headers to help any users migrate their code to the new location. Reviewers: gribozavr Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68637 llvm-svn: 374271
* [clang-tools-extra] [cmake] Link against libclang-cpp whenever possibleMichal Gorny2019-10-048-17/+41
| | | | | | | | | Use clang_target_link_libraries() in order to support linking against libclang-cpp instead of static libraries. Differential Revision: https://reviews.llvm.org/D68448 llvm-svn: 373786
* [clang-tidy] Make llvm-header-guard work on llvm git monorepoHaojian Wu2019-09-261-0/+9
| | | | | | | | | | | | | | Reviewers: gribozavr Reviewed By: gribozavr Subscribers: xazax.hun, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68026 llvm-svn: 372953
* [Tooling] Migrated APIs that take ownership of objects to unique_ptrDmitri Gribenko2019-08-301-1/+3
| | | | | | | | | | Subscribers: jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66960 llvm-svn: 370451
* GlobList: added a clear test for pattern priorityDmitri Gribenko2019-08-271-1/+35
| | | | | | | | | | | | | | Summary: The last glob that matches the string decides whether that string is included or excluded. Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66787 llvm-svn: 370028
* Moved GlobList into a separate header fileDmitri Gribenko2019-08-263-60/+69
| | | | | | | | | | | | | | Summary: It is a separate abstraction that is used in more contexts than just a helper for ClangTidyDiagnosticConsumer. Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66747 llvm-svn: 369918
* [clang-tidy][NFC] Qualify `makeRule` call in test, for consistency with ↵Yitzhak Mandelbaum2019-08-261-2/+3
| | | | | | | | | | other calls. One call `makeRule` is unqualified (and unintentionally relying on ADL to resolve correctly). This revision qualifies that call for consistency and to drop use of ADL. llvm-svn: 369915
* [clang-tidy] TransformerClangTidyCheck: change choice of location for ↵Yitzhak Mandelbaum2019-08-261-4/+54
| | | | | | | | | | | | | | | | | | | | | | | | | diagnostic message. Summary: This patch changes the location specified to the `ClangTidyCheck::diag()`. Currently, the beginning of the matched range is used. This patch uses the beginning of the first fix's range. This change both simplifies the code and (hopefully) gives a more intuitive result: the reported location aligns with the fix(es) provided, rather than the (arbitrary) range of the rule's match. N.B. this patch will break the line offset numbers in lit tests if the first fix is not at the beginning of the match. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66676 llvm-svn: 369914
* Remove \brief commands from doxygen comments.Dmitri Gribenko2019-08-221-5/+5
| | | | | | | | | | | | | | | | | | | | | | | Summary: We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done [This is analogous to LLVM r331272 and CFE r331834] Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66578 llvm-svn: 369643
* [clang-doc] Redesign of generated HTML filesDiego Astiazaran2019-08-161-150/+197
| | | | | | | | | | | | | The new design includes a header (contains the project name), a main section, and a footer. The main section is divided into three subsections. Left, middle, right. The left section contains the general index, the middle contains the info's data, and the right contains the index for the info's content. The CSS has been updated. A flag --project-name is added. The Attributes attribute of the TagNode struct is now a vector of pairs because these attributes should be rendered in the insertion order. The functions (cpp and js) that converts an Index tree structure into HTML were slightly modified; the first ul tag created is now a ol tag. The inner lists are still ul. Differential Revision: https://reviews.llvm.org/D66353 llvm-svn: 369139
* [clang-doc] Fix records in global namespaceDiego Astiazaran2019-08-161-26/+84
| | | | | | | | | | | | | When a Record is declared in the global namespace, clang-doc serializes it as a child of the global namespace, so the global namespace is now one if its parent namespaces. This namespace was not being included in the list of namespaces of the Info causing paths to be incorrect and the index rendered incorrectly. Affected tests have been fixed. Differential revision: https://reviews.llvm.org/D66298 llvm-svn: 369123
* [clang-doc] Serialize inherited attributes and methodsDiego Astiazaran2019-08-166-12/+118
| | | | | | | | | | | clang-doc now serializes the inherited attributes and methods, not only the name of the base class. All inherited are tracked, if B:A and C:B, info of A is included in C. This data is stored in attribute Bases in a RecordInfo. Previously tracked inheritance data, stored in Parents and VParents, hasn't been removed to reduce review load. Differential revision: https://reviews.llvm.org/D66238 llvm-svn: 369075
* [clang-doc] Sort index elements case insensitiveDiego Astiazaran2019-08-151-0/+19
| | | | | | | | Implement logic to compare the references of the index case insensitive. Differential revision: https://reviews.llvm.org/D66299 llvm-svn: 369068
* [clang-doc] Fix bitcode writer for access specifiersDiego Astiazaran2019-08-155-4/+23
| | | | | | | | | | | | | | | Bitcode writer was not emitting the corresponding record for the Access attribute of a FunctionInfo. This has been added. AS_none was being used as the default value for any AcesssSpecifier attribute (in FunctionInfo and MemberTypeInfo), this has been changed to AS_public because this is the enum value that evaluates to 0. The bitcode writer doesn't write values that are 0 so if an attribute was set to AS_public, this value is not written and after reading the bitcode it would have the default value which is AS_none. This is why the default value is now AS_public. Differential Revision: https://reviews.llvm.org/D66151 llvm-svn: 369063
* [clang-tools-extra] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-1410-116/+116
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368944
* [clang-doc] Add missing check in testsDiego Astiazaran2019-08-142-2/+3
| | | | | | | | Path is now checked when comparing two Infos in the unit tests. Differential Revision: https://reviews.llvm.org/D66124 llvm-svn: 368912
* [clang-doc] Generate HTML links for children namespaces/recordsDiego Astiazaran2019-08-124-21/+34
| | | | | | | | | | | | | | | | Path is now stored in the references to the child while serializing, then this path is used to generate the relative path in the HTML generator. Now some references have paths and some don't so in the reducing phase, references are now properly merged checking for empty attributes. Tests added for HTML and YAML generators, merging and serializing. computeRelativePath function had a bug when the filepath is part of the given directory; it returned a path that starts with a separator. This has been fixed. Differential Revision: https://reviews.llvm.org/D65987 llvm-svn: 368602
* [clang-format] Add link to source code in file definitionsDiego Astiazaran2019-08-092-14/+24
| | | | | | | | | | | | | Two command line options have been added to clang-doc. --repository=<string> - URL of repository that hosts code; used for links to definition locations. --source-root=<string> - Directory where processed files are stored. Links to definition locations will only be generated if the file is in this dir. If the file is in the source-root and a repository options is passed; a link to the source code will be rendered by the HTML generator. Differential Revision: https://reviews.llvm.org/D65483 llvm-svn: 368460
* [clang-doc] Add second index for sections within info's contentDiego Astiazaran2019-08-071-15/+88
| | | | | | | | | | | | This new index contains links to the main section of infos: Namespaces, Records, Functions, Enums, Members. Also to each child function or enum. Index is currently rendered on top of the info content, this will be fixed later with CSS. Depends on D65690. Differential Revision: https://reviews.llvm.org/D65030 llvm-svn: 368209
* [clang-doc] Add index in each info html fileDiego Astiazaran2019-08-065-0/+96
| | | | | | | | | | | | An index structure is created while generating the output file for each info. This structure is parsed to JSON and written to a file in the output directory. The html for the index is not rendered by clang-doc. A Javascript file is included in the output directory, this will the JSON file and insert HTML elements into the file. Differential Revision: https://reviews.llvm.org/D65690 llvm-svn: 368070
* [clang-doc] Fix link generationDiego Astiazaran2019-08-061-2/+3
| | | | | | | | | | | | | | | | | | | Before making a link to a reference it is required to check that the reference has a path (eg. primitives won't have paths). This was done by checking if the path was empty; that worked because when generating paths the outdirectory was included, so if the path was assigned it had that outdirectory at least. The path generation was changed, it's now only the composite of the namespaces without the outdirectory. So if the info is in the global namespace the path would be empty and the old check wouldn't work as expected. A new attribute has been added to the Reference struct that indicates if the info's parent is the global namespace. Paths generation now fails if the path is empty and if the info is not in the global namespace. Differential Revision: https://reviews.llvm.org/D64958 llvm-svn: 367958
* [clang-doc] Fix expected output in testsDiego Astiazaran2019-07-301-8/+2
| | | | | | | | | Removes conversion of html paths in output. These will always be in posix-style paths. Differential Revision: https://reviews.llvm.org/D65425 llvm-svn: 367279
* [clang-format] Fix style of css file pathsDiego Astiazaran2019-07-261-14/+3
| | | | | | | | | CSS files included in HTML should have a path in posix style, it should not be different for Windows. Differential Revision: https://reviews.llvm.org/D65309 llvm-svn: 367137
* [clang-doc] Fix failing tests on WindowsDiego Astiazaran2019-07-251-1/+6
| | | | | | | | | Tests on Windows were failing due to path separator differences. '/' was being used as separator in the expected output, paths in expected output are now changed to their native form before comparing them to the actual output. Differential Revision: https://reviews.llvm.org/D65306 llvm-svn: 367074
* [clang-doc] Add option for user provided stylesheetsDiego Astiazaran2019-07-253-15/+31
| | | | | | | | | | An option has been added to clang-doc to provide a list of css stylesheets that the user wants to use for the generated html docs. Depends on D64539. Differential Revision: https://reviews.llvm.org/D64938 llvm-svn: 367072
* [clang-doc] Add stylesheet to generated html docsDiego Astiazaran2019-07-251-0/+5
| | | | | | | | A default css stylesheet is included for docs generated in html format. Differential Revision: https://reviews.llvm.org/D64539 llvm-svn: 367056
* [clang-doc] Fix output format of htmlDiego Astiazaran2019-07-251-32/+16
| | | | | | | | | The children of a TagNode are rendered in the same line as the parent only if they are all TextNodes. When children are not inline; two text nodes that are adjacent won't have a new line between them, each tag node is rendered in its own line. Differential Revision: https://reviews.llvm.org/D65005 llvm-svn: 367050
* [clang-doc] Fix html entities in rendered textDiego Astiazaran2019-07-251-0/+12
| | | | | | | | | Replace &, <, >, ", and ' with their corresponding html entities in text rendered by HTML generator. Differential Revision: https://reviews.llvm.org/D65107 llvm-svn: 367045
* Replace CRLF with LF.Rui Ueyama2019-07-171-94/+94
| | | | llvm-svn: 366304
* [clang-doc] Fix failing tests on WindowsJulie Hockett2019-07-121-8/+23
| | | | | | | | | | | | | Tests on Windows were failing due to path separator differences. '/' was being used as separator in the expected output, paths in expected output are now changed to their native form before comparing them to the actual output. Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com). Differential Revision: https://reviews.llvm.org/D64669 llvm-svn: 365967
* [clang-doc] Add html links to referencesJulie Hockett2019-07-122-16/+34
| | | | | | | | | | | | | | | | <a> tags are added for the parents and members of records and return type and params of functions. The link redirects to the reference's info file. The directory path where each info file will be saved is now generated in the serialization phase and stored as an attribute in each Info. Bitcode writer and reader were modified to handle the new attributes. Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com). Differential Revision: https://reviews.llvm.org/D63663 llvm-svn: 365937
* [test] Delete trailing spaces from YAML tests after D65566/r365869Fangrui Song2019-07-121-48/+48
| | | | llvm-svn: 365874
* [clang-doc] Add a structured HTML generatorJulie Hockett2019-07-102-0/+277
| | | | | | | | | | | | | | | Implements an HTML generator. Nodes are used to represent each part of the HTML file. There are TagNodes that represent every HTML tag (p, h1, div, ...) and they have children nodes, which can be TagNodes or TextNodes (these nodes only have text). Proper indentation is rendered within the files generated by tool. No styling (CSS) is included. Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com) Differential Revision: https://reviews.llvm.org/D63857 llvm-svn: 365687
* [Bitcode] Move Bitstream to a separate libraryFrancis Visoiu Mistrih2019-07-032-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | This moves Bitcode/Bitstream*, Bitcode/BitCodes.h to Bitstream/. This is needed to avoid a circular dependency when using the bitstream code for parsing optimization remarks. Since Bitcode uses Core for the IR part: libLLVMRemarks -> Bitcode -> Core and Core uses libLLVMRemarks to generate remarks (see IR/RemarkStreamer.cpp): Core -> libLLVMRemarks we need to separate the Bitstream and Bitcode part. For clang-doc, it seems that it doesn't need the whole bitcode layer, so I updated the CMake to only use the bitstream part. Differential Revision: https://reviews.llvm.org/D63899 llvm-svn: 365091
* [clang-doc] Serialize child namespaces and recordsJulie Hockett2019-07-022-53/+77
| | | | | | | | | | | | Serialization of child namespaces and records is now handled. Namespaces can have child records and child namespaces. Records can only have child records. Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com). Differential Revision: https://reviews.llvm.org/D63911 llvm-svn: 364963
OpenPOWER on IntegriCloud