David Blaikie
6adc78e0df
Replace TypeLoc llvm::cast support to be well-defined.
...
The TypeLoc hierarchy used the llvm::cast machinery to perform undefined
behavior by casting pointers/references to TypeLoc objects to derived types
and then using the derived copy constructors (or even returning pointers to
derived types that actually point to the original TypeLoc object).
Some context is in this thread:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html
Though it's spread over a few months which can be hard to read in the mail
archive.
llvm-svn: 175462
2013-02-18 22:06:02 +00:00
Dmitri Gribenko
c22ea1ce88
libclang: factor out the frequent pattern static_cast<ASTUnit *>(TU->TUData)
...
into a getter cxtu::getASTUnit(TU)
llvm-svn: 173585
2013-01-26 18:53:38 +00:00
David Greene
e6c9fe035d
Fix Casting
...
Use const_cast<> to avoid a cast-away-const error.
llvm-svn: 172565
2013-01-15 22:09:51 +00:00
Dmitri Gribenko
9c256e379e
libclang: remove a few const_casts
...
llvm-svn: 172373
2013-01-14 00:46:27 +00:00
Dmitri Gribenko
909eebc9ac
Add a missing 'else'. Found by grep '} if'
...
No testcase because this did not affect correctness: a declaration can only be
ClassTemplateDecl or a FunctionTemplateDecl, not both.
llvm-svn: 170565
2012-12-19 17:29:30 +00:00
Argyrios Kyrtzidis
8b71bc7d6b
[libclang] Introduce a new indexing mode where we skip function bodies
...
that were already parsed in the same "indexing session".
An indexing session is defined as using the same CXIndexAction object
for multiple clang_indexSourceFile calls.
Passing CXIndexOpt_SkipParsedBodiesInSession as an indexing option will
enable the mode where we try to skip bodies that were already parsed in
another translation unit.
If a function's body was skipped, the "flags" field in the CXIdxDeclInfo
structure will have "CXIdxDeclFlag_Skipped" bit was set.
llvm-svn: 169539
2012-12-06 19:41:16 +00:00
Chandler Carruth
cc0694c8a4
Sort #include lines for tools/...
...
Completely automated with sort_includes.py
llvm-svn: 169240
2012-12-04 09:25:21 +00:00
Nick Lewycky
f7c59696e2
Fix name of this file.
...
llvm-svn: 166913
2012-10-29 06:03:40 +00:00
Argyrios Kyrtzidis
5e2ec486bb
[libclang] Invoke a ppIncludedFile callback when indexing implicit module imports.
...
llvm-svn: 166161
2012-10-18 00:17:05 +00:00
Argyrios Kyrtzidis
dc78f3e7a9
[libclang] Now that we have a CXModule object, pass it to the
...
importedASTFile indexing callback.
llvm-svn: 165281
2012-10-05 00:22:40 +00:00
Argyrios Kyrtzidis
f484b139db
[libclang] When indexing, invoke the importedASTFile for PCH files as well.
...
llvm-svn: 165161
2012-10-03 21:05:51 +00:00
Argyrios Kyrtzidis
184b14428e
[libclang] Simplify indexing of module imports by handling implicit
...
imports via ImportDecls.
llvm-svn: 165160
2012-10-03 21:05:44 +00:00
Argyrios Kyrtzidis
472eda06b0
[libclang] Implement the importedASTFile indexing callback to provide
...
info about imported modules.
llvm-svn: 165020
2012-10-02 16:10:38 +00:00
Argyrios Kyrtzidis
68e87e1360
[libclang] Do index 'extern' declarations inside functions.
...
rdar://12257073
llvm-svn: 163563
2012-09-10 22:58:04 +00:00
Joao Matos
e9a3ed4d71
Normalize line endings of r163013 (part 2).
...
llvm-svn: 163032
2012-08-31 22:18:20 +00:00
Joao Matos
dc86f94f62
Improved MSVC __interface support by adding first class support for it, instead of aliasing to "struct" which had some incorrect behaviour. Patch by David Robins.
...
llvm-svn: 163013
2012-08-31 18:45:21 +00:00
Argyrios Kyrtzidis
0dbe9b6015
[libclang] Fix use-after-free bug when handling attributes indexing info.
...
When indexing a property with a getter/setter with attributes, the allocated memory
for AttrListInfo could get released before its destructor is run.
Fixes rdar://11113442.
llvm-svn: 153792
2012-03-31 01:14:06 +00:00
Argyrios Kyrtzidis
3460880674
[AST] When we @synthesize a property with a user-defined ivar name,
...
make sure to record the source location of the ivar name.
[libclang] When indexing @synthesized objc methods, report the @implementation
as the lexical container.
Fixes rdar://10905472
llvm-svn: 151635
2012-02-28 17:50:39 +00:00
Argyrios Kyrtzidis
93db2923da
[libclang] When indexing an objc property, also provide information about
...
the getter/setter objc method entities that the property is associated with.
rdar://10244558
llvm-svn: 151634
2012-02-28 17:50:33 +00:00
Douglas Gregor
3009383b9f
Implement indexing support for lambdas in libclang (both kinds), as
...
well as improving the RecursiveASTVisitor's walk of lambda
expressions.
llvm-svn: 150549
2012-02-15 00:54:55 +00:00
Argyrios Kyrtzidis
7e747957cd
[libclang] Indexing: only index implicit template instantiations via an opt-in indexing option.
...
llvm-svn: 150517
2012-02-14 22:23:11 +00:00
Dylan Noblesmith
f1a13f29f2
drop more llvm:: prefixes on SmallString<>
...
More cleanup after r149799.
llvm-svn: 150380
2012-02-13 12:32:26 +00:00
Argyrios Kyrtzidis
e5dc5b31f2
[libclang] Indexing API: Fully index implict template instantiations.
...
llvm-svn: 150267
2012-02-10 20:10:44 +00:00
Argyrios Kyrtzidis
95c0feb5e0
[libclang] Indexing: When suppressing references, suppress references
...
of bases in C++ classes. rdar://10768707
llvm-svn: 150048
2012-02-08 03:04:33 +00:00
Argyrios Kyrtzidis
ea9b81b4c6
[libclang] Do not index implicit C++ member functions. rdar://10769813
...
llvm-svn: 150007
2012-02-07 22:46:16 +00:00
Abramo Bagnara
48c05be124
Added location for template keyword in TemplateSpecializationTypeLoc. In the process removed some naming ambiguities.
...
llvm-svn: 149870
2012-02-06 14:41:24 +00:00
Argyrios Kyrtzidis
18dc04eba2
[libclang] For:
...
@implementation I(cat)
suppress subsequent references to 'I'.
rdar://10568103
llvm-svn: 148730
2012-01-23 21:28:38 +00:00
Argyrios Kyrtzidis
5c4e065a9a
Introduce CXXRecordDecl::isCLike() that is true if the class is C-like,
...
without C++-specific features.
Use it to set the language to C++ when indexing non-C-like structs.
rdar://10732579
llvm-svn: 148708
2012-01-23 16:58:45 +00:00
Argyrios Kyrtzidis
908c4dcc5d
[libclang] Fix crash when indexing attributes, rdar://10702250.
...
llvm-svn: 148524
2012-01-20 01:38:51 +00:00
Argyrios Kyrtzidis
da6e05476d
[libclang] Make sure Preprocessor is set in ASTUnit during indexing.
...
llvm-svn: 148319
2012-01-17 18:48:07 +00:00
Douglas Gregor
ec9fd13c77
De-virtualize getPreviousDecl() and getMostRecentDecl() when we know
...
we have a redeclarable type, and only use the new virtual versions
(getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have
that type information. This keeps us from penalizing users with strict
type information (and is the moral equivalent of a "final" method).
Plus, settle on the names getPreviousDecl() and getMostRecentDecl()
throughout.
llvm-svn: 148187
2012-01-14 16:38:05 +00:00
Argyrios Kyrtzidis
9ef9486ab7
[libclang] If CXIndexOpt_IndexFunctionLocalSymbols is enabled, also
...
index parameters.
llvm-svn: 148169
2012-01-14 02:05:51 +00:00
Argyrios Kyrtzidis
fb7d1455cd
[libclang] Add CXIndexOpt_IndexFunctionLocalSymbols indexing option to indicate
...
that one wants indexing callbacks for function-local symbols as well.
llvm-svn: 148160
2012-01-14 00:11:49 +00:00
Douglas Gregor
f610267581
Eliminate ObjCForwardProtocolDecl, which is redundant now that
...
ObjCProtocolDecl modules forward declarations properly.
llvm-svn: 147415
2012-01-01 21:23:57 +00:00
Douglas Gregor
e6e48b1490
Move the data that corresponds to the definition of a protocol into a
...
separately-allocated DefinitionData structure. Introduce various
functions that will help with the separation of declarations from
definitions (isThisDeclarationADefinition(), hasDefinition(),
getDefinition()).
llvm-svn: 147408
2012-01-01 19:29:29 +00:00
Douglas Gregor
deafd0b2a4
Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDecl
...
covers both declarations (@class ) and definitions (@interface) of an
Objective-C class.
llvm-svn: 147299
2011-12-27 22:43:10 +00:00
Douglas Gregor
c0ac7d688e
Move the definition-specific data of ObjCInterfaceDecl into a
...
separately-allocated DefinitionData structure, which we manage the
same way as CXXRecordDecl::DefinitionData. This prepares the way for
making ObjCInterfaceDecls redeclarable, to more accurately model
forward declarations of Objective-C classes and eliminate the mutation
of ObjCInterfaceDecl that causes us serious trouble in the AST reader.
Note that ObjCInterfaceDecl's accessors are fairly robust against
being applied to forward declarations, because Clang (and Sema in
particular) doesn't perform RequireCompleteType/hasDefinition() checks
everywhere it has to. Each of these overly-robust cases is marked with
a FIXME, which we can tackle over time.
llvm-svn: 146644
2011-12-15 05:27:12 +00:00
Argyrios Kyrtzidis
4d873b725e
[libclang] Indexing API: provide an attribute list inside CXIdxEntityInfo
...
so that we can access the attributes of an entity for a reference.
llvm-svn: 146616
2011-12-15 00:05:00 +00:00
Argyrios Kyrtzidis
41cfce25fe
[libclang] Suppress indexing references for occurrences of the interface
...
in a superclass and the protocols in a protocol list.
llvm-svn: 146615
2011-12-15 00:04:56 +00:00
Douglas Gregor
40d009ff0c
Eliminate the vistigial ObjCClassDecl::ObjCClassRef, and inline its
...
members into ObjCClassDecl, saving ourselves one pointer per forward
declaration.
llvm-svn: 146564
2011-12-14 17:12:03 +00:00
Argyrios Kyrtzidis
9b9f7a9f7a
[libclang] Indexing API: Provide the protocols list for objc categories as well.
...
rdar://10573361
llvm-svn: 146498
2011-12-13 18:47:45 +00:00
Argyrios Kyrtzidis
ccdf8276a3
[libclang] Indexing API: Fix suppressing of references in macros and suppress
...
@class forward references.
rdar://10568080&10568103&10568119
llvm-svn: 146496
2011-12-13 18:47:35 +00:00
Argyrios Kyrtzidis
4996f5fba2
Save category name loc in ObjCCategoryImplDecl, patch by Jason Haslam!
...
llvm-svn: 146213
2011-12-09 00:31:40 +00:00
Argyrios Kyrtzidis
bf1d884d9e
[libclang] Remove IndexingContext's getScopedContext(), it's not useful
...
now that client containers can be set via function calls.
llvm-svn: 146117
2011-12-08 00:54:07 +00:00
Argyrios Kyrtzidis
663c8ecda1
[libclang] Indexing API: provide both the semantic and the lexical container.
...
They are generally the same except in C++ cases like out-of-line member functions.
llvm-svn: 146069
2011-12-07 20:44:19 +00:00
Argyrios Kyrtzidis
b3c16bad20
[libclang] Fix indexing of C++ bases in a C++ class.
...
llvm-svn: 146068
2011-12-07 20:44:15 +00:00
Argyrios Kyrtzidis
520028802c
[libclang] Introduce CXIdxEntityLanguage that indicates the language
...
of an indexed entity.
llvm-svn: 146067
2011-12-07 20:44:12 +00:00
Argyrios Kyrtzidis
2b0b43cf56
[libclang] Index C++ namespaces.
...
llvm-svn: 146019
2011-12-07 05:52:06 +00:00
Argyrios Kyrtzidis
1a10f29b2f
[libclang] When indexing a field in a C++ class, return an entity
...
of kind CXIdxEntity_CXXInstanceVariable. rdar://10522503.
llvm-svn: 145859
2011-12-05 22:05:28 +00:00
Benjamin Kramer
696894a35b
Silence GCC warnings, RefCountedBase is meant to be default-initialized here.
...
llvm-svn: 145396
2011-11-29 11:31:35 +00:00