Daniel Dunbar
eced7e065f
Minor formatting tweaks.
...
llvm-svn: 86825
2009-11-11 09:38:42 +00:00
Daniel Dunbar
759cab9a54
clang-cc: Refactor some -fixit-at handling.
...
llvm-svn: 86824
2009-11-11 09:38:35 +00:00
Daniel Dunbar
d0c3bb0df2
Allow TextDiagnosticPrinter to have optional ownership of its output stream.
...
llvm-svn: 86823
2009-11-11 09:38:24 +00:00
Daniel Dunbar
d2cfa0111c
clang-cc: Move InitializeAnalyzerOptions into Options.cpp
...
llvm-svn: 86821
2009-11-11 08:13:55 +00:00
Daniel Dunbar
ef0147c0e9
clang-cc: Start coalescing "frontend" options.
...
llvm-svn: 86820
2009-11-11 08:13:47 +00:00
Daniel Dunbar
dcd40fb95f
clang-cc: Move InitializeDiagnosticOptions to Options.cpp
...
llvm-svn: 86819
2009-11-11 08:13:40 +00:00
Daniel Dunbar
f527a12e47
clang-cc: Move HeaderSearchOptions to Options.cpp
...
llvm-svn: 86818
2009-11-11 08:13:32 +00:00
Daniel Dunbar
b6bac22d02
Turn LoggingDiagnosticClient into a more general ChainedDiagnosticClient and
...
move to libFrontend.
llvm-svn: 86817
2009-11-11 08:13:24 +00:00
Daniel Dunbar
84dfbfde26
clang-cc: Move InitializeLangOptions to Options.cpp.
...
Also, inline InitializeLanguageStandard into InitializeLangOptions; this code
needs to be refactored but the current division doesn't make any sense.
llvm-svn: 86816
2009-11-11 07:26:12 +00:00
Daniel Dunbar
f0f6f0efb0
Inline some trivial functions.
...
llvm-svn: 86815
2009-11-11 07:26:02 +00:00
Daniel Dunbar
999215c8c8
clang-cc: Move InitializePreprocessorOptions to Options.cpp
...
llvm-svn: 86811
2009-11-11 06:10:03 +00:00
Daniel Dunbar
de142beafb
clang-cc: Simplify this code, now that predefines handling is uniform in the
...
PCH/-E and PCH/not--E cases.
llvm-svn: 86808
2009-11-11 05:33:31 +00:00
Daniel Dunbar
000c4ffd16
Redo how PCH handles its implicit include. Instead of treating this specially in
...
the front-end (as far as the preprocessor goes), follow the usual logic of
inserting the (original include path) name into the predefines buffer. This
pushes the responsibility for handling this to PCH instead of the front-end. In
PCH this requires being a little more clever when we diff the predefines
buffers.
Neither of these solutions are particularly great, I think what we eventually
should do is something like gcc where we insert a special marker to indicate the
PCH file, but then run the preprocessor as usual. This would be clearer and
would allow us to drop the overly clever predefines handling.
llvm-svn: 86806
2009-11-11 05:29:04 +00:00
Daniel Dunbar
3618834da8
Recognize -fsyntax-only as a "consumer only" action.
...
llvm-svn: 86776
2009-11-11 00:54:56 +00:00
Daniel Dunbar
93097b3906
Add Diagnostic::Report method for reporting diagnostics without a location.
...
llvm-svn: 86760
2009-11-10 23:55:23 +00:00
Daniel Dunbar
de02f63945
PreprocessorOptions: Get rid of unnecessary 'isPTH' flag for include entries.
...
llvm-svn: 86757
2009-11-10 23:53:43 +00:00
Daniel Dunbar
47ea8628a5
Decouple more of clang-cc by moving ImplicitP[CT]H options into
...
PreprocessorOptions.
Global variables used as [in] [out] parameters considered harmful.
llvm-svn: 86728
2009-11-10 22:09:38 +00:00
Ted Kremenek
4a720a363c
Update CMake file.
...
llvm-svn: 86721
2009-11-10 21:38:41 +00:00
Dan Gohman
ad5ef3d70f
Use #include <stdio.h> when using fprintf and stderr.
...
llvm-svn: 86717
2009-11-10 21:21:27 +00:00
Daniel Dunbar
f89a32ac45
clang-cc: Start moving "pure" option handling to Options.cpp, to separate it
...
from the logic part of clang-cc, and to enforce limited scoping.
llvm-svn: 86711
2009-11-10 19:51:53 +00:00
Daniel Dunbar
d96cd43f13
clang-cc: Sink more options inside codegenopts namespace.
...
llvm-svn: 86710
2009-11-10 19:51:46 +00:00
Daniel Dunbar
a35a2cb56b
Change LangOpts initialization to directly test the code generation options,
...
instead of reproducing their logic.
llvm-svn: 86709
2009-11-10 19:51:33 +00:00
Ted Kremenek
ba64574c9a
CIndex: Only display diagnostics to llvm::errs() when the client has set the 'displayDiagnostics' option to 1 in clang_createIndex(). This fixes <rdar://problem/7370691>.
...
llvm-svn: 86700
2009-11-10 19:18:52 +00:00
Daniel Dunbar
f76c9d270a
Driver: Run 'clang' in C++ mode based on the name it was invoked by. We match
...
anything that ends with ++ or ++-FOO (e.g., c++, clang++, clang++-1.1) as being
a "C++ compiler".
This allows easy testing of the C++ compiler by 'ln -s clang clang++', or by 'cp
clang clang++'.
Based on patch by Roman Divacky.
llvm-svn: 86697
2009-11-10 18:47:41 +00:00
Daniel Dunbar
ef2919f1fa
Factor out parts of InitializeCompileOptions that depend on the LangOptions.
...
llvm-svn: 86696
2009-11-10 18:47:35 +00:00
Daniel Dunbar
be50f5ab9d
Localize -disable-llvm-optzns handling to BackendConsumer::CreatePasses.
...
- This is conceptually better since the only thing we want this option to do is
preserve the internal module as constructed by IRgen, before running any
passes.
- This also fixes bugs in -disable-llvm-optzns handling with regards to debug
info.
llvm-svn: 86691
2009-11-10 17:50:53 +00:00
Daniel Dunbar
ede182ef05
clang-cc: Start sinking (CodeGen) options into namespaces to limit their scope.
...
llvm-svn: 86690
2009-11-10 17:50:42 +00:00
Daniel Dunbar
68ac06142b
Cleanup some clang-cc FIXMEs
...
llvm-svn: 86686
2009-11-10 16:23:44 +00:00
Daniel Dunbar
754c11ec48
Add CompileOptions to CompilerInvocation.
...
llvm-svn: 86685
2009-11-10 16:19:45 +00:00
Daniel Dunbar
a8b869e794
Simplify, following MemoryBuffer::getSTDIN API fix.
...
llvm-svn: 86633
2009-11-10 00:46:25 +00:00
Daniel Dunbar
190401566e
Remove some if-0'd code, we can resurrect this if we ever decide to support
...
continuing after invalid PCH loads.
llvm-svn: 86631
2009-11-10 00:46:12 +00:00
Daniel Dunbar
60198df262
Add PreprocessorOptions to CompilerInvocation.
...
llvm-svn: 86623
2009-11-09 23:12:31 +00:00
Daniel Dunbar
4df9aa2388
Privatize InitHeaderSearch, this functionality is only exposed via
...
ApplyHeaderSearchOptions now.
llvm-svn: 86617
2009-11-09 23:02:47 +00:00
Daniel Dunbar
e213db84cb
Move LangOptions, HeaderSearchOptions, and the target feature map into
...
CompilerInvocation.
llvm-svn: 86612
2009-11-09 22:46:17 +00:00
Daniel Dunbar
d673bfa6aa
Switch Target* to Target&.
...
llvm-svn: 86611
2009-11-09 22:46:09 +00:00
Daniel Dunbar
1de7855155
Change clang-cc to expect that all inputs have the same language (so we can only construct a single LangInfo). This matches how it is used in practice (since the compiler only it invokes it for one file at a time).
...
llvm-svn: 86609
2009-11-09 22:45:57 +00:00
Daniel Dunbar
06d4716297
(llvm up) Convert clang-cc.cpp:GetLanguage to StringSwitch.
...
llvm-svn: 86608
2009-11-09 22:45:47 +00:00
Douglas Gregor
8caea94c74
Make sure that we look into nested, transparent declaration contexts
...
when looking for a name within a given DeclContext. Now enumerators
will show up in code-completion results.
llvm-svn: 86591
2009-11-09 21:35:27 +00:00
Daniel Dunbar
b2eae89108
Add CompilerInvocation object, to capture all the options one needs to invoke
...
the compiler, and start flood filling it into clang-cc.
llvm-svn: 86586
2009-11-09 20:55:08 +00:00
Benjamin Kramer
04c99a6fe8
Factor CXString creation into a helper method.
...
llvm-svn: 86577
2009-11-09 19:13:48 +00:00
Benjamin Kramer
d6f85a8c88
Writing to a struct passed by value is pointless. Remove dead code.
...
- free(NULL) is a nop anyway.
- if someone thinks calling clang_disposeString twice should be legal
please change the method to take a pointer.
llvm-svn: 86568
2009-11-09 18:24:53 +00:00
Douglas Gregor
f96ea29b39
Improve c-index-test's parsing of the -code-completion-at=file:line:column argument
...
llvm-svn: 86566
2009-11-09 18:19:57 +00:00
Steve Naroff
8675d5c754
Introduce CXString type and associated functions clang_getCString() and clang_disposeString().
...
This abstraction will help us manage string memory for complex names that cross the C++/C boundary (e.g. ObjC methods, selectors). This patch also uses it in clang_getTranslationUnitSpelling (which I'm not sure is necessary). Will investigate later...since the extra malloc() can't hurt (for now).
Patch by John Thompson.
llvm-svn: 86562
2009-11-09 17:45:52 +00:00
Douglas Gregor
f81f528db1
C doesn't allow mixing declarations and statements, silly
...
llvm-svn: 86556
2009-11-09 17:05:28 +00:00
Douglas Gregor
8b14f8fde4
Minor cleanup for CIndex-based code-completion:
...
- Provide an actual test for code-completion via CIndex.
- Actually print optional strings in c-index-test
- Export clang_getCompletionChunkCompletionString from CIndex
llvm-svn: 86550
2009-11-09 16:04:45 +00:00
Daniel Dunbar
bd33c94d6f
Revert unintentional change to this file.
...
llvm-svn: 86455
2009-11-08 09:46:33 +00:00
Daniel Dunbar
2679a884d7
Move a function which returns a class outside of extern C scope.
...
llvm-svn: 86439
2009-11-08 04:13:53 +00:00
Daniel Dunbar
a797946755
CIndex: Add temporary hack to leak memory instead of returning invalid pointers.
...
llvm-svn: 86438
2009-11-08 04:11:32 +00:00
Daniel Dunbar
4ba3b297e6
Fix some build warnings.
...
llvm-svn: 86393
2009-11-07 18:34:24 +00:00
Daniel Dunbar
5a3b974446
Add some missing libraries for CMake as well.
...
llvm-svn: 86390
2009-11-07 17:53:40 +00:00
Daniel Dunbar
05aaf77d6c
Add some missing libraries.
...
llvm-svn: 86389
2009-11-07 17:52:11 +00:00
Daniel Dunbar
8ec8804de1
Switch clang-cc to use ApplyHeaderSearchOptions, and fix a thinko.
...
llvm-svn: 86341
2009-11-07 04:58:12 +00:00
Daniel Dunbar
ec87991c8f
Lift InitHeaderSearch::AddEnvVarPaths logic higher.
...
llvm-svn: 86337
2009-11-07 04:20:39 +00:00
Daniel Dunbar
00f8a397c6
Rename PreprocessorInitOptions to PreprocessorOptions for consistency, and fix
...
filenames.
Also, move InitializePreprocessor to Utils.h.
llvm-svn: 86335
2009-11-07 04:20:15 +00:00
Daniel Dunbar
b10ac0d708
Lift compiler builtin include path logic higher.
...
llvm-svn: 86334
2009-11-07 04:19:57 +00:00
Douglas Gregor
9eb7701dff
Various improvements to Clang's code-completion infrastructure:
...
- Introduce more code-completion string "chunk" kinds that describe
symbols, the actual text that the user is expected to type, etc.
- Make the generation of macro results optional, since it can be
slow
- Make code-completion accessible through the C API, marshalling the
code-completion results through a temporary file (ick) to maintain
process separation.
The last doesn't have tests yet.
llvm-svn: 86306
2009-11-07 00:00:49 +00:00
John Thompson
864bf7562f
Eliminate tabls
...
llvm-svn: 86183
2009-11-05 22:03:02 +00:00
John Thompson
ed4e2950bc
Adding -fshort-wchar option.
...
llvm-svn: 86167
2009-11-05 20:14:16 +00:00
Daniel Dunbar
0231895ce6
Replace DiagnosticClient::setLangOptions with {Begin,End}SourceFile, and clarify
...
invariants (diagnostics with source informations must occur between
{Begin,End}SourceFile).
llvm-svn: 86113
2009-11-05 02:42:12 +00:00
Daniel Dunbar
b5f2025b77
Convert CreateAnalysisConsumer and friends to just take a const Preprocessor&, and simplify.
...
llvm-svn: 86112
2009-11-05 02:41:58 +00:00
Daniel Dunbar
aef52f4c83
Remove clang-cc -html-diags option, this doesn't fit in well and we get plenty
...
of coverage of this from the analyzer.
If this bothers you, I can add it back in a mode where non-source diagnostics go
to stderr and only source diagnostics use -html-diags, but I don't think anyone
uses this.
llvm-svn: 86109
2009-11-05 02:11:37 +00:00
Daniel Dunbar
c00be15469
Simplify.
...
llvm-svn: 86104
2009-11-05 01:53:23 +00:00
Daniel Dunbar
b6362c13c9
CreatePreprocessor cannot fail
...
llvm-svn: 86103
2009-11-05 01:53:12 +00:00
Daniel Dunbar
d0ba0e6108
Kill PreprocessorFactory, which was both morally repugnant and totally unused.
...
llvm-svn: 86076
2009-11-04 23:56:25 +00:00
Daniel Dunbar
a5beced60e
Turn if chain into switch.
...
llvm-svn: 86071
2009-11-04 23:41:40 +00:00
Daniel Dunbar
181aaee165
InitializePreprocessor cannot fail.
...
llvm-svn: 86048
2009-11-04 21:13:15 +00:00
Daniel Dunbar
b27ec09a7e
Move -undef flag into PreprocessorInitOptions
...
llvm-svn: 86047
2009-11-04 21:13:02 +00:00
Daniel Dunbar
5ec950218a
Move -fcolor-diagnostics logic to driver.
...
llvm-svn: 86014
2009-11-04 06:24:57 +00:00
Daniel Dunbar
2c9784769a
Move logic for selection -fmessage-length= to driver.
...
llvm-svn: 86013
2009-11-04 06:24:47 +00:00
Daniel Dunbar
c2e6a4709e
Factor out a diagnostic options class.
...
llvm-svn: 86010
2009-11-04 06:24:30 +00:00
Tanya Lattner
f9d41df093
Merge constant array and structures. This will create a global variables for arrays and structs that are constant and their initializer is constant. It is on by default but can be disable with the flag -fno-merge-all-constants.
...
llvm-svn: 85991
2009-11-04 01:18:09 +00:00
Chris Lattner
e9d7d78ab3
Implement support for the -undef command line option, patch by
...
Roman Divacky! PR5363
llvm-svn: 85932
2009-11-03 19:50:27 +00:00
Daniel Dunbar
cb68cdfb03
Sort export list.
...
llvm-svn: 85832
2009-11-02 22:23:08 +00:00
Daniel Dunbar
f3355a61c4
Remove clang-cc code for handling -mmacosx-version-min and
...
-miphoneos-version-min.
llvm-svn: 85601
2009-10-30 18:12:31 +00:00
Steve Naroff
f406f4d99b
- Add/tweak some comments.
...
- change ObjCCategoryImplDecl::getCategoryClass() to getCategoryDecl().
No functionality change.
llvm-svn: 85528
2009-10-29 21:11:04 +00:00
Daniel Dunbar
7ad807f248
Move some clang-cc errors to use diagnostics, and simplify.
...
llvm-svn: 85527
2009-10-29 21:05:18 +00:00
Steve Naroff
a4aeed6958
clang_getDeclSpelling(): For category implementations, make sure we hand back the category name (not the class name). This fixes <rdar://problem/7297518>.
...
llvm-svn: 85521
2009-10-29 18:55:50 +00:00
Daniel Dunbar
38b6279ce4
Reject -I- in driver instead of clang-cc.
...
llvm-svn: 85469
2009-10-29 01:53:44 +00:00
Daniel Dunbar
938eb27b25
Formatting fixes.
...
llvm-svn: 85468
2009-10-29 01:53:18 +00:00
Steve Naroff
58bd62d190
Remove _clang_initCXLookupHint() and _clang_getCursorWithHint(). Related to <rdar://problem/7310688>.
...
Localize the optimization to ResolveLocationInAST(). The last valid AST location is now stored with ASTUnit. There still isn't optimal, however it's an improvement (with a much cleaner API). Having the client manage an "hint" is error prone and complex.
I wanted to land the major changes before finishing up the optimizations.
llvm-svn: 85425
2009-10-28 20:44:47 +00:00
Zhongxing Xu
cb131542f1
make CallGraph more flexible by letting it accept ASTContext instead of ASTUnit.
...
Patch by Simone Pellegrini.
llvm-svn: 85386
2009-10-28 12:23:03 +00:00
Steve Naroff
6231f18793
Add support for 'CXFile' (<rdar://problem/7303360>).
...
- 4 new functions (clang_getCursorSourceFile, clang_getDeclSourceFile, clang_getFileName, clang_getFileTime).
- Should remove clang_getDeclSource() and clang_getCursorSource(). For now, just put 'deprecate' comment in header.
- Also changed CXX style comment to C style (to eliminate warning).
llvm-svn: 85238
2009-10-27 14:35:18 +00:00
John Thompson
de258b5ab9
Changes for building as a Windows DLL
...
llvm-svn: 85234
2009-10-27 13:42:56 +00:00
Ted Kremenek
12e678d550
Unify Unix and Windows code paths when executing 'clang'.
...
llvm-svn: 85163
2009-10-26 22:14:08 +00:00
Ted Kremenek
bf0690c99f
Remove unnecessary calls to 'flush()'.
...
llvm-svn: 85162
2009-10-26 22:08:39 +00:00
Daniel Dunbar
431895f748
clang-cc: Allow building for x86_64 with -mmacosx-version-min=10.4.
...
llvm-svn: 85132
2009-10-26 17:52:49 +00:00
Rafael Espindola
b3549d74da
Rename -nostdclanginc to -nobuiltininc.
...
llvm-svn: 85116
2009-10-26 13:36:57 +00:00
Fariborz Jahanian
0797404a33
Fixes a warning.
...
llvm-svn: 84909
2009-10-22 22:49:47 +00:00
Ted Kremenek
2a3ffa9658
Always emit error diagnostics when an error occurs within clang_createTranslationUnit() and clang_createTranslationUnitFromSource(). These kind of errors are ones that shouldn't be missed.
...
llvm-svn: 84904
2009-10-22 22:19:00 +00:00
Ted Kremenek
a96b72a4ca
Split clang_getCursor() into clang_getCursor() and clang_getCursorWithHint().
...
llvm-svn: 84873
2009-10-22 17:22:53 +00:00
Ted Kremenek
44886fd124
Add some explanatory diagnostics when clang_createTranslationUnitFromSource fails.
...
llvm-svn: 84825
2009-10-22 03:24:01 +00:00
Ted Kremenek
649bf5c04b
Enhance 'clang_createTranslationUnitFromSourceFile()' in two ways:
...
(1) Allow the source file to be specified in the actual command line arguments by allowing the
caller to set 'source_filename' to NULL.
(2) Automatically strip off the arguments '-emit-ast', '-fsyntax-only', and '-c'.
llvm-svn: 84802
2009-10-22 00:03:57 +00:00
Steve Naroff
20bad0b7c6
Extend clang_getCursor() to take a 'relativeDecl' argument (so speed up searching). Without a 'relativeDecl', the algorithm is n-squared. For example, running the following command on 'Large.m' takes hours without a 'relatvieDecl'.
...
snaroff% time ../../Debug/bin/c-index-test Large.ast all > Large.out
snaroff% cat Large.m
#import <Cocoa/Cocoa.h>
#import <QuickTime/QuickTime.h>
#import <OpenGL/OpenGL.h>
With a 'relativeDecl', it takes <30 seconds:-)
llvm-svn: 84760
2009-10-21 13:56:23 +00:00
Steve Naroff
531e284064
- Extend clang_createIndex() to support PCH and diagnostic 'filtering'. This seems cleaner to me without sacrificing much flexibility.
...
- Remove clang_wantOnlyLocalDeclarations().
- Remove 'displayDiagnostics' arguments to clang_createTranslationUnitFromSourceFile() and clang_createTranslationUnit().
- Have clang_createTranslationUnitFromSourceFile() strip the '-o <outfile>' command line arguments if they exist. Document this semantic in the header. Also verify we have a valid ASTUnit before telling it to 'unlinkTemporaryFile()'.
llvm-svn: 84634
2009-10-20 14:46:24 +00:00
Ted Kremenek
e28968828b
Fix inverted preprocessor guard, and fix the resulting compiler error that was unmasked.
...
llvm-svn: 84555
2009-10-19 22:27:32 +00:00
Ted Kremenek
02b319ce18
Really fix <rdar://problem/7312058> by adding a 'displayDiagnostics' option to
...
clang_createTranslationUnit() and clang_createTranslationUnitFromSourceFile(). The user can now
specify if the diagnostics from Clang are printed to stderr or are silenced completely. We can
obviously evolve this API to be more general in the future.
Note: Added a FIXME since I wasn't certain what was the best way to redirect to something analogous
to '/dev/null' on Windows.
llvm-svn: 84548
2009-10-19 22:15:09 +00:00
Ted Kremenek
428c637ada
The constructor for ASTUnit now takes a DiagnosticClient*, allowing uses of ASTUnit to specify
...
alternate DiagnosticClients. To match this API, ASTUnit::LoadFromPCHFile() now takes a corresponding
DiagnosticClient* argument as well. The DiagnosticClient object is destroyed when the ASTUnit object
is destroyed.
The CIndex library now uses this API to create a 'IgnoreDiagnosticsClient' that simply silences
diagnostics when using the clang_createTranslationUnitFromSourceFile() function. This fixes
<rdar://problem/7312058>. This API can change in the future as we add more flexibility for clients.
llvm-svn: 84539
2009-10-19 21:44:57 +00:00
Ted Kremenek
9dd89ba393
Re-order includes so that the logic involving '#ifdef LLVM_ON_WIN32' appears after the main #includes. The ultimate solution is to just use LLVM-portable methods in llvm/System.
...
llvm-svn: 84534
2009-10-19 21:17:25 +00:00
Steve Naroff
505fb84ed9
Move Diagnostic/DiagClient/FileManager from Indexer => ASTUnit.
...
Removing this shared data should enable clang_createTranslationUnit/clang_createTranslationUnitFromSourceFile to be run from multiple threads (related to <rdar://problem/7303432>).
llvm-svn: 84499
2009-10-19 14:34:22 +00:00
Steve Naroff
2f78a6f368
Change indenting for case/compound statements to conform to the rest of clang.
...
llvm-svn: 84498
2009-10-19 13:41:39 +00:00
Benjamin Kramer
b625a13c79
CIndex: make variable non-static to avoid potential race conditions, per
...
Daniel's comment.
llvm-svn: 84484
2009-10-19 10:20:24 +00:00
Daniel Dunbar
2c422dc9ca
Move clients to use IdentifierInfo::getNameStart() instead of getName()
...
llvm-svn: 84436
2009-10-18 20:26:12 +00:00
Benjamin Kramer
a259086fd5
Try to unbreak MSVC build.
...
llvm-svn: 84433
2009-10-18 19:59:44 +00:00
Benjamin Kramer
ad9c37661b
CIndex: fix typo.
...
llvm-svn: 84422
2009-10-18 16:52:07 +00:00
Benjamin Kramer
49ce64eb88
Missed a paren.
...
llvm-svn: 84421
2009-10-18 16:20:58 +00:00
Benjamin Kramer
6bd6d50b42
CIndex: add a (untested) WIN32 codepath to get ClangPath.
...
llvm-svn: 84420
2009-10-18 16:13:48 +00:00
Benjamin Kramer
61f5d0cb15
CIndex: compute ClangPath lazily.
...
llvm-svn: 84419
2009-10-18 16:11:04 +00:00
Benjamin Kramer
2836c4ccb6
CIndex: replace fork/exec with our portable ExecuteAndWait wrapper.
...
llvm-svn: 84414
2009-10-18 11:19:36 +00:00
Benjamin Kramer
817e7e4fb8
CIndex: avoid a dangling pointer issue.
...
llvm-svn: 84413
2009-10-18 11:10:55 +00:00
Daniel Dunbar
cd23718ca1
Attempt to unbreak the MSVC build.
...
llvm-svn: 84381
2009-10-17 23:53:11 +00:00
Daniel Dunbar
f997f1e896
Simplify (move guard to caller instead of callee).
...
llvm-svn: 84325
2009-10-17 09:04:56 +00:00
Ted Kremenek
5ccfc98d19
Fix compiler warning: "ISO C90 forbids mixed declarations and code"
...
llvm-svn: 84318
2009-10-17 06:42:15 +00:00
Ted Kremenek
bbf7fa317a
Fix warning: 'warning: C++ style comments are not allowed in ISO C90'
...
llvm-svn: 84317
2009-10-17 06:37:16 +00:00
Ted Kremenek
05729c2835
Resolve FIXME: delete the 'Program' object in the destructor of CIndexer.
...
llvm-svn: 84313
2009-10-17 06:21:47 +00:00
Ted Kremenek
8bcb1c6883
Add 'UseBumpPtrAllocator' flag to ASTUnit::LoadFromPCHFile() to cause the created ASTContext to use
...
its own BumpPtrAllocator to allocate ASTs.
Change clang_createTranslationUnit (CIndex) to pass 'UseBumpPtrAllocator = true' to
ASTUnit::LoadFromPCHFile().
llvm-svn: 84296
2009-10-17 00:34:24 +00:00
Douglas Gregor
d3d923a0f2
Make CIndex and c-index-test a little bit more robust. The only
...
substantive change is that clang_getCursorSource() now returns the
file in which a macro was instantiated when the cursor points into a
macro instantiation, rather than crashing.
llvm-svn: 84275
2009-10-16 21:24:31 +00:00
Douglas Gregor
16bef857d9
Keep track of whether declararions were loaded from a precompiled
...
header or not via a new "PCHLevel" field in Decl. We currently use
this information to help CIndex filter out declarations that came from
a precompiled header (rather than from an AST file). Further down the
road, it can be used to help implement multi-level precompiled
headers.
llvm-svn: 84267
2009-10-16 20:01:17 +00:00
Ted Kremenek
51d06bbe5b
Use an std::vector<> instead of an array of ARG_MAX size, as ARG_MAX may not be defined everywhere.
...
llvm-svn: 84220
2009-10-15 23:21:22 +00:00
Steve Naroff
44cd60eebe
Make sure temporary files get unlinked.
...
llvm-svn: 84208
2009-10-15 22:23:48 +00:00
Ted Kremenek
fb8e47323f
Add missing #include for wait().
...
llvm-svn: 84207
2009-10-15 22:10:56 +00:00
Steve Naroff
1cfb96cd14
Minor improvement to format...no functionality change.
...
llvm-svn: 84203
2009-10-15 20:50:09 +00:00
Steve Naroff
7781daa4e0
Implement <rdar://problem/7303432> [Clang/Index] In-memory-style AST generation API (initial API implementation).
...
Added clang_createTranslationUnitFromSourceFile().
Changed clang_createIndex() to lookup the location of clang (using dladdr).
llvm-svn: 84198
2009-10-15 20:04:39 +00:00
Mike Stump
904ad90bc8
Set up include paths for VC++ and Cygwin headers, along with the
...
existing MinGW headers, plus the newer 4.4.0 version. Patch by John
Thompson.
llvm-svn: 83594
2009-10-08 23:29:47 +00:00
Douglas Gregor
084a654334
Make sure that c-index-test links as a C++ executable
...
llvm-svn: 83335
2009-10-05 22:29:42 +00:00
Douglas Gregor
629f4811a0
Make sure that libCIndex links as a C++ library
...
llvm-svn: 83331
2009-10-05 22:25:29 +00:00
Eric Christopher
c2ac4f020b
Fix C90 compile warning about mixed declarations and code.
...
llvm-svn: 83327
2009-10-05 21:33:42 +00:00
Steve Naroff
d7eb7179a2
- Fix assert in clang_getCursorDecl (having to do with recently added ObjC_ProtocolRef).
...
- Make sure CHECK: lines in test case match the expected output.
llvm-svn: 83316
2009-10-05 17:58:19 +00:00
Rafael Espindola
e7178953f9
Add a -nostdclanginc flag to clang-cc that prevents it from searching
...
its own binary-relative headers. Useful when using clang's preprocessor
with gcc.
llvm-svn: 83302
2009-10-05 13:12:17 +00:00
Steve Naroff
a6c56bb849
Add support for class and protocol references.
...
llvm-svn: 83186
2009-10-01 00:31:07 +00:00
Argyrios Kyrtzidis
419e38bbe2
When pointing at a type decl reference, ASTLocation is a NamedDeclRef.
...
llvm-svn: 83099
2009-09-29 19:45:58 +00:00
Argyrios Kyrtzidis
4cbe85904c
Modify ASTLocation and apart from being a Decl or Stmt, allow it to also be:
...
-A NamedDecl reference
-A TypeLoc
llvm-svn: 83095
2009-09-29 19:44:27 +00:00
Douglas Gregor
63b3556c9c
Set GNUMode only for the "gnu" language standard options, from Ken Dyck!
...
llvm-svn: 83064
2009-09-29 14:42:43 +00:00
Daniel Dunbar
73b6b4e1a3
Disable c-index-test on MSVC until someone figures out the real problem.
...
llvm-svn: 82830
2009-09-26 01:21:38 +00:00
Steve Naroff
43b118fc2c
Fix cut/paste error resulting in bad column info.
...
llvm-svn: 82810
2009-09-25 22:15:54 +00:00
Steve Naroff
2676089407
Add clang_getDeclSource().
...
llvm-svn: 82807
2009-09-25 21:45:39 +00:00
Steve Naroff
63f475a212
Add clang_getDeclLine and clang_getDeclColumn
...
Fix clang_getCursorDecl to do the right thing for expr refs
Fixup test file to accommodate new output (which includes the line/column for the referenced decl)
llvm-svn: 82798
2009-09-25 21:32:34 +00:00
Douglas Gregor
43bc1a7483
CMake build support for libCIndex and c-index-test. The indexing tests
...
are now running properly from within CMake.
llvm-svn: 82755
2009-09-25 06:35:15 +00:00
Douglas Gregor
9e84d88d27
Hide clang-wpa executable behind a CMake variable so it won't be built by default
...
llvm-svn: 82751
2009-09-25 05:41:21 +00:00
Steve Naroff
a7753c492e
Add test for C-based indexing API, using FileCheck utility.
...
llvm-svn: 82706
2009-09-24 20:03:06 +00:00
Chris Lattner
6d98ede7e8
wpa is an experiment, don't build it by default, it adds to build times due to everything it links in.
...
llvm-svn: 82704
2009-09-24 19:45:12 +00:00
Anders Carlsson
d934010557
Add a -dump-record-layouts argument to clang-cc.
...
llvm-svn: 82703
2009-09-24 18:54:49 +00:00
Steve Naroff
f99203abd0
Some minor cleanups...
...
llvm-svn: 82646
2009-09-23 20:00:53 +00:00
Steve Naroff
76b8f13fcb
More work to enable more exhaustive testing of the indexing API.
...
Next step: Add actual some test cases:-)
llvm-svn: 82636
2009-09-23 17:52:52 +00:00
Daniel Dunbar
5564ba743f
Push "clang-is-production" logic up to tools/driver, and make it hittable by
...
defining the CLANG_IS_PRODUCTION Makefile variable.
llvm-svn: 82583
2009-09-22 22:31:13 +00:00
Douglas Gregor
ea9b03e6e2
Replace the -code-completion-dump option with
...
-code-completion-at=filename:line:column
which performs code completion at the specified location by truncating
the file at that position and enabling code completion. This approach
makes it possible to run multiple tests from a single test file, and
gives a more natural command-line interface.
llvm-svn: 82571
2009-09-22 21:11:38 +00:00
Steve Naroff
66af1aecdb
- Implement support for various types of "refs" (initially to help test clang_getCursor()).
...
- Add missing prototypes for dispose functions.
llvm-svn: 82564
2009-09-22 19:25:29 +00:00
Daniel Dunbar
1da62f5723
This FIXME is done.
...
llvm-svn: 82509
2009-09-22 02:17:27 +00:00
Fariborz Jahanian
71848a3ff1
Removed -fobjc-newgc-api option. clang now conforms to
...
gcc-style write-barrier api only.
llvm-svn: 82493
2009-09-21 23:03:37 +00:00
Daniel Dunbar
26e37a77c6
Switch ProcessASTInputFile to still use ParseAST.
...
- Currently this requires us to fake an input file.
- This allows Sema to be keep all the logic for how to pull decls out of the external AST source and how to handle things like tentative definitions.
llvm-svn: 82432
2009-09-21 03:03:56 +00:00
Daniel Dunbar
7cd285f0fe
Change ASTUnit to take the Diagnostic as an argument, the client should have control of this.
...
llvm-svn: 82430
2009-09-21 03:03:39 +00:00
Daniel Dunbar
948062a592
Add Diagnostic to Indexer, and have it keep its own FileManager instead of taking an external reference (which was leaked in the case of the CIndex library).
...
llvm-svn: 82429
2009-09-21 03:03:22 +00:00
Chris Lattner
78765c36de
switch command line 'parse' methods to use StringRef for efficiency, which
...
is also required for an llvm-side change.
llvm-svn: 82344
2009-09-20 00:39:15 +00:00
Douglas Gregor
2436e7116b
Initial implementation of a code-completion interface in Clang. In
...
essence, code completion is triggered by a magic "code completion"
token produced by the lexer [*], which the parser recognizes at
certain points in the grammar. The parser then calls into the Action
object with the appropriate CodeCompletionXXX action.
Sema implements the CodeCompletionXXX callbacks by performing minimal
translation, then forwarding them to a CodeCompletionConsumer
subclass, which uses the results of semantic analysis to provide
code-completion results. At present, only a single, "printing" code
completion consumer is available, for regression testing and
debugging. However, the design is meant to permit other
code-completion consumers.
This initial commit contains two code-completion actions: one for
member access, e.g., "x." or "p->", and one for
nested-name-specifiers, e.g., "std::". More code-completion actions
will follow, along with improved gathering of code-completion results
for the various contexts.
[*] In the current -code-completion-dump testing/debugging mode, the
file is truncated at the completion point and EOF is translated into
"code completion".
llvm-svn: 82166
2009-09-17 21:32:03 +00:00
Steve Naroff
3aa2d7300b
Add clang_disposeTranslationUnit() and clang_disposeIndex().
...
llvm-svn: 82154
2009-09-17 18:33:27 +00:00
Daniel Dunbar
e9fee8a361
Initial support for code generation from .ast files.
...
- Doesn't actually work yet because only module level asm's get correctly marked as externally visible in the PCH.
- Other things like 'clang-cc foo.ast -ast-dump' now work, as well.
llvm-svn: 82107
2009-09-17 00:48:13 +00:00
Daniel Dunbar
691b9337a6
clang-cc: Factor out code for creating one of the standard AST consumer actions.
...
llvm-svn: 82106
2009-09-17 00:48:00 +00:00
Daniel Dunbar
785d51c45b
Simplify.
...
llvm-svn: 82104
2009-09-17 00:47:46 +00:00
Daniel Dunbar
1188987e23
clang-cc: Remove -ObjC -ObjC++ handling from clang-cc.
...
llvm-svn: 82103
2009-09-17 00:47:27 +00:00
Fariborz Jahanian
a7fa6beb2e
Starting patch to generate more specific API for objc's
...
GC. Currently, new API will be generated under
clang-cc's -fobjc-newgc-api flag which will eventually
become the default. WIP.
llvm-svn: 82082
2009-09-16 21:37:16 +00:00
Mike Stump
a1874a91b6
Be sure to use the correct version instead of the wrong one.
...
llvm-svn: 81925
2009-09-15 21:49:22 +00:00
Steve Naroff
54f22fb1de
- clang_getCursor(): Replace asserts with error codes (CXCursor_InvalidFile, CXCursor_NoDeclFound).
...
- Add predicate clang_isInvalid().
- Implement clang_getCursorFromDecl().
llvm-svn: 81908
2009-09-15 20:25:34 +00:00
Daniel Dunbar
4e97bc3ee7
Add -target-abi clang-cc option, currently unused.
...
llvm-svn: 81731
2009-09-14 00:02:12 +00:00
Chris Lattner
46d90f7b32
rewrite the parsing code for -miphoneos-version-min and
...
-mmacosx-version-min to work on llvm::Triple. Simplify
it to use x-'0' to parse single digit integer strings.
llvm-svn: 81646
2009-09-12 22:45:58 +00:00
Steve Naroff
e0064d2e95
Make sure ObjCInterfaceDecl's that are forward declared always contain a valid location.
...
llvm-svn: 81487
2009-09-11 00:12:01 +00:00
Fariborz Jahanian
2cde203392
Non fragile ABI for GNU runtime. Patch bu David Chisnall.
...
llvm-svn: 81462
2009-09-10 21:48:21 +00:00
Mike Stump
11289f4280
Remove tabs, and whitespace cleanups.
...
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Daniel Dunbar
0da4a5dcab
Use llvm::sys::getHostTriple, not LLVM_HOSTTRIPLE.
...
llvm-svn: 81013
2009-09-04 17:43:10 +00:00
Steve Naroff
ef9618b75f
Implement accessors clang_getCursorKind(), clang_getCursorDecl().
...
Implement clang_getCursor() - wired up to Argiris's work.
Implement callbacks for CXCursor_ObjCProtocolRef.
llvm-svn: 81004
2009-09-04 15:44:05 +00:00
Steve Naroff
c0683b909a
Add ASTUnit::getOriginalSourceFileName() and use in clang_getTranslationUnitSpelling().
...
llvm-svn: 80932
2009-09-03 18:19:54 +00:00
Steve Naroff
38c1a7ba12
- Add back some harmless code that part of a reverted commit (r80859). I'll investigate the lifetime snafu (with ASTUnit) separately.
...
- Traverse category methods, add a "class ref" and make the little test harness a bit more flexible.
llvm-svn: 80921
2009-09-03 15:49:00 +00:00
Daniel Dunbar
3a0637b06b
Revert "Visit function/method bodies and issue callback for parameters and local
...
variables.", this is breaking x86_64-apple-darwin10 and Linux tests.
llvm-svn: 80896
2009-09-03 05:59:50 +00:00
Daniel Dunbar
a77eaeb1e6
Add basic support for -pthread.
...
- Patch by David Chisnall, with PCH and Darwin support mixed in.
llvm-svn: 80883
2009-09-03 04:54:28 +00:00
Daniel Dunbar
57f2224c79
Tweak comment.
...
llvm-svn: 80882
2009-09-03 04:54:12 +00:00
Steve Naroff
ef3cf2a576
Visit function/method bodies and issue callback for parameters and local variables.
...
Add clang_getTranslationUnitSpelling().
llvm-svn: 80859
2009-09-03 00:32:06 +00:00
Daniel Dunbar
1268851c51
Initialize targets before parsing command line options, so --version shows registered targets.
...
llvm-svn: 80849
2009-09-02 23:20:15 +00:00
Eli Friedman
b041c75f09
Fix warnings.
...
llvm-svn: 80833
2009-09-02 20:07:26 +00:00
Steve Naroff
b92c73a02a
Fix some newly added bugs uncovered by the RELEASE build.
...
llvm-svn: 80813
2009-09-02 18:58:52 +00:00
Steve Naroff
80a766bf50
Start issuing callback for references (add some predicates, refactor some code).
...
llvm-svn: 80810
2009-09-02 18:26:48 +00:00
Steve Naroff
3645f5a99b
Flesh out CXCursorKind...
...
- More declaration types (distinguish between struct/union/class, instance/class methods).
- Add definition types (class, category, function, instance/class method, etc.).
Add client data to clang_loadDeclaration() and implement.
llvm-svn: 80787
2009-09-02 13:28:54 +00:00
Steve Naroff
69b10fd2c5
Add explicit "blind" client data to callback function (since we aren't using blocks).
...
llvm-svn: 80673
2009-09-01 15:55:40 +00:00
David Chisnall
5778fce141
Updated GNU runtime non-fragile ABI.
...
Added -fconstant-string-class= option.
Added __has_feature() test for non-fragile ABI.
llvm-svn: 80591
2009-08-31 16:41:57 +00:00
Steve Naroff
772c1a4574
Implement source/line/column hooks.
...
llvm-svn: 80585
2009-08-31 14:26:51 +00:00
Steve Naroff
1054e60334
More fleshing out the C-based indexing API (under construction).
...
llvm-svn: 80529
2009-08-31 00:59:03 +00:00
Benjamin Kramer
8b83f5dfb8
gcc 4.4 needs cstdio for printf. Reorder includes while at it.
...
llvm-svn: 80430
2009-08-29 12:56:35 +00:00
Ted Kremenek
2dde6bb80e
Add CIndex dependencies: libLLVMC and libclangSema (for IdentifierResolver).
...
llvm-svn: 80385
2009-08-28 18:33:53 +00:00
Ted Kremenek
e486cdc015
Tweak CIndex file to resolve to linking issues with the clang libraries. In
...
particular, clangFrontend was not being linked in.
llvm-svn: 80384
2009-08-28 18:29:48 +00:00
Daniel Dunbar
e58bd8b1ab
Hide IdxVisitor and remove unimplemented method (causing link errors on x86_64
...
linux builder).
llvm-svn: 80376
2009-08-28 16:30:07 +00:00
Steve Naroff
a1c728438c
Lot's of little changes to get the C-based indexing API going...
...
Work in progress.
llvm-svn: 80367
2009-08-28 15:28:48 +00:00
Steve Naroff
8721959642
Add CX prefix to Cursor and move a comment.
...
llvm-svn: 80359
2009-08-28 12:07:44 +00:00
Ted Kremenek
30cbea5cad
Update exports list.
...
llvm-svn: 80306
2009-08-27 23:50:46 +00:00
Steve Naroff
d5e8e862bb
Fill in Index.h header file and add stubs to implementation file.
...
llvm-svn: 80279
2009-08-27 19:51:58 +00:00
Ted Kremenek
b60d87c517
Add initial boilerplate for CIndex, a shared library that will vend high-level
...
source symbol information (harvested by Clang) through a C API.
llvm-svn: 80166
2009-08-26 22:36:44 +00:00
Eli Friedman
c00767d32a
Since the HexFloats option only controls a warning, it shouldn't depend
...
on whether we're in GNUMode. Adjust the code appropriately.
llvm-svn: 80132
2009-08-26 20:15:14 +00:00
Dan Gohman
a98e0e73de
Update clang for raw_fd_ostream no longer requiring F_Force.
...
llvm-svn: 79991
2009-08-25 15:36:09 +00:00
Chris Lattner
72bb4f602c
prune #includes.
...
llvm-svn: 79889
2009-08-24 04:11:30 +00:00
Chris Lattner
3441b4f77e
API changes to match llvm ToT.
...
llvm-svn: 79868
2009-08-23 22:45:33 +00:00
Douglas Gregor
33870d908f
CMake: Improve installation of Clang
...
- Install clang-cc into libexec
- Install headers into lib/clang/<version>/include
- Don't install other clang-based tools (clang-wpa, clang-index, etc.)
llvm-svn: 79827
2009-08-23 05:28:29 +00:00
Chris Lattner
84cffc22d4
adjust for raw_fd_ostream api change.
...
llvm-svn: 79809
2009-08-23 02:59:41 +00:00
Anders Carlsson
9cedbefb24
Add a -fno-elide-constructors option to clang-cc.
...
llvm-svn: 79782
2009-08-22 22:30:33 +00:00
Daniel Dunbar
4cd55b0507
Don't install wpa or index-test tools.
...
llvm-svn: 79557
2009-08-20 18:45:52 +00:00