Commit Graph

765 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis b0b336ebe9 [libclang] Fix indexing type alias declarations. rdar://11878406
llvm-svn: 163072
2012-09-01 19:08:08 +00:00
Argyrios Kyrtzidis da188de2b6 [libclang] The annotation of tokens operation visits statement nodes code-recursively.
This can blow the stack with extremely deep hierarchies. Switch it to data-recursive.

This is implemented by introducing a post-children visitation callback that the
CursorVisitor is calling after child nodes of a cursor have been visited.
This is used by the annotate-tokens visitor to do extra work at that point.

rdar://11979525.

llvm-svn: 163071
2012-09-01 18:27:30 +00:00
Nico Weber 723b4f02a7 Reland r160052: Default to -std=c++11 on Windows.
Also update the tests that rely on c++98 to explicitly mention that.

llvm-svn: 162890
2012-08-30 02:08:31 +00:00
Dmitri Gribenko 557a8d568b Merging consecutive comments: be more conservative.
Should fix part 2 of PR13374.

llvm-svn: 162723
2012-08-28 01:20:53 +00:00
Argyrios Kyrtzidis 71c85b6a87 [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

llvm-svn: 162715
2012-08-28 00:04:23 +00:00
Argyrios Kyrtzidis 079ff5c6da [libclang] c-index-test: Make the printing of the overrides list of a cursor in
a deterministic order, to avoid random test failures.

llvm-svn: 162408
2012-08-22 23:15:52 +00:00
Dmitri Gribenko 90631809cb Attaching comments to declarations: when documentation is requested for an
implicit instantiation, look for documentation attached to the template.

llvm-svn: 162371
2012-08-22 17:44:32 +00:00
Dmitri Gribenko 75eea89920 CommentBriefParser: allow paragraphs to be separated by line of whitespace.
Skip paragraphs that contain only whitespace.

llvm-svn: 162315
2012-08-21 21:15:34 +00:00
Jordan Rose 517fdc7a2d Use -fobjc-runtime=macosx10.7 instead of obsolete -fobjc-runtime-has-weak.
This should unbreak the buildbots (r162220).

llvm-svn: 162232
2012-08-20 21:55:33 +00:00
Jordan Rose 53cb2f327a Code-complete 'weak' for properties under ARC-with-weak-references (or GC)
Also, suggest 'readonly' even if the property has been given an ownership
attribute ('strong', 'weak', etc). This is used when properties are declared
readonly in the public interface but readwrite in a class extension.

<rdar://problem/11500004&11932285>

llvm-svn: 162220
2012-08-20 20:01:13 +00:00
Douglas Gregor e3eb777415 Make the spacing of the code completion result for NSDictionary
literals match the spacing introduced by the ObjC modernizer. Fixes
the rest of <rdar://problem/11889572>.

llvm-svn: 162084
2012-08-17 05:40:05 +00:00
Douglas Gregor cda209a944 When we need the complete set of visible declarations from a
declaration context, check whether the primary context---not the
current context---has any external visible declarations. Fixes
PR13616.

llvm-svn: 162083
2012-08-17 05:26:33 +00:00
Douglas Gregor 5d944dbf1a Don't do jump-scope checking when code completion is enabled. It's
both a waste of time, and prone to crash due to the use of the
error-recovery path in parser. Fixes <rdar://problem/12103608>, which
has been driving me nuts.

llvm-svn: 162081
2012-08-17 05:12:08 +00:00
Dmitri Gribenko a43ec186a4 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.

llvm-svn: 161722
2012-08-11 00:51:43 +00:00
Dmitri Gribenko bacbc08b98 Remove absolute file path in test.
llvm-svn: 161602
2012-08-09 18:35:49 +00:00
Dmitri Gribenko ba7aca3b38 Comment to HTML and XML conversion: ignore commands that contain a declaration
as their argument.  For example, \fn, \function, \typedef, \method, \class etc.

llvm-svn: 161601
2012-08-09 18:20:29 +00:00
Dmitri Gribenko dcbc8ce2b5 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.

llvm-svn: 161596
2012-08-09 17:33:20 +00:00
Dmitri Gribenko 6cffc1928a Comment XML: use xml:space="preserve" in Verbatim tags, so that XML tidy does
not compress spaces in verbatim content.

llvm-svn: 161531
2012-08-08 22:10:24 +00:00
Dmitri Gribenko 168d23414a Comment AST: DeclInfo: add a special kind for enums.
Comment XML: add a root node kind for enums.

llvm-svn: 161442
2012-08-07 18:59:04 +00:00
Dmitri Gribenko 94ef6357ca Comment AST: treat enumerators as "variables" in DeclInfo.
llvm-svn: 161435
2012-08-07 18:12:22 +00:00
Dmitri Gribenko 740c0fbe0e 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!

llvm-svn: 161431
2012-08-07 17:54:38 +00:00
Dmitri Gribenko 58e4131995 Comment to HTML conversion: correct typo in CSS class name: taram -> tparam
llvm-svn: 161145
2012-08-01 23:47:30 +00:00
Dmitri Gribenko 307cf89b19 Comment to HTML conversion: skip \tparam commands with whitespace paragraphs
llvm-svn: 161096
2012-08-01 00:48:00 +00:00
Dmitri Gribenko 7c0456f91b Comment to HTML conversion: escape HTML special characters in command arguments
llvm-svn: 161094
2012-08-01 00:21:12 +00:00
Dmitri Gribenko 34df220410 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.

llvm-svn: 161087
2012-07-31 22:37:06 +00:00
Douglas Gregor 2d8db8fe7a Tweak code-completion heuristics deciding between a lambda
code-completion and an Objective-C message send, based on Jordan's
feedback.

llvm-svn: 161049
2012-07-31 15:27:48 +00:00
Douglas Gregor 721b14d1b3 When we encounter a code-completion token while parsing an ill-formed
lambda-introducer in Objective-C++11, fall back to treating the tokens
as an Objective-C message send to provide those (more likely)
completions. Fixes <rdar://problem/11980263>.

llvm-svn: 161015
2012-07-31 00:50:07 +00:00
Dmitri Gribenko 4586df765e Implement resolving of HTML character references (named: &amp;, decimal: &#42;,
hex: &#x1a;) during comment parsing.

Now internal representation of plain text in comment AST does not contain
character references, but the characters themselves.

llvm-svn: 160891
2012-07-27 20:37:06 +00:00
Dmitri Gribenko 6b375193a2 libclang comment to HTML rendering: \result is the same as \returns
llvm-svn: 160738
2012-07-25 17:14:58 +00:00
Dmitri Gribenko 378458d597 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.

llvm-svn: 160638
2012-07-23 19:41:49 +00:00
Dmitri Gribenko d73e4ce992 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.

llvm-svn: 160633
2012-07-23 16:43:01 +00:00
Dmitri Gribenko 4c6d7a2ed2 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.

llvm-svn: 160595
2012-07-21 01:47:43 +00:00
Dmitri Gribenko 5e4fe00e64 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.

llvm-svn: 160577
2012-07-20 21:34:34 +00:00
Dmitri Gribenko 77369eead6 CommentBriefParser: use \returns if we can't find the \brief or just a plain
paragraph.

llvm-svn: 160550
2012-07-20 17:01:34 +00:00
Douglas Gregor 951de307e4 Remove unnecessary spacing around Objective-C object literal code
completions. Fixes <rdar://problem/11889572>.

llvm-svn: 160407
2012-07-17 23:24:47 +00:00
Dmitri Gribenko 3e242d6d3c CommentBriefParser: make \short should equivalent to \brief, per Doxygen manual.
llvm-svn: 160383
2012-07-17 18:35:14 +00:00
Daniel Jasper 3e1a9cf3b8 Add correct parenthesis range to CXXConstructExprs inside
CXXFunctionalCastExprs.

llvm-svn: 160252
2012-07-16 08:05:07 +00:00
Dmitri Gribenko 44cd7e6746 Restrict the set of declaration kinds for which we allow trailing comments.
llvm-svn: 159878
2012-07-06 23:27:33 +00:00
Argyrios Kyrtzidis b6df682194 [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

llvm-svn: 159627
2012-07-02 23:54:36 +00:00
Dmitri Gribenko 3292d06a1b 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).

llvm-svn: 159539
2012-07-02 17:35:10 +00:00
Arnaud A. de Grandmaison 0fe28a1a84 [libclang] add CompilationDatabase support
llvm-svn: 159484
2012-06-30 11:27:57 +00:00
Dmitri Gribenko 0743f94671 Cleanup \brief comment. Since it is a single paragraph, no need to save newlines there.
llvm-svn: 159325
2012-06-28 01:38:21 +00:00
Dmitri Gribenko a1e9c8e783 Teach \brief parser about commands that start a new paragraph implicitly
llvm-svn: 159309
2012-06-28 00:01:41 +00:00
Dmitri Gribenko 7e8729b904 Attaching documentation comments to declarations: don't attach a comment to a declaration if there is a preprocessor directive between them.
llvm-svn: 159305
2012-06-27 23:43:37 +00:00
Dmitri Gribenko 8fcf0e7870 Add a test for unterminated /* comments.
llvm-svn: 159267
2012-06-27 16:05:49 +00:00
Dmitri Gribenko 5188c4b9cc Implement a lexer for structured comments.
llvm-svn: 159223
2012-06-26 20:39:18 +00:00
Dmitri Gribenko 923074016b Handle include directive with comments. It turns out that in this case comments are not coming in source order. Instead of trying to std::sort() comments (which can be costly), just remove comments that are not in order.
llvm-svn: 158940
2012-06-21 22:04:37 +00:00
Dmitri Gribenko aab8383a2b 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

llvm-svn: 158771
2012-06-20 00:34:58 +00:00
Argyrios Kyrtzidis 33b4bfcef5 [AST/libclang] Fix the selector locations that are reported for a
method definition that has its '{' attached to the method name without
a space.

With a method like:

-(id)meth{
.....
}

the logic in ObjCMethodDecl that determined the selector locations got
confused because it was initialized based on an end location for '{' but
that end location changed to '}' after the method was finished.

Fix this by having an immutable end location for the declarator and
for getLocEnd() get the end location from the body itself.

Fixes rdar://11659739.

llvm-svn: 158583
2012-06-16 00:46:02 +00:00
Jordan Rose 9da05858b4 [completion] Add completions for @"..." and @(...), and tidy up @[] and @{}.
Specifically, @[] and @{} didn't have a type associated with them; we now
use "NSArray *" and "NSDictionary *", respectively. @"" has the type
"NSString *". @(), unfortunately, has type "id", since it (currently) may
be either an NSNumber or an NSString.

Add a test for all the Objective-C at-expression completions.

<rdar://problem/11507708&11507668&11507711>

llvm-svn: 158533
2012-06-15 18:19:56 +00:00