Commit Graph

839 Commits

Author SHA1 Message Date
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
Nate Begeman 5ec4b318e3 Take 2 on AltiVec-style vector initializers.
Fixes PR4704 problems

Addresses Eli's patch feedback re: ugly cast code

Updates all postfix operators to remove ParenListExprs.  While this is awful,
no better solution (say, in the parser) is obvious to me.  Better solutions
welcome.

llvm-svn: 78621
2009-08-10 23:49:36 +00:00
Chris Lattner 30ba674391 fix a couple of problems with section attributes:
1. Passing something that isn't a string used to cause:
   "argument to annotate attribute was not a string literal"
  make it say "section attribute" instead.

2. Fix the location of the above message to point to the
   bad argument instead of the section token.

3. Implement rdar://4341926, by diagnosing invalid section
   specifiers in the frontend rather than letting them slip all
   the way to the assembler (a QoI win).

An example of #3 is that we used to produce something like this:

/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Expected comma after segment-name
/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Rest of line ignored. 1st junk character valued 46 (.).

Daniel improved clang to use llvm_report_error, so now we got:

$ clang t.c -c
fatal error: error in backend: Global variable 'x' has an invalid section specifier 'sadf': mach-o section specifier
      requires a segment and section separated by a comma.

with no loc info.  Now we get:

$ clang t.c -fsyntax-only
t.c:4:30: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment
      and section separated by a comma
int x __attribute__((section("sadf")));
                             ^

which is nice :)

llvm-svn: 78586
2009-08-10 19:03:04 +00:00
Daniel Dunbar 71f22e738a Use LLVM's new error handler API to report back end errors using Diagnostic.
For example,
--
ddunbar@giles:Frontend$ clang -c backend-errors.c
fatal error: error in backend: Global variable 'a' has an invalid section specifier
      'I AM, not, legal': mach-o section specifier uses an unknown section type.
--
compare to:
--
ddunbar@giles:Frontend$ gcc -c backend-errors.c
/var/folders/DQ/DQ8GT3++HESEzT1obWBynE+++TI/-Tmp-//cc45w2pq.s:2:Expected comma after segment-name
/var/folders/DQ/DQ8GT3++HESEzT1obWBynE+++TI/-Tmp-//cc45w2pq.s:2:Rest of line ignored. 1st junk character valued 77 (M).
--

Yay!

I am not tied to my wording choice, we could also go with "uncoverable error"
for the prefix, or just leave it off entirely.

llvm-svn: 78554
2009-08-10 03:40:28 +00:00
Daniel Dunbar 481fe50903 Revert r78535, it is causing a number of failures to build projects.
--- Reverse-merging r78535 into '.':
D    test/Sema/altivec-init.c
U    include/clang/Basic/DiagnosticSemaKinds.td
U    include/clang/AST/Expr.h
U    include/clang/AST/StmtNodes.def
U    include/clang/Parse/Parser.h
U    include/clang/Parse/Action.h
U    tools/clang-cc/clang-cc.cpp
U    lib/Frontend/PrintParserCallbacks.cpp
U    lib/CodeGen/CGExprScalar.cpp
U    lib/Sema/SemaInit.cpp
U    lib/Sema/Sema.h
U    lib/Sema/SemaExpr.cpp
U    lib/Sema/SemaTemplateInstantiateExpr.cpp
U    lib/AST/StmtProfile.cpp
U    lib/AST/Expr.cpp
U    lib/AST/StmtPrinter.cpp
U    lib/Parse/ParseExpr.cpp
U    lib/Parse/ParseExprCXX.cpp

llvm-svn: 78551
2009-08-10 03:01:36 +00:00
Nate Begeman a96114ed08 AltiVec-style vector initializer syntax, vec4 a = (vec4)(a, b, c, d);
In addition to being defined by the AltiVec PIM, this is also the vector
initializer syntax used by OpenCL, so that vector literals are compatible
with macro arguments.

llvm-svn: 78535
2009-08-09 17:55:44 +00:00
Benjamin Kramer 8b79886e0d Remove duplicated colon.
llvm-svn: 77891
2009-08-02 12:12:11 +00:00
Mike Stump 183c3d2f59 Add beginnigs of rtti generation, wire up more of -fno-exceptions.
llvm-svn: 77751
2009-07-31 23:15:31 +00:00
Argyrios Kyrtzidis bd92767014 Add support for ObjC message expressions, in the Analyzer:
-Accept an ObjC method and find all message expressions that this method may respond to.
-Accept an ObjC message expression and find all methods that may respond to it.

llvm-svn: 77551
2009-07-30 00:03:55 +00:00
Argyrios Kyrtzidis 2eff90515f Support ObjC methods as Entities.
llvm-svn: 77547
2009-07-29 23:41:46 +00:00
Argyrios Kyrtzidis f7f56741e0 Add TranslationUnit::getSelectorMap().
llvm-svn: 77542
2009-07-29 23:41:08 +00:00
Argyrios Kyrtzidis 91d3df0b53 -Introduce the idx::Analyzer class used for getting indexing information, like finding
references of a declaration across translation units.

-Modify the index-test tool to use it.

llvm-svn: 77536
2009-07-29 23:40:14 +00:00
Argyrios Kyrtzidis 82150b38d2 Add getDeclReferenceMap() to the abstract interface of TranslationUnit class.
llvm-svn: 77530
2009-07-29 23:39:18 +00:00
Argyrios Kyrtzidis ca9efa0271 Remove the TranslationUnit usage from clang-wpa.cpp since it's not really
necessary.

llvm-svn: 77529
2009-07-29 23:39:09 +00:00
Argyrios Kyrtzidis f1a0fd852f Introduce a helper template for the Handler classes and use it instead
of the iterator of the Indexer class.

llvm-svn: 77528
2009-07-29 23:39:03 +00:00
Argyrios Kyrtzidis dd9ee4aa04 -Make IndexProvider an abstract interface for getting indexing information.
-Introduce Indexer as an IndexProvider implementation.

llvm-svn: 77524
2009-07-29 23:38:21 +00:00
Daniel Dunbar 13796e3b95 Destroy the ASTConsumer prior to the Context, HTMLPrinter for example wants to
do a significant amount of work in its destructor, which may access the
context. (PR4642).

llvm-svn: 77423
2009-07-29 02:40:09 +00:00
Zhongxing Xu ee5d708e55 Add two nodes to the call graph:
- Root is the main function or 0.
 - ExternalCallingNode has edges to all external functions.

llvm-svn: 76876
2009-07-23 13:39:38 +00:00
Argyrios Kyrtzidis 05ac8276cf Change the semantics for Entity.
Entity can now refer to declarations that are not visible outside the translation unit.
It is a wrapper of a pointer union, it's either a Decl* for declarations that don't
"cross" translation units, or an EntityImpl* which is associated with the specific "visible" Decl.

Included is a test case for handling fields across translation units.

llvm-svn: 76515
2009-07-21 00:07:06 +00:00
Argyrios Kyrtzidis 153d418def Add '\n' to the end of error message.
llvm-svn: 76506
2009-07-21 00:05:10 +00:00
Argyrios Kyrtzidis d6bf03c272 Introduce ASTLocation::getReferencedDecl(), for getting the declaration that the ASTLocation references.
llvm-svn: 76336
2009-07-18 21:17:58 +00:00
Argyrios Kyrtzidis 05898da9cb Introduce a redecl_iterator in Decl class, so that we can do a "iterate over all declarations of the same decl" without knowing the exact type.
llvm-svn: 76298
2009-07-18 08:50:35 +00:00
Daniel Dunbar c3ccd180e7 Fix indentation / trailing white space.
llvm-svn: 76200
2009-07-17 18:10:27 +00:00
Daniel Dunbar 54091b82b5 [llvm up] Add support for '#' component of QA_OVERRIDE_GCC3_OPTIONS.
- This silences the output about how command line arguments are being changed.

llvm-svn: 76107
2009-07-16 21:32:51 +00:00
Ted Kremenek afe797d7b3 Add 'clang-wpa' to the CMake-based build.
llvm-svn: 76091
2009-07-16 18:10:20 +00:00
Daniel Dunbar 84a56054cd Unbreak build?
llvm-svn: 75887
2009-07-16 02:02:48 +00:00
Zhongxing Xu cd64aaa4a9 update makefile.
llvm-svn: 75878
2009-07-16 01:05:34 +00:00
Zhongxing Xu bd8549169a add copyright comments.
llvm-svn: 75877
2009-07-16 01:03:49 +00:00
Zhongxing Xu 17c9e7cb5c Add a primitive clang whole primitive analyzer tool.
llvm-svn: 75874
2009-07-16 01:00:25 +00:00
Owen Anderson 9f98d37612 Update for LLVM API change.
llvm-svn: 75869
2009-07-16 00:14:12 +00:00
Dan Gohman 74e3eb49ea Update for raw_fd_ostream API changes. raw_fd_ostream now has a
Force flag to control whether the case of opening an existing
file is considered an error.

llvm-svn: 75802
2009-07-15 17:32:18 +00:00
Argyrios Kyrtzidis 12563b8111 Handle redeclarations properly at the index-test tool.
llvm-svn: 75605
2009-07-14 03:20:31 +00:00
Argyrios Kyrtzidis e6cd787ee1 For index-test, if the ASTLocation points at a CallExpr, get a Decl out of it.
llvm-svn: 75599
2009-07-14 03:19:30 +00:00
Argyrios Kyrtzidis 2f0eff102c Handle struct fields through the index-test tool.
llvm-svn: 75596
2009-07-14 03:18:40 +00:00
Zhongxing Xu 6999b90146 Fix comment.
llvm-svn: 74896
2009-07-07 07:14:55 +00:00
Douglas Gregor 0086a5a3bb Introduce the notion of "Relocatable" precompiled headers, which are built
with a particular system root directory and can be used with a different
system root directory when the headers it depends on have been installed.
Relocatable precompiled headers rewrite the file names of the headers used
when generating the PCH file into the corresponding file names of the 
headers available when using the PCH file.

Addresses <rdar://problem/7001604>.

llvm-svn: 74885
2009-07-07 00:12:59 +00:00
Argyrios Kyrtzidis 85b18aff24 Use the "ASTLocation nomenclature" (instead of the ASTNode one) in index-test.cpp.
llvm-svn: 74863
2009-07-06 21:35:26 +00:00
Argyrios Kyrtzidis b8020f0833 Some changes to ASTLocation's methods
-Change hasStmt() to isStmt()
-Add isDecl()
-Add getSourceRange()

llvm-svn: 74862
2009-07-06 21:35:20 +00:00
Argyrios Kyrtzidis f24249554b Move the 'ResolveLocationInAST' function from the Frontend library to the Index library.
Also, cut down its comments; more comments will be added to ASTLocation.

llvm-svn: 74860
2009-07-06 21:35:02 +00:00
Argyrios Kyrtzidis 63afa49add Move ASTLocation and DeclReferenceMap from the AST library to the Index library.
llvm-svn: 74859
2009-07-06 21:34:47 +00:00
Argyrios Kyrtzidis b0048027ba Rename 'ASTNode' -> 'ASTLocation'.
ASTLocation is a much better name for its intended purpose which to represent a "point" into the AST.

llvm-svn: 74858
2009-07-06 21:34:20 +00:00
Argyrios Kyrtzidis 5641111e3f Make use of the Index library through the index-test tool.
'index-test' is now able to provide additional info for a Decl, through multiple AST files:
-Find declarations
-Find definitions
-Find references

llvm-svn: 74803
2009-07-05 22:22:35 +00:00
Argyrios Kyrtzidis a4d36d5a58 Make use of ASTNode for return value of clang::ResolveLocationInAST() and in the index-test tool.
llvm-svn: 74798
2009-07-05 22:21:40 +00:00
Douglas Gregor c6d5edd2ed Add support for retrieving the Doxygen comment associated with a given
declaration in the AST. 

The new ASTContext::getCommentForDecl function searches for a comment
that is attached to the given declaration, and returns that comment, 
which may be composed of several comment blocks.

Comments are always available in an AST. However, to avoid harming
performance, we don't actually parse the comments. Rather, we keep the
source ranges of all of the comments within a large, sorted vector,
then lazily extract comments via a binary search in that vector only
when needed (which never occurs in a "normal" compile).

Comments are written to a precompiled header/AST file as a blob of
source ranges. That blob is only lazily loaded when one requests a
comment for a declaration (this never occurs in a "normal" compile). 

The indexer testbed now supports comment extraction. When the
-point-at location points to a declaration with a Doxygen-style
comment, the indexer testbed prints the associated comment
block(s). See test/Index/comments.c for an example.

Some notes:
  - We don't actually attempt to parse the comment blocks themselves,
  beyond identifying them as Doxygen comment blocks to associate them
  with a declaration.
  - We won't find comment blocks that aren't adjacent to the
  declaration, because we start our search based on the location of
  the declaration.
  - We don't go through the necessary hops to find, for example,
  whether some redeclaration of a declaration has comments when our
  current declaration does not. Similarly, we don't attempt to
  associate a \param Foo marker in a function body comment with the
  parameter named Foo (although that is certainly possible).
  - Verification of my "no performance impact" claims is still "to be
  done".

llvm-svn: 74704
2009-07-02 17:08:52 +00:00
Owen Anderson ecaeaa81b1 Update for changes in LLVM. Hopefully this is the last one for a while.
llvm-svn: 74657
2009-07-01 23:14:14 +00:00
Owen Anderson 03200753ee Hold the LLVMContext by reference instead of by pointer.
llvm-svn: 74642
2009-07-01 21:23:16 +00:00
Daniel Dunbar 38bfda6ab5 Driver: Move Compilation::Execute to Driver::ExecuteCompilation.
- The Compilation is just a helper class, it shouldn't have that amount of
   logic in it.

 - No functionality change.

llvm-svn: 74634
2009-07-01 20:03:04 +00:00
Owen Anderson d9dd77ff6c Update for LLVMContext+Module change.
llvm-svn: 74615
2009-07-01 17:00:06 +00:00
Chris Lattner c61089a6c2 Key decisions about 'bool' vs '_Bool' to be based on a new flag in langoptions.
This is simple enough, but then I thought it would be nice to make PrintingPolicy
get a LangOptions so that various things can key off "bool" and "C++" independently.
This spiraled out of control.  There are many fixme's, but I think things are slightly
better than they were before.

One thing that can be improved: CFG should probably have an ASTContext pointer in it,
which would simplify its clients.

llvm-svn: 74493
2009-06-30 01:26:17 +00:00
Argyrios Kyrtzidis 3cfb28a68d Remove redundant leftover code.
llvm-svn: 74433
2009-06-29 17:38:09 +00:00
Bill Wendling 1835107ed0 Make the StackProtector bitfield use enums instead of obscure numbers.
llvm-svn: 74414
2009-06-28 23:01:01 +00:00
Bill Wendling d63bbadbef Add stack protector support to clang. This generates the 'ssp' and 'sspreq'
function attributes. There are predefined macros that are defined when stack
protectors are used: __SSP__=1 with -fstack-protector and __SSP_ALL__=2 with
-fstack-protector-all.

llvm-svn: 74405
2009-06-28 07:36:13 +00:00
Nate Begeman 95f48a5d87 OpenCL 1.0 patch 2/N: Language options & file extension
llvm-svn: 74217
2009-06-25 22:43:10 +00:00
Argyrios Kyrtzidis 02f3e84c5b Check that index-test uses an up-to-date AST file.
llvm-svn: 74214
2009-06-25 22:15:12 +00:00
Argyrios Kyrtzidis bf61749b47 Add some comments and clean-up some leftover code.
llvm-svn: 74207
2009-06-25 21:54:50 +00:00
Argyrios Kyrtzidis 92772215af Introduce tools/index-test.
This tool will be the test bed for indexing related operations. It basically reads PCH files passed by the command line and performs various operations.

Currently it can accept a file:line:column which resolves to a declaration/statement and displays some information about them.

llvm-svn: 74198
2009-06-25 18:22:52 +00:00
Douglas Gregor 9b5f9cd2f7 Make sure install Clang headers when building clang-cc
llvm-svn: 74163
2009-06-25 05:07:31 +00:00
Argyrios Kyrtzidis 25ee5db366 Move the command line source location parsing from clang-cc.cpp into "include/Frontend/CommandLineSourceLoc.h".
llvm-svn: 74012
2009-06-23 22:01:39 +00:00
Argyrios Kyrtzidis 0ec73555a8 Tiny correction on the command-line source location parser.
llvm-svn: 73758
2009-06-19 06:32:46 +00:00
Chris Lattner a0e4dedf9e link in targets
llvm-svn: 73619
2009-06-17 17:25:50 +00:00
Chris Lattner d15131020d Remove old #includes
llvm-svn: 73618
2009-06-17 17:23:16 +00:00
Douglas Gregor b4fd5b03c9 Make the clang executable target depend on clang-cc
llvm-svn: 73568
2009-06-16 22:26:26 +00:00
Douglas Gregor 274a6b4f2d Update Clang to include the InitializeAllTargets and
InitializeAllAsmPrinters LLVM headers. Also includes some minor fixes
for the CMake-based build with Xcode.

llvm-svn: 73544
2009-06-16 20:13:51 +00:00
Chris Lattner 4ef49c1d6e my refactoring of builtins changed target-specific builtins to only be
registered when PCH wasn't being used.  We should always install (in BuiltinInfo)
information about target-specific builtins, but we shouldn't register any builtin
identifier infos.  This fixes the build of apps that use PCH and target specific
builtins together.

llvm-svn: 73492
2009-06-16 16:18:48 +00:00
Chris Lattner 15ba94987a Sink the BuiltinInfo object from ASTContext into the
preprocessor and initialize it early in clang-cc.  This
ensures that __has_builtin works in all modes, not just
when ASTContext is around.

llvm-svn: 73319
2009-06-14 01:54:56 +00:00
Eli Friedman aa27a87ab3 Misc minor fixes for clang for the Windows target.
llvm-svn: 73050
2009-06-08 06:11:14 +00:00
Devang Patel 9e24386c65 Set function Attribute::NoImplicitFloat appropriately.
llvm-svn: 72961
2009-06-05 22:05:48 +00:00
Eli Friedman 6be4b393b9 Add -fsigned-char option to clang-cc.
llvm-svn: 72929
2009-06-05 07:12:17 +00:00
Devang Patel 6e467b1a46 Set function attribute llvm::Attribute::NoRedZone appropriately.
llvm-svn: 72902
2009-06-04 23:32:02 +00:00
Torok Edwin a1581e1a7a forward -fno-color-diagnostics to clang-cc.
llvm-svn: 72856
2009-06-04 07:27:53 +00:00
Torok Edwin c91b6e0ff8 Add ANSI color support for clang.
llvm-svn: 72855
2009-06-04 07:18:23 +00:00
Daniel Dunbar 4b665ebb01 Add clang-cc support for -disable-llvm-optzns.
- Avoids running any LLVM optimizations, even at -O2, etc., while still keeping
   any language changes these optimizations imply.

llvm-svn: 72742
2009-06-02 22:07:45 +00:00
Douglas Gregor 278f52ec29 Refactor and clean up the AST printer, so that it uses a DeclVisitor,
walks through DeclContexts properly, and prints more of the
information available in the AST. The functionality is still available
via -ast-print, -ast-dump, etc., and also via the new member functions
Decl::dump() and Decl::print().

llvm-svn: 72597
2009-05-30 00:08:05 +00:00
Daniel Dunbar 044a702f2f Move clang-cc's -v output to the start (vs. end) of compilation, and change
clang -> clang-cc to be less confusing.

llvm-svn: 72527
2009-05-28 16:37:33 +00:00
Daniel Dunbar fed44d215e Revert to using &...[0] for std::vector, apparently .data isn't generally
available (and it isn't necessary in this case).

llvm-svn: 72425
2009-05-26 18:00:25 +00:00
Daniel Dunbar 33794edae7 Use .data() vs &...[0]
llvm-svn: 72420
2009-05-26 17:13:50 +00:00
Daniel Dunbar f7323f3f65 The driver/diagnostic client don't need to be on the heap.
llvm-svn: 72418
2009-05-26 16:15:44 +00:00
Fariborz Jahanian a4404f21d1 This patch adds support for sender-aware dispatch in Objective-C for the GNU runtime, when
compiled with -fobjc-sender-dependent-dispatch.  This is used in AOP, COP, implementing object 
planes, and a few other things.
Patch by David Chisnall.

llvm-svn: 72275
2009-05-22 20:17:16 +00:00
Douglas Gregor 7f5601e55f AST XML dump, from Olaf Krzikalla!
llvm-svn: 72224
2009-05-21 20:55:50 +00:00
Eli Friedman 5b5bd90a21 Move AnalysisConsumer.h and Analyses.def from tools/clang-cc to
include/clang/Frontend, and move AnalysisConsumer.cpp from 
tools/clang-cc to lib/Frontend.

llvm-svn: 72135
2009-05-19 21:10:40 +00:00
Eli Friedman 45966b4671 Remove the -arch option from clang-cc: for all practical purposes, it's
redundant with -triple.

llvm-svn: 72108
2009-05-19 11:12:40 +00:00
Eli Friedman 996ef2f7b6 Move analysis command-line options out of AnalysisConsumer.cpp into
clang-cc.cpp.

With this commit, all of the clang-cc command-line options are defined 
in clang-cc.cpp.

llvm-svn: 72107
2009-05-19 10:18:02 +00:00
Eli Friedman e15ecf04a4 CMake updates for r72099; untested, so please tell me if there are any
issues.

llvm-svn: 72100
2009-05-19 04:21:30 +00:00
Eli Friedman 16b7b6f511 Move clang-cc.h to lib/Frontend/Utils.h, and move the associated .cpp
files to lib/Frontend.

llvm-svn: 72099
2009-05-19 04:14:29 +00:00
Eli Friedman 2bd0f3964c Move CreateAnalysisConsumer into a separate header AnalysisConsumer.h.
Start moving things around in the direction of refactoring the 
command-line options out of AnalysisConsumer.cpp.

llvm-svn: 72097
2009-05-19 03:57:28 +00:00
Eli Friedman 33cd03cd89 Move the options for dependency file generation from DependencyFile.cpp
to clang-cc.cpp.  Also, rename CreateDependencyFileGen to 
AttachDependencyFileGen, and make it take a raw_ostream rather than 
opening a file itself.

llvm-svn: 72096
2009-05-19 03:35:57 +00:00
Eli Friedman 6af494b426 Move options for -E mode from PrintPreprocessedOutput.cpp to
clang-cc.cpp.

llvm-svn: 72095
2009-05-19 03:06:47 +00:00
Eli Friedman 26c672b490 Refactor -dM mode out of the main routine for -E handling.
llvm-svn: 72090
2009-05-19 01:32:34 +00:00
Eli Friedman 42279c0f07 Move the warning options from Warnings.cpp to clang-cc.cpp.
llvm-svn: 72089
2009-05-19 01:17:04 +00:00
Eli Friedman fcb57d5b6a Switch some utilities in clang-cc to take a stream instead of a
filename (or unconditionally using stdout).

llvm-svn: 72085
2009-05-19 01:02:07 +00:00
Eli Friedman 351fa4b1b2 Attempted CMake build fixes for r72060; this is untested, so please tell
me if there are any issues.

llvm-svn: 72063
2009-05-18 23:06:15 +00:00
Eli Friedman 2b6d281e11 Build fixes for r72060; sorry for any inconvenience.
llvm-svn: 72062
2009-05-18 23:02:01 +00:00
Eli Friedman 9f30fc33d9 Move ASTConsumers.h to include/clang/Frontend, and move the associated
.cpp files to lib/Frontend.  (As proposed on cfe-dev.)

llvm-svn: 72060
2009-05-18 22:50:54 +00:00
Eli Friedman f22439a709 Move the Wno-rewrite-macros option out of RewriteObjC.cpp in prepration
for moving ASTConsumers.h to include/clang/Frontend.

llvm-svn: 72059
2009-05-18 22:39:16 +00:00
Eli Friedman a63ab2dc76 Rename the factory function for the ObjC rewriter to something sane.
llvm-svn: 72055
2009-05-18 22:29:17 +00:00
Eli Friedman e5594d724b Move AnalysisConsumer out of ASTConsumers.h in preparation for moving
ASTConsumers.h to include/clang/Frontend.

llvm-svn: 72054
2009-05-18 22:25:55 +00:00
Eli Friedman 94cf21e282 Refactor ASTConsumers to take a raw_ostream instead of a filename where
appropriate.  There shouldn't be any significant functionality change.

llvm-svn: 72052
2009-05-18 22:20:00 +00:00
Eli Friedman 174c310967 Remove unused parameter.
llvm-svn: 71996
2009-05-18 07:39:39 +00:00
Eli Friedman 07cdffc295 Add some comments to ASTConsumers.h describing what the different
ASTConsumers actually do.

llvm-svn: 71992
2009-05-18 01:16:21 +00:00
Anders Carlsson ee13926fbe Make ActOnWhileStmt take a FullExprArg for the condition expr.
llvm-svn: 71990
2009-05-17 21:22:26 +00:00
Anders Carlsson 24824e5009 Make ActOnExprStmt take a FullExprArg.
llvm-svn: 71989
2009-05-17 21:11:30 +00:00