Douglas Gregor
f88e35ba0b
When using a precompiled preamble with detailed preprocessing records,
...
trap the serialized preprocessing records (macro definitions, macro
instantiations, macro definitions) from the generation of the
precompiled preamble, then replay those when walking the list of
preprocessed entities. This eliminates a bug where clang_getCursor()
wasn't able to find preprocessed-entity cursors in the preamble.
llvm-svn: 120396
2010-11-30 06:16:57 +00:00
Michael J. Spencer
8aaf49959c
Merge System into Support.
...
llvm-svn: 120297
2010-11-29 18:12:39 +00:00
Chris Lattner
5159f6162e
now the FileManager has a FileSystemOpts ivar, stop threading
...
FileSystemOpts through a ton of apis, simplifying a lot of code.
This also fixes a latent bug in ASTUnit where it would invoke
methods on FileManager without creating one in some code paths
in cindextext.
llvm-svn: 120010
2010-11-23 08:35:12 +00:00
Benjamin Kramer
3959370c92
Fix a bunch of IndirectFieldDecl-related warnings.
...
- Negative ChainingSize doesn't make sense, make it unsigned.
llvm-svn: 119943
2010-11-21 14:11:41 +00:00
Chris Lattner
8afa6deb1d
remove old compatibility APIs, use StringRef versions instead.
...
llvm-svn: 119935
2010-11-21 09:55:08 +00:00
Douglas Gregor
06a3f30be9
Implement a simple hash function for libclang cursors
...
llvm-svn: 119876
2010-11-20 00:09:34 +00:00
Douglas Gregor
fec4dc9418
Implement clang_getCanonicalCursor() in libclang, which does the obvious thing.
...
llvm-svn: 119874
2010-11-19 23:44:15 +00:00
Argyrios Kyrtzidis
8d5038c1b3
Get the number of errors reported from the diagnostic client, in clang_parseTranslationUnit_Impl.
...
llvm-svn: 119745
2010-11-18 21:47:04 +00:00
Ted Kremenek
5d304a34c6
CursorVisitor: switch remaining expressions over
...
to the data-recursion algorithm. CursorVisitor
now no longer subclasses StmtVisitor.
llvm-svn: 119596
2010-11-18 00:42:18 +00:00
Ted Kremenek
8390027a99
CursorVisitor: migrate handling of
...
'DependentScopeDeclRefExpr' and
'CXXDependentScopeMemberExpr' to the
data-recursion algorithm.
llvm-svn: 119591
2010-11-18 00:02:32 +00:00
Ted Kremenek
7df92ae92b
Make definition of CXTranslationUnitImpl private
...
to libclang.
llvm-svn: 119585
2010-11-17 23:24:11 +00:00
Douglas Gregor
30313cbb80
When libclang is walking a member access expression, don't walk into
...
an implicit "this"; it causes clang_getCursor() to find the implicit
"this" expression (which isn't written in the source!) rather than the
actual member.
llvm-svn: 119516
2010-11-17 17:15:08 +00:00
Douglas Gregor
29ee422861
When comparing the source range of a declaration against the region of
...
interest (e.g., as used by clang_getCursor()), count the
decl-specifier-seq as part of the source range, as we do for
clang_annotateTokens(). Makes clang_getCursor() work properly for the
result types of functions, for example.
llvm-svn: 119514
2010-11-17 17:14:07 +00:00
Ted Kremenek
9f49b37f25
CursorVisitor: Migrate handling of
...
'SizeOfAlignOfExpr' and 'CXXSCalarValueInitExpr'
to data-recursion algorithm.
llvm-svn: 119452
2010-11-17 02:18:35 +00:00
Douglas Gregor
b1b71e50a0
For an Objective-C @synthesize statement, e.g.,
...
@synthesize foo = _foo;
keep track of the location of the ivar ("_foo"). Teach libclang to
visit the ivar as a member reference.
llvm-svn: 119447
2010-11-17 01:03:52 +00:00
Ted Kremenek
7003a50b77
CursorVisitor: migrate handling of CXXUuidofExpr to
...
data-recursion algorithm.
llvm-svn: 119444
2010-11-17 00:50:52 +00:00
Ted Kremenek
513cd579b6
CursorVisitor: migrate handling of UnaryTypeTraitExpr
...
to data-recursion algorithm.
llvm-svn: 119443
2010-11-17 00:50:50 +00:00
Ted Kremenek
8eaa165c7e
CursorVisitor: refactor visitation of
...
explicit template args within data-recursion
algorithm.
llvm-svn: 119442
2010-11-17 00:50:47 +00:00
Ted Kremenek
e48db8dfae
CursorVisitor: migrate handling of
...
AddrLabelExpr to data-recursion algorithm, and
unify that reasoning with GotoStmt.
llvm-svn: 119441
2010-11-17 00:50:45 +00:00
Ted Kremenek
c1c30cd329
CursorVisitor: migrate handling of
...
VAArgExpr to data-recursion algorithm.
llvm-svn: 119440
2010-11-17 00:50:43 +00:00
Ted Kremenek
a51cc43261
CursorVisitor: migrate handling of
...
CXXTypeidExpr to data-recursion algorithm.
llvm-svn: 119439
2010-11-17 00:50:41 +00:00
Ted Kremenek
dd0d4b4192
CursorVisitor: migrate handling of
...
TypesCompatibleExpr to data-recursion algorithm.
llvm-svn: 119438
2010-11-17 00:50:39 +00:00
Ted Kremenek
79ddc67caa
CursorVisitor: Migrate CXXUnresolvedConstructExpr over to data-recursive algorithm.
...
llvm-svn: 119437
2010-11-17 00:50:36 +00:00
Douglas Gregor
68dbaead7b
Fix source-range information for Objective-C properties. Previously,
...
we were just getting a range covering only the property name, which is
certainly not correct (and broke token annotation, among other
things).
Also, teach libclang about the relationship between
@synthesize/@dynamic and @property, so we get property name and
cursor-reference information for @synthesize and @dynamic.
llvm-svn: 119409
2010-11-17 00:13:31 +00:00
Benjamin Kramer
d1fb1f49a2
MSVC doesn't like the noinline attribute at the end of a declaration. Try the other side.
...
llvm-svn: 119349
2010-11-16 15:45:46 +00:00
Ted Kremenek
915542850b
Change CXTranslationUnit to not directly cast to an ASTUnit*,
...
but to wrap both an ASTUnit and a "string pool"
that will be used for fast USR generation.
This requires a bunch of mechanical changes, as
there was a ton of code that assumed that CXTranslationUnit
and ASTUnit* were the same.
Along with this change, introduce CXStringBuf,
which provides an llvm::SmallVector<char> backing
for repeatedly generating CXStrings without a huge
amount of malloc() traffic. This requires making
some changes to the representation of CXString
by renaming a few fields (but keeping the size
of the object the same).
llvm-svn: 119337
2010-11-16 08:15:36 +00:00
Ted Kremenek
4b4f36990d
Move CXString creation/management routines into
...
their own .cpp file and make the interpretation
of its flags private.
llvm-svn: 119319
2010-11-16 01:56:27 +00:00
Ted Kremenek
a4c27ec73b
CursorVisitor: cache worklists created for data-recursion to reduce malloc() traffic.
...
llvm-svn: 119290
2010-11-15 23:31:32 +00:00
Ted Kremenek
acd03f6fa3
Use LLVM_ATTRIBUTE_NOINLINE instead of attribute((noinline)).
...
llvm-svn: 119287
2010-11-15 23:11:54 +00:00
Ted Kremenek
e6f030467c
Cast pointers instead of returning a new value within RunVisitorWorkList().
...
llvm-svn: 119282
2010-11-15 22:23:26 +00:00
Ted Kremenek
51df4d5596
Annotate CursorVisitor::VisitDataRecursive() with attribute 'noinline'.
...
Clang currently uses a ridiculous amount of stack space when inlining
this function, which can lead to premature stack overflows.
llvm-svn: 119281
2010-11-15 22:23:24 +00:00
Ted Kremenek
ca817a3c0c
"Fix" some unintentional fallout from converting
...
the Stmt* visitation in CursorVisitor to be
data-recursive.
Since AnnotationTokensWorker explicitly calls
CursorVisitor::VisitChildren(), it essentially
transforms the data-recursive algorithm in
CursorVisitor back into a non-data recursive one.
This is particularly bad because the data-recursive
algorithm uses more stack space per stack frame,
which can cause us to blow the stack in some cases.
"Fix" this by making the stack that AnnotationTokensWorker
runs in really huge. The real fix is to modify
AnnotationTokensWorker not to do the explicit
recursive call.
llvm-svn: 119047
2010-11-14 17:47:35 +00:00
Ted Kremenek
d57f43eb3a
CursorVisitor: make data-recursion algorithm the default except for the few remaining Exprs still
...
covered by the normal recursive visitation.
llvm-svn: 119030
2010-11-14 05:45:47 +00:00
Ted Kremenek
d34c65d8a2
Remove stale #include.
...
llvm-svn: 119028
2010-11-14 05:28:43 +00:00
Ted Kremenek
bc8b378848
Rewrite reverse iteration loop in a more natural countdown manner.
...
llvm-svn: 118990
2010-11-13 05:55:56 +00:00
Ted Kremenek
89bad8a6e7
CursorVisitor: migrate CXXNewExpr and CXXDefaultArgExpr over to data-recursive algorithm.
...
llvm-svn: 118989
2010-11-13 05:55:53 +00:00
Ted Kremenek
fdc5237b5e
CursorVisitor: special-case CompoundStmt in data-recursion algorithm so we don't have to enqueue
...
its children and then reverse them.
llvm-svn: 118986
2010-11-13 05:38:03 +00:00
Ted Kremenek
809c6fc93c
CursorVisitor: Migrate BlockExpr, CXXTemporaryOBjectExpr, and ObjCEncodeExpr to data-recursive algorithm.
...
llvm-svn: 118964
2010-11-13 01:09:29 +00:00
Ted Kremenek
573411b539
CursorVisitor: Migrate DeclRefExpr over to data-recursion algorithm.
...
llvm-svn: 118961
2010-11-13 00:58:18 +00:00
Ted Kremenek
03b8602490
CursorVisitor: migrate GotoStmt to data-recursive algorithm.
...
llvm-svn: 118960
2010-11-13 00:58:15 +00:00
Ted Kremenek
072e637671
CursorVisitor: migrate DeclStmt over to data-recursive algorithm.
...
llvm-svn: 118957
2010-11-13 00:36:50 +00:00
Ted Kremenek
acff73c3bf
CursorVisitor: Convert logic for populating data-recursion worklist from a switch statement to a StmtVisitor. No functionality change.
...
llvm-svn: 118956
2010-11-13 00:36:47 +00:00
Nick Lewycky
214a0ad0c7
Use dyn_cast result instead of re-casting. Fixes -Werror build with:
...
/llvm/tools/clang/tools/libclang/CIndex.cpp:1823: error: unused variable 'E' [-Wunused-variable]
llvm-svn: 118947
2010-11-12 23:52:43 +00:00
Ted Kremenek
e0f9382d64
CursorVisitor: Pull ObjCMessageExpr and explicit casts into data-recursion algorithm.
...
llvm-svn: 118934
2010-11-12 22:24:57 +00:00
Ted Kremenek
0d693a161c
CursorVisitor: migrate ObjCMessageExpr over to data-recursion algorithm.
...
llvm-svn: 118933
2010-11-12 22:24:55 +00:00
Ted Kremenek
cfbbeda7dc
CursorVisitor: migrate UnresolvedMemberExpr and UnresolvedLookupExpr over to data-recursion algorithm.
...
llvm-svn: 118929
2010-11-12 21:34:16 +00:00
Ted Kremenek
e12bcf5717
CursorVisitor: migrate CompoundLiteralExpr over to data-recursion algorithm.
...
llvm-svn: 118928
2010-11-12 21:34:12 +00:00
Ted Kremenek
6a5df579e6
CursorVisitor: add data-recursion support for InitListExprs.
...
llvm-svn: 118927
2010-11-12 21:34:09 +00:00
Ted Kremenek
cb035359e8
CursorVisitor: migrate 'DoStmt', 'ForStmt', and 'WhileStmt' over to data-recursion algorithm.
...
llvm-svn: 118912
2010-11-12 18:27:04 +00:00
Ted Kremenek
b50e311bad
CursorVisitor: use 'WLAddStmt' and 'WLAddDecl' for adding to data-recursion worklist.
...
llvm-svn: 118911
2010-11-12 18:27:01 +00:00