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