Ted Kremenek
ff9021b675
Implement clang_isUnexposed(), a predicate function to simplify filtering out
...
unexposed AST elements.
llvm-svn: 97985
2010-03-08 21:17:29 +00:00
Douglas Gregor
de4827dd34
Extend ObjCMessageExpr for class method sends with the source location
...
of the class name.
llvm-svn: 97943
2010-03-08 16:40:19 +00:00
Douglas Gregor
12852d9521
Keep track of type source information in the return type of an
...
Objective-C method declaration, e.g., for
- (Foo *)myMethod;
we now have TypeSourceInfo for the Foo*.
llvm-svn: 97942
2010-03-08 14:59:44 +00:00
Ted Kremenek
a6d3ab394c
Check if 'Unit' is NULL before trying to iterate over the diagnostics.
...
This obviates a null dereference that can occur when 'NumErrors'
is not zero.
llvm-svn: 97849
2010-03-05 22:43:29 +00:00
Ted Kremenek
b39084072f
Add clang version to crashtracer string.
...
llvm-svn: 97848
2010-03-05 22:43:25 +00:00
Douglas Gregor
0c7c2f8b4d
A little hack to identify unwanted concurrency in CIndex
...
llvm-svn: 97831
2010-03-05 21:16:25 +00:00
Ted Kremenek
547f4172b7
Export clang_getCursorLinkage().
...
llvm-svn: 97647
2010-03-03 06:37:30 +00:00
Ted Kremenek
fb4961dfd0
Add clang_getCursorLinkage(), which returns the
...
underlying linkage for the entity referred to by a
CXCursor.
llvm-svn: 97646
2010-03-03 06:36:57 +00:00
Douglas Gregor
89a56c561f
When given unsaved files in clang_createTranslationUnitFromSourceFile,
...
copy the source buffers provided rather than referencing them
directly, so that the caller can free those buffers immediately after
calling clang_createTranslationUnitFromSourceFile(). Otherwise, we
risk hitting those buffers later (when building source ranges, forming
diagnostics, etc.).
llvm-svn: 97296
2010-02-27 01:32:48 +00:00
Daniel Dunbar
253dbad1c9
Fix bogus diagnostic format string.
...
llvm-svn: 96978
2010-02-23 20:23:45 +00:00
Douglas Gregor
d770f73fac
Rework the CIndex API for displaying diagnostics. Instead of printing
...
the diagnostics to a FILE*, return a CXString containing the formatted
diagnostic.
llvm-svn: 96823
2010-02-22 23:17:23 +00:00
Douglas Gregor
e61e24a5e3
Attempt to fix the MSVC9 failure with c-indext-test, where the CIndex DLL
...
and the c-index-test executable end up getting different copies of
stderr, causing non-deterministic ordering of output. Fixed by
flushing the file after printing a diagnostic (only on Windows).
llvm-svn: 96754
2010-02-21 20:15:42 +00:00
Douglas Gregor
836ec94c8e
Simplify the CIndex fix-it API, now that we have half-open CXSourceRanges.
...
llvm-svn: 96685
2010-02-19 18:16:06 +00:00
Douglas Gregor
6cb5ba4c4f
Teach ASTUnit to keep track of temporary files, then delete them when
...
the ASTUnit itself is destroyed. Fixes <rdar://problem/7649385>.
llvm-svn: 96628
2010-02-18 23:35:40 +00:00
Douglas Gregor
1e21cc7d19
Re-apply my diagnostics-capture patch for CIndex, with some tweaks to
...
try to address the msvc failures.
llvm-svn: 96624
2010-02-18 23:07:20 +00:00
Ted Kremenek
e21102523a
Revert "Sort visitor methods so we can easily tell what's implemented."
...
This reverts commit 4383e04c75731f8695b8355783f9966ac56b0926.
llvm-svn: 96622
2010-02-18 22:36:18 +00:00
Ted Kremenek
aaaf2bfffb
Revert "Tidy up order of switch statement. No functionality change."
...
This reverts commit 95575005fc6409df98e6e079caf324308f62171b.
llvm-svn: 96620
2010-02-18 22:32:43 +00:00
Douglas Gregor
9773e3d077
Revert my CIndex diagnostic changes (r96603, 96606, 96607), which were
...
breaking the msvc9 builder for unknown reasons.
llvm-svn: 96618
2010-02-18 22:27:07 +00:00
Douglas Gregor
81d53769b5
Introduce debugging/testing hook clang_enableStackTraces() into
...
CIndex, so that c-index-test to use it to call
lvm::sys::PrintStackTraceOnErrorSignal().
llvm-svn: 96607
2010-02-18 20:22:25 +00:00
Douglas Gregor
707cf72cb8
Resurrect the displayDiagnostics parameter to clang_createIndex(), and
...
display captured diagnostics when we can't return an invalid
CXTranslationUnit.
llvm-svn: 96606
2010-02-18 20:11:31 +00:00
Douglas Gregor
06dcf0375b
Introduce CIndex API functions for displaying a diagnostic, with some
...
knobs to control formatting. Eventually, I'd like to merge the
implementation of this code with the TextDiagnosticPrinter, so that
it's easy for CIndex clients to produce beautiful diagnostics like the
clang compiler does.
Use this new function to display diagnostics within c-index-test.
llvm-svn: 96603
2010-02-18 19:08:21 +00:00
Ted Kremenek
fcb3db7d68
Tidy up order of switch statement. No functionality change.
...
llvm-svn: 96602
2010-02-18 18:52:18 +00:00
Ted Kremenek
7dff4163aa
Sort visitor methods so we can easily tell what's implemented.
...
llvm-svn: 96600
2010-02-18 18:47:08 +00:00
Ted Kremenek
0e2930979d
Change cursor behavior for attributes to have them visited as part of recursing
...
to the children of a Decl.
llvm-svn: 96599
2010-02-18 18:47:01 +00:00
Douglas Gregor
33cdd81064
Rework how CIndex handles diagnostics. Rather than using a callback,
...
we attach diagnostics to translation units and code-completion
results, so they can be queried at any time.
To facilitate this, the new StoredDiagnostic class stores a diagnostic
in a serializable/deserializable form, and ASTUnit knows how to
capture diagnostics in this stored form. CIndex's CXDiagnostic is a
thin wrapper around StoredDiagnostic, providing a C interface to
stored or de-serialized diagnostics.
I've XFAIL'd one test case temporarily, because currently we end up
storing diagnostics in an ASTUnit that's never returned to the user
(because it contains errors). I'll introduce a temporary fix for this
soon; the real fix will be to allow us to return and query invalid ASTs.
llvm-svn: 96592
2010-02-18 18:08:43 +00:00
Ted Kremenek
6ab9aa02e3
Add basic cursor traversal for attributes. We currently don't have source
...
ranges for Attr objects, so lookup by cursor location currently doesn't work.
llvm-svn: 96571
2010-02-18 05:46:33 +00:00
Douglas Gregor
4db30233a8
Teach CMake to put the CIndex header into the Xcode/MSVC project
...
llvm-svn: 96566
2010-02-18 04:01:41 +00:00
Ted Kremenek
bff31437ef
Start adding cursor kinds for attributes, with first exposing
...
IBActionAttr and IBOutletAttr respectively.
llvm-svn: 96563
2010-02-18 03:09:07 +00:00
Ted Kremenek
896e164351
Don't make the inclusion of crashtracer information depend on NDEBUG.
...
llvm-svn: 96515
2010-02-17 21:12:23 +00:00
Ted Kremenek
f602f96e60
Convert clang_getCompletionChunkText() to return a CXString.
...
llvm-svn: 96439
2010-02-17 01:42:24 +00:00
Ted Kremenek
f441baf6dd
Remove trailing spaces.
...
llvm-svn: 96427
2010-02-17 00:41:40 +00:00
Ted Kremenek
29004673f7
Change clang_getCursorKindSpelling() to return a CXString
...
instead of a 'const char *'.
llvm-svn: 96425
2010-02-17 00:41:32 +00:00
Ted Kremenek
c560b6835e
Change clang_getFileName() to return a 'CXString' instead of 'const char *'.
...
llvm-svn: 96424
2010-02-17 00:41:20 +00:00
Ted Kremenek
5cca6ebae9
Move createCXString() functions out of CIndexer and into the clang::cxstring namespace.
...
We can much more succinctly refer to these functions this way.
Also change the default behavior of createCXString(StringRef&) to duplicate the
string. This is almost always what we want. The other case is where we pass
a constant c-string, which uses the other version of createCXString().
llvm-svn: 96423
2010-02-17 00:41:08 +00:00
Daniel Dunbar
1951192213
ASTUnit: Constant fold UseBumpAllocator to true, we don't care to support this as an argument.
...
llvm-svn: 96316
2010-02-16 01:55:04 +00:00
Daniel Dunbar
02968e53cf
CIndex: Switch CXSourceRange to proper half-open intervals.
...
- Doug, please review.
llvm-svn: 96162
2010-02-14 10:02:57 +00:00
Daniel Dunbar
edeb9b87e6
CIndex: Avoid an unnecessary getLocForEndOfToken call, the region of interest
...
doesn't need to be a full token.
- Doug, please review.
llvm-svn: 96161
2010-02-14 10:02:42 +00:00
Daniel Dunbar
2049933196
CIndex: Simplify (remove provably dead code).
...
llvm-svn: 96157
2010-02-14 08:32:11 +00:00
Daniel Dunbar
2f4ba179f5
CIndex: Inline CompareRegionOfInterest(CXSourceRange) into sole caller.
...
llvm-svn: 96156
2010-02-14 08:32:05 +00:00
Daniel Dunbar
80daf53600
Rename translateSourceRange(CXSourceRange) translateCXSourceRange, instead of
...
having overloaded functions with inverse semantics.
llvm-svn: 96155
2010-02-14 08:31:57 +00:00
Daniel Dunbar
c4b4d3953c
CIndex: Kill off CXSourceLocationPtr, and AtEnd arguments.
...
llvm-svn: 96145
2010-02-14 01:47:36 +00:00
Daniel Dunbar
474b207716
CIndex: Stop hiding magic end bit in CXSourceRange locations where clients can't
...
see it. Instead, translate the locations up-front when we create a
CXSourceRange.
- This is part of a move to make CXSourceRange a pure half-open range, which is
a more natural API for clients to deal with. More cleanups to follow.
llvm-svn: 96144
2010-02-14 01:47:29 +00:00
Ted Kremenek
a3e657064b
Make the following functions thread-safe but having them return an std::string that is reconstructed
...
every time they are called:
getClangRevision()
getClangFullRepositoryVersion()
getClangFullVersion()
llvm-svn: 96033
2010-02-12 22:54:40 +00:00
Douglas Gregor
0a5a2216e2
Eliminate the ASTContext parameter from RecordDecl::getDefinition()
...
and CXXRecordDecl::getDefinition(); it's totally unnecessary. No
functionality change.
llvm-svn: 95836
2010-02-11 01:04:33 +00:00
Douglas Gregor
4b8fd6d3d3
Clean up the CIndex interface to diagnostic ranges. Thanks, Daniel!
...
llvm-svn: 95602
2010-02-08 23:11:56 +00:00
John McCall
2adddcae7e
Remove abstract expression kinds from the StmtClass enum. Update a few users
...
appropriately. Call out a few missing cases in the expression mangler.
llvm-svn: 95176
2010-02-03 00:55:45 +00:00
Daniel Dunbar
64ee535382
CIndex: Respect TMPDIR/TEMP/TMP when making temporary files for remapping. As a
...
side effect, this also fixes some cases on Windows where the file would end up
on a different drive, because tmpnam doesn't include the drive component. PR3837
strikes again.
llvm-svn: 95067
2010-02-02 05:19:57 +00:00
Daniel Dunbar
a4a2e5dd5b
CIndex: Fix a crash in clang_createTranslationUnitFromSourceFile when using
...
external ASTs, and the ASTUnit fails to load.
Also, move getLocationFromExpr outside extern "C" block.
llvm-svn: 95065
2010-02-02 05:00:22 +00:00
Sebastian Redl
5ca7984bb4
In C++, an initializer on a variable doesn't necessarily mean it's the definition. With that in mind, rename getDefinition to getAnyInitializer (to distinguish it from getInit) and reimplement it in terms of isThisDeclarationADefinition. Update all code to use this new function.
...
llvm-svn: 94999
2010-02-01 20:16:42 +00:00
Daniel Dunbar
baf33fc56f
CIndex/USRs: Disable a bogus assert, we don't want CIndex to crash liberally. I
...
have sent Ted a test case for this.
llvm-svn: 94935
2010-01-31 00:41:05 +00:00