summaryrefslogtreecommitdiffstats
path: root/clang/unittests/libclang
Commit message (Collapse)AuthorAgeFilesLines
* [libclang] Fix UninstallAbortingLLVMFatalErrorHandler testJan Korous2019-09-121-2/+3
| | | | llvm-svn: 371794
* [libclang] Expose abort()-ing LLVM fatal error handlerJan Korous2019-09-123-0/+46
| | | | | | Differential Revision: https://reviews.llvm.org/D66775 llvm-svn: 371787
* [libclang][test][NFC] Split off fixture from tests.Jan Korous2019-09-032-71/+95
| | | | llvm-svn: 370825
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [libclang] Recommit r336590 with a fix for the memory leak in the testAlex Lorenz2019-01-081-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | The original commit had a memory leak in the test has a leak as it doesn't dispose of the evaluated cursor result. This also contains the follow-up NFC refactoring commit r336591. rdar://45893054 Original commit message: [libclang] evalute compound statement cursors before trying to evaluate the cursor like a declaration This change fixes a bug in libclang in which it tries to evaluate a statement cursor as a declaration cursor, because that statement still has a pointer to the declaration parent. rdar://38888477 Differential Revision: https://reviews.llvm.org/D49051 llvm-svn: 350666
* Revert r336590 "[libclang] evalute compound statement cursors before trying ↵Evgeniy Stepanov2018-07-101-41/+0
| | | | | | | | | to evaluate" New memory leaks in LibclangParseTest_EvaluateChildExpression_Test::TestBody() llvm-svn: 336716
* [libclang] evalute compound statement cursors before trying to evaluateAlex Lorenz2018-07-091-0/+41
| | | | | | | | | | | | | | the cursor like a declaration This change fixes a bug in libclang in which it tries to evaluate a statement cursor as a declaration cursor, because that statement still has a pointer to the declaration parent. rdar://38888477 Differential Revision: https://reviews.llvm.org/D49051 llvm-svn: 336590
* [clang] Update uses of DEBUG macro to LLVM_DEBUG.Nicola Zaghen2018-05-151-5/+7
| | | | | | | | | | | | | The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM Explicitly avoided changing the strings in the clang-format tests. Differential Revision: https://reviews.llvm.org/D44975 llvm-svn: 332350
* [libclang] Fix LibclangReparseTest.FileName when TMPDIR is set to a symlinkPetr Pavlu2018-04-211-2/+3
| | | | | | | | | | | | | | | | | | | | | Fix testing of clang_File_tryGetRealPathName() in LibclangReparseTest.FileName when executing in an environment which has TMPDIR set to a symbolic link that points to an actual directory. The test would fail because the name returned by clang_File_tryGetRealPathName() has the symlink resolved but the test compared it to the original filename of a temporary file. The patch addresses the problem by checking only that the value returned by clang_File_tryGetRealPathName() ends with "main.cpp". Additionally, the patch makes the previous assertion in the test that checks result of clang_getFileName() stricter. It newly verifies that the name returned by the function is exactly same as what was given to clang_parseTranslationUnit()/clang_getFile(). Differential Revision: https://reviews.llvm.org/D45807 llvm-svn: 330507
* Defer adding keywords to the identifier table until after the language ↵Aaron Ballman2018-04-161-0/+64
| | | | | | | | | | options have been loaded from the AST file. This fixes issues with "class" being reported as an identifier in "enum class" because the construct is not present when using default language options. Patch by Johann Klähn. llvm-svn: 330159
* [libclang] Add clang_File_tryGetRealPathNameFangrui Song2018-04-071-0/+15
| | | | | | | | | | | | | | | | | | | | | Summary: clang_getFileName() may return a path relative to WorkingDir. On Arch Linux, during clang_indexTranslationUnit(), clang_getFileName() on CXIdxIncludedIncludedFileInfo::file may return "/../lib64/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/string", for `#include <string>`. I presume WorkingDir is somehow changed to /usr/lib or /usr/include and clang_getFileName() returns a path relative to WorkingDir. clang_File_tryGetRealPathName() returns "/usr/include/c++/7.3.0/string" which is more useful for the indexer in this case. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42893 llvm-svn: 329515
* [libclang] Add PrintingPolicy for pretty printing declarationsJonathan Coe2018-01-161-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Introduce clang_getCursorPrettyPrinted() for pretty printing declarations. Expose also PrintingPolicy, so the user gets more fine-grained control of the entities being printed. The already existing clang_getCursorDisplayName() is pretty limited - for example, it does not handle return types, parameter names or default arguments for function declarations. Addressing these issues in clang_getCursorDisplayName() would mean to duplicate existing code (e.g. clang::DeclPrinter), so rather expose new API to access the existing functionality. Reviewed By: jbcoe Subscribers: cfe-commits Tags: #clang Patch by nik (Nikolai Kosjar) Differential Revision: https://reviews.llvm.org/D39903 llvm-svn: 322540
* Fixed memory leak in unit test introduced in my previous commit r322503Cameron Desrochers2018-01-151-0/+3
| | | | llvm-svn: 322513
* [PCH] Serialize skipped preprocessor rangesCameron Desrochers2018-01-151-0/+78
| | | | | | | | The skipped preprocessor ranges are now serialized in the AST PCH file. This fixes, for example, libclang's clang_getSkippedRanges() returning zero ranges after reparsing a translation unit. Differential Revision: https://reviews.llvm.org/D20124 llvm-svn: 322503
* Revert 320391: Certain targets are failing, pulling back to diagnose.Erich Keane2017-12-111-3/+1
| | | | llvm-svn: 320398
* For Linux/gnu compatibility, preinclude <stdc-predef.h> if the file is availableErich Keane2017-12-111-1/+3
| | | | | | | | | | | | | | | | | | | | As reported in llvm bugzilla 32377. Here’s a patch to add preinclude of stdc-predef.h. The gcc documentation says “On GNU/Linux, <stdc-predef.h> is pre-included.” See https://gcc.gnu.org/gcc-4.8/porting_to.html; The preinclude is inhibited with –ffreestanding. Basically I fixed the failing test cases by adding –ffreestanding which inhibits this behavior. I fixed all the failing tests, including some in extra/test, there's a separate patch for that which is linked here Note: this is a recommit after a test failure took down the original (r318669) Patch By: mibintc Differential Revision: https://reviews.llvm.org/D34158 llvm-svn: 320391
* [CMake] Use PRIVATE in target_link_libraries for executablesShoaib Meenai2017-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently use target_link_libraries without an explicit scope specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables. Dependencies added in this way apply to both the target and its dependencies, i.e. they become part of the executable's link interface and are transitive. Transitive dependencies generally don't make sense for executables, since you wouldn't normally be linking against an executable. This also causes issues for generating install export files when using LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM library dependencies, which are currently added as interface dependencies. If clang is in the distribution components but the LLVM libraries it depends on aren't (which is a perfectly legitimate use case if the LLVM libraries are being built static and there are therefore no run-time dependencies on them), CMake will complain about the LLVM libraries not being in export set when attempting to generate the install export file for clang. This is reasonable behavior on CMake's part, and the right thing is for LLVM's build system to explicitly use PRIVATE dependencies for executables. Unfortunately, CMake doesn't allow you to mix and match the keyword and non-keyword target_link_libraries signatures for a single target; i.e., if a single call to target_link_libraries for a particular target uses one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must also be updated to use those keywords. This means we must do this change in a single shot. I also fully expect to have missed some instances; I tested by enabling all the projects in the monorepo (except dragonegg), and configuring both with and without shared libraries, on both Darwin and Linux, but I'm planning to rely on the buildbots for other configurations (since it should be pretty easy to fix those). Even after this change, we still have a lot of target_link_libraries calls that don't specify a scope keyword, mostly for shared libraries. I'm thinking about addressing those in a follow-up, but that's a separate change IMO. Differential Revision: https://reviews.llvm.org/D40823 llvm-svn: 319840
* Fixed more signed/unsigned mismatch warnings introduced in my change at r279076Cameron Desrochers2016-08-181-5/+5
| | | | llvm-svn: 279145
* Removed use of 'emplace' on std::map, since not all buildbot slaves support itCameron Desrochers2016-08-181-2/+2
| | | | llvm-svn: 279114
* [libclang] Fixed signed/unsigned comparison warning introduced in my ↵Cameron Desrochers2016-08-181-1/+1
| | | | | | revision r279076 llvm-svn: 279085
* [libclang] Add clang_getAllSkippedRanges functionCameron Desrochers2016-08-181-2/+80
| | | | | | | | | | This complements the clang_getSkippedRanges function which returns skipped ranges filtered by a specific file. This function is useful when all the ranges are desired (and a lot more efficient than the equivalent of asking for the ranges file by file, since the implementation of clang_getSkippedRanges iterates over all ranges anyway). Differential Revision: https://reviews.llvm.org/D20132 llvm-svn: 279076
* tests: Add explicit -stdlib=libstdc++ to tests that require itJonas Hahnfeld2016-02-121-1/+1
| | | | | | | This will be needed for the next commit that allows to switch the default C++ library which would otherwise make these tests fail. llvm-svn: 260661
* Remove autoconf supportChris Bieneman2016-01-261-37/+0
| | | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "This is the way [autoconf] ends Not with a bang but a whimper." -T.S. Eliot Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D16472 llvm-svn: 258862
* Avoid picking up system headers in unittest by providing a fake libstdc++ ↵Benjamin Kramer2015-12-011-2/+4
| | | | | | | | | with a ridiculously high version number. The host libstdc++ may be horribly broken and we want the fake one to be picked up. This workaround is lame but I don't see a better way. llvm-svn: 254446
* Add --gcc-toolchain= to one of the libclang unitests to fix issue related to Samuel Antao2015-11-301-1/+2
| | | | | | | the gcc libraries clang picks for when it was configures with a user defined path. llvm-svn: 254306
* [libclang] Add entry points that take a full command line including argv[0].Benjamin Kramer2015-11-181-0/+26
| | | | | | | | | | | | This provides both a more uniform interface and makes libclang behave like clang tooling wrt relative paths against argv[0]. This is necessary for finding paths to a c++ standard library relative to a clang binary given in a compilation database. It can also be used to find paths relative to libclang.so if the full path to it is passed in. Differential Revision: http://reviews.llvm.org/D14695 llvm-svn: 253466
* Tweak libclang's users, c-arcmt-test, c-index-test and libclangTests to ↵NAKAMURA Takumi2015-07-121-0/+4
| | | | | | satisfy LDFLAGS=-static. llvm-svn: 241992
* Reformat Makefile.NAKAMURA Takumi2015-07-121-1/+6
| | | | llvm-svn: 241991
* Add clang_free to libclang to free memory allocated in libclang.Yaron Keren2015-07-091-2/+2
| | | | | | | | | | | | | | One of the problems libclang tests has running under Windows is memory allocated in libclang.dll but being freed in the test executable, possibly by a different memory manager. This patch exposes a new export function, clang_free(), used to free any allocated memory with the same libclang.dll memory manager that allocated the memory. http://reviews.llvm.org/D10949 Reviewed by Reid Kleckner, Douglas Gregor. llvm-svn: 241789
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-2/+2
| | | | | | | | | | | | | | | | | | | | Summary: The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix Reviewers: dblaikie Reviewed By: dblaikie Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D8926 llvm-svn: 234678
* Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl2015-02-251-3/+2
| | | | llvm-svn: 230454
* Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl2015-02-251-2/+3
| | | | | | | | | | | | | | | | | This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. This reapplies r230044 with a fixed configure+make build and updated dependencies and testcase requirements. Over the last iteration this version adds - missing target requirements for testcases that specify an x86 triple, - a missing clangCodeGen.a dependency to libClang.a in the make build. rdar://problem/19104245 llvm-svn: 230423
* [cleanup] Re-sort the #include lines using llvm/utils/sort_includes.pyChandler Carruth2015-01-141-1/+1
| | | | | | | No functionality changed, this is a purely mechanical cleanup to ensure the #include order remains consistent across the project. llvm-svn: 225975
* [autoconf] Add clangToolingCore.a to Makefile(s) for static build w/o ↵NAKAMURA Takumi2014-10-301-0/+1
| | | | | | libclang.dll. llvm-svn: 220904
* Make clang's rewrite engine a core featureAlp Toker2014-07-161-1/+1
| | | | | | | | | | | | | | | The rewrite facility's footprint is small so it's not worth going to these lengths to support disabling at configure time, particularly since key compiler features now depend on it. Meanwhile the Objective-C rewriters have been moved under the ENABLE_CLANG_ARCMT umbrella for now as they're comparatively heavy and still potentially worth excluding from lightweight builds. Tests are now passing with any combination of feature flags. The flags historically haven't been tested by LLVM's build servers so caveat emptor. llvm-svn: 213171
* VirtualFileSystem: Correctly generate the mapping for an empty VFSJustin Bogner2014-07-151-0/+10
| | | | | | | In r209332 I accidentally broke generation of empty VFS maps. This fixes the issue and adds a test. llvm-svn: 213028
* Use temporary module cache in testBen Langmuir2014-07-071-1/+3
| | | | llvm-svn: 212467
* Consider module depedencies when checking a preamble in libclangBen Langmuir2014-06-301-1/+34
| | | | | | | | | | | | | Add module dependencies (header files, module map files) to the list of files to check when deciding whether to rebuild a preamble. That fixes using preambles with module imports so long as they are in non-overridden files. My intent is to use to unify the existing dependency collectors to the new “DependencyCollectory” interface from this commit, starting with the DependencyFileGenerator. llvm-svn: 212060
* LibclangTest.cpp: s/uint/unsigned/. I think 'uint' is not a standard type.NAKAMURA Takumi2014-06-291-3/+3
| | | | llvm-svn: 211997
* Add reparse test for libclangBen Langmuir2014-06-271-0/+89
| | | | | | Adapted from a reproducer by Dan Schmidt, thanks! llvm-svn: 211910
* [C++11] Use 'nullptr'. Unittests edition.Craig Topper2014-06-081-6/+7
| | | | llvm-svn: 210423
* VirtualFileSystem: Fix a few directory traversal bugs in VFSWriterJustin Bogner2014-05-211-0/+68
| | | | | | | | | | | There are a couple of issues with writing VFS maps that are awkward to fix within the current mutually recursive approach. Instead, replace the algorithm with an iterative version that uses an explicit stack of directories. Includes tests for cases the old approach was tripping on. llvm-svn: 209332
* libclang: Give each VirtualFileOverlay unit test its own nameJustin Bogner2014-05-201-173/+176
| | | | llvm-svn: 209257
* VirtualFileSystem: Fix false positives in YAMLVFSWriter::containedInJustin Bogner2014-05-201-0/+51
| | | | | | | | Checking if a path starts with another path isn't sufficient for determining if one is contained within the heirarchy of the other. We need to ensure that the substring ends at a directory boundary. llvm-svn: 209250
* Switch another write_escaped to yaml::escapeBen Langmuir2014-05-161-2/+2
| | | | | | I missed one in r206443. llvm-svn: 208941
* Fix a tiny test-only leak, found by LSan.Nico Weber2014-04-241-8/+8
| | | | llvm-svn: 207137
* When writing YAML in libclang, use yaml::escape instead of write_escapedBen Langmuir2014-04-171-0/+21
| | | | | | | | The YAMLParser has its own escaped string representation, and does not handle octal escape sequences. When writing the virtual file system to a YAML file, use yaml::escape(). llvm-svn: 206443
* [libclang] Introduce clang_VirtualFileOverlay_setCaseSensitivity that ↵Argyrios Kyrtzidis2014-03-201-0/+23
| | | | | | | | | | exposes the VFS option to set the case-sensitivity for lookups. rdar://16374696 llvm-svn: 204303
OpenPOWER on IntegriCloud