Douglas Gregor
e0fbb83b8b
Give SourceManager a Diagnostic object with which to report errors,
...
and start simplifying the interfaces in SourceManager that can fail.
llvm-svn: 98594
2010-03-16 00:06:06 +00:00
Douglas Gregor
802b77601e
Introduce a new BufferResult class to act as the return type of
...
SourceManager's getBuffer() (and similar) operations. This abstract
can be used to force callers to cope with errors in getBuffer(), such
as missing files and changed files. Fix a bunch of callers to use the
new interface.
Add some very basic checks for file consistency (file size,
modification time) into ContentCache::getBuffer(), although these
checks don't help much until we've updated the main callers (e.g.,
SourceManager::getSpelling()).
llvm-svn: 98585
2010-03-15 22:54:52 +00:00
Ted Kremenek
bc1a67bee3
Rename clang_constructUSR_ObjCategory to clang_constructUSR_ObjCCategory.
...
(there was a missing 'C').
llvm-svn: 98554
2010-03-15 17:38:58 +00:00
Anton Korobeynikov
762c6b7346
Fix thinko and enable clang build on mingw again (hopefully)
...
llvm-svn: 98492
2010-03-14 12:55:35 +00:00
Benjamin Kramer
f156b9d55d
Revert 98439. There is a bad race condition in sys::Path::makeUnique on win32.
...
llvm-svn: 98452
2010-03-13 21:22:49 +00:00
Benjamin Kramer
84c37f9903
Make getTemporaryPath a static member of CIndexer and use it to replace tmpnam calls.
...
This fixes linker warnings on linux.
llvm-svn: 98439
2010-03-13 13:05:20 +00:00
Ted Kremenek
d071c6019a
Implement several CIndex functions for constructing USRs from C-strings instead of AST elements.
...
llvm-svn: 98421
2010-03-13 02:50:34 +00:00
Jeffrey Yasskin
f6442f80cb
Allow users to set CPPFLAGS and CXXFLAGS on the make command line.
...
Tested: make CPPFLAGS=-m64 CXXFLAGS=-m64 -j8 && (cd tools/clang;make test)
llvm-svn: 98399
2010-03-12 22:55:16 +00:00
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
Ted Kremenek
adccbca23f
Don't enable static analysis support for C++ by default. Users are
...
accidentally using it without realizing that it is nowhere close
to being generally usable and are reporting crashes that we
already know about.
llvm-svn: 97960
2010-03-08 19:06:44 +00:00
Kovarththanan Rajaratnam
4bc61181f9
Mark variable as const
...
llvm-svn: 97951
2010-03-08 18:33:04 +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
Chris Lattner
03b3eba151
disable these dirs which rely on dynamic linking on mingw/cygwin
...
llvm-svn: 97892
2010-03-07 00:17:28 +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
Douglas Gregor
0b46650b66
c-index-test's printing of linkage was completely broken, as was the
...
test of this functionality. The API worked great, though! :)
llvm-svn: 97736
2010-03-04 19:36:27 +00:00
Ted Kremenek
83b28a2433
Add '-test-print-linkage-source' option to c-index-test
...
to test clang_getCursorLinkage()
llvm-svn: 97648
2010-03-03 06:37:58 +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
Charles Davis
dde71b93da
Pass -m32 and -m64 to the static analyzer when using scan-build. Now we can
...
use scan-build with Wine, for example.
Ted, I hope this is OK.
llvm-svn: 97566
2010-03-02 15:26:41 +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
cea0c70f12
Frontend: Pull CodeGenAction out more, and eliminate CreateBackendConsumer.
...
This is the way I would like to move the frontend function towards -- distinct
pieces of functionality should be exposed only via FrontendAction
implementations which have clean and relatively-stable APIs.
This also isolates the surface area in clang which depends on LLVM CodeGen.
llvm-svn: 97110
2010-02-25 04:37:45 +00:00
Daniel Dunbar
12ee380a61
Driver: Use TextDiagnosticPrinter instead of a custom one.
...
llvm-svn: 97102
2010-02-25 03:23:43 +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
Daniel Dunbar
43b464cfe5
Remove unused includes.
...
llvm-svn: 96760
2010-02-21 21:47:19 +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
Daniel Dunbar
d2b20c1348
clang: Add support for s// edit form of QA_OVERRIDE_GCC3_OPTIONS.
...
- Used to do regex patsubst on arguments.
llvm-svn: 96512
2010-02-17 21:00:34 +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