Граф коммитов

47 Коммитов

Автор SHA1 Сообщение Дата
Eric Liu 0c965af23b [Index] Add an option to collect macros from preprocesor.
Summary: Also added unit tests for the index library; lit+c-index-test is painful...

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: mgorny, cfe-commits

Differential Revision: https://reviews.llvm.org/D52098

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342451 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-18 08:51:08 +00:00
Gabor Horvath 6254bf4ade Add Cross Translation Unit support library
This patch introduces a class that can help to build tools that require cross
translation unit facilities. This class allows function definitions to be loaded
from external AST files based on an index. In order to use this functionality an
index is required. The index format is a flat text file but it might be
replaced with a different solution in the near future. USRs are used as names to
look up the functions definitions. This class also does caching to avoid
redundant loading of AST files.

Right now only function defnitions can be loaded using this API because this is
what the in progress cross translation unit feature of the Static Analyzer
requires. In to future this might be extended to classes, types etc.

Differential Revision: https://reviews.llvm.org/D34512


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313975 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22 11:11:01 +00:00
Alex Lorenz 4803aff743 [refactor] Move clang-rename into the clang repository
The core engine of clang-rename will be used for local and global renames in the
new refactoring engine, as mentioned in
http://lists.llvm.org/pipermail/cfe-dev/2017-June/054286.html.

The clang-rename tool is still supported but might get deprecated in the future.

Differential Revision: https://reviews.llvm.org/D34696


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306840 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 16:36:09 +00:00
Alexander Kornienko 740b6bb048 CFGBuilder: Fix crash when visiting a range-based for over a dependent type
Summary:
CFG generation is expected to fail in this case, but it should not crash.

Also added a test that reproduces the crash.

Reviewers: klimek

Subscribers: cfe-commits

Patch by Martin Boehme!

Differential Revision: http://reviews.llvm.org/D21895


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274834 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-08 10:50:51 +00:00
Chris Bieneman d2dea072db [CMake] Don't build the libclang tests unless you're building libclang
This fixes a build issue reported by users at Apple.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254797 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 23:12:19 +00:00
Yaron Keren 993b475a27 Document problems when trying libclang tests on Windows 7.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241407 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-05 17:53:00 +00:00
Argyrios Kyrtzidis b90bec812a [Rewrite] Make RewriteBuffer accessible on its own, and add a unit test for it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231588 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-08 04:00:33 +00:00
Gabor Horvath 5595ece789 [analyzer] Individual configuration options can be specified for checkers.
Reviewed by: Anna Zaks

Original patch by: Aleksei Sidorin

Differential Revision: http://reviews.llvm.org/D7905


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231266 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-04 17:59:34 +00:00
Keno Fischer 6cc1c22a83 Don't segfault in EmitCXXGlobalInitFunc when main file is a membuf
Summary: When the main file is created from a membuffer, there is no file entry that can be retrieved. This uses "__GLOBAL_I_a" in that case which is what was always used before r208128.

Reviewers: majnemer, thakis

Reviewed By: thakis

Subscribers: yaron.keren, rsmith, cfe-commits

Differential Revision: http://reviews.llvm.org/D5043

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216495 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26 22:10:15 +00:00
Alp Toker 6c4abb1676 Make clang's rewrite engine a core feature
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213171 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-16 16:48:33 +00:00
Dmitri Gribenko 31ad0a00d1 libclang: fix a bug in processing invalid arguments, introduced in r201249
Recommit r201346, reverted in r201373.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201578 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-18 15:20:02 +00:00
Juergen Ributzka 7a03bd8c20 Revert "[CMake] Disable libclangTests.exe on win32 for now."
Because I also reverted the original commit that required this change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201374 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13 23:51:55 +00:00
NAKAMURA Takumi 2c974a9674 [CMake] Disable libclangTests.exe on win32 for now.
libclangTests.exe cannot find libclang.dll since it is not on $PATH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201348 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13 17:51:35 +00:00
Dmitri Gribenko cf7344d4ce libclang: fix a bug in processing invalid arguments, introduced in r201249,
pointed out by Daniel Jasper in r201329


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201346 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13 16:51:38 +00:00
Jonathan Roelofs ddccd4eca1 Add Multilib selection machinery
This patch improves the support for picking Multilibs from gcc installations.
It also provides a better approximation for the flags '-print-multi-directory'
and '-print-multi-lib'.

This reverts r201203 (i.e. re-applying r201202 with small fixes in
unittests/CMakeLists.txtto make the build bots happy).

review: http://llvm-reviews.chandlerc.com/D2538


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201205 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-12 03:21:20 +00:00
Jonathan Roelofs 56c7cf67c6 Revert 201202
Breaks cmake configure of new unit tests directory


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201203 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-12 01:36:51 +00:00
Jonathan Roelofs 1b6afd89e6 Add Multilib selection machinery
This patch improves the support for picking Multilibs from gcc installations.
It also provides a better approximation for the flags '-print-multi-directory'
and '-print-multi-lib'.

review: http://llvm-reviews.chandlerc.com/D2538


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201202 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-12 01:29:25 +00:00
Kaelyn Uhrain 70571f43ab Add hooks for typo correction to ExternalSemaSource, courtesy of Luke Zarko.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188196 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-12 19:54:38 +00:00
Roman Divacky ff62d64c63 Turn CLANG_ENABLE_{ARCMT,REWRITER,STATIC_ANALYZER} into proper options so that
users can disable those. Just like in autoconf generated makefiles.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182881 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-29 21:09:18 +00:00
Daniel Jasper bac016bd3f Initial version of formatting library.
This formatting library will be used by a stand-alone clang-format tool
and can also be used when writing other refactorings.

Manuel's original design document:
https://docs.google.com/a/google.com/document/d/1gpckL2U_6QuU9YW2L1ABsc4Fcogn5UngKk7fE5dDOoA/edit

The library can already successfully format itself.

Review: http://llvm-reviews.chandlerc.com/D80

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169137 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 18:12:45 +00:00
Dmitri Gribenko f919985b6e add AST unittests to CMake build system
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160640 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 20:11:34 +00:00
Manuel Klimek 4da216637f Adds the AST Matcher library, which provides a in-C++ DSL to express
matches on interesting parts of the AST, and callback mechanisms to
act on them.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159805 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 05:48:52 +00:00
Chandler Carruth 0c750ec837 Clang side of a refactoring of the CMake unit test build strategy.
The fundamental change is to put a CMakeLists.txt file in the unittest
directory, with a single test binary produced from it. This has several
advantages.

Among other fundamental advantages, we start to get the checking logic
for when a file is missing from the CMake build, and this caught one
missing file already! More fun details in the LLVM commit corresponding
to this one.

Note that the LLVM commit and this one most both be applied, or neither.
Sorry for any skew issues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158910 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-21 09:51:42 +00:00
Chandler Carruth 20e4129bd0 Switch Clang to re-use the the newly factored common LLVM
implementation. Yay for '-' lines in CMake!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158897 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-21 05:23:23 +00:00
Chandler Carruth f96b9ce9d9 Simplify the Clang unittest function in the CMake build, and make it
match the LLVM implemenation. This also simplifies the name management
and splits the custom library management out from the unittest specific
management. It finally drops the dependency on parsing cmake arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158894 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-21 02:04:39 +00:00
Chandler Carruth b0d8671f95 Remove a goofy CMake hack and use the standard CMake facilities to
express library-level dependencies within Clang.

This is no more verbose really, and plays nicer with the rest of the
CMake facilities. It should also have no change in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158888 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-21 01:30:21 +00:00
Chandler Carruth caba856a86 Remove an unused feature of the clang unittest macro.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158884 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-21 00:40:48 +00:00
Manuel Klimek f9d4cbd3dd Adds the Refactoring library, which is a layer on top of the Tooling library
that allows easy refactoring across translation units.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157331 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-23 16:29:20 +00:00
Manuel Klimek bfbfee51ec Adds a method overwriteChangedFiles to the Rewriter. This is implemented by
first writing the changed files to a temporary location and then overwriting
the original files atomically.

Also adds a RewriterTestContext to aid unit testing rewrting logic in general.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157260 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-22 17:01:35 +00:00
Manuel Klimek fad7f85553 Adds a unit test for the RecursiveASTVisitor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155108 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-19 08:48:53 +00:00
Manuel Klimek cb971c6726 Adds a tooling library.
Provides an API to run clang tools (FrontendActions) as standalone tools,
or repeatedly in-memory in a process. This is useful for unit-testing,
map-reduce style applications, source transformation daemons or command line
tools.

The ability to run over multiple translation units with different command
line arguments enables building up refactoring tools that need to apply
transformations across translation unit boundaries.

See tools/clang-check/ClangCheck.cpp for an example.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154008 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-04 12:07:46 +00:00
Argyrios Kyrtzidis 19d5aea478 Add unit testing for Lexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148478 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-19 15:59:01 +00:00
Argyrios Kyrtzidis d7711ec430 For SourceManager::isBeforeInTranslationUnit(), have it consider macro arg expanded
token locations as coming before the closing ')' of a function macro expansion.

Include a unit test for SourceManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147056 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-21 16:56:29 +00:00
Richard Smith 08d6e032a2 C++11 constexpr: Add note stacks containing backtraces if constant evaluation
fails within a call to a constexpr function. Add -fconstexpr-backtrace-limit
argument to driver and frontend, to control the maximum number of notes so
produced (default 10). Fix APValue printing to be able to pretty-print all
APValue types, and move the testing for this functionality from a unittest to
a -verify test now that it's visible in clang's output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146749 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-16 19:06:07 +00:00
Jeffrey Yasskin 5b106a872d Define DiagnosticBuilder<<APValue so it's easy to include APValues in
diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135398 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 16:43:53 +00:00
Manuel Klimek 16f213142f Reverts the Tooling changes as requested by Chris.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132462 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-02 16:58:33 +00:00
Manuel Klimek 64cbdf3709 This patch implements an AST matching framework that allows to write
tools that match on the C++ ASTs. The main interface is in ASTMatchers.h,
an example implementation of a tool that removes redundant .c_str() calls
is in the example RemoveCStrCalls.cpp.

Various contributions:
Zhanyong Wan, Chandler Carruth, Marcin Kowalczyk, Wei Xu, James Dennett.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132374 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-31 23:49:32 +00:00
Oscar Fuentes c5cd252aba Handle gcc-compatible compilers (such as clang) the same way we handle
gcc.

Fixes PR9886.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131182 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-11 13:53:30 +00:00
Manuel Klimek 9a05fa97df This is the next step in building the standalone tools infrastructure:
This patch simplifies writing of standalone Clang tools. As an
example, we add clang-check, a tool that runs a syntax only frontend
action over a .cc file. When you integrate this into your favorite
editor, you get much faster feedback on your compilation errors, thus
reducing your feedback cycle especially when writing new code.

The tool depends on integration of an outstanding patch to CMake to
work which allows you to always have a current compile command
database in your cmake output directory when you set
CMAKE_EXPORT_COMPILE_COMMANDS.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130306 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-27 16:39:14 +00:00
Manuel Klimek cf3ce5d896 Adds a function to run FrontendActions over in-memory code. This is
the first step towards a standalone Clang tool infrastructure.
The plan is to make it easy to build command line tools that run over
the AST of source files in a project outside of the build system.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129924 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-21 18:37:41 +00:00
Oscar Fuentes a3f787c32b Put targets on folders, if the IDE supports the feature.
Requires CMake 2.8.3 or newer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126094 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-20 22:06:44 +00:00
Jeffrey Yasskin f91ae524c0 Use PARSE_ARGUMENTS to clean up add_clang_unittest's calling convention.
It would be nice to propagate this into the other functions to replace
LLVM_LINK_COMPONENTS and friends, but I don't plan to do that.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126032 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-19 18:06:01 +00:00
Jeffrey Yasskin effc48d217 Remove support and mc from the clang unittests' dependencies because they're not
needed or provided by the libraries under test.

The next step is to import http://www.itk.org/Wiki/CMakeMacroParseArguments to
make the empty string parameter unnecessary.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126024 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-19 06:07:17 +00:00
Peter Collingbourne 906c73ffbc Move CompilerInstance::LLVMContext and LLVMContext ownership to CodeGenAction
This removes the final dependency edge from any lib outside of CodeGen
to core.  As a result we can, and do, trim the dependency on core
from libclang, PrintFunctionNames, the unit tests and c-index-test.
While at it, review and trim other unneeded dependencies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125820 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18 02:25:12 +00:00
Zhanyong Wan c515d18023 Adds a CMake target for the Basic lib's unit tests. Reviewed by
jyasskin and chapuni.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125657 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-16 05:45:20 +00:00
Zhanyong Wan 05cb9f2d61 Improves CMakeLists.txt for Clang's unit tests: make "linked
components" and "used libs" arguments of add_clang_unittest().
Reviewed by jyasskin and chapuni.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125652 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-16 05:19:17 +00:00
Jeffrey Yasskin 718b01d077 Add CMake support to the clang unittests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125561 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-15 07:54:28 +00:00