Commit Graph

20 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 153d418def Add '\n' to the end of error message.
llvm-svn: 76506
2009-07-21 00:05:10 +00:00
Argyrios Kyrtzidis d6bf03c272 Introduce ASTLocation::getReferencedDecl(), for getting the declaration that the ASTLocation references.
llvm-svn: 76336
2009-07-18 21:17:58 +00:00
Argyrios Kyrtzidis 05898da9cb Introduce a redecl_iterator in Decl class, so that we can do a "iterate over all declarations of the same decl" without knowing the exact type.
llvm-svn: 76298
2009-07-18 08:50:35 +00:00
Argyrios Kyrtzidis 12563b8111 Handle redeclarations properly at the index-test tool.
llvm-svn: 75605
2009-07-14 03:20:31 +00:00
Argyrios Kyrtzidis e6cd787ee1 For index-test, if the ASTLocation points at a CallExpr, get a Decl out of it.
llvm-svn: 75599
2009-07-14 03:19:30 +00:00
Argyrios Kyrtzidis 2f0eff102c Handle struct fields through the index-test tool.
llvm-svn: 75596
2009-07-14 03:18:40 +00:00
Zhongxing Xu 6999b90146 Fix comment.
llvm-svn: 74896
2009-07-07 07:14:55 +00:00
Argyrios Kyrtzidis 85b18aff24 Use the "ASTLocation nomenclature" (instead of the ASTNode one) in index-test.cpp.
llvm-svn: 74863
2009-07-06 21:35:26 +00:00
Argyrios Kyrtzidis b8020f0833 Some changes to ASTLocation's methods
-Change hasStmt() to isStmt()
-Add isDecl()
-Add getSourceRange()

llvm-svn: 74862
2009-07-06 21:35:20 +00:00
Argyrios Kyrtzidis f24249554b Move the 'ResolveLocationInAST' function from the Frontend library to the Index library.
Also, cut down its comments; more comments will be added to ASTLocation.

llvm-svn: 74860
2009-07-06 21:35:02 +00:00
Argyrios Kyrtzidis 63afa49add Move ASTLocation and DeclReferenceMap from the AST library to the Index library.
llvm-svn: 74859
2009-07-06 21:34:47 +00:00
Argyrios Kyrtzidis b0048027ba Rename 'ASTNode' -> 'ASTLocation'.
ASTLocation is a much better name for its intended purpose which to represent a "point" into the AST.

llvm-svn: 74858
2009-07-06 21:34:20 +00:00
Argyrios Kyrtzidis 5641111e3f Make use of the Index library through the index-test tool.
'index-test' is now able to provide additional info for a Decl, through multiple AST files:
-Find declarations
-Find definitions
-Find references

llvm-svn: 74803
2009-07-05 22:22:35 +00:00
Argyrios Kyrtzidis a4d36d5a58 Make use of ASTNode for return value of clang::ResolveLocationInAST() and in the index-test tool.
llvm-svn: 74798
2009-07-05 22:21:40 +00:00
Douglas Gregor c6d5edd2ed Add support for retrieving the Doxygen comment associated with a given
declaration in the AST. 

The new ASTContext::getCommentForDecl function searches for a comment
that is attached to the given declaration, and returns that comment, 
which may be composed of several comment blocks.

Comments are always available in an AST. However, to avoid harming
performance, we don't actually parse the comments. Rather, we keep the
source ranges of all of the comments within a large, sorted vector,
then lazily extract comments via a binary search in that vector only
when needed (which never occurs in a "normal" compile).

Comments are written to a precompiled header/AST file as a blob of
source ranges. That blob is only lazily loaded when one requests a
comment for a declaration (this never occurs in a "normal" compile). 

The indexer testbed now supports comment extraction. When the
-point-at location points to a declaration with a Doxygen-style
comment, the indexer testbed prints the associated comment
block(s). See test/Index/comments.c for an example.

Some notes:
  - We don't actually attempt to parse the comment blocks themselves,
  beyond identifying them as Doxygen comment blocks to associate them
  with a declaration.
  - We won't find comment blocks that aren't adjacent to the
  declaration, because we start our search based on the location of
  the declaration.
  - We don't go through the necessary hops to find, for example,
  whether some redeclaration of a declaration has comments when our
  current declaration does not. Similarly, we don't attempt to
  associate a \param Foo marker in a function body comment with the
  parameter named Foo (although that is certainly possible).
  - Verification of my "no performance impact" claims is still "to be
  done".

llvm-svn: 74704
2009-07-02 17:08:52 +00:00
Chris Lattner c61089a6c2 Key decisions about 'bool' vs '_Bool' to be based on a new flag in langoptions.
This is simple enough, but then I thought it would be nice to make PrintingPolicy
get a LangOptions so that various things can key off "bool" and "C++" independently.
This spiraled out of control.  There are many fixme's, but I think things are slightly
better than they were before.

One thing that can be improved: CFG should probably have an ASTContext pointer in it,
which would simplify its clients.

llvm-svn: 74493
2009-06-30 01:26:17 +00:00
Argyrios Kyrtzidis 3cfb28a68d Remove redundant leftover code.
llvm-svn: 74433
2009-06-29 17:38:09 +00:00
Argyrios Kyrtzidis 02f3e84c5b Check that index-test uses an up-to-date AST file.
llvm-svn: 74214
2009-06-25 22:15:12 +00:00
Argyrios Kyrtzidis bf61749b47 Add some comments and clean-up some leftover code.
llvm-svn: 74207
2009-06-25 21:54:50 +00:00
Argyrios Kyrtzidis 92772215af Introduce tools/index-test.
This tool will be the test bed for indexing related operations. It basically reads PCH files passed by the command line and performs various operations.

Currently it can accept a file:line:column which resolves to a declaration/statement and displays some information about them.

llvm-svn: 74198
2009-06-25 18:22:52 +00:00