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
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
ce79bc9c7a
c-index-test: Pass appropriate client data.
...
llvm-svn: 96317
2010-02-16 01:55:10 +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
e922d9bdf0
CompilerInstance: Move LLVMContext member out of constructor.
...
llvm-svn: 96314
2010-02-16 01:54:47 +00:00
Daniel Dunbar
aced322c3c
Switch clang to use its own LLVMContext (not the global one).
...
llvm-svn: 96313
2010-02-16 01:54:33 +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
6092d507f0
c-index-test: Unify and always print half-open extents.
...
llvm-svn: 96160
2010-02-14 08:32:51 +00:00
Daniel Dunbar
eb27e7d999
c-index-test: Simplify file scanning code.
...
llvm-svn: 96159
2010-02-14 08:32:32 +00:00
Daniel Dunbar
98c07e0e23
c-index-test: Unify syntax for printing extents. Yes, there were 4.
...
llvm-svn: 96158
2010-02-14 08:32:24 +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
Ted Kremenek
e9711db487
Two changes to scan-build:
...
(1) When no 'clang' is found with 'scan-build', remember the one from
the path as scan-build sees it, not the build system. This prevents
us from finding different clangs during the build.
(2) Don't set LDPLUSPLUS when running xcodebuild; instead rely on the
clang driver to do the right thing.
llvm-svn: 95943
2010-02-12 00:12:25 +00:00
Ted Kremenek
14015de619
Add comments.
...
llvm-svn: 95942
2010-02-12 00:10:34 +00:00
Ted Kremenek
50228be0f3
Attempt to always dispose of the CXIndex object in c-index-test.
...
llvm-svn: 95864
2010-02-11 07:41:25 +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
Daniel Dunbar
d64ce7b611
c-index-test: Add "none" filter, useful for performance testing.
...
llvm-svn: 95800
2010-02-10 20:42:40 +00:00
Douglas Gregor
62d311fdf4
Introduce a testbed for merging multiple ASTs into a single AST
...
context with the AST importer. WIP, still useless but at least it has
a test.
llvm-svn: 95683
2010-02-09 19:21:46 +00:00
Ted Kremenek
74cc62e161
Tweak output.
...
llvm-svn: 95676
2010-02-09 18:51:44 +00:00
Ted Kremenek
8de7a0efd1
Add a check for a running Xcode before modifying its configuration files.
...
llvm-svn: 95675
2010-02-09 18:46:58 +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
Ted Kremenek
e52f932f5f
Add some diagnostics for when we cannot update the original spec file.
...
llvm-svn: 95572
2010-02-08 21:19:27 +00:00
Ted Kremenek
94c5349ef2
Add a Python script to change what version of Clang is used by Xcode for static analysis (and ONLY static analysis).
...
llvm-svn: 95569
2010-02-08 20:54:01 +00:00
Ted Kremenek
6a93195783
Fix how scan-build finds c++-analyzer to work with checker builds.
...
llvm-svn: 95425
2010-02-05 20:34:14 +00:00
Ted Kremenek
01a83104a2
Now that the -cc1 options for analyzer checks have a structured naming, add back scanning for analyzer checks to scan-build.
...
llvm-svn: 95349
2010-02-05 02:18:39 +00:00
Ted Kremenek
2f2692f8ca
Rename -cc1 option '-checker-cfref' to '-analyzer-check-objc-mem'.
...
llvm-svn: 95348
2010-02-05 02:06:54 +00:00
Ted Kremenek
b6e400c87c
Rename -cc1 option '-warn-objc-missing-dealloc' to '-analyzer-check-objc-missing-dealloc'.
...
llvm-svn: 95347
2010-02-05 01:59:21 +00:00
Ted Kremenek
61b506aa8f
Rename -cc1 option '-warn-objc-methodsigs' to '-analyzer-check-objc-methodsigs'.
...
llvm-svn: 95346
2010-02-05 01:57:44 +00:00
Ted Kremenek
2d8ef71ae6
Rename -cc1 option '-warn-objc-unused-ivars' to '-analyzer-check-objc-unused-ivars'.
...
llvm-svn: 95345
2010-02-05 01:55:01 +00:00
Ted Kremenek
d519b83757
Rename -cc1 option '-warn-dead-stores' to '-analyzer-check-dead-stores'.
...
llvm-svn: 95343
2010-02-05 01:52:40 +00:00
Ted Kremenek
ec5b3d45c1
Rename -cc1 option '-warn-security-syntactic' to '-analyzer-check-security-syntactic'.
...
llvm-svn: 95342
2010-02-05 01:50:36 +00:00
Daniel Dunbar
92db0fbe5a
clang -cc1: Wire up -emit-obj, for emitting object files.
...
llvm-svn: 95182
2010-02-03 01:18:43 +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
Daniel Dunbar
83a2354c8b
CIndex: Fix clang_equalLocations for change to ptr_data field.
...
llvm-svn: 94930
2010-01-30 23:58:27 +00:00
Daniel Dunbar
9ee3a92a75
CIndex: Fix diagnostic callback to not return SourceLocations with a reference to a temporary LangOptions object.
...
llvm-svn: 94928
2010-01-30 23:31:49 +00:00
Daniel Dunbar
854d36bd9b
CIndex: Fix ReportSerializedDiagnostics to honor the DiagnosticClient contract
...
that diagnostics with a source location should occur inside
{Begin,End}SourceFile.
Note that code completion is currently passing in an invalid LangOptions object
due to its implementation, I need to sort this out with Doug.
llvm-svn: 94927
2010-01-30 23:31:40 +00:00
Chandler Carruth
7e6c0fcc59
Bring driver link order in CMake into alignment with the order in the Makefile.
...
This includes the fix in r94797 to reflect the new dependency of Sema on
Analysis.
llvm-svn: 94806
2010-01-29 10:03:42 +00:00
Zhongxing Xu
0fcbe369aa
Fix linking problem on Linux.
...
llvm-svn: 94797
2010-01-29 03:25:47 +00:00
Anders Carlsson
ba6c437d52
Add an CXXBindReferenceExpr (not used just yet).
...
llvm-svn: 94791
2010-01-29 02:39:32 +00:00
Douglas Gregor
69ff5dc0cb
Harden the CIndex implementation a bit, so that it does not assert
...
when given bad inputs.
llvm-svn: 94769
2010-01-29 00:47:48 +00:00
Douglas Gregor
60b11f6dfd
When printing diagnostics in c-index-test, also print source ranges
...
and fix-it information, so we can see everything in one place. Along
the way, fix a few bugs with deserialization and query of diagnostics
in CIndex.
llvm-svn: 94768
2010-01-29 00:41:11 +00:00
Douglas Gregor
ac0605e927
Introduce serialization and deserialization of diagnostic information
...
so that CIndex can report diagnostics through the normal mechanisms
even when executing Clang in a separate process. This applies both
when performing code completion and when using ASTs as an intermediary
for clang_createTranslationUnitFromSourceFile().
The serialized format is not perfect at the moment, because it does
not encapsulate macro-instantiation information. Instead, it maps all
source locations back to the instantiation location. However, it does
maintain source-range and fix-it information. To get perfect fidelity
from the serialized format would require serializing a large chunk of
the source manager; at present, it isn't clear if this code will live
long enough for that to matter.
llvm-svn: 94740
2010-01-28 06:00:51 +00:00
Douglas Gregor
ba965fb2a7
Switch the remaining diagnostic printing in CIndex over to the
...
diagnostic callback mechanism, so all diagnostics now go through that
callback. Also, eliminate the displayDiagnostics flag to
clang_createIndex(), since it is no longer necessary: the client
determines whether to display diagnostics or not.
llvm-svn: 94714
2010-01-28 00:56:43 +00:00
Douglas Gregor
4f9c376570
Implement a diagnostics callback for the C interface to Clang, so that
...
clients can format diagnostics as they wish rather than having to
parse standard error. All of the important parts of the front end's
diagnostics are exposed: text, severity, location, source ranges, and
fix-its. The diagnostics callback is now available with
clang_createTranslationUnitFromSource() and
clang_createTranslationUnit().
As part of this change, CXSourceLocation and CXSourceRange got one
pointer larger, since we need to hold on to the SourceManager and
LangOptions structures in the source location. This is the minimum
amount of information needed for the functions that operate on source
locations and ranges (as implemented now). Previously we held on to
the ASTContext, but the diagnostics callback can end up with source
locations when there is no ASTContext (or preprocessor).
Still to do:
- Code completion needs to support the diagnostics callback, once we
have the ability to (de-)serialize diagnostics.
- Eliminate the "displayDiagnostics" argument to createIndex; we'll
always pass diagnostics to the callback and let it deal with display.
llvm-svn: 94709
2010-01-28 00:27:43 +00:00
Chandler Carruth
2370ec6513
Fix libCIndex.so's lookup of the clang executable on CMake out-of-tree builds.
...
llvm-svn: 94668
2010-01-27 07:37:16 +00:00
Ted Kremenek
0b86e3a72d
Implement 'clang_getInclusions()' in CIndex. This API allows clients to walk the set of files included in a translation unit via the C API.
...
llvm-svn: 94575
2010-01-26 19:31:51 +00:00
Douglas Gregor
9bd6db5834
Eliminate clang_getInstantiationLocationOffset(), and instead add an
...
offset parameter to clang_getInstantiationLocation().
llvm-svn: 94573
2010-01-26 19:19:08 +00:00
Douglas Gregor
6165611986
Implement clang_annotateTokens(), which associates cursors with each
...
of the tokens within a raw token stream. This does not even attempt to
handle macros yet.
llvm-svn: 94561
2010-01-26 18:31:56 +00:00
Ted Kremenek
b478ff4efc
Add 'PostVisitTU' callback hook to 'perform_test_load()' to allow a special callback after the translation unit has been loaded (and streamed).
...
llvm-svn: 94557
2010-01-26 17:59:48 +00:00
Ted Kremenek
a97a5cd59e
Allow the 'visitor' argument to 'perform_test_load()' to be NULL. The
...
utility of this change will be made clearer in a subsequent patch when
perform_test_load()' does more than stream the AST.
llvm-svn: 94556
2010-01-26 17:55:33 +00:00
Douglas Gregor
27b4fa994d
Introduce a CIndex API for lexing the raw tokens within a given source
...
range. The token-annotation function does nothing, yet.
llvm-svn: 94551
2010-01-26 17:06:03 +00:00
Douglas Gregor
47751d6c21
Introduce clang_getInstantiationLocationOffset(), which decomposes a
...
source location in file + offset.
llvm-svn: 94497
2010-01-26 03:07:15 +00:00
Ted Kremenek
97a4537138
Pull functions that translate from CXSourceLocation to SourceLocation (and back) to a separate header file.
...
llvm-svn: 94462
2010-01-25 22:34:44 +00:00
Ted Kremenek
6dc73bc183
Fix include guard.
...
llvm-svn: 94447
2010-01-25 21:09:34 +00:00
Douglas Gregor
5bce76cd53
Loosen preconditions for clang_getCursorSpelling(), returning an empty
...
string when given a cursor that does not have a name. Also, don't give
silly names for statements and non-reference expressions.
llvm-svn: 94426
2010-01-25 16:56:17 +00:00
Douglas Gregor
33f1685607
Expect the impossible
...
llvm-svn: 94425
2010-01-25 16:45:46 +00:00
Douglas Gregor
7201f9f6b8
Visit the condition variables of while and for loops; also, visit the
...
condition even when we've visited the condition variable, so that
we'll see implicit conversions there.
llvm-svn: 94423
2010-01-25 16:12:32 +00:00
Ted Kremenek
d6b8708643
Split libAnalysis into two libraries: libAnalysis and libChecker.
...
(1) libAnalysis is a generic analysis library that can be used by
Sema. It defines the CFG, basic dataflow analysis primitives, and
inexpensive flow-sensitive analyses (e.g. LiveVariables).
(2) libChecker contains the guts of the static analyzer, incuding the
path-sensitive analysis engine and domain-specific checks.
Now any clients that want to use the frontend to build their own tools
don't need to link in the entire static analyzer.
This change exposes various obvious cleanups that can be made to the
layout of files and headers in libChecker. More changes pending. :)
This change also exposed a layering violation between AnalysisContext
and MemRegion. BlockInvocationContext shouldn't explicitly know about
BlockDataRegions. For now I've removed the BlockDataRegion* from
BlockInvocationContext (removing context-sensitivity; although this
wasn't used yet). We need to have a better way to extend
BlockInvocationContext (and any LocationContext) to add
context-sensitivty.
llvm-svn: 94406
2010-01-25 04:41:41 +00:00
Daniel Dunbar
2def7eb3ca
CIndex: Don't crash when visitor passes null child statements, and sprinkle some
...
asserts in cursor construction functions to make this more obvious.
Doug, please check. c-index-test would previously crash on this code:
--
for(;;) {}
--
Do we need a custom visit of the for statement to cover the variable
declarations?
llvm-svn: 94391
2010-01-25 00:40:30 +00:00
Chris Lattner
0bcc858a2b
-fno-rtti is now the default.
...
llvm-svn: 94379
2010-01-24 20:43:31 +00:00
Ted Kremenek
4c0df3dc1d
Rename getClangFullVendorVersion() to getClangFullVersion().
...
llvm-svn: 94273
2010-01-23 02:11:34 +00:00
Douglas Gregor
625a515120
Teach the cursor visitor to recurse into the type information of
...
explicit casts, sizeof, alignof, and compound literals.
llvm-svn: 94265
2010-01-23 00:40:08 +00:00
Douglas Gregor
aa98ed9a07
Extend clang_createTranslationUnitFromSourceFile() to support creating
...
translation units that include unsaved files.
llvm-svn: 94258
2010-01-23 00:14:00 +00:00
Ted Kremenek
c0f3f72fa4
Add 'clang_getClangVersion()' function to CIndex. This exposes the full Clang version string through the CIndex API.
...
llvm-svn: 94242
2010-01-22 22:44:15 +00:00
Douglas Gregor
816fd36316
Yet more CIndex API cleanup:
...
- Added more routines to manipulate/compare source locations and ranges
- Switched clang_getCursor() over to take a CXSourceLocation rather
than file/line/column.
llvm-svn: 94226
2010-01-22 21:44:22 +00:00
Douglas Gregor
9ae8d349e6
Eliminate index-test; all of its tested functionality is now in c-index-test.
...
llvm-svn: 94211
2010-01-22 20:40:20 +00:00
Douglas Gregor
877524918a
Eliminate CIndex's dependency on the Clang Index library, since we
...
weren't actually using any of its facilities.
llvm-svn: 94210
2010-01-22 20:35:53 +00:00
Douglas Gregor
562c1f9365
Teach CIndex's cursor visitor to restrict its traversal to a specific
...
region of interest (if provided). Implement clang_getCursor() in terms
of this traversal rather than using the Index library; the unified
cursor visitor is more complete, and will be The Way Forward.
Minor other tweaks needed to make this work:
- Extend Preprocessor::getLocForEndOfToken() to accept an offset
from the end, making it easy to move to the last character in the
token (rather than just past the end of the token).
- In Lexer::MeasureTokenLength(), the length of whitespace is zero.
llvm-svn: 94200
2010-01-22 19:49:59 +00:00
Douglas Gregor
e1084fa2d2
Visit if, switch statements properly
...
llvm-svn: 94126
2010-01-22 01:00:11 +00:00
Douglas Gregor
d824f8825b
Teach the cursor visitor to walk all of the C and Objective-C
...
declarations that have enough source information to make such a walk
useful. This includes walking into variable initializers and enum
constants, the types behind typedefs, etc.
llvm-svn: 94124
2010-01-22 00:50:27 +00:00
Douglas Gregor
5e8cf37917
Teach the cursor visitor to walk statements and expressions, including
...
a few important subkinds. Now we're cookin' with gas!
llvm-svn: 94116
2010-01-21 23:27:09 +00:00
Douglas Gregor
6479fc4554
Teach the cursor visitor to walk into typeof types (both kinds). This
...
is hard to test now; tests will come when we can walk stataements and
expressions properly.
llvm-svn: 94099
2010-01-21 20:48:56 +00:00
Douglas Gregor
d182431968
Teach the cursor visitor to walk into a variety of different TypeLoc
...
kinds, so that we see referenced types, protocols, classes, etc.
llvm-svn: 94085
2010-01-21 17:29:07 +00:00
Douglas Gregor
93f899509d
Introduce type references into the C API, capturing references to
...
typedefs only (for now).
llvm-svn: 94078
2010-01-21 16:28:34 +00:00
Douglas Gregor
fed36b1aa1
Stash a CXXUnit pointer into each cursor. This allows us to simplify
...
the interface to clang_visitChildren() by eliminating the
CXTranslationUnit pointer.
llvm-svn: 94051
2010-01-20 23:57:43 +00:00
Douglas Gregor
58552bcd65
Eliminate the MakeCXCursor routines that require their callers to know too much about the cursor's storage
...
llvm-svn: 94049
2010-01-20 23:34:41 +00:00
Douglas Gregor
721e82edbc
Kill CXEntity and CXDecl. The first has never been used, while the
...
second has been wholly replaced by cursors.
llvm-svn: 94039
2010-01-20 22:14:22 +00:00
Douglas Gregor
dd969c897e
Kill some CXDecl-related APIs that have been superceded by
...
CXCursor-based APIs.
llvm-svn: 94037
2010-01-20 21:45:58 +00:00
Douglas Gregor
990b576ec8
Kill clang_loadDeclaration() and clang_loadTranslationUnit().
...
llvm-svn: 94034
2010-01-20 21:37:00 +00:00
Douglas Gregor
720d00553a
Switch c-index-test from clang_loadDeclaration() and
...
clang_loadTranslationUnit() over to clang_visitChildren().
llvm-svn: 94031
2010-01-20 21:32:04 +00:00
Douglas Gregor
befc4a1658
Switch the internals of clang_loadTranslationUnit() over to the new
...
cursor-based traversal, and eliminate TUVisitor. We're now down to one
visitor for traversing the AST. Yay!
llvm-svn: 94025
2010-01-20 21:13:59 +00:00
Douglas Gregor
71f3d94391
Introduce a new, cursor-based traversal function that visits the
...
children of a given cursor, regardless of what kind of cursor it
is. This is a generalization of clang_loadDeclaration and
clang_loadTranslationUnit that will also extent to statements,
expressions, etc.
As proof-of-concept, switched clang_loadDeclaration() from its own
visitor over to an instance of this traversal function internally.
llvm-svn: 94022
2010-01-20 20:59:29 +00:00
Douglas Gregor
b693f65c4d
Remove some #if 0'd code that's never going to get used.
...
llvm-svn: 93957
2010-01-20 00:34:08 +00:00
Douglas Gregor
9074c3fe97
Kill off clang_getDeclColumn, clang_getDeclExtent, clang_getDeclLine,
...
clang_getDeclSource, and clang_getDeclSourceFile; the cursor
equivalents are the way of the future.
llvm-svn: 93955
2010-01-20 00:26:57 +00:00
Douglas Gregor
d2fc7277be
Introduce a special cursor kind for the translation unit, to serve as
...
the root of the conceptual cursor hierarchy (just like we do with
declarations). This will be used when we get to unify
clang_loadTranslationUnit() and clang_loadDeclaration() into something
more generally useful.
llvm-svn: 93954
2010-01-20 00:23:15 +00:00
Douglas Gregor
084236fafd
Kill CXCursor_ObjCSelectorRef, CXCursor_VarRef, CXCursor_FunctionRef,
...
and CXCursor_EnumConstantRef; they've been subsumed by expression
references, which do a much nicer job.
llvm-svn: 93947
2010-01-19 23:25:01 +00:00
Douglas Gregor
8f40bbee78
Extend the CIndex API with direct support for expressions and
...
statements, moving some of the more unnatural kinds of references
(VarRef, EnumConstantRef, etc.) over to the expressions. We can now
poke at arbitrary expressions and statements with, e.g.,
clang_getCursor() and get back useful information (e.g., source
ranges).
llvm-svn: 93946
2010-01-19 23:20:36 +00:00
Douglas Gregor
7d1efeb43d
Kill the unused and unnecessary CXCursor_MemberRef, twin to the
...
now-dead CXCursor_ObjCIvarRef.
llvm-svn: 93928
2010-01-19 22:15:34 +00:00
Douglas Gregor
015026e358
Kill CXCursor_ObjCIvarRef. Such cursors could never be created, and
...
have been marked for death for a while.
llvm-svn: 93927
2010-01-19 22:11:32 +00:00
Douglas Gregor
accb183371
Introduce the notion of an "unexposed" declaration into the CIndex
...
API. This is a catch-all for any declaration known to Clang but not
specifically part of the CIndex API. We'll use the same approach with
expressions, statements, references, etc., as needed.
llvm-svn: 93924
2010-01-19 22:07:56 +00:00
Douglas Gregor
4f46e789b3
Rework the CXSourceLocation and CXSourceRange APIs. They are now
...
opaque data structures accessed through the new functions
clang_getInstantiationLocation(), clang_getRangeStart(), and
clang_getRangeEnd(). The new API permits later extensions to introduce
new functions to allow CIndex clients to walk macro instantiations, if
we ever care.
llvm-svn: 93915
2010-01-19 21:36:55 +00:00
Douglas Gregor
6b8232ff82
Eliminate cursor kinds used to express definitions. Instead, provide
...
CIndex functions that (1) map from a reference or declaration to the
corresponding definition, if available, and (2) determine whether a
given declaration cursor is also a definition. This eliminates a lot
of duplication in the cursor kinds, and maps more closely to the Clang
ASTs.
This is another API + ABI breaker with no deprecation. Yay, progress.
llvm-svn: 93893
2010-01-19 19:34:47 +00:00
Douglas Gregor
ad27e8b777
Introduce clang_getCursorReferenced, to get a cursor pointing at the
...
entity that a particular cursor references.
llvm-svn: 93830
2010-01-19 01:20:04 +00:00
Douglas Gregor
33c34ac19a
Implement clang_getCursorExtent, which provides a source range for the
...
cursor itself. In particular, for references this returns the source
range of the reference rather than the source range of the thing it
refers to.
Switch c-index-test from clang_getDeclExtent (which will eventually be
deprecated and removed) over to clang_getCursorExtent. The source
ranges we print for references now make sense; fix up the tests
appropriately.
llvm-svn: 93823
2010-01-19 00:34:46 +00:00
Douglas Gregor
7ecd020cf2
Teach clang_getCursorLocation() to return the locations of references
...
rather than the locations that refer to.
llvm-svn: 93812
2010-01-18 23:41:10 +00:00
Ted Kremenek
7161fc1e2f
Tweak USR output for ObjC categories.
...
llvm-svn: 93805
2010-01-18 23:25:32 +00:00
Douglas Gregor
3338c1f5d2
Now that a reasonable deprecation cycle has passed, kill
...
clang_getCursorLine(), clang_getCursorColumn(),
clang_getCursorSource(), and clang_getCursorSourceFile() outright.
llvm-svn: 93801
2010-01-18 22:48:04 +00:00
Douglas Gregor
66a58819d1
Introduce clang_getCursorLocation(), which supercedes
...
clang_getCursorLine(), clang_getCursorColumn(),
clang_getCursorSource(), and clang_getCursorSourceFile(). Mark those 4
functions as deprecated and stop using them ourselves.
llvm-svn: 93800
2010-01-18 22:46:11 +00:00
Ted Kremenek
80de67b0cf
Refactor USR generation for TagDecls into a common method.
...
llvm-svn: 93799
2010-01-18 22:42:20 +00:00
Douglas Gregor
49c4baf430
Clean up the CIndex API slightly.
...
Renamed CXSourceFileLine to CXSourceLocation and added a CXFile, to
better match Clang's SourceLocation. Teach clang_getDeclExtent to fill
in the CXFile properly.
Renamed CXSourceExtent to CXSourceRange, to better match Clang's
SourceLocation.
llvm-svn: 93783
2010-01-18 22:13:09 +00:00
Ted Kremenek
0ea923c550
Explicitly not handle ObjCForwardProtocolDecl in GetCursorKind().
...
llvm-svn: 93779
2010-01-18 22:07:45 +00:00
Ted Kremenek
a6980af2d2
Tweak USR generation to handle anonymous bitfields.
...
llvm-svn: 93778
2010-01-18 22:02:49 +00:00
Ted Kremenek
473c7a72f1
Replace clang_getDeclUSR() with clang_getCursorUSR(). Also remove printing 'contexts' from c-index-test output; it wasn't helpful and was extremely brittle.
...
llvm-svn: 93760
2010-01-18 20:23:29 +00:00
Douglas Gregor
fb00d93c98
Make CMake's clang++ installation respect DESTDIR, based on a patch by
...
Ingmar Vanhassel. Fixes PR6046.
llvm-svn: 93741
2010-01-18 18:27:29 +00:00
Daniel Dunbar
e2aa06d4ae
Don't build/install clang++ in CLANG_IS_PRODUCTION build mode yet.
...
llvm-svn: 93732
2010-01-18 17:52:48 +00:00
Daniel Dunbar
fadf43c2ae
Fix -Asserts warning.
...
llvm-svn: 93731
2010-01-18 17:52:42 +00:00
Douglas Gregor
46d6614388
Give ObjCClassRef cursors a sane representation, which is encapsulated
...
in CXCursor.cpp. With this sane representation, fix the class
reference that is part of Objective-C category declarations so that
the cursor's location matches up with the reference, not the class
being referred to.
llvm-svn: 93640
2010-01-16 17:14:40 +00:00
Douglas Gregor
ef6eb84da1
Use a sane encoding for CXCursor_ObjCProtocolRef, using the actual
...
source locations where the protocols were referenced rather than the
location of some random enclosing declaration.
llvm-svn: 93637
2010-01-16 15:44:18 +00:00
Douglas Gregor
6c8959b71b
Give CXCursor_ObjCSuperClassRef a sane encoding, which is only known
...
to CXCursor.cpp.
llvm-svn: 93634
2010-01-16 14:00:32 +00:00
Ted Kremenek
13751dc571
Add mapping from ObjCPropertDecl to CXCursorKind.
...
llvm-svn: 93623
2010-01-16 02:08:29 +00:00
Ted Kremenek
4ba5263441
Remove 'default' case in switch statement in clang_getCursorKindSpelling(). This identified a missing case (warned by the compiler) and identified that CXCursor_FirstDecl didn't actually correspond to the first decl.
...
llvm-svn: 93622
2010-01-16 02:02:09 +00:00
Ted Kremenek
9cec00019a
Remove TranslateKind and centralize Decl -> CXCursorKind in GetCursorKind(). This revealed a bunch of inconsistencies in how CXCursorKinds were being computed.
...
llvm-svn: 93618
2010-01-16 01:44:12 +00:00
Ted Kremenek
c2aa0f1ecb
Migrate Decl* -> cursorkind logic into CXCursor.cpp, and drastically tighten TUVisitor.
...
llvm-svn: 93599
2010-01-16 00:36:30 +00:00
Ted Kremenek
10dd6e9ca5
Remove unused code.
...
llvm-svn: 93586
2010-01-15 23:35:12 +00:00
Ted Kremenek
6b1d550d4b
Refactor USR logic for EnumDecls and RecordDecls so that both handle 'anonymous' declarations in the same way.
...
llvm-svn: 93585
2010-01-15 23:34:31 +00:00
Ted Kremenek
a7f7b17bc7
USR generation: look at the typedef of an anonymous struct (if any) when trying to generate a USR.
...
llvm-svn: 93572
2010-01-15 23:08:25 +00:00
Douglas Gregor
c58d05bcf9
Make CXCursor's data opaque.
...
llvm-svn: 93561
2010-01-15 21:56:13 +00:00
Ted Kremenek
87553c42c0
Add CXCursor.[h,cpp]. These files will centralize the logic for creating/probing CXCursors.
...
llvm-svn: 93547
2010-01-15 20:35:54 +00:00
Ted Kremenek
8433d1da5e
Add USR generation for enums.
...
llvm-svn: 93543
2010-01-15 20:04:31 +00:00
Douglas Gregor
082c3e69eb
Add -cursor-at=file:line:column command line option to c-index-test,
...
to directly check the results of clang_getCursor(). Also, start
migrating some index-test tests over to c-index test [*] and some
grep-using tests over to FileCheck.
llvm-svn: 93537
2010-01-15 19:40:17 +00:00
Ted Kremenek
63b15c3af7
getLocationFromCursor: If a cursor is a reference and has a referringDecl, using the referringDecl for the location.
...
llvm-svn: 93520
2010-01-15 18:24:18 +00:00
Ted Kremenek
e34cbde383
Switch return site to use clang_getNullCursor().
...
llvm-svn: 93405
2010-01-14 01:51:23 +00:00
Ted Kremenek
e1b5525510
Further tweak USR generation by shorting names and distinguish between namespaces and functions.
...
llvm-svn: 93404
2010-01-14 01:50:21 +00:00
Ted Kremenek
d5c6eafe09
Reorganize CIndex.cpp into clearer sections of functions, and add a utility function 'MakeCXCursor' to centralize the logic for creating CXCursor objects.
...
llvm-svn: 93359
2010-01-13 21:46:36 +00:00
Ted Kremenek
e14e372b67
Add 'referringDecl' field to CXCursor to prepare the way to better model declaration references from other delcarations.
...
llvm-svn: 93343
2010-01-13 19:59:20 +00:00
Ted Kremenek
95ae5e16b9
Add extra null check in clang_disposeString().
...
llvm-svn: 93328
2010-01-13 18:45:36 +00:00
Daniel Dunbar
4f2bc55d4e
cc1: Factor out CompilerInstance::ExecuteAction which has the majority of the
...
clang -cc1 logic for running an action against a set of options.
- This should make it easier to build tools that have a clang -cc1 like
interface, but aren't actually part of clang -cc1.
llvm-svn: 93282
2010-01-13 00:48:06 +00:00
Daniel Dunbar
7d38d4da61
cc1: Lift creation of the FrontendAction higher.
...
llvm-svn: 93281
2010-01-13 00:47:51 +00:00
Ted Kremenek
78668fdcfb
Move definitions for visitor methods in CDeclVisitor out-of-line.
...
llvm-svn: 93276
2010-01-13 00:22:49 +00:00
Ted Kremenek
1351b09b04
Make method definitions in TUVisitor out-of-line, making it easy to tell what visitor methods are defined.
...
Generalize TUVisitor to take a general "root" and "iterator" callback; this is prep. work to merging TUVisitor and CDeclVisitor.
llvm-svn: 93275
2010-01-13 00:13:47 +00:00
Ted Kremenek
58a6a8ec62
Add USR printing modes to c-index-test.
...
llvm-svn: 93269
2010-01-12 23:34:26 +00:00
Ted Kremenek
a188cbbf29
Make clang_getDeclUSR() visible.
...
llvm-svn: 93268
2010-01-12 23:34:05 +00:00
Ted Kremenek
cb674f9492
Rename clang_getUSR() -> clang_getDeclUSR(). For now we take a CXDecl instead of a CXEntity.
...
Enhance USR generation a bit with support for records.
llvm-svn: 93267
2010-01-12 23:33:42 +00:00
Ted Kremenek
55e3e83b07
Further tweaking of USR generation. WIP.
...
llvm-svn: 93250
2010-01-12 19:35:53 +00:00
Ted Kremenek
73eccd2c10
Make 'CXTranslationUnitIterator' an argument to perform_test_load(),
...
perform_test_load_tu(), and perform_test_load_source().
llvm-svn: 93248
2010-01-12 18:53:15 +00:00
Benjamin Kramer
59617be4a5
Remove trailing semicolons and silence MSVC warning about C linkage.
...
warning C4190: 'GetEntity' has C-linkage specified, but returns UDT
'clang::idx::Entity' which is incompatible with C
llvm-svn: 93237
2010-01-12 11:32:40 +00:00
Daniel Dunbar
abd3686f49
Remove duplicate class name, MSVC doesn't like this.
...
llvm-svn: 93225
2010-01-12 02:34:07 +00:00
Ted Kremenek
5631d2d1a1
Add a boilerplate implementation for clang_getUSR(). WIP.
...
llvm-svn: 93223
2010-01-12 02:07:58 +00:00
Ted Kremenek
87be3617e3
Change clang_getUSR() to return a CXString instead of a 'const char *'.
...
llvm-svn: 93213
2010-01-12 00:38:53 +00:00
Ted Kremenek
46157971e9
Make createCXString() a static member function of class CIndex.
...
llvm-svn: 93212
2010-01-12 00:36:38 +00:00
Ted Kremenek
e5f86be138
CIndex:
...
- Remove unused (and unimplemented) clang_getDeclarationName().
- Remove unused (and unimplemented) clang_getEntity().
- Add clang_getEntityFromDecl(): maps from a CXDecl to a CXEntity)
- Add clang_getDeclaration(): maps from a (CXEntity, CXTranslationUnit) to a CXDecl).
llvm-svn: 93209
2010-01-11 23:56:39 +00:00
Douglas Gregor
504a6ae83e
Improve code completion by introducing patterns for the various C and
...
C++ grammatical constructs that show up in top-level (namespace-level)
declarations, member declarations, template declarations, statements,
expressions, conditions, etc. For example, we now provide a pattern
for
static_cast<type>(expr)
when we can have an expression, or
using namespace identifier;
when we can have a using directive.
Also, improves the results of code completion at the beginning of a
top-level declaration. Previously, we would see value names (function
names, global variables, etc.); now we see types, namespace names,
etc., but no values.
llvm-svn: 93134
2010-01-10 23:08:15 +00:00
Ted Kremenek
ea903067e1
For now, add back clang_getDeclSource().
...
llvm-svn: 93003
2010-01-08 17:11:32 +00:00
Ted Kremenek
32b79317a2
More crashtracer enhancements to CIndex. When "popping" a crashtracer string
...
restore to the one most recently created.
llvm-svn: 92959
2010-01-07 23:13:53 +00:00
Ted Kremenek
7a5ede2ff0
Tidy up crashtracer logic in CIndex.
...
llvm-svn: 92955
2010-01-07 22:49:05 +00:00
Ted Kremenek
b58514e613
Add FileCheck prefix to another location in the output of c-index-test.
...
llvm-svn: 92890
2010-01-07 01:17:12 +00:00
Ted Kremenek
2a43fd58ee
Change clang_getDeclExtent() to have the endpoint point to the last character in the last token.
...
llvm-svn: 92869
2010-01-06 23:43:31 +00:00
Daniel Dunbar
4ff42d6500
Add _clang_getDeclExtent to export list.
...
llvm-svn: 92825
2010-01-06 05:41:00 +00:00
Ted Kremenek
991eb3f6c0
Add enhanced crash reporter breadcrumbs for clang_createTranslationUnitFromSourceFile().
...
llvm-svn: 92820
2010-01-06 03:42:32 +00:00
Ted Kremenek
e50486bbca
Remove unused variables.
...
llvm-svn: 92804
2010-01-05 23:22:20 +00:00
Ted Kremenek
bde648030b
Remove deprecated function 'clang_getDeclSource()'. Use 'clang_getDeclFile()' instead.
...
llvm-svn: 92803
2010-01-05 23:21:30 +00:00
Ted Kremenek
a44d99c934
Add C API hook 'clang_getDeclExtent()', which returns the source extent of a declaration. This implements <rdar://problem/7280072>.
...
llvm-svn: 92802
2010-01-05 23:18:49 +00:00
Ted Kremenek
9cd9f6d861
Split (mostly nonexistent) USR code out from the main CIndex logic.
...
llvm-svn: 92789
2010-01-05 22:06:45 +00:00
Ted Kremenek
902292d7ac
Add back #include of 'cstdio' to hopefully unbreak the build on Linux.
...
llvm-svn: 92765
2010-01-05 20:55:39 +00:00
Ted Kremenek
0ec2cca8f2
Split code in CIndex.cpp into multiple source files, and remove some unnecessary #includes.
...
llvm-svn: 92756
2010-01-05 19:32:54 +00:00
Douglas Gregor
51af7f628c
Turn on code-completion for macros within CIndex
...
llvm-svn: 92500
2010-01-04 19:45:17 +00:00
Daniel Dunbar
b2138e5529
Driver: Use "g++" as generic gcc name when running in C++ mode, for platforms
...
that lack real tool definitions.
llvm-svn: 92164
2009-12-25 20:21:23 +00:00
Kovarththanan Rajaratnam
55e74a1a6a
Remove RewriteBlocks. It has been superseded by RewriteObjC
...
llvm-svn: 92014
2009-12-23 18:03:34 +00:00
Ted Kremenek
c0895eb730
Add c++-analyzer symlink (which is used by scan-build)
...
llvm-svn: 91937
2009-12-22 23:00:32 +00:00
Douglas Gregor
b3fa919c2d
Extend code-completion results with the type of each result
...
llvm-svn: 91702
2009-12-18 18:53:37 +00:00
Douglas Gregor
f72b6ac87f
Change clang_codeComplete API to return the results in a structure on
...
the heap, so that clients are not forced to copy the results during
the initial iteration. A separate clang_disposeCodeCompleteResults
function frees the returned results.
llvm-svn: 91690
2009-12-18 16:20:58 +00:00
Chandler Carruth
65ce1b7c61
Test for errors during fread() inside c-index-test and handle them
...
appropriately. This also silences some pedantic GCC warnings.
llvm-svn: 91596
2009-12-17 09:18:43 +00:00
Ted Kremenek
22a8a4bfb9
Compute the right extension for preprocessed Objective-C++ files.
...
llvm-svn: 91547
2009-12-16 18:32:41 +00:00
Daniel Dunbar
282c9b9cc1
Fix pretty stack traces.
...
llvm-svn: 91537
2009-12-16 11:47:38 +00:00
Ted Kremenek
dca6816d6a
Add logic for computing preprocessor file extensions for C++ files.
...
llvm-svn: 91505
2009-12-16 05:02:47 +00:00
Ted Kremenek
f65a0c6768
scan-build/ccc-analyzer: start analyzing C++ FTW.
...
llvm-svn: 91398
2009-12-15 02:35:54 +00:00
Daniel Dunbar
a5a166d01a
Add -resource-dir to clang -cc1, this allows the base directory for compiler
...
resources (e.g., /usr/lib/clang/1.1) to be passed on the command line instead of
computed.
llvm-svn: 91370
2009-12-15 00:06:45 +00:00
Daniel Dunbar
8d4a202aad
Lift builtin-include-path logic out of ASTUnit::LoadFromCommandLine and fix CIndex to pass in the right directory (previously it was using the path to the main executable, which generally is wrong).
...
llvm-svn: 91238
2009-12-13 03:46:13 +00:00
Daniel Dunbar
d613677ec9
CompilerInvocation: Move builtin-include-path logic out of CompilerInvocation::CreateFromArgs.
...
llvm-svn: 91237
2009-12-13 03:45:58 +00:00
Jeffrey Yasskin
1615d45daa
Un-namespace-qualify llvm_unreachable. It's a macro, so the qualification gave
...
no extra safety anyway.
llvm-svn: 91207
2009-12-12 05:05:38 +00:00
Daniel Dunbar
3c6d1b52a0
Remove clang-cc tool, it has joined in unholy union with clang.
...
- tools/driver will be renamed to tools/clang at some point.
llvm-svn: 91195
2009-12-12 00:56:47 +00:00
Ted Kremenek
f5303fe492
scan-build: when the build command is 'make', override the CC and CXX options by passing them as arguments to make. This fixes <rdar://problem/6790224>.
...
llvm-svn: 91179
2009-12-11 23:22:52 +00:00
Ted Kremenek
f92b446dd4
Remove more old references to clang-cc.
...
llvm-svn: 91177
2009-12-11 23:12:52 +00:00
Ted Kremenek
5c512e63f4
Convert scan-build and ccc-analyzer over to using 'clang -cc1' instead of using 'clang-cc'.
...
llvm-svn: 91172
2009-12-11 22:44:53 +00:00
Daniel Dunbar
f72bdf7eed
Implement clang -cc1.
...
- I apologize for the link time horrors, my goal is to kill off clang-cc in fairly short order.
llvm-svn: 91170
2009-12-11 22:20:12 +00:00
Douglas Gregor
01ddf7a65f
clang_getCompletionChunkText() will treat optional strings as empty text blocks
...
llvm-svn: 91072
2009-12-10 22:46:19 +00:00
Jeffrey Yasskin
567ae47b4a
Remove several .c_str() to be forward-compatible with StringRef.
...
llvm-svn: 90822
2009-12-08 01:46:24 +00:00
Ted Kremenek
7bea9a1672
Enable '-analyzer-opt-analyze-nested-blocks' by default for testing.
...
llvm-svn: 90812
2009-12-07 22:26:14 +00:00
Daniel Dunbar
1597da4c05
Document that CompilerInvocation::createDiagnostics keeps a reference to the DiagnosticOptions, and update callers to make sure they don't pass in a temporary.
...
llvm-svn: 90704
2009-12-06 09:56:30 +00:00
Steve Naroff
c275f70bf9
Remove 'LangOpts' from Diagnostic (added in http://llvm.org/viewvc/llvm-project?view=rev&revision=90642 ).
...
Simply use the 'LangOpts' member already present in TextDiagnosticPrinter.
Sorry for the confusion!
llvm-svn: 90664
2009-12-05 12:23:07 +00:00
Daniel Dunbar
72fe5b1bcc
CIndex: For the time being, don't return translation units if we encounter an error during parsing.
...
- We need to be more careful in the rest of CIndex if we are to handle
possibly-invalid ASTs, and don't have much experience with this yet.
llvm-svn: 90643
2009-12-05 02:17:18 +00:00
Steve Naroff
4fb3d9fcd7
Integrate the following from the 'objective-rewrite' branch:
...
http://llvm.org/viewvc/llvm-project?view=rev&revision=71086
Note - This commit only includes the fix for:
<rdar://problem/6309338> slightly different error message format for Visual Studio.
The fix for <rdar://problem/6845623> from protocol to template. is separate/forthcoming.
llvm-svn: 90642
2009-12-05 02:14:08 +00:00
Rafael Espindola
73d4637545
Add gcc's -no-canonical-prefixes option to clang.
...
llvm-svn: 90577
2009-12-04 19:31:58 +00:00
Daniel Dunbar
644dca07b9
ASTUnit/CIndex: Explicitly track the top-level decls when using an ASTUnit made
...
from a source file.
- This allows CIndex to avoid iterating over all the top-level decls when using
a PCH, which means we deserialize far fewer decls.
llvm-svn: 90559
2009-12-04 08:17:33 +00:00
Daniel Dunbar
b066116b30
Kill off one last exit() call.
...
llvm-svn: 90439
2009-12-03 09:13:43 +00:00
Daniel Dunbar
0905b7f3be
clang-cc: Move to CompilerInvocation based command line parsing.
...
llvm-svn: 90426
2009-12-03 07:23:38 +00:00
Daniel Dunbar
215ca5f199
clang-cc: Honor -help and -version when using new style option parsing.
...
llvm-svn: 90422
2009-12-03 07:01:58 +00:00
Daniel Dunbar
3eff927255
Update test and CIndex to use -FOO BAR form for -{remap-file,code-completion-at}.
...
llvm-svn: 90416
2009-12-03 05:32:40 +00:00
Daniel Dunbar
da7a52289f
Add clang -cc1 -load option.
...
llvm-svn: 90413
2009-12-03 05:11:05 +00:00
Daniel Dunbar
1108966959
Switch clang_createTranslationUnitFromSourceFile to use ASTUnit::LoadFromCommandLine.
...
- This is much faster, as it avoids the overhead of dumping an AST file to disk and reloading it.
- For debugging purposes, there is a clang_setUseExternalASTGeneration hook which can be used to disable this.
On the Sketch Cocoa app, the speedup is pretty nice, especially when using a PCH file while scanning the source:
Wall time to c-index-test all files (no PCH):
Old: 23.4221
New: 12.3884
Wall time to c-index-test all files (with a PCH, and "local" mode):
Old: 10.9233
New: 1.9038
llvm-svn: 90385
2009-12-03 01:54:28 +00:00
Daniel Dunbar
59203007ac
Fix ASTUnit to allows require a (persistent) Diagnostic object be provided; propogate and simplify.
...
llvm-svn: 90379
2009-12-03 01:45:44 +00:00
Daniel Dunbar
845a87bd04
Normalize CIndex/c-index-test/index-test link lines in the hopes it will fix
...
*something*.
- We really need to fix how LLVM's build systems manage
linking. Pretty-please-someone-else-do-this? :)
llvm-svn: 90350
2009-12-02 21:47:55 +00:00
Nuno Lopes
8dc27496c0
this also depends on libDriver. this almost fixes the build problems of c-index-test
...
llvm-svn: 90342
2009-12-02 20:20:47 +00:00
Mike Stump
c01c2b87e8
Change rtti/Rtti to RTTI, as it is an acronym.
...
llvm-svn: 90334
2009-12-02 18:57:08 +00:00
Douglas Gregor
9485bf9538
Extend the CIndex code-completion API to perform code completion
...
involving unsaved files, using the -remap-file= functionality recently
added to clang-cc.
llvm-svn: 90314
2009-12-02 09:21:34 +00:00
Daniel Dunbar
e7fe5b2613
Fix relative ordering of Analyis library.
...
llvm-svn: 90312
2009-12-02 08:44:24 +00:00
Douglas Gregor
d062bff7ee
Introduce a new clang-cc option
...
-remap-file=from;to
which takes the file "from" and transparently replaces its contents
with the contents of the file "to" from the source manager's
perspective. This is the moral equivalent of
cp from saved
cp to from
<call clang>
cp saved from
rm saved
without all of the pesky file copying.
llvm-svn: 90307
2009-12-02 08:08:39 +00:00
Zhongxing Xu
d186a02987
libFrontend depends on libDriver now.
...
llvm-svn: 90295
2009-12-02 05:45:19 +00:00
Daniel Dunbar
55a17b66cd
Add ASTUnit::LoadFromCommandLine, which creates an ASTUnit out of a list of
...
(clang/driver) command line arguments (including the source file).
- The arguments are expected to include the source file.
- The idea is that even though this is a somewhat odd API, its the form which
many tools can most easily use (for example, by interposing with the compiler).
Also, switch index-test's -ast-from-source to use this entry point, and provide
a -arg command line argument which can be used to test that the command line
arguments are handled correctly.
llvm-svn: 90288
2009-12-02 03:23:45 +00:00
Nuno Lopes
d751528af0
fix build on linux
...
llvm-svn: 90229
2009-12-01 12:49:04 +00:00
Daniel Dunbar
764c082027
Add ASTUnit::LoadFromCompilerInvocation, which does what it says.
...
Also, add an -ast-from-source option to index-test which allows index-test to
run on source files directly.
llvm-svn: 90223
2009-12-01 09:51:01 +00:00
Kovarththanan Rajaratnam
cb58439f34
Tuck away scan-build related files into tools/scan-build
...
llvm-svn: 90215
2009-12-01 06:52:01 +00:00
Douglas Gregor
f09935f16c
Switch the clang-to-CIndex interface for code-completion to a binary format, for a massive speedup
...
llvm-svn: 90209
2009-12-01 05:55:20 +00:00
Daniel Dunbar
079203fa16
CIndex: Normalize formatting some more.
...
llvm-svn: 90196
2009-12-01 03:14:51 +00:00
Daniel Dunbar
5442bfcd5a
c-index-test: Split "function scanning" behavior into its own "filter" -- its
...
quite slow and doesn't really stress the APIs people should really use.
- I'm not even sure if this mode is still useful given the other scanning mode;
Steve?
llvm-svn: 90193
2009-12-01 02:35:37 +00:00
Daniel Dunbar
3e535d7efa
Add c-index-test -test-load-source, which loads the translation unit from a source file (and other command line arguments).
...
llvm-svn: 90187
2009-12-01 02:03:10 +00:00
Daniel Dunbar
5b2f5cadbd
Reindent buffer, switches in particular were totally out of style.
...
llvm-svn: 90155
2009-11-30 20:42:49 +00:00
Daniel Dunbar
bbc569ce8d
Strip trailing space.
...
llvm-svn: 90154
2009-11-30 20:42:43 +00:00
Daniel Dunbar
bd74028095
clang-cc: Add code (currently disabled) for parsing arguments using clang -cc1 functionality instead of LLVM's CommandLine.
...
- It works and passes test suite, but I want to polish and test a wee bit more before making the switch.
llvm-svn: 90128
2009-11-30 08:42:10 +00:00
Daniel Dunbar
a74f8ff15c
Add CodeGenOptions::{SoftFloat,FloatABI}, and update the all the (far too many) places to use this instead of using the backend -soft-float and -float-abi= options.
...
llvm-svn: 90127
2009-11-30 08:42:00 +00:00
Daniel Dunbar
2c11cd156e
Don't try to generate common globals for C++ files, instead of depending on the FE to set NoCommon, and simplify CodeGenOptions initialization.
...
llvm-svn: 90119
2009-11-30 08:40:34 +00:00
Daniel Dunbar
8e70505692
Eliminate CodeGenOptions::TimePasses.
...
llvm-svn: 90118
2009-11-30 08:39:52 +00:00
Daniel Dunbar
de18224d9c
Eliminate CodeGenOptions::SimplifyLibCalls.
...
llvm-svn: 90117
2009-11-30 08:39:32 +00:00
Daniel Dunbar
fe994279ad
Simplify.
...
llvm-svn: 90115
2009-11-30 07:18:20 +00:00
Daniel Dunbar
1c39f3c89d
Put CompilerInvocation testing code in clang-cc instead of clang for now, I can't bear to link all of clang into 'clang' yet. :)
...
- Still triggered by a magic leading -cc1 argument, as before.
llvm-svn: 90114
2009-11-30 07:18:13 +00:00
Daniel Dunbar
fcb9caa772
Change CompilerInvocation::CreateFromArgs to report errors using a proper diagnostic engine.
...
- Clients that care about having the diagnostics output honor the user-controllable diagnostic options can buffer the diagnostics and issue them later.
llvm-svn: 90092
2009-11-29 20:58:50 +00:00
Daniel Dunbar
65ca1c6f02
Change CompilerInvocation::CreateFromArgs to take Argv0 and the address of main (or something in the main executable) so it can find the builtin compiler files.
...
llvm-svn: 90090
2009-11-29 20:58:32 +00:00
Kovarththanan Rajaratnam
5505dff8af
This patch moves the frontend timer from clang-cc into CompilerInstance.
...
CompilerInstance already contains various objects that are used
throughout the entire run.
Also addresses Daniels review comments in:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20091123/024508.html
llvm-svn: 90073
2009-11-29 09:57:35 +00:00
Daniel Dunbar
a1b02a2380
Move LLVM backend options to explicit clang-cc / clang -cc1 options, which we then manually pass to the command line library; eventually the latter grossness should be fixed by a real API when creating the target machine.
...
llvm-svn: 90063
2009-11-29 07:18:39 +00:00
Daniel Dunbar
0317c4c5b7
Add clang -cc1 parsing for LangOptions.
...
- This is the last major parsing piece, main FIXMEs remain.
llvm-svn: 90059
2009-11-29 05:52:21 +00:00
Daniel Dunbar
34c82c5695
clang-cc: Tweak LangOptions parsing to make it a bit more obvious what depends on what.
...
llvm-svn: 90058
2009-11-29 03:18:48 +00:00
Daniel Dunbar
5fe0866b9d
clang-cc: Change -fsigned-char=0 to -fno-unsigned-char and pass -pic-level using separate args.
...
llvm-svn: 90054
2009-11-29 02:39:08 +00:00
Daniel Dunbar
9eac065e67
Move MainFileName option variable into CodeGenOptions instead of LangOptions.
...
llvm-svn: 90051
2009-11-29 02:38:34 +00:00
Kovarththanan Rajaratnam
15e9a9df83
Move program actions implications to clang::InitializeFrontendOptions which already contains such logic.
...
llvm-svn: 90029
2009-11-28 07:52:34 +00:00
Daniel Dunbar
cc0ba6a9d6
Simplify.
...
llvm-svn: 89998
2009-11-27 08:26:00 +00:00
Daniel Dunbar
e0d81f2237
Factor out a LangStandard class and coalesce the information about the standards into LangStandards.def
...
- I'd appreciate another pair of eyeballs to double check this.
llvm-svn: 89919
2009-11-26 02:14:31 +00:00
Daniel Dunbar
b7f1babb73
Add a missing include <cstdio>
...
llvm-svn: 89859
2009-11-25 10:53:00 +00:00
Kovarththanan Rajaratnam
2279b1308e
Sort CMakeLists.txt
...
llvm-svn: 89771
2009-11-24 16:32:20 +00:00
Daniel Dunbar
8d731964d0
Sketch the rest of the clang -cc1 option definitions, aka fun with C-x C-(.
...
llvm-svn: 89721
2009-11-24 00:54:16 +00:00
Daniel Dunbar
f5835ea2e7
Add clang -cc1 parsing of analyzer options.
...
llvm-svn: 89629
2009-11-22 22:08:20 +00:00
Daniel Dunbar
a604639635
Switch CompilerInvocation::CreateFromArgs to take const char** arguments until Driver itself switches to StringRef.
...
llvm-svn: 89503
2009-11-20 22:47:55 +00:00
Daniel Dunbar
4274685b63
Pass '-mcpu' 'FOO' instead of '-mcpu=FOO'.
...
llvm-svn: 89498
2009-11-20 22:21:52 +00:00
Daniel Dunbar
8cde1d978f
clang-cc: Lift setForcedLangOptions out of options initialization.
...
llvm-svn: 89462
2009-11-20 16:55:31 +00:00
Benjamin Kramer
df5280df05
Add a workaround to silence a bogus g++-4.4 -pedantic warning.
...
driver.cpp:211: warning: ISO C++ forbids zero-size array 'argv'
llvm-svn: 89455
2009-11-20 11:49:06 +00:00
Daniel Dunbar
84e8a249fa
Fix some default in the option classes, and some CompilerInvocation argification
...
errors.
llvm-svn: 89388
2009-11-19 20:54:59 +00:00
Douglas Gregor
45959e5556
Try yet again to de-bork CMake Windows build w.r.t. clang++
...
llvm-svn: 89361
2009-11-19 16:42:34 +00:00
Douglas Gregor
c3851cd0d8
Try to fix CMake clang++ creation on Windows
...
llvm-svn: 89336
2009-11-19 07:59:29 +00:00
Daniel Dunbar
51cd8f085f
Sketch some 'clang -cc1' support, for testing parts of CompilerInvocation.
...
llvm-svn: 89333
2009-11-19 07:37:51 +00:00
Douglas Gregor
564d41fbe4
CMake goop to create clang++ symlink
...
llvm-svn: 89320
2009-11-19 05:46:45 +00:00
Daniel Dunbar
da9e8e225d
clang-cc: Remove some more llvm: 🆑 :init arguments, by only setting values when
...
the argument is given.
Also, tweak Opt.Sysroot defaulting.
llvm-svn: 89318
2009-11-19 05:32:21 +00:00
Daniel Dunbar
d80277895d
Change -code-completion-debug-printer to -no-code-completion-debug-printer.
...
Also, tweak a few help strings and update CompilerInvocation serialization for prev change.
llvm-svn: 89317
2009-11-19 05:32:09 +00:00
Daniel Dunbar
484afa2d3b
Switch -f{builtin,math-errno,rtti} and -analyzer-purge-dead to -...no... variants instead of using llvm: 🆑 :init(true) arguments.
...
llvm-svn: 89315
2009-11-19 04:55:23 +00:00
Daniel Dunbar
71f5f9ff7f
clang-cc: Remove superfluous llvm: 🆑 :init(false) arguments.
...
llvm-svn: 89314
2009-11-19 04:55:06 +00:00
Daniel Dunbar
da13faf982
Driver: ArgList doesn't depend on Options.h anymore.
...
llvm-svn: 89313
2009-11-19 04:25:22 +00:00
Daniel Dunbar
b8c4825fed
Use TOOLALIAS so that clang++ gets 'built'.
...
llvm-svn: 89286
2009-11-19 00:21:33 +00:00
Ted Kremenek
0469b7ea00
Add special clang_getCursor() support for @class . Handles <rdar://problem/7383421>.
...
llvm-svn: 89183
2009-11-18 02:02:52 +00:00
Daniel Dunbar
aa1e2efbc3
Fix -Asserts warning.
...
llvm-svn: 89149
2009-11-17 21:51:03 +00:00
Benjamin Kramer
10d0831718
fgetln is a BSDism; replace it with more portable code.
...
llvm-svn: 89140
2009-11-17 20:51:40 +00:00
Ted Kremenek
2df52dca49
Add c-index-test mode "-test-file-scan", which scans a source file and calls clang_getCursor() on every character.
...
llvm-svn: 89136
2009-11-17 19:37:36 +00:00
Ted Kremenek
e05d7806ff
Add clang_getNullCursor() and clang_equalCursors() (the latter for comparing cursors).
...
llvm-svn: 89131
2009-11-17 19:28:59 +00:00
Ted Kremenek
123344e5dd
Allow "source_filename" to be an optional argument (the client can provide NULL). This allows the client to put the source_filename in the command_line_args without fear of the file being named twice.
...
llvm-svn: 89118
2009-11-17 18:18:02 +00:00
Ted Kremenek
1cd27d50b3
Organize c-index-test into logic sections, and add section headers.
...
llvm-svn: 89117
2009-11-17 18:13:31 +00:00
Ted Kremenek
ef3339b7d4
Clean up c-index-test command line usage a bit by requiring a "-test-load-tu" option when testing clang_loadTranslationUnit(). Running c-index-test without the correct arguments now also prints a useful summary of its correct usage.
...
llvm-svn: 89115
2009-11-17 18:09:14 +00:00
Daniel Dunbar
664a1c2f98
Remove stale reference to old WPA dir, patch by Kovarththanan Rajaratnam.
...
llvm-svn: 89086
2009-11-17 10:15:57 +00:00
Daniel Dunbar
2208c57116
Eliminate TargetInfo::getDefaultLangOptions, this kind of logic is better done
...
in the driver.
llvm-svn: 89073
2009-11-17 09:15:44 +00:00
Daniel Dunbar
4656c53e12
Move -fnext-runtime defaulting to driver (and change clang-cc default to
...
-fnext-runtime), instead of using getDefaultLangOptions.
llvm-svn: 89058
2009-11-17 07:07:28 +00:00
Ted Kremenek
98524b1ce2
Sort visitor methods. No functionality change.
...
llvm-svn: 89055
2009-11-17 07:02:15 +00:00
Daniel Dunbar
d6ea9028e7
Simplify PreprocessorOptions, it doesn't need abstracted field access.
...
llvm-svn: 89047
2009-11-17 05:52:41 +00:00
Ted Kremenek
4c4d643b6e
Have clang_getCursorSource() return NULL when the source location is invalid or refers to a built-in buffer. Implements <rdar://problem/7296243>.
...
llvm-svn: 89044
2009-11-17 05:31:58 +00:00
Daniel Dunbar
19b04fff34
Move InitializeAnalyzerOptions for consistency.
...
llvm-svn: 89040
2009-11-17 05:05:08 +00:00
Daniel Dunbar
8870e97dc6
Remove unused NoPreprocess variable.
...
llvm-svn: 89039
2009-11-17 05:04:57 +00:00
Daniel Dunbar
92881dbe73
Remove unused IsCXXAware and IgnoreSysRoots option from HeaderSearchOptions::Entry.
...
llvm-svn: 89035
2009-11-17 05:04:15 +00:00
Daniel Dunbar
2cbf4a7d6e
Trim includes.
...
llvm-svn: 88982
2009-11-16 22:38:48 +00:00
Daniel Dunbar
24347f7cda
Store more information in HeaderSearchOptions so that its initialization is not
...
language dependent.
llvm-svn: 88981
2009-11-16 22:38:40 +00:00
Daniel Dunbar
77a9d2b3ec
clang-cc: Eliminate cyclic dependency in initializing CodeGenOptions.
...
llvm-svn: 88980
2009-11-16 22:38:14 +00:00
Daniel Dunbar
b9bbd54fdb
Add TargetOptions and use it when constructing targets.
...
- This ended up being hard to factor, sorry for the large diff.
- Some post-commit cleanup to come.
llvm-svn: 88833
2009-11-15 06:48:46 +00:00
Daniel Dunbar
9b30eb721f
Add examples dir, built with BUILD_EXAMPLES=1 (Makefiles, no CMake equivalent yet).
...
Move tools/wpa to examples/wpa, and unbreak its build.
llvm-svn: 88825
2009-11-15 00:22:33 +00:00
Daniel Dunbar
d392dd0709
Add pluggable action support to clang-cc, via -plugin command line option.
...
- Expects the plugin has been loaded with -load.
- Using this may require disabling TOOL_NO_EXPORTS in the clang-cc Makefile, this breaks the llvm::Registry way of working (static constructors are bad, kids). This should be replaced with a "real" plugin model that has explicit plugin interfaces.
llvm-svn: 88824
2009-11-15 00:12:04 +00:00
Daniel Dunbar
7fbd42f08a
Move the program action enum to FrontendOptions.
...
--
ddunbar@giles:clang-cc (master)$ grep llvm:🆑 :opt clang-cc.cpp # Woot
ddunbar@giles:clang-cc (master)$
--
llvm-svn: 88820
2009-11-14 22:32:38 +00:00
Daniel Dunbar
ea956ddf0b
clang-cc: Switch to using FrontendAction. Whee.
...
Please report any discrepancies you see in clang-cc, I'm not confident that our regression tests cover all the fun ways one can use clang-cc.
llvm-svn: 88776
2009-11-14 10:53:49 +00:00
Daniel Dunbar
409e890f8d
Add CompilerInstance::InitializeSourceManager.
...
llvm-svn: 88764
2009-11-14 07:53:04 +00:00
Daniel Dunbar
10563ea92e
Turn -fixit it back into a mode, but make -fixit-at imply that mode this time
...
(instead of running it with arbitrary consumers).
- Also, turn any -fixit-at lookup failure into an error.
llvm-svn: 88757
2009-11-14 04:39:29 +00:00
Daniel Dunbar
50ec0da0e1
Switch -verify implementation to use VerifyDiagnosticClient.
...
- Not tested, but -verify with multiple inputs should work now.
llvm-svn: 88750
2009-11-14 03:24:39 +00:00
Daniel Dunbar
e598a56d30
Pass Preprocessor through DiagnosticClient::BeginSourceFile.
...
llvm-svn: 88744
2009-11-14 02:48:04 +00:00
Ted Kremenek
4ef13f8ac9
Add clang-cc option "--analyzer-experimental-internal-checks". This
...
option enables new "internal" checks that will eventually be turned on
by default but still require broader testing.
llvm-svn: 88671
2009-11-13 18:46:29 +00:00
Daniel Dunbar
420b0f1bd8
Add CompilerInstance utility functions for creating output files.
...
llvm-svn: 88667
2009-11-13 18:32:08 +00:00
Daniel Dunbar
566eeb2da5
Add output file list to CompilerInstance, so that it can track them instead of
...
forcing all clients to do it.
llvm-svn: 87103
2009-11-13 10:37:48 +00:00
Daniel Dunbar
ac28c38737
clang-cc: Move output file initialization closer to use.
...
llvm-svn: 87102
2009-11-13 10:18:59 +00:00
Daniel Dunbar
39991862e1
Simplify, in anticipation of introducing explicit action instances.
...
llvm-svn: 87101
2009-11-13 09:57:06 +00:00
Daniel Dunbar
f7093b5ae8
Add CodeCompletion consumer to CompilerInvocation.
...
llvm-svn: 87100
2009-11-13 09:36:05 +00:00
Daniel Dunbar
242ea9a05a
Rework Sema code completion interface.
...
- Provide Sema in callbacks, instead of requiring it in constructor. This
eliminates the need for a factory function. Clients now just pass the object
to consume the results in directly.
- CodeCompleteConsumer is cheap to construct, so building it whenever we are
doing code completion is reasonable.
Doug, please review.
llvm-svn: 87099
2009-11-13 08:58:20 +00:00
Daniel Dunbar
599313ef94
Add CompilerInstance::createPCHExternalASTSource.
...
llvm-svn: 87097
2009-11-13 08:21:10 +00:00
Daniel Dunbar
adf6c242a0
Add CompilerInstance::has* methods for testing if the instance has a particular
...
subobject.
llvm-svn: 87096
2009-11-13 08:20:57 +00:00
Daniel Dunbar
df3e30c41c
Add ASTContext to CompilerInstance.
...
llvm-svn: 87095
2009-11-13 08:20:47 +00:00
Daniel Dunbar
7d75afc56a
Add CompilerInstance::createDiagnostics, and move clang-cc to it.
...
clang-cc.cpp is now under 1k lines, if anyone is counting.
llvm-svn: 87090
2009-11-13 05:52:34 +00:00
Daniel Dunbar
210a80086b
Add a FIXME.
...
llvm-svn: 87089
2009-11-13 05:52:19 +00:00