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

2354 Коммитов

Автор SHA1 Сообщение Дата
Michael Liao 6422149364 Fix C++ comment in C source
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162887 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-30 00:45:32 +00:00
Ted Kremenek be92debbf1 Use double instead of single quote to expand .
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162830 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-29 07:22:34 +00:00
Ted Kremenek 92daae0186 Fix passing of -analyzer-max-loop from scan-build to clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162765 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-28 16:48:48 +00:00
Argyrios Kyrtzidis c178d76c02 [libclang] When determining the cursor via a location, ignore synthesized ivars otherwise
if we have something like:

   @synthesize prop = _prop;

and '_prop' is not declared, we will encounter a '_prop' ivar before
encountering the 'prop' synthesize declaration and we will think that
we passed the region-of-interest, missing the cursor for 'prop'.

rdar://12172700

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162715 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-28 00:04:23 +00:00
Chad Rosier 5c7f59445a [ms-inline asm] Rename getClobber to getClobberStringLiteral. No functional
change intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162710 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-27 23:28:41 +00:00
Ted Kremenek 5a3581daf2 Change --with-analyzer to --use-analyzer, per sage feedback from Jordan.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162640 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-25 05:24:46 +00:00
Chad Rosier df5faf5e7a [ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162632 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-25 00:11:56 +00:00
Ted Kremenek 0d3a3fd721 Fix a few issues related to -with-analyzer reported by Jordan. Let's
have the option with two '--' to be consistent with other options.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162625 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 23:42:58 +00:00
Ted Kremenek 810e6229e5 Rework how scan-build picks the version of clang to use for static analysis.
Unless the user specifies, the clang used for static analysis is the one
found relative to scan-build.

If the user specifies -with-analyzer, they can pick either to use
the clang bundled with Xcode (via xcrun) or they can specify
a path to clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162620 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 23:08:08 +00:00
Ted Kremenek eaafdfc7b4 Reformat help text for scan-build, and remove -constraints
and -store from help text because they are no longer relevant
to users.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162619 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 23:08:06 +00:00
Ted Kremenek 73078642d3 Revert "Go ahead and show experimental checkers in the scan-build "-h" output."
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162587 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 20:39:38 +00:00
Ted Kremenek 160b3a5460 Go ahead and show experimental checkers in the scan-build "-h" output.
They are labeled as not being enabled-by-default, and how else
are users going to test them.

Fixes <rdar://problem/11654923>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162543 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 06:49:34 +00:00
Ted Kremenek 56fd9084b1 On OS X, use xcrun (if present) to find the clang to use for static analysis if
no clang can be found relative to the location of scan-build.

Fixes <rdar://problem/11691794>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162535 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 04:53:06 +00:00
Alexander Kornienko 6fbe982bb4 Updated LibTooling.html, minor improvements in CommonOptionsParser
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162521 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 00:39:14 +00:00
Jordan Rose c629ad4706 [scan-build] Accept -fno-objc-arc as well as -fobjc-arc.
This is how Xcode lets individual files be marked as non-ARC when the rest
of the project is ARC-enabled, so this is necessary for scan-build xcodebuild.

Patch by Paul Eipper!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162497 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-23 23:16:34 +00:00
Dmitri Gribenko 70517ca5c0 Fix a bunch of -Wdocumentation warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162452 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-23 17:58:28 +00:00
Argyrios Kyrtzidis b3dd988abd [libclang] c-index-test: Make the printing of the overrides list of a cursor in
a deterministic order, to avoid random test failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162408 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-22 23:15:52 +00:00
Alexander Kornienko d7166b01df Reverted clang-check to fully supported CommandLine Library use-case: global
static variables.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162391 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-22 20:52:52 +00:00
Alexander Kornienko 4846470d20 Implemented -ast-dump, -ast-print, -ast-dump-filter options in clang-check
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161753 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-13 10:50:08 +00:00
Dmitri Gribenko f50555eede Attaching comments to declarations: find comment attached to any redeclaration
Not only look for the comment near the declaration itself, but also walk the
redeclaration chain: the previous declaration might have had a documentation
comment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161722 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-11 00:51:43 +00:00
Benjamin Kramer d1a4f68a43 Fix a couple of pedantic gcc warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161656 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 10:06:13 +00:00
NAKAMURA Takumi a59114bc19 c-arcmt-test, c-index-test: Appease Cygwin, to link to libclang.a, not clang.dll.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161655 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 06:10:58 +00:00
Chandler Carruth 20316a948e Temporarily revert r161612 while we figure out just what the semantics
of PARALLEL_DIRS are. They apparantly aren't what either Nick, Eric, or
I thought. ;] Should let the bots make forward progress.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161618 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09 21:02:52 +00:00
Chandler Carruth 86073673d0 Make all of the tools build in parallel. Missing this caused incremental
rebuilds to serially link each tool, which is really really slow.

We still have to build libclang serially first because c-index-test
depends on it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161612 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09 20:40:24 +00:00
Chandler Carruth af310b1c7e Recurse into the extra tools repo the correct way from the Makefile
build system. Thanks to Nick for pointing at the actual construct which
should be used here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161609 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09 20:21:38 +00:00
Dmitri Gribenko 62290ae569 Comment to HTML and XML conversion: ignore commands that contain a declaration
as their argument.  For example, \fn, \function, \typedef, \method, \class etc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161601 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09 18:20:29 +00:00
Dmitri Gribenko d1db12540e Comment to HTML and XML conversion: use CommandTraits to classify commands.
This also fixes a bug in comment to XML conversion: \result was just an
ordinary paragraph, not an alias for \returns.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161596 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09 17:33:20 +00:00
Chad Rosier 1a5d421c26 [ms-inline asm] Add various MC components to clang build to support MS-style inline assembly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161594 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09 17:17:01 +00:00
Chandler Carruth 2689a080a8 Allow the Makefile build system to find the extra repo if it is checked
out.

Unfortunately, the existing makefiles for the extra repo don't specify
the correct library dependencies. Fixing that next. If you're following
along, you'll get linker errors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161549 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09 00:05:27 +00:00
Dmitri Gribenko 6cd4420945 Comment XML: use xml:space="preserve" in Verbatim tags, so that XML tidy does
not compress spaces in verbatim content.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161531 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 22:10:24 +00:00
Chad Rosier fa1d30ddb1 Add various MC components to clang build to support MS-style inline assembly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161498 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 16:27:29 +00:00
Ted Kremenek 6e53137f44 Teach ccc-analyze about -fobjc-legacy-dispatch and -mios-simulator-version-min
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161443 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 19:27:08 +00:00
Dmitri Gribenko cff339a60a Comment AST: DeclInfo: add a special kind for enums.
Comment XML: add a root node kind for enums.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161442 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 18:59:04 +00:00
Dmitri Gribenko 67bf7dd9fa c-index-test Makefile: fix build on Linux. Reviewed by Eric Christopher.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161439 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 18:36:33 +00:00
Dmitri Gribenko f303d4cb10 libclang API for comment-to-xml conversion.
The implementation also includes a Relax NG schema and tests for the schema
itself.  The schema is used in c-index-test to verify that XML documents we
produce are valid.  In order to do the validation, we add an optional libxml2
dependency for c-index-test.

Credits for CMake part go to Doug Gregor.  Credits for Autoconf part go to Eric
Christopher.  Thanks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161431 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 17:54:38 +00:00
Chandler Carruth 5d435b6001 Initial support for recursing into the new clang-tools-extra repository
if checked out under clang/tools/extra.

This is mostly so folks other than me can start to test. Documentation,
details, and an announcement are still in the works.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161405 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 08:37:42 +00:00
Ted Kremenek cbea860417 scan-build: factor out setting of environment variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161343 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 20:19:19 +00:00
Ted Kremenek 38447a4079 Pull 'xcodebuild' wrapper logic into a separate function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161330 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 18:54:19 +00:00
Dmitri Gribenko 6a425525e5 Comment to HTML conversion: correct typo in CSS class name: taram -> tparam
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161145 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-01 23:47:30 +00:00
Dmitri Gribenko 2ff84b514e Comment to HTML conversion: refactor. Extracted a class to for FullComment
semantic parts -- this will be reused for comment to XML conversion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161139 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-01 22:48:16 +00:00
Dmitri Gribenko f0d151c485 Comment to HTML conversion: skip \tparam commands with whitespace paragraphs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161096 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-01 00:48:00 +00:00
Dmitri Gribenko 59500fec68 Comment to HTML conversion: escape HTML special characters in command arguments
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161094 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-01 00:21:12 +00:00
Dmitri Gribenko 96b0986749 Comment parsing: add support for \tparam command on all levels.
The only caveat is renumbering CXCommentKind enum for aesthetic reasons -- this
breaks libclang binary compatibility, but should not be a problem since API is
so new.

This also fixes PR13372 as a side-effect.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161087 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-31 22:37:06 +00:00
David Blaikie 0bc35e9e48 Include clang-check as part of the clang installation.
This also tidies up a couple of other tools we were (partially) installing:
* c-index-test was being installed but shouldn't be (it's just a clang-dev tool)
* diagtool was being installed in cmake but not make (& shouldn't be installed in either)

Review by Manuel Klimek, Doug Gregor, and Chandler Carruth.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161073 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-31 20:29:59 +00:00
Dmitri Gribenko e5db09cf67 Move comment from member operator() to class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160980 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30 19:47:34 +00:00
Dmitri Gribenko 74edbd4edf c-index-test: remove dead store. Found by Clang static analyzer!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160974 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30 18:00:35 +00:00
Dmitri Gribenko 221a6d74d4 Add missing include for Linux buildbot
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160971 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30 17:49:32 +00:00
Dmitri Gribenko b740316a12 Add an assert to ParamCommandComment::getParamIndex() -- it should not be
called unless index is valid.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160970 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30 17:38:19 +00:00
Arnaud A. de Grandmaison 9369d4f930 [scan-build] Fix clang++ pathname
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160871 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-27 17:10:06 +00:00
NAKAMURA Takumi 3eb3755949 libclang, examples: [CMake] Add dependencies to tblgen'd headers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160849 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-27 06:17:56 +00:00
Alexander Kornienko 77b1ae5656 Removed standalone clang-ast-dump tool.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160772 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 01:44:18 +00:00
Dmitri Gribenko 2c6b00e712 libclang comment to HTML rendering: \result is the same as \returns
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160738 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-25 17:14:58 +00:00
Dmitri Gribenko 1f8c529a2a libclang comments AST: clang_ParamCommandComment_getParamName: don't assert
when a \param command does not have a parameter name, just return an empty
string instead.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160638 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 19:41:49 +00:00
Dmitri Gribenko 2d66a5016d Comment AST: add InlineContentComment::RenderKind to specify a default
rendering mode for clients that don't want to interpret Doxygen commands.

Also add a libclang API to query this information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160633 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 16:43:01 +00:00
Dmitri Gribenko 3e63d332ba Comment to HTML conversion: add more CSS classes to identify function arguments
by index.  This is useful if the user does not document all arguments, and we
can't find a particular argument by index via :nth-of-type() CSS selector.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160595 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 01:47:43 +00:00
Dmitri Gribenko 5ef6ea5c69 Fix c-index-test to compile as C89.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160582 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 22:00:35 +00:00
Dmitri Gribenko ae99b75fbb Add libclang APIs to walk comments ASTs and an API to convert a comment to an
HTML fragment.

For testing, c-index-test now has even more output:
* HTML rendering of a comment
* comment AST tree dump in S-expressions like Comment::dump(), but implemented
* with libclang APIs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160577 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 21:34:34 +00:00
NAKAMURA Takumi 675a4e1afe CMake: clang should depend on clang-headers, or bin/clang would not work better.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160549 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 16:40:09 +00:00
NAKAMURA Takumi df9b933aa3 [Win32] Rework crash-report since r145389.
- lib/Driver/Driver.cpp, tools/driver/driver.cpp: Exit status should not be propagated, although clang driver should catch exceptions.
  - test/Driver/crash-report.c: Add REQUIRES:shell for now.
    FIXME: setenv should work also on Lit.InternalShellRunner.
  - test/Driver/crash-report.c: Remove XFAIL.

Thanks to Chad, To point out the issue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160343 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17 05:09:29 +00:00
Dmitri Gribenko b619e7877f Move clang_Cursor_getBriefCommentText implementation under `extern "C"'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160331 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17 00:17:45 +00:00
Ted Kremenek b8971b2781 Add hack (provided by Jonathan Sauer) to fall back to assuming Xcode is installed in /Developer
when using Python < 2.7.0.  This is the case on Snow Leopard, where the tools are always
installed in /Developer.  This isn't a proper fix for really figuring out where Xcode
is installed, but should work to fix an obvious problem on Snow Leopard.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160321 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 21:39:29 +00:00
Alexander Kornienko dea8fba3c6 The new clang-ast-dump tool for selective AST dumping. Moved common command-line tool stuff to CommandLineClangTool
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160265 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 12:46:48 +00:00
Alexander Kornienko 140d513043 Updated -help message in clang-check.
Summary: Provide more information on usage in -help

Test Plan: ran once

Reviewers: klimek, chandlerc, djasper

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D5

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160132 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 14:34:23 +00:00
Dmitri Gribenko a5ef44ff5d Enable comment parsing and semantic analysis to emit diagnostics. A few
diagnostics implemented -- see testcases.

I created a new TableGen file for comment diagnostics,
DiagnosticCommentKinds.td, because comment diagnostics don't logically
fit into AST diagnostics file.  But I don't feel strongly about it.

This also implements support for self-closing HTML tags in comment
lexer and parser (for example, <br />).

In order to issue precise diagnostics CommentSema needs to know the
declaration the comment is attached to.  There is no easy way to find a decl by 
comment, so we match comments and decls in lockstep: after parsing one
declgroup we check if we have any new, not yet attached comments.  If we do --
then we do the usual comment-finding process.

It is interesting that this automatically handles trailing comments.
We pick up not only comments that precede the declaration, but also
comments that *follow* the declaration -- thanks to the lookahead in
the lexer: after parsing the declgroup we've consumed the semicolon
and looked ahead through comments.

Added -Wdocumentation-html flag for semantic HTML errors to allow the user to 
disable only HTML warnings (but not HTML parse errors, which we emit as
warnings in -Wdocumentation).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160078 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 21:38:39 +00:00
Argyrios Kyrtzidis ff398965a5 Introduce a flag in SourceManager to treat non-system source files
as "volatile", meaning there's a high enough chance that they may
change while we are trying to use them.

This flag is only enabled by libclang.
Currently "volatile" source files will be stat'ed immediately
before opening them, because the file size stat info
may not be accurate since when we got it (e.g. from the PCH).
This avoids crashes when trying to reference mmap'ed memory
from a file whose size is not what we expect.

Note that there's still a window for a racing issue to occur
but the window for it should be way smaller than before.
We can consider later on to avoid mmap completely on such files.

rdar://11612916

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160074 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 20:59:04 +00:00
Daniel Jasper d217a66ef5 Fix usage instructions for clang-check.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160048 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 15:05:24 +00:00
Arnaud A. de Grandmaison 4187df5f7b Adds support for auto-detection of compilation databases, looking in a directory and all its parents.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159998 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-10 16:56:35 +00:00
Manuel Klimek 8fa2fb859a Adds support for auto-detection of compilation databases
from a source file and changes clang-check to make use of this.

This makes clang-check just work on in-tree builds, and allows
easy setup via a symlink per source directory to make clang-check
work without any extra configuration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159990 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-10 13:10:51 +00:00
Ted Kremenek a437b84765 Enhance 'diagtool list-warnings' to report number of diagnostics covered directly under -Wpedantic, and enhance warning-flags.c test to test that this set does not grow.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159893 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 06:30:31 +00:00
Ted Kremenek e8cf7d1434 Re-apply r159875 with fixes.
- Split pedantic driver flag test into separate test file, and XFAIL on cygwin,mingw32
- Fix bug in tablegen logic where a missing '{' caused errors to be included in -Wpedantic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159892 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 05:53:30 +00:00
NAKAMURA Takumi 3b4c532596 Revert rr159875, "Implement -Wpedantic and --no-pedantic to complement -Weverything." It broke several builds.
I suspect FileCheck might match assertion failure, even if clang/test/Misc/warning-flags.c passed the test.

> 0. Program arguments: bin/./clang -### -pedantic -Wpedantic clang/test/Driver/warning-options.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159886 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 02:48:02 +00:00
Ted Kremenek 25570a94ca Implement -Wpedantic and --no-pedantic to complement -Weverything.
This patch introduces some magic in tablegen to create a "Pedantic" diagnostic
group which automagically includes all warnings that are extensions.  This
allows a user to suppress specific warnings traditionally under -pedantic used
an ordinary warning flag.  This also allows users to use #pragma to silence
specific -pedantic warnings, or promote them to errors, within blocks of text
(just like any other warning).

-Wpedantic is NOT an alias for -pedantic.  Instead, it provides another way
to (a) activate -pedantic warnings and (b) disable them.  Where they differ
is that -pedantic changes the behavior of the preprocessor slightly, whereas
-Wpedantic does not (it just turns on the warnings).

The magic in the tablegen diagnostic emitter has to do with computing the minimal
set of diagnostic groups and diagnostics that should go into -Wpedantic, as those
diagnostics that already members of groups that themselves are (transitively) members
of -Wpedantic do not need to be included in the Pedantic group directly.  I went
back and forth on whether or not to magically generate this group, and the invariant
was that we always wanted extension warnings to be included in -Wpedantic "some how",
but the bookkeeping would be very onerous to manage by hand.

-no-pedantic (and --no-pedantic) is included for completeness, and matches many of the
same kind of flags the compiler already supports.  It does what it says: cancels out
-pedantic.  One discrepancy is that if one specifies --no-pedantic and -Weverything or
-Wpedantic the pedantic warnings are still enabled (essentially the -W flags win).  We
can debate the correct behavior here.

Along the way, this patch nukes some code in TextDiagnosticPrinter.cpp and CXStoredDiagnostic.cpp
that determine whether to include the "-pedantic" flag in the warning output.  This is
no longer needed, as all extensions now have a -W flag.

This patch also significantly reduces the number of warnings not under flags from 229
to 158 (all extension warnings).  That's a 31% reduction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159875 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 23:07:31 +00:00
Richard Smith e07c5f897e Fix some memory leaks found by the static analyzer. Thanks to John Smith for running it over Clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159732 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-05 08:20:49 +00:00
Arnaud A. de Grandmaison c70851b74c [libclang] CompilationDatabase naming and comment fixes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159682 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-03 20:38:12 +00:00
Argyrios Kyrtzidis f39a7aea7d [libclang] Introduce clang_Cursor_isDynamicCall which,
given a cursor pointing to a C++ method call or an ObjC message,
returns non-zero if the method/message is "dynamic", meaning:

  For a C++ method: the call is virtual.
  For an ObjC message: the receiver is an object instance, not 'super' or a
  specific class.

rdar://11779185

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159627 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-02 23:54:36 +00:00
Dmitri Gribenko d99ef536b2 Add a new libclang completion API to get brief documentation comment that is
attached to a declaration in the completion string.

Since extracting comments isn't free, a new code completion option is
introduced.

A new code completion option that enables including brief comments
into CodeCompletionString should be a, err, code completion option.
But because ASTUnit caches global declarations during parsing before
even completion consumer is created, the option is duplicated as a
translation unit option (in both libclang and ASTUnit, like the option
to cache code completion results).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159539 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-02 17:35:10 +00:00
NAKAMURA Takumi e7e9332a0c c-index-test/Makefile: Tweak USEDLIBS for cygwin. cygclang.dll is not linked to c-index-test yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159499 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-01 00:40:17 +00:00
Arnaud A. de Grandmaison 685d78d0da [libclang] Make implementation filename match the header's name for CXCompilationDatabase
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159493 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-30 20:43:43 +00:00
Arnaud A. de Grandmaison e27537d2cf [libclang] Fix autoconf library dependencies for tooling support
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159490 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-30 12:49:09 +00:00
NAKAMURA Takumi 0fb474a932 c-index-test.c: Fix missing semicolon(s).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159486 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-30 11:47:18 +00:00
Arnaud A. de Grandmaison db29318326 [libclang] add CompilationDatabase support
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159484 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-30 11:27:57 +00:00
Argyrios Kyrtzidis 3791814b2c [libclang] Don't bind a StringRef to a temporary std::string object.
It may end up pointing at garbage.

Fixes the MSVC debug build. rdar://11703319

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159377 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-28 21:03:08 +00:00
Dmitri Gribenko 8376f5934a Remove redundant check.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159355 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-28 16:25:36 +00:00
Dmitri Gribenko 2d44d77fed Implement a lexer for structured comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159223 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-26 20:39:18 +00:00
Jordan Rose 19bf662a7c [diagtool] Appease buildbots by explicitly using makeArrayRef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159095 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-24 00:27:36 +00:00
Jordan Rose e742763676 [diagtool] Add a new "tree" command to shows warnings activated by a flag.
% diagtool tree -Wunused-value
-Wunused-value
  -Wunused-comparison
    warn_unused_comparison
  -Wunused-result
    warn_unused_result
  warn_unused_call
  warn_unused_container_subscript_expr
  warn_unused_expr
  warn_unused_property_expr
  warn_unused_voidptr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159093 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-24 00:07:45 +00:00
Anna Zaks 1e548f12f7 [analyzer]scan-build: report the total number of steps analyzer performs
This would be useful to investigate performance issues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159038 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-22 22:08:12 +00:00
Jordan Rose 0764573a17 [diagtool] Write to llvm::outs() by default instead of llvm::errs()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158954 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-22 00:33:20 +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 f95d4125c0 Fix a big layering violation introduced by r158771.
That commit added a new library just to hold the RawCommentList. I've
started a discussion on the commit thread about whether that is really
meritted -- it certainly doesn't seem necessary at this stage.

However, the immediate problem is that the AST library has a hard
dependency on the Comment library, but the dependencies were set up
completely backward. In addition to the layering violation, this had an
unfortunate effect if scattering the Comments library dependency
throughout the build system, but inconsistently so -- several parts of
the CMake dependencies were missing and only showed up due to transitive
deps or the fact that the target wasn't being built by tho bots.

It turns out that the Comments library can't (currently) be a well
formed layer *below* the AST library either, as it has an API that
accepts an ASTContext. That parameter is currently unused, so maybe that
was a mistake?

Anyways, it really seems like this is logically part of the AST --
that's the whole point of the ASTContext providing access to it as far
as I can tell -- so I've merged it into the AST library to solve the
immediate layering violation problems and remove some of the churn from
our library dependencies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158807 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-20 09:53:52 +00:00
Rafael Espindola e3bbfcae61 Fix cmake build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158782 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-20 01:18:08 +00:00
Dmitri Gribenko aa0cd85838 Structured comment parsing, first step.
* Retain comments in the AST
* Serialize/deserialize comments
* Find comments attached to a certain Decl
* Expose raw comment text and SourceRange via libclang


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158771 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-20 00:34:58 +00:00
Ted Kremenek c9480dd035 Adjust scan-build to enable color output for xterm-256color.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158735 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19 19:27:28 +00:00
Ted Kremenek 3065cf9ecc Sink definition of IBOutlet, IBOutletCollection, and IBAction into
the compiler predefines buffer.  These are essentially part of
the Objective-C language.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158690 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19 00:37:39 +00:00
Jordan Rose dceccacff2 Add new tool 'diag-build' for showing enabled warnings in a project.
diag-build acts as a wrapper for 'diagtool show-enabled', in the same way
that scan-build acts as a wrapper for the static analyzer. The common case is
simple: use 'diag-build make' or 'diag-build xcodebuild' to list the warnings
enabled for the first compilation command we see. Other build systems require
you to manually specify "dry-run" and "use $CC and $CXX"; if there is a build
system you are interested in, please add it to the switch statement.

diag-build is fairly stupid right now, but it serves its basic purpose.
Hopefully it can grow to meet any additional requirements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158682 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-18 21:31:37 +00:00
NAKAMURA Takumi 28ba2ee5c5 diagtool/CMakeLists.txt: Add missing tblgen'd dependency, ClangDiagnosticIndexName.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158649 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-17 15:41:44 +00:00
Chad Rosier 8cd64b4c55 Etch out the code path for MS-style inline assembly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158325 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-11 20:47:18 +00:00
Argyrios Kyrtzidis 135bf8ee69 [libclang] When doing the cursor visitation make sure declarations
in the same line do not override getting a cursor for the previous declaration.

e.g:

int x, y;
@synthesize prop1, prop2;

pointing at 'x'/'prop1' would give 'y'/'prop2' because their source ranges overlap.

rdar://11361113

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158258 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-09 03:03:02 +00:00
Argyrios Kyrtzidis 374a00bcc6 [libclang] Don't crash when saving a PCH from a prefix header
that does not exist.

rdar://11607033

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158193 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-08 05:48:06 +00:00
Argyrios Kyrtzidis 390fff8e8b [libclang/AST]
AST: For auto-synthesized ivars give them the location of the related
property (previously they had no source location). This allows them
to be indexed by libclang.

libclang: Make sure synthesized ivars are indexed before the methods that
may reference them.

Fixes rdar://11607001.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158189 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-08 02:16:11 +00:00
Benjamin Kramer 855243789c Plug a long standing memory leak in TemplateArgument.
The integral APSInt value is now stored in a decomposed form and the backing
store for large values is allocated via the ASTContext. This way its not
leaked as TemplateArguments are never destructed when they are allocated in
the ASTContext. Since the integral data is immutable it is now shared between
instances, making copying TemplateArguments a trivial operation.

Currently getting the integral data out of a TemplateArgument requires creating
a new APSInt object. This is cheap when the value is small but can be expensive
if it's not. If this turns out to be an issue a more efficient accessor could
be added.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158150 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-07 15:09:51 +00:00
Francois Pichet a08e7bc74b Zap the /Za compiler switch from MSVC projects, the option is considered harmful even by Microsoft people and clang won't build using the MSVC 2012 RC if not removed.
Only 1 minor code change was necessary: can't use cdecl as variable name anymore.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158063 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-06 12:00:10 +00:00
Jordan Rose e2f705d1bf [diagtool] Properly order libraries in Makefile for buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157934 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-04 17:21:14 +00:00
Jordan Rose 0832f82f76 [diagtool] Re-add show-enabled, minimizing the code pulled in from Frontend.
Now correctly builds with both GNU make and CMake.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157932 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-04 16:57:50 +00:00
Jordan Rose 0a5ca3588d [diagtool] Pull show-enabled back out for now.
Need to figure out how to get Frontend's warning parsing without bringing
in all of Frontend.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157847 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-01 22:23:02 +00:00
Jordan Rose b705489e8e [diagtool] Unbork Makefile build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157846 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-01 22:02:18 +00:00
Jordan Rose 4fab4fdb10 [diagtool] Appease buildbot by adding llvm_unreachable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157843 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-01 21:50:37 +00:00
Jordan Rose f11b0f9a4e [diagtool] Add 'show-enabled', which displays which warnings are enabled.
show-enabled uses the command line you give it to build a CompilerInstance,
so any flags you pass will be processed as if running clang proper.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157842 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-01 21:23:17 +00:00
Jordan Rose 39876df44d [diagtool] The driver skips two arguments, not one.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157841 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-01 21:23:13 +00:00
Benjamin Kramer 28b230723d Replace some custom hash combines with the standard stuff from DenseMapInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157531 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-27 13:28:44 +00:00
Anna Zaks f8e8a3eeff [analyzer] Loading external plugins with scan-build
Load custom plugins when running scan-build. This is useful when
additional static analysis Checkers must be provided via clang's plugin
interface.

Loading additional plugins can now be done via the scan-build call:
scan-build -load-plugin <plugin.so>

A patch by Thomas Hauth.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157452 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-25 01:13:50 +00:00
Ted Kremenek 8db26ce046 New & improved man page attached, now with standard license added.
Plus, a patch for scan-build.  

* mdoc corrections
* slightly more compact output
* same license as scan-build
* DESCRIPTION describes
* Default checkers corrected & explained
* Authors credited

The patch adds support for --help-checkers.  It just lists the default
checkers by recursively invoking "scan-build -h" and looking for the
magic '+' signs.  

Patch by James Lowden!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157411 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-24 20:13:47 +00:00
Argyrios Kyrtzidis 25bd27932a [libclang] Report CXType_ObjCId for 'const id', not CXType_Typedef.
rdar://11357807

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157356 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-23 23:30:16 +00:00
Argyrios Kyrtzidis 87014f33f1 [libclang] Properly handle @encode() in RecursiveASTVisitor and traverse
its type source info. Fixes indexing references inside @encode().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156936 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-16 19:22:47 +00:00
Argyrios Kyrtzidis 7d24e289be [libclang/AST] Index references of protocols in "@protocol(...)" syntax.
To do that, keep track of the location of the protocol id in the ObjCProtocolExpr
AST node.

rdar://11190837

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156890 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-16 00:50:02 +00:00
Douglas Gregor b4882d5092 Add the output of "clang --version" to scan-build results, from Gerald Combs!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156834 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-15 18:41:55 +00:00
Jim Grosbach 92ecfe9c47 Allow MCCodeEmitter access to the target MCRegisterInfo.
Add MRI to the createMCCodeEmitter() call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156830 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-15 17:36:07 +00:00
Manuel Klimek 57daf55d43 This patch fixes the cmake build to create libclang.so/libclang.a on linux
instead of liblibclang.so/liblibclang.a.

Patch by Arnaud de Grandmaison.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156809 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-15 08:58:48 +00:00
Ted Kremenek 33ee15964e Provide a man page for scan-build. Patch by James Lowden!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156559 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-10 19:10:47 +00:00
Argyrios Kyrtzidis 16afdf76b6 Fix an assertion hit when the serialized diagnostics writer receive a diagnostic
from the frontend when the location is invalid and the SourceManager null.

Instead of keeping the SourceManager object in DiagnosticRenderer, propagate it
to the calls accordingly (as reference when it is expected to not be null, or pointer
when it may be null).
This effectively makes DiagnosticRenderer not tied to a specific SourceManager,
removing a hack from TextDiagnosticPrinter.

rdar://11386874

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156536 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-10 05:03:45 +00:00
Argyrios Kyrtzidis e15db6f0d2 [AST/libclang] Speed up clang_getOverriddenCursors() considerably by reserving a bit
in ObjCMethodDecl to indicate whether the method does not override any other method,
which is the majority of cases.

That way we can avoid unnecessary work doing lookups, especially when PCH is involved.

rdar://11360082

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156476 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-09 16:12:57 +00:00
Argyrios Kyrtzidis ae5ac1f5bd [libclang] Map 'id'/'Class'/'SEL' to the corresponding CXType kinds.
rdar://11357807

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156352 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-08 01:22:12 +00:00
Douglas Gregor cc889664de Introduce a new libclang API to determine the platform availability of
a given entity, so that we can tell when the entity was
introduced/deprecated/obsoleted on each platform for which we have an
annotation. Addresses <rdar://problem/11365715>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156347 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-08 00:14:45 +00:00
Argyrios Kyrtzidis 428499e6f5 [libclang] Actually commit the changes to make libclang's RecursiveASTVisitor
data-recursive for statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156339 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-07 23:23:03 +00:00
Argyrios Kyrtzidis 98180d49bd [libclang] Put the RecursiveASTVisitor in libclang in a cxindex namespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156331 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-07 22:22:58 +00:00
Argyrios Kyrtzidis e377d71d81 Un-revert r156142, "[libclang] Bring back BodyIndexer::TraverseCXXOperatorCallExpr".
It was reverted on r156253.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156330 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-07 22:16:49 +00:00
Argyrios Kyrtzidis dec35a9848 [libclang] Use a copy of the data-recursive RecursiveASTVisitor inside libclang.
This is temporary until we settle on how to make the main RecursiveASTVisitor safe.
There are some modifications on the original version, to avoid extreme memory usage
when compiling for release.

rdar://11179167

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156329 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-07 22:16:46 +00:00
NAKAMURA Takumi 2643475c22 Revert r156142, "[libclang] Bring back BodyIndexer::TraverseCXXOperatorCallExpr which"
It caused test/Index/index-many-call-ops.cpp to fail in stage2 c-index-test on selfhosting i686-cygwin and x86_64-linux since r156229 (Reverting making RecursiveASTVisitor data recursive).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156253 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-06 08:24:34 +00:00
Argyrios Kyrtzidis 2e9a44d333 [libclang] Bring back BodyIndexer::TraverseCXXOperatorCallExpr which
was removed in r155969 to address a deficiency of RecursiveASTVisitor
prior to recent changes on it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156142 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-04 01:00:38 +00:00
Richard Smith c8c222830a Unrevert r155951, reverted in r155962, with two changes:
* Work around build failures due to gcc 4.2 bugs.
 * Remove BodyIndexer::TraverseCXXOperatorCallExpr, which was not being called
   prior to this change, and whose presence disables a RecursiveASTVisitor
   stack space optimization after this change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155969 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-02 00:30:48 +00:00
James Molloy bfd7a525bc Unify Options.td and CC1Options.td, in a first step towards unifying the serialization logic in Frontend and Driver.
Reviewed by Eric, Doug and Chandler, and here: http://llvm.org/reviews/r/7/



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155916 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-01 14:57:16 +00:00
Douglas Gregor 8e5900c8e9 clang_getCursorLexicalParent should return a translation unit cursor for declarations at the global scope, from Evan P. Fixes PR9083.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155858 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-30 23:41:16 +00:00
Ted Kremenek 8eece46c54 Fix C versus C++ linkage issue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155842 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-30 19:33:45 +00:00
Ted Kremenek bbf66ca1da Reduce malloc() traffic of clang_getOverridenCursors() by using a pool of SmallVector<CXCursor> objects
under the covers.

Fixes <rdar://problem/11289160>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155841 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-30 19:06:49 +00:00
Chris Lattner 92f4e6e8f9 don't use soname on OpenBSD, it doesn't support it. Patch by
Brad Smith!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155534 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-25 06:09:30 +00:00
Argyrios Kyrtzidis f676608f60 [libclang] Don't set dylib load address to 0xe000000.
Per Greg Clayton:
libclang.dylib is trying to be smart and load itself at a valid address
to be able to load faster which would work for 32 bit systems,
bit won't make any difference on 64 bit systems.
It should either pick a better 64 bit address, or just let itself be loaded at zero.

rdar://11159142

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155246 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-20 22:07:11 +00:00
Chad Rosier 80ec127fc9 Add a little hack to emulate a clang crash, so the diagnostics generator can be
tested.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155205 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-20 17:08:59 +00:00
Patrick Beard eb382ec150 Implements boxed expressions for Objective-C. <rdar://problem/10194391>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155082 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-19 00:25:12 +00:00
Manuel Klimek 30318e6df9 Adds a FixedCompilationDatabase to be able to specify tool parameters
at the command line.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154989 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-18 07:41:50 +00:00
Argyrios Kyrtzidis a9d45a3f42 [libclang] Make sure that when we have multiple @class references in the same line,
that later ones do not override the previous ones.

If we have:
   @class Foo, Bar;
source ranges for both start at '@', so 'Bar' will end up overriding
'Foo' even though the cursor location was at 'Foo'.

rdar://11257578

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154873 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-16 22:42:01 +00:00
Argyrios Kyrtzidis 9482a185d3 [libclang] Spelling range for a objc category should the category name range, not the class one.
rdar://11249386

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154853 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-16 20:01:28 +00:00
Sylvestre Ledru 0740a25e9b Like for LLVM / shlib, we also provide a SONAME to libclang.so
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154779 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-15 23:17:25 +00:00
Anna Zaks f4dd85835b [analyzer] Add .cxx and .txx as known file extensions to ccc-analyzer.
A patch by Sean McBride.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154751 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-14 16:30:00 +00:00
Benjamin Kramer 342742adb6 c-index-test: dispose spelling string after use.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154738 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-14 09:11:51 +00:00
Richard Smith 534986f2b2 Add an AttributedStmt type to represent a statement with C++11 attributes
attached. Since we do not support any attributes which appertain to a statement
(yet), testing of this is necessarily quite minimal.

Patch by Alexander Kornienko!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154723 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-14 00:33:13 +00:00
Douglas Gregor ba8be8c422 Kill the last vestiges of clangIndex
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154675 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-13 17:26:32 +00:00
Erik Verbruggen 6a91d38561 Added a flag to the parser to skip method bodies.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154584 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-12 10:11:59 +00:00
Ted Kremenek 78d5d3bb93 Implement clang_getDiagnosticCategoryText() to provide a way for a client of libclang to accurately
get the diagnostic category name from a serialized diagnostic when the version of libclang used
to read the diagnostic file is newer than the clang that emitted the diagnostic file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154567 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-12 00:03:31 +00:00
Argyrios Kyrtzidis 47f1165c92 [libclang] Apparently it's important to build in C89, sigh..
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154525 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-11 19:54:09 +00:00
Argyrios Kyrtzidis d98ef9ae48 [libclang] Introduce a couple of functions to make it convenient
to get at the parameters (and their types) of a function or objc method cursor.

int clang_Cursor_getNumArguments(CXCursor C);
CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i);

rdar://11201527

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154523 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-11 19:32:19 +00:00