Commit Graph

1213 Commits

Author SHA1 Message Date
Ted Kremenek c62ab8d064 Add CXType support for querying the return type of Objective-C methods. This is done by
adding a clang_getCursorResultType() function (which complements clang_getResultType()).

llvm-svn: 106473
2010-06-21 20:48:56 +00:00
Ted Kremenek c150887fef Add CXType support for FunctionNoProto and FunctionProto types. This includes adding a new
function, clang_getResultType(), which returns the result type of the function type.

llvm-svn: 106459
2010-06-21 20:15:39 +00:00
Ted Kremenek d34da45a83 Add clang_getCursorType() support for @property declarations.
llvm-svn: 106451
2010-06-21 19:41:40 +00:00
Chris Lattner ed8b6b799d introduce a new CharSourceRange class, and enhance the diagnostics routines
to use them instead of SourceRange.  CharSourceRange is just a SourceRange
plus a bool that indicates whether the range has the end character resolved
or whether the end location is the start of the end token.  While most of
the compiler wants to think of ranges that have ends that are the start of
the end token, the printf diagnostic stuff wants to highlight ranges within
tokens.

This is transparent to the diagnostic stuff.  To start taking advantage of
the new capabilities, you can do something like this:
  Diag(..) << CharSourceRange::getCharRange(Begin,End)

llvm-svn: 106338
2010-06-18 22:45:06 +00:00
Alexis Hunt 344393e9cf Implement first TD-based usage of attributes.
Currently, there are two effective changes:

 - Attr::Kind has been changed to attr::Kind, in a separate namespace
   rather than the Attr class. This is because the enumerator needs to
   be visible to parse.
 - The class definitions for the C++0x attributes other than aligned are
   generated by TableGen.

The specific classes generated by TableGen are controlled by an array in
TableGen (see the accompanying commit to the LLVM repository). I will be
expanding the amount of code generated as I develop the new attributes system
while initially keeping it confined to these attributes.

llvm-svn: 106172
2010-06-16 23:43:53 +00:00
Daniel Dunbar 7c995e8fac Frontend: Allow passing -cc1 level arguments to plugins. Patch by Troy Straszheim!
llvm-svn: 106113
2010-06-16 16:59:23 +00:00
Daniel Dunbar c1b1729b66 Break Frontend's dependency on Rewrite, Checker and CodeGen in shared library configuration
Currently, all AST consumers are located in the Frontend library,
meaning that in a shared library configuration, Frontend has a
dependency on Rewrite, Checker and CodeGen.  This is suboptimal for
clients which only wish to make use of the frontend.  CodeGen in
particular introduces a large number of unwanted dependencies.

This patch breaks the dependency by moving all AST consumers with
dependencies on Rewrite, Checker and/or CodeGen to their respective
libraries.  The patch therefore introduces dependencies in the other
direction (i.e. from Rewrite, Checker and CodeGen to Frontend).

After applying this patch, Clang builds correctly using CMake and
shared libraries ("cmake -DBUILD_SHARED_LIBS=ON").

N.B. This patch includes file renames which are indicated in the
patch body.

Changes in this revision of the patch:
 - Fixed some copy-paste mistakes in the header files
 - Modified certain aspects of the coding to comply with the LLVM
   Coding Standards

llvm-svn: 106010
2010-06-15 17:48:49 +00:00
Chris Lattner fa04338f38 don't make libclang depend on codegen. Patch by Peter Collingbourne!
llvm-svn: 105901
2010-06-12 22:54:45 +00:00
Daniel Dunbar a442fd5da6 Driver: Fix arg_iterator typing to reflect that it is really an iterator over Arg*s.
llvm-svn: 105838
2010-06-11 22:00:13 +00:00
Daniel Dunbar d04e1a7ef1 Makefiles: Remove unnecessary early include of Makefile.config.
llvm-svn: 105640
2010-06-08 20:57:22 +00:00
Daniel Dunbar ee6b692551 Makefiles: Set Clang CPP compiler flags in a single location, instead of scattered throughout the project Makefiles.
llvm-svn: 105638
2010-06-08 20:44:43 +00:00
Daniel Dunbar e6c1daa8fd Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.
- This eliminates most dependencies on how Clang is installed relative to LLVM.

llvm-svn: 105637
2010-06-08 20:34:18 +00:00
Douglas Gregor 61b5ff5ab4 Teach the PrintFunctionNames example to be a proper module, so that
Clang can load it as a plugin. Original fix by Troy D. Straszheim,
which I extended with Darwin support. Fixes PR6801.

llvm-svn: 105630
2010-06-08 19:23:49 +00:00
Ted Kremenek e869a182c2 Add ccc-analyzer support for '-imacros'. Fixes PR 7204.
llvm-svn: 105624
2010-06-08 18:27:55 +00:00
Daniel Dunbar 6f8362c6bf Frontend: Add CodeGenAction support for handling LLVM IR.
- This magically enables using 'clang -cc1' as a replacement for most of 'llvm-as', 'llvm-dis', 'llc' and 'opt' functionality.

For example, 'llvm-as' is:
  $ clang -cc1 -emit-llvm-bc FOO.ll -o FOO.bc
and 'llvm-dis' is:
  $ clang -cc1 -emit-llvm    FOO.bc -o -
and 'opt' is, e.g.:
  $ clang -cc1 -emit-llvm -O3 -o FOO.opt.ll FOO.ll
and 'llc' is, e.g.:
  $ clang -cc1 -S -o - FOO.ll

The nice thing about using the backend tools this way is that they are guaranteed to exactly match how the compiler generates code (for example, setting the same backend options).

llvm-svn: 105583
2010-06-07 23:27:59 +00:00
Abramo Bagnara d73405829b Added AccessSpecDecl node.
llvm-svn: 105525
2010-06-05 05:09:32 +00:00
John McCall a3cecb628f Add indexing support for the block and @property type location information
I just implemented.

llvm-svn: 105491
2010-06-04 22:33:30 +00:00
Ted Kremenek b4bb6dc44d Return a proper null CXSourceLocation from clang_getLocation() when the SourceLocation is invalid. Fixes <rdar://problem/8056640>.
llvm-svn: 105392
2010-06-03 15:52:32 +00:00
Dan Gohman b2e7169db8 Delete a blank line to make it easier to process this file with a script.
llvm-svn: 105275
2010-06-01 16:56:42 +00:00
Ted Kremenek cadaad1bea Add check for an invalid CXType in clang_getTypeDeclaration.
llvm-svn: 105111
2010-05-29 20:01:52 +00:00
Dan Gohman ef832a6965 When handling raw_ostream errors manually, use clear_error() so that
raw_ostream doesn't try to do its own error handling.

llvm-svn: 104880
2010-05-27 20:16:37 +00:00
Bill Wendling 47bb3e2ba1 Silence warning about "enumeral and non-enumeral type in conditional
expression".

llvm-svn: 104863
2010-05-27 18:35:05 +00:00
Ted Kremenek 31729162bc Remove clang_isFromMainFile(). It doesn't work correctly with CXDiagnostics, and we shouldn't
have an API around that cannot be implemented correctly yet.

llvm-svn: 104849
2010-05-27 16:57:42 +00:00
Douglas Gregor a2db793ff0 Introduce priorities into the code-completion results.
llvm-svn: 104751
2010-05-26 22:00:08 +00:00
Daniel Dunbar 4c77a64391 Driver/Frontend: Add -emit-codegen-only, for running irgen + codegen but not the
.s printer or .o writer.

llvm-svn: 104623
2010-05-25 18:41:01 +00:00
Douglas Gregor 09737ee885 Turn vertical spacing into horizontal spacing in code-completion results
llvm-svn: 104586
2010-05-25 06:14:46 +00:00
Douglas Gregor 01308a0e11 Make clang_isFromMainFile() robust against NULL source locations.
llvm-svn: 104474
2010-05-23 21:31:22 +00:00
Ted Kremenek ea465e1847 Make crashreport data in libclang a compile-time option.
llvm-svn: 104413
2010-05-22 00:06:46 +00:00
Daniel Dunbar 6ac7d7d068 Fix __crashreport_info__ declaration.
llvm-svn: 104301
2010-05-20 23:50:23 +00:00
Daniel Dunbar 0454f657ce clang -cc1as: Add -help, -version, and -mllvm support.
Also, fix output defaulting to match llvm-mc.

llvm-svn: 104246
2010-05-20 18:15:20 +00:00
Daniel Dunbar 2fcaa549a8 Driver/MC: Add 'clang -cc1as' integrated assembler tool, currently accepts approximately the same interface as 'llvm-mc'.
llvm-svn: 104239
2010-05-20 17:49:16 +00:00
Abramo Bagnara 1108e7b873 Renamed misleading getSourceRange -> getLocalSourceRange and getFullSourceRange -> getSourceRange for TypeLoc.
llvm-svn: 104220
2010-05-20 10:00:11 +00:00
Ted Kremenek 76a434840a Add libclang function 'clang_isFromMainFile()' (which just wraps SourceManager::isFromMainFile()).
llvm-svn: 104208
2010-05-20 02:59:19 +00:00
Ted Kremenek 08de5c1418 Move CXCursor_FirstDecl definition later to make the results more readable in the debugger.
llvm-svn: 104171
2010-05-19 21:51:10 +00:00
Ted Kremenek 84d2bd759f Remove clang_isDeclarationADefinition() since its functionality is already provided by clang_isCursorDefinition().
llvm-svn: 104138
2010-05-19 18:36:55 +00:00
Ted Kremenek 26bde774df Add clang support for IBOutletCollection.
llvm-svn: 104135
2010-05-19 17:38:06 +00:00
Ted Kremenek a10f12829f Add function 'clang_isTagDeclDefinition()' to allow clients of libclang to distinguish between
forward declarations and definitions of structs/classes/enums.

llvm-svn: 104075
2010-05-18 22:32:15 +00:00
Ted Kremenek 49be9e0819 Teach CursorVisitor about duplicate ObjCPropertyDecls that can arise because of a current
design limitation in how we handle Objective-C class extensions.  This was causing the CursorVisitor
to essentially visit an @property twice (once in the @interface, the other in the class extension).
Fixes <rdar://problem/7410145>.

llvm-svn: 104055
2010-05-18 21:09:07 +00:00
Ted Kremenek 0ed7549343 Fix missing '}'.
llvm-svn: 103966
2010-05-17 20:12:45 +00:00
Ted Kremenek 9cfe9e6a4a Add libclang function 'clang_CXXMethod_isStatic' to query of a C++ method
is declared static.

llvm-svn: 103963
2010-05-17 20:06:56 +00:00
John McCall 8b07ec253d Substantially alter the design of the Objective C type AST by introducing
ObjCObjectType, which is basically just a pair of
  one of {primitive-id, primitive-Class, user-defined @class}
with
  a list of protocols.
An ObjCObjectPointerType is therefore just a pointer which always points to
one of these types (possibly sugared).  ObjCInterfaceType is now just a kind
of ObjCObjectType which happens to not carry any protocols.

Alter a rather large number of use sites to use ObjCObjectType instead of
ObjCInterfaceType.  Store an ObjCInterfaceType as a pointer on the decl rather
than hashing them in a FoldingSet.  Remove some number of methods that are no
longer used, at least after this patch.

By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
pointers to Objective-C types, which is crucial for a certain kind of ObjC++
metaprogramming common in WebKit.

llvm-svn: 103870
2010-05-15 11:32:37 +00:00
Ted Kremenek be4556f550 Change install_name for libclang.dylib to '@rpath/libclang.dylib'. Fixes <rdar://problem/7987039>.
llvm-svn: 103837
2010-05-14 23:50:33 +00:00
Ted Kremenek 6bca984b54 Add CXType and an initial set of supporting functions to libclang. This exposes details of
Clang's representation of the C type system to clients.  It is nowhere near complete, and will
be expanded on demand.

llvm-svn: 103809
2010-05-14 21:29:26 +00:00
Ted Kremenek d321413e3d Fold assertion into condition, as it does not hold all the time.
llvm-svn: 103716
2010-05-13 15:38:38 +00:00
Ted Kremenek 00da2b1546 Remove stale comment.
llvm-svn: 103696
2010-05-13 03:40:51 +00:00
Ted Kremenek 12e0f2937e Specially handle CaseStmts in CursorVisitor because they can be nested and walking them
can blow out the stack.

llvm-svn: 103687
2010-05-13 00:25:00 +00:00
Ted Kremenek 8278a32802 Re-apply r103581 with updated tests. It turns out we were computing bogus locations for
many things.

llvm-svn: 103583
2010-05-12 06:16:13 +00:00
Ted Kremenek a53bead8db Temporarily revert r103581 so I can fix the failing tests.
llvm-svn: 103582
2010-05-12 06:03:33 +00:00
Ted Kremenek 847941b1f4 Correctly check if a cursor is a declaration before returning its location/range in clang_getCursorLocation()/clang_getCursorExtent(). This fixes a horrible bug reported in
<rdar://problem/7961995> and <rdar://problem/7967123> where declarations with attributes
would get grossly annotated with the wrong tokens because the attribute would be interpreted
as if it was a Decl*.

llvm-svn: 103581
2010-05-12 06:00:25 +00:00
Ted Kremenek 7b2fcc3697 Remove debugging aids I did not intend to commit.
llvm-svn: 103578
2010-05-12 05:30:50 +00:00