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

1426 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 66b7fbfa7b Introduce a simple, substitution-based compression scheme for USRs, so
that redundant types don't result in super-long USRs. Fixes
<rdar://problem/8447875>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114347 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-20 20:37:39 +00:00
Douglas Gregor 692577cd30 When traversing an InitListExpr, there may not be a syntactic form;
check for NULL and visit the InitListExpr we have if there is no
syntactic form.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114203 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-17 20:26:51 +00:00
Douglas Gregor 7c432dd959 Fix a silly typo and its pasteo. Thanks to Francois Pichet for noticing my mistake
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114075 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 13:54:00 +00:00
Daniel Dunbar 6dbcaf3849 build: Add support for a CLANG_ORDER_FILE build variable to specify the path to
the order file to use for the clang executable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114052 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 00:42:38 +00:00
Douglas Gregor 1f6206ed21 I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113821 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-14 00:20:32 +00:00
Michael J. Spencer 560a921b85 Revert "CMake: Update to use standard CMake dependency tracking facilities instead"
This reverts commit r113631

Conflicts:

	CMakeLists.txt
	lib/CodeGen/CMakeLists.txt

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113817 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-13 23:54:41 +00:00
Douglas Gregor 1f60d9ea52 Introduce a new kind of cursor into libclang, which covers a reference
to an "overloaded" set of declarations. This cursor kind works for
unresolved references to functions/templates (e.g., a call within a
template), using declarations, and Objective-C class and protocol
forward declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113805 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-13 22:52:57 +00:00
Douglas Gregor 1aad34043d Fix my silly sorting predicate. I hate integer-to-bool conversions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113656 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 23:05:54 +00:00
Daniel Dunbar b08fab82a6 Driver: Set TOOL_NO_EXPORTS when building a "production" compiler, we don't
currently expect that to be useful for plugins, and this is important for
startup performance:
--
ddunbar@lordcrumb:tmp$ touch empty.c
ddunbar@lordcrumb:tmp$ runN 100 ~/llvm.obj.64/Release/bin/clang -c empty.c
name	  avg  	  min  	  med  	  max  	   SD  	 total 
user	 0.0054	 0.0052	 0.0054	 0.0055	 0.0000	 0.5350
 sys	 0.0084	 0.0090	 0.0078	 0.0087	 0.0008	 0.8390
wall	 0.0149	 0.0149	 0.0149	 0.0149	 0.0003	 1.4943
ddunbar@lordcrumb:tmp$ runN 100 ~/llvm.obj.64/Release/bin/clang -c empty.c
name	  avg  	  min  	  med  	  max  	   SD  	 total 
user	 0.0036	 0.0036	 0.0036	 0.0038	 0.0000	 0.3646
 sys	 0.0072	 0.0071	 0.0068	 0.0070	 0.0006	 0.7158
wall	 0.0123	 0.0123	 0.0122	 0.0136	 0.0003	 1.2262
--

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113638 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 21:42:03 +00:00
Michael J. Spencer 5a7f34958c CMake: Update to use standard CMake dependency tracking facilities instead
of whatever we were using before...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113631 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 21:13:16 +00:00
Sebastian Redl 2e156225a2 Define and implement CXXNoexceptExpr. Create it in Sema.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113623 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 20:55:43 +00:00
Douglas Gregor 36897b05ca Add libclang support for label statements, gotos, and taking the
address of a label (GNU extension).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113564 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 00:22:18 +00:00
Douglas Gregor fa2e26f621 Add libclang visitation for C99 designated initializers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113560 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 23:28:23 +00:00
Douglas Gregor 8ccef2d032 Add libclang visitation for __builtin_offsetof's components (fields
and array references).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113556 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 23:10:46 +00:00
Douglas Gregor a67e03fdf1 Teach libclang to walk the base and member initializers of a
constructor, in source order. Also introduces a new reference kind for
class members, which is used here (for member initializers) and will
also be used for designated initializers and offsetof.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113545 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 21:42:20 +00:00
Douglas Gregor 83cb942690 Simplify template instantiation for C++ exception declarations,
eliminating an unnecessary use of TemporaryBase in the process.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113500 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 17:09:21 +00:00
Douglas Gregor 3d37c0ada0 Add proper type-source information to UnaryTypeTraitExpr, including
libclang visitation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113492 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 16:14:44 +00:00
Douglas Gregor ec9bf47565 Clean up CMake dependencies
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113489 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 15:44:58 +00:00
Francois Pichet 9be88403e9 Fix warnings caused by new CXXUuidofExprClass enumerator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113444 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08 23:47:05 +00:00
Douglas Gregor ab6677ec40 Provide proper type-source location information for
CXXTemporaryObjectExpr, CXXScalarValueInitExpr, and
CXXUnresolvedConstructExpr, getting rid of a bunch of FIXMEs in the
process.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113319 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08 00:15:04 +00:00
Douglas Gregor 1bb2a93ab7 Improve source-location information for CXXNewExpr, by hanging on to
the TypeSourceInfo for the allocated type. Fixes PR7501.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113291 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 21:49:58 +00:00
Rafael Espindola 79e9e9dd53 Make "-ccc-cxx" option work on Linux.
Patch by nobled.

I also took the opportunity to make the field private since now it is only ready from the
outside.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113138 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-06 02:36:23 +00:00
Douglas Gregor e8d7bebc0d Synchronize code-completion cursor kinds with indexing cursor
kinds. How shameful that this code was duplicated!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113033 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 23:30:36 +00:00
Douglas Gregor aaa80b208d Implement libclang visitation for UnresolvedMemberExpr. This is the
last of the C++-specific expressions where we have decent source
information in the AST already. In particular, various
object-construction expressions (CXXNewExpr, CXXTemporaryObjectExpr)
still have poor source-location information that needs to be addressed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112981 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 18:01:25 +00:00
Douglas Gregor 25d63629cc libclang visitation for CXXDependentScopeMemberExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112978 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 17:35:34 +00:00
Douglas Gregor bfebed2a83 libclang visitation for DependentScopeDeclRefExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112975 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 17:24:10 +00:00
Douglas Gregor 1f7b590d12 Teach libclang to visit OverloadExprs, so that we can reuse this
code. Also, teach it about explicitly-specified template arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112884 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 22:29:21 +00:00
Douglas Gregor 8ab670ee2b Add libclang visitation for UnresolvedLookupExprs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112879 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 22:19:24 +00:00
Douglas Gregor 6f7198f638 Add libclang visitation for C++ pseudo-destructor expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112873 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 22:09:03 +00:00
Douglas Gregor e2ca6d4a2f Eliminate CXXBindReferenceExpr, which was used in a ton of
well-intentioned but completely unused code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112868 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 21:50:02 +00:00
Douglas Gregor da135b14ad Teach libclang not to recursive into default argument expressions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112866 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 21:38:13 +00:00
Douglas Gregor 948022908d Add libclang visitation for C++ typeid expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112862 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 21:20:16 +00:00
Douglas Gregor fbb4c98a24 In libclang, visit the nested-name-specifier and explicitly-specified template arguments of a MemberExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 21:07:44 +00:00
Douglas Gregor 8947a7501e Visit the nested-name-specifier and explicitly-specified template
arguments of a DeclRefExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112854 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 20:35:02 +00:00
Douglas Gregor c5ade2e364 Implement basic visitation for nested name specifiers via libclang
cursors. Sadly, this visitation is a hack, because we don't have
proper source-location information for nested-name-specifiers in the
AST. It does improve on the status quo, however.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112837 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 17:35:32 +00:00
Douglas Gregor e0329acf5c Introduce a new libclang function,
clang_getSpecializedCursorTemplate(), which determines the template
(or member thereof) that the given cursor specializes or from which it
was instantiated. This routine can be used to establish a link between
templates and their instantiations/specializations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112780 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 00:07:54 +00:00
Douglas Gregor 84b51d77e1 Teach libclang to visit the default arguments of template parameters.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112734 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 20:16:53 +00:00
Douglas Gregor 7e24256c95 Implement libclang support for using declarations. Clang actually uses
three different kinds of AST nodes to represent using declarations:
UsingDecl, UnresolvedUsingValueDecl, and
UnresolvedUsingTypenameDecl. These three are collapsed into a single
cursor kind for using declarations, since libclang clients don't need
the distinction.

Several related changes here:
  - Cursor visitation of the three AST nodes for using declarations
  - Proper source-range computation for these AST nodes
  - Using declarations have no USRs, since they don't actually declare
    any entities.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112730 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 19:52:22 +00:00
Douglas Gregor 0ab1e9f672 Improve libclang indexing support for class template specializations
in a few related ways:

  - Don't recurse into instantiations of templates.
  - Recurse into explicit specializations.
  - Visit the template arguments of an explicit specialization or
    explicit instantiation.
  - Include template specialization arguments in the USRs for class
    template specializations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112720 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 17:32:36 +00:00
Douglas Gregor 2ef6944d52 Make it clear that libclang does not modify the command-line arguments
it is given.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112717 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 16:43:19 +00:00
Douglas Gregor 0a35bceb77 Implement libclang support for using directives (cursor + visitation +
suppressing USRs). Also, fix up the source location information for
using directives so that the declaration location refers to the
namespace name.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112693 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 03:07:18 +00:00
Douglas Gregor 6931900f43 Add libclang support for namespace aliases (visitation + USRs) along
with a new cursor kind for a reference to a namespace. 

There's still some oddities in the source location information for
NamespaceAliasDecl that I'll address with a separate commit, so the
source locations displayed in the load-namespaces.cpp test will
change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112676 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 23:48:11 +00:00
Douglas Gregor 49f6f54894 Add a new libclang function clang_getTemplateCursorKind(), which
determines the kind of declaration that would be generated if the
given template were instantiated. This allows a client to distinguish
among class/struct/union templates and function/member function/static
member function templates.

Also, teach clang_CXXMethod_isStatic() about function templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112655 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 22:12:17 +00:00
Douglas Gregor 0b36e614aa Extend libclang with a new cursor kind that indicates a reference to a
template. Such cursors occur, for example, in template specialization
types such as vector<int>. Note that we do not handle the
super-interesting case where the template name is unresolved, e.g.,
within a template.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112636 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 20:37:03 +00:00
Douglas Gregor 74dbe64002 Add libclang support for class template partial specializations,
including a cursor kind, visitation, and USRs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112629 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 19:31:58 +00:00
Douglas Gregor 39d6f07b05 Add a libclang cursor kind, visitation support and USR support for C++
class templates. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112627 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 19:02:00 +00:00
Douglas Gregor fe72e9ceea Implement basic support for indexing function templates in
libclang. This includes:
  - Cursor kind for function templates, with visitation logic
  - Cursor kinds for template parameters, with visitation logic
  - Visitation logic for template specialization types, qualified type
  locations
  - USR generation for function templates, template specialization
  types, template parameter types.

Also happens to fix PR7804, which I tripped across while testing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112604 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 17:01:39 +00:00
Douglas Gregor 01829d3afa libclang indexing support for C++ constructors, destructors, and
conversion functions. This introduces new cursor kinds for these three
C++ entities, and reworks visitation of function declarations so that
we get type-source information for the names.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112600 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 14:41:23 +00:00
Sean Hunt 6cf750298d Revert my user-defined literal commits - r1124{58,60,67} pending
some issues being sorted out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112493 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 17:47:05 +00:00
Duncan Sands 2dc14532b6 Straighten out target triples provided on the command line
before using them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112468 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 09:42:39 +00:00
Sean Hunt 0016d519b8 Implement C++0x user-defined string literals.
The extra data stored on user-defined literal Tokens is stored in extra
allocated memory, which is managed by the PreprocessorLexer because there isn't
a better place to put it that makes sure it gets deallocated, but only after
it's used up. My testing has shown no significant slowdown as a result, but
independent testing would be appreciated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112458 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 21:26:48 +00:00
Ted Kremenek 585b318a73 Add source file I meant to include in my previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112303 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 21:57:20 +00:00
Ted Kremenek 3064ef9e60 Implement CXCursor support for walking C++ base specifiers. This includes adding the API hooks clang_isVirtualBase() and clang_getCXXAccessSpecifier() to query properties of the base specifier.
Implements <rdar://problem/8274883>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112296 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 21:34:58 +00:00
Douglas Gregor df46316a42 Teach clang_codeComplete to always sort its code-completion results
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112292 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 21:13:41 +00:00
Douglas Gregor 458433d2f0 Implement code completion for @selector expressions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112186 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 15:07:07 +00:00
Douglas Gregor 1e5e6684b0 Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.

Provide a libclang function that sorts the results.

3rd try. How embarrassing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112180 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 13:48:20 +00:00
Daniel Dunbar 1cb237fbf9 Revert r112149, "Move the sorting of code-completion results out of the main
path and ...", it is failing tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112161 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 03:53:50 +00:00
Daniel Dunbar 12f740f4cd Revert r112154, "Fix thinko in sorting operation", it depends on r112149 which
doth lay upon the chopping block.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112160 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 03:53:44 +00:00
Douglas Gregor 86d00659f7 Fix thinko in sorting operation
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112154 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 02:54:05 +00:00
Douglas Gregor be13afea6d Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.

Provide a libclang function that sorts the results.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112149 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 02:23:45 +00:00
Ted Kremenek 95f33555a6 Add libclang API hook "clang_getIBOutletCollectionType" to query the collection type for iboutletcollection attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112139 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 01:42:22 +00:00
Douglas Gregor 9214819c7d Revert "Move the sorting of code-completion results out of the main path and
into the clients", because the C standard library sucks. Where's my
stable sort, huh?


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112121 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 00:30:24 +00:00
Ted Kremenek d8b0a84d58 When annotating tokens, don't fallback to annotating with a null cursor for cursors that come before a macro instantiation. Fixes <rdar://problem/7974151>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112096 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 22:16:02 +00:00
Douglas Gregor c7ed372ec7 Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112095 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 22:15:42 +00:00
John McCall 0a2c5e256a Teach Sema to live without CodeCompleteConsumer.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112028 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 06:19:51 +00:00
Ted Kremenek 28a7f258ae USRs for class extensions should "mangle" in the location of the extension. (<rdar://problem/8350262>)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111991 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 23:13:41 +00:00
Peter Collingbourne 1b7255de78 Move ExecuteCompilerInvocation to a new library FrontendTool
r110903 introduced a dependency from Frontend to every library that
declared an Action by introducing Action references that previously
resided in the driver in the file ExecuteCompilerInvocation.cpp.
This patch moves ExecuteCompilerInvocation to a new library named
FrontendTool which is intended to bear these dependencies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111873 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 00:31:22 +00:00
Douglas Gregor 58ddb60f40 Introduce new libclang API functions that determine the availability
of a cursor or code-completion result, e.g., whether that result
refers to an unavailable, deleted, or deprecated declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111858 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23 23:00:57 +00:00
Daniel Dunbar 60a4543d42 libclang: Print more information when recovering from crashes in
clang_parseTranslationUnit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111855 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23 22:35:34 +00:00
Eli Friedman a7e6845660 Detabify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111768 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 01:00:03 +00:00
John McCall 1951085672 Another step in the process of making the parser depend on Sema:
- move DeclSpec &c into the Sema library
  - move ParseAST into the Parse library
Reflect this change in a thousand different includes.
Reflect this change in the link orders.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111667 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 18:27:03 +00:00
Douglas Gregor 2283d79155 When performing code-completion in the presence of a preamble, make
sure to (1) actually use the remapped files we were given rather
than old data, and (2) keep the remapped files alive until the
code-completion results are destroyed. Big thanks to Daniel for the
test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111597 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 00:59:43 +00:00
Daniel Dunbar b1fd345868 libclang: Execute clang_codeCompleteAt() inside a crash recovery context.
- Test case is disabled for now, because something isn't write with file
   remapping.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111581 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 23:44:10 +00:00
Daniel Dunbar 2de41c9c99 c-index-test: Diagnose parse / completion failures in -code-completion-at=.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111580 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 23:44:06 +00:00
Daniel Dunbar 43f331d0fd c-index-test: As with reparse, only honor remapped false during the code
completion step with -code-completion-at=, to allow testing simulated source
changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111579 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 23:44:04 +00:00
Daniel Dunbar 57b5b4aee9 libclang/Darwin: Always set the compatibility version in the dylib.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111578 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 23:44:02 +00:00
Douglas Gregor 653a55f4bc Fix a c-index-test leak with file remapping
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111559 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 20:50:29 +00:00
Sebastian Redl 3c7f413460 More PCH -> AST renaming.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111472 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 23:57:06 +00:00
Sean Hunt cf807c4dfd Generate Attr subclasses with TableGen.
Now all classes derived from Attr are generated from TableGen.
Additionally, Attr* is no longer its own linked list; SmallVectors or
Attr* are used. The accompanying LLVM commit contains the updates to
TableGen necessary for this.

Some other notes about newly-generated attribute classes:

 - The constructor arguments are a SourceLocation and a Context&,
   followed by the attributes arguments in the order that they were
   defined in Attr.td

 - Every argument in Attr.td has an appropriate accessor named getFoo,
   and there are sometimes a few extra ones (such as to get the length
   of a variadic argument).

Additionally, specific_attr_iterator has been introduced, which will
iterate over an AttrVec, but only over attributes of a certain type. It
can be accessed through either Decl::specific_attr_begin/end or
the global functions of the same name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111455 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 23:23:40 +00:00
Daniel Dunbar ea94bbc476 libclang: Put clang_reparseTranslationUnit inside a crash recovery context.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111451 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 23:09:31 +00:00
Daniel Dunbar c8a618002c c-index-test: Change -test-load-source-repase to only use remapped files for the
reparse, to allow testing distinct inputs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111448 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 23:09:16 +00:00
Douglas Gregor bdbb004f38 Simplify the ownership model for DiagnosticClients, which was really
convoluted and a bit leaky. Now, the Diagnostic object owns its
DiagnosticClient.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111437 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 22:29:43 +00:00
Dan Gohman 726578c22e Call llvm::remove_fatal_error_handler before deallocating objects
which are used by the error handling functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111427 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 21:23:17 +00:00
Daniel Dunbar 19ffd492a3 libclang: Put clang_parseTranslationUnit inside a crash recovery context.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111387 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 18:43:17 +00:00
Daniel Dunbar c7df4f344d libclang: Implicitly enable crash recovery when using the libclang APIs. We may need to add an explicit API call, but hopefully we can make the crash recovery seamless enough that it doesn't make sense to turn it off.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111386 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 18:43:14 +00:00
Douglas Gregor 783c56f477 Simplify FixItHint by eliminated the unnecessary InsertionLoc
location. Patch by Eelis van der Weegen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111362 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 14:24:02 +00:00
Sebastian Redl 857281328f Reintroduce the serialization library, with fixed dependencies.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111279 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 20:43:28 +00:00
Douglas Gregor e638f86124 Remove the last bit of the Clang Serialization library, for now
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111267 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 19:00:27 +00:00
Douglas Gregor 4557e473c9 Revert Sebastian's build-breaking patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111265 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 18:31:01 +00:00
Dan Gohman 9baa8b0be6 Add the clangSerialization library to libclang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111261 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 18:07:30 +00:00
Sebastian Redl 93c972945b Create a new Serialization module that contains all the PCH code, and will contain all the module code in the future. Update the Makefiles, CMake projects and the Xcode project. I hope I did everything right for Xcode. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111258 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 17:55:49 +00:00
Douglas Gregor 8071e4212a Extend the code-completion caching infrastructure to include global
declarations (in addition to macros). Each kind of declaration maps to
a certain set of completion contexts, and the ASTUnit completion logic
introduces the completion strings for those declarations if the actual
code-completion occurs in one of the contexts where it matters. 

There are a few new code-completion-context kinds. Without these,
certain completions (e.g., after "using namespace") would need to
suppress all global completions, which would be unfortunate.

Note that we don't get the priorities right for global completions,
because we don't have enough type information. We'll need a way to
compare types in an ASTContext-agnostic way before this can be
implemented.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111093 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15 06:18:01 +00:00
Ted Kremenek 23bc11ff18 Always recurse into sub-cursors when annotating tokens, as this information is used for annotating macro arguments. This finishes up <rdar://problem/8044584>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111066 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14 02:50:46 +00:00
Ted Kremenek 3f4046004b As a heuristic, annotate tokens (via clang_annotateTokens) that are the arguments of a macro instantiation using the closest cursor with the same spelling location. Because macro arguments can get token pasted in any arbitrary order, we use the annotation map to paper over the token -> cursor annotations during our post-processing stage. This fixes most of <rdar://problem/8044584>, but still doesn't work for assert().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111062 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14 01:14:06 +00:00
Douglas Gregor 87c08a5d6b Implement caching of code-completion results for macro definitions
when the CXTranslationUnit_CacheCompletionResults option is given to
clang_parseTranslationUnit(). Essentially, we compute code-completion
results for macro definitions after we have parsed the file, then
store an ASTContext-agnostic version of those results (completion
string, cursor kind, priority, and active contexts) in the
ASTUnit. When performing code completion in that ASTUnit, we splice 
the macro definition results into the results provided by the actual
code-completion (which has had macros turned off) before libclang gets
those results. We use completion context information to only splice in
those results that make sense for that context.

With a completion involving all of the macros from Cocoa.h and a few other
system libraries (totally ~8500 macro definitions) living in a
precompiled header, we get about a 9% performance improvement from
code completion, since we no longer have to deserialize all of the
macro definitions from the precompiled header. 

Note that macro definitions are merely the canary; the cache is
designed to also support other top-level declarations, which should be
a bigger performance win. That optimization will be next.

Note also that there is no mechanism for determining when to throw
away the cache and recompute its contents.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111051 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 22:48:40 +00:00
Douglas Gregor 1999844e7a Add an options parameter to clang_saveTranslationUnit, because we'll want it later
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111016 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 15:35:05 +00:00
Douglas Gregor 7ae2faafd3 Implement clang_saveTranslationUnit(), which saves a translation unit
into a PCH/AST file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111006 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 05:36:37 +00:00
Daniel Dunbar 8eb2b0141d Frontend: Move the bulk of the cc1_main() processing into
ExecuteCompilerInvocation in libFrontend.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110903 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 02:53:12 +00:00
Daniel Dunbar a6bf47f855 clang -cc1: Move real diagnostics client initialization to earlier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110902 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 02:53:07 +00:00
Douglas Gregor e6b1bb6e7f Once code completion has completed, pass a "completion context" on to
the code-completion consumer. The consumer can use this information to
augument, filter, or display the code-completion results.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110858 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 21:23:17 +00:00