Граф коммитов

1007 Коммитов

Автор SHA1 Сообщение Дата
Daniel Dunbar d1e7a964c6 clang-cc: Refactor ParseInputFollow to clearly split on the two primary cases,
when we are running an AST consumer and when we are just running the
preprocessor or parser alone.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86937 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 02:53:27 +00:00
Daniel Dunbar 975790e8f8 clang-cc: Factor ReadPCHFile out of ProcessInputFile.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86936 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 02:53:20 +00:00
Daniel Dunbar 6606864161 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86935 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 02:53:13 +00:00
Daniel Dunbar b4373b235d clang-cc: Unify InitializeSourceManager calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 02:53:06 +00:00
Daniel Dunbar 8e1bcb0ad3 clang-cc: Move non-Consumer action handling to common location, to expose the massive amount of redundancy we have introduced through blind copy-and-paste.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86922 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 01:36:27 +00:00
Daniel Dunbar 1ea52949b2 Fix PCH/preprocess test to be more useful, and unbreak -E mode with implicit
PCH, which I broke.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86921 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 01:36:20 +00:00
Daniel Dunbar c8daaa4513 Tweak formatting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86907 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 00:24:28 +00:00
Daniel Dunbar 5746f1ff62 Move AnalyzerOptions into CompilerInvocation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86906 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 00:24:10 +00:00
John Thompson 6a6742a8fc Fix clang executable path for Windows
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86896 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 23:11:14 +00:00
Daniel Dunbar 961c76ea8d Always initialize the header search object as part of InitializePreprocessor;
not doing this has little to no utility.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86883 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 21:44:42 +00:00
Daniel Dunbar 5814e657c9 Allow Preprocessor to take ownership of the HeaderSearch object. I think it should probably always own the header search object, but I'm not sure...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86882 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 21:44:21 +00:00
Daniel Dunbar ca11f61233 Sink AttachDependencyFileGen into CreatePreprocessor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86881 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 21:44:00 +00:00
Daniel Dunbar 0e0bae8139 Add DependencyOutputOptions to wrap -M... options, and propogate to
CompilerInvocation and clang-cc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86880 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 21:43:12 +00:00
Daniel Dunbar 387ecbd1e6 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86830 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 10:22:48 +00:00
Daniel Dunbar e26bd90e5f Fix unsafe use of StringRef I introduced.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86829 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 10:10:25 +00:00
Daniel Dunbar 29cf746aef Add PreprocessorOutputOptions to CompilerInvocation, and move initialization to
clang-cc/Options.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86828 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 10:07:44 +00:00
Daniel Dunbar 775bee71ad Add PreprocessorOutputOptions, for things like -dM, -C, -CC which control -E
mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86827 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 10:07:22 +00:00
Daniel Dunbar 29a790ba42 Simplifiy target feature handling by coalescing all the logic into
InitializeCompileOptions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86826 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 09:38:56 +00:00
Daniel Dunbar dc8bbac2f8 Minor formatting tweaks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86825 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 09:38:42 +00:00
Daniel Dunbar bd9f04b68b clang-cc: Refactor some -fixit-at handling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86824 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 09:38:35 +00:00
Daniel Dunbar aea364195b Allow TextDiagnosticPrinter to have optional ownership of its output stream.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86823 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 09:38:24 +00:00
Daniel Dunbar 339c13460e clang-cc: Move InitializeAnalyzerOptions into Options.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86821 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 08:13:55 +00:00
Daniel Dunbar d1cdcf38ca clang-cc: Start coalescing "frontend" options.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86820 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 08:13:47 +00:00
Daniel Dunbar 0db4b765d7 clang-cc: Move InitializeDiagnosticOptions to Options.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86819 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 08:13:40 +00:00
Daniel Dunbar f797329454 clang-cc: Move HeaderSearchOptions to Options.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86818 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 08:13:32 +00:00
Daniel Dunbar dbf75feeb6 Turn LoggingDiagnosticClient into a more general ChainedDiagnosticClient and
move to libFrontend.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86817 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 08:13:24 +00:00
Daniel Dunbar 56749087b5 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86816 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 07:26:12 +00:00
Daniel Dunbar d9beeaf1f1 Inline some trivial functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86815 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 07:26:02 +00:00
Daniel Dunbar b52d243d36 clang-cc: Move InitializePreprocessorOptions to Options.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86811 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 06:10:03 +00:00
Daniel Dunbar d8daaa7450 clang-cc: Simplify this code, now that predefines handling is uniform in the
PCH/-E and PCH/not--E cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86808 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 05:33:31 +00:00
Daniel Dunbar 7b5a1210d9 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86806 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 05:29:04 +00:00
Daniel Dunbar 5ee0aa715d Recognize -fsyntax-only as a "consumer only" action.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86776 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 00:54:56 +00:00
Daniel Dunbar 0f9fed70ce Add Diagnostic::Report method for reporting diagnostics without a location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86760 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 23:55:23 +00:00
Daniel Dunbar b6d1cc84d1 PreprocessorOptions: Get rid of unnecessary 'isPTH' flag for include entries.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86757 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 23:53:43 +00:00
Daniel Dunbar e0a9581d60 Decouple more of clang-cc by moving ImplicitP[CT]H options into
PreprocessorOptions.

Global variables used as [in] [out] parameters considered harmful.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86728 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 22:09:38 +00:00
Ted Kremenek 7976f5923c Update CMake file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86721 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 21:38:41 +00:00
Dan Gohman 0063e98f59 Use #include <stdio.h> when using fprintf and stderr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86717 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 21:21:27 +00:00
Daniel Dunbar 0498cfc445 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86711 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 19:51:53 +00:00
Daniel Dunbar 9773429c26 clang-cc: Sink more options inside codegenopts namespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86710 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 19:51:46 +00:00
Daniel Dunbar e359445fd7 Change LangOpts initialization to directly test the code generation options,
instead of reproducing their logic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86709 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 19:51:33 +00:00
Ted Kremenek 0854d70dab 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>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86700 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 19:18:52 +00:00
Daniel Dunbar 8fa01c8f98 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86697 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 18:47:41 +00:00
Daniel Dunbar fcb0c3b39b Factor out parts of InitializeCompileOptions that depend on the LangOptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86696 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 18:47:35 +00:00
Daniel Dunbar 8d35314401 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86691 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 17:50:53 +00:00
Daniel Dunbar bc2ea3406b clang-cc: Start sinking (CodeGen) options into namespaces to limit their scope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86690 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 17:50:42 +00:00
Daniel Dunbar 9af869510b Cleanup some clang-cc FIXMEs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86686 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 16:23:44 +00:00
Daniel Dunbar 36f4ec353b Add CompileOptions to CompilerInvocation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86685 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 16:19:45 +00:00
Daniel Dunbar 89f8c1d40e Simplify, following MemoryBuffer::getSTDIN API fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86633 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 00:46:25 +00:00
Daniel Dunbar 9253e49492 Remove some if-0'd code, we can resurrect this if we ever decide to support
continuing after invalid PCH loads.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86631 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 00:46:12 +00:00
Daniel Dunbar 5fc7d344ae Add PreprocessorOptions to CompilerInvocation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86623 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 23:12:31 +00:00
Daniel Dunbar 2cdafa8001 Privatize InitHeaderSearch, this functionality is only exposed via
ApplyHeaderSearchOptions now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86617 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 23:02:47 +00:00
Daniel Dunbar 26a0cac165 Move LangOptions, HeaderSearchOptions, and the target feature map into
CompilerInvocation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86612 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 22:46:17 +00:00
Daniel Dunbar 638c901ae3 Switch Target* to Target&.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86611 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 22:46:09 +00:00
Daniel Dunbar 227b2380f6 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).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86609 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 22:45:57 +00:00
Daniel Dunbar 094a84cc06 (llvm up) Convert clang-cc.cpp:GetLanguage to StringSwitch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86608 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 22:45:47 +00:00
Douglas Gregor ff4393c1ce 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86591 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 21:35:27 +00:00
Daniel Dunbar e29709f32e Add CompilerInvocation object, to capture all the options one needs to invoke
the compiler, and start flood filling it into clang-cc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86586 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 20:55:08 +00:00
Benjamin Kramer 62cf322cf1 Factor CXString creation into a helper method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 19:13:48 +00:00
Benjamin Kramer 858e5de143 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86568 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 18:24:53 +00:00
Douglas Gregor 88d23952ea Improve c-index-test's parsing of the -code-completion-at=file:line:column argument
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86566 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 18:19:57 +00:00
Steve Naroff ef0cef6cec 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86562 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 17:45:52 +00:00
Douglas Gregor d5a2089663 C doesn't allow mixing declarations and statements, silly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86556 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 17:05:28 +00:00
Douglas Gregor 3ac738567f 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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86550 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 16:04:45 +00:00
Daniel Dunbar 4ee17acbf7 Revert unintentional change to this file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86455 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-08 09:46:33 +00:00
Daniel Dunbar c6190330e7 Move a function which returns a class outside of extern C scope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86439 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-08 04:13:53 +00:00
Daniel Dunbar 4dc99f8928 CIndex: Add temporary hack to leak memory instead of returning invalid pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86438 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-08 04:11:32 +00:00
Daniel Dunbar f8297f1512 Fix some build warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86393 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 18:34:24 +00:00
Daniel Dunbar 597e7c380d Add some missing libraries for CMake as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86390 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 17:53:40 +00:00
Daniel Dunbar 286bf95a86 Add some missing libraries.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86389 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 17:52:11 +00:00
Daniel Dunbar dd35ce9a78 Switch clang-cc to use ApplyHeaderSearchOptions, and fix a thinko.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86341 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 04:58:12 +00:00
Daniel Dunbar e166582f8f Lift InitHeaderSearch::AddEnvVarPaths logic higher.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86337 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 04:20:39 +00:00
Daniel Dunbar 8863b985f1 Rename PreprocessorInitOptions to PreprocessorOptions for consistency, and fix
filenames.

Also, move InitializePreprocessor to Utils.h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86335 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 04:20:15 +00:00
Daniel Dunbar 750156aec2 Lift compiler builtin include path logic higher.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86334 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 04:19:57 +00:00
Douglas Gregor 0c8296dfb4 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86306 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 00:00:49 +00:00
John Thompson 40d1bb6383 Eliminate tabls
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86183 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 22:03:02 +00:00
John Thompson a6fda124bf Adding -fshort-wchar option.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86167 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 20:14:16 +00:00
Daniel Dunbar efcbe94753 Replace DiagnosticClient::setLangOptions with {Begin,End}SourceFile, and clarify
invariants (diagnostics with source informations must occur between
{Begin,End}SourceFile).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86113 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 02:42:12 +00:00
Daniel Dunbar efceabd238 Convert CreateAnalysisConsumer and friends to just take a const Preprocessor&, and simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86112 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 02:41:58 +00:00
Daniel Dunbar ad451ccdbf 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86109 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 02:11:37 +00:00
Daniel Dunbar 4cc1a25932 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86104 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 01:53:23 +00:00
Daniel Dunbar 64acf1dd2f CreatePreprocessor cannot fail
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86103 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 01:53:12 +00:00
Daniel Dunbar 90b1827c1c Kill PreprocessorFactory, which was both morally repugnant and totally unused.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86076 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 23:56:25 +00:00
Daniel Dunbar 593c41fb0b Turn if chain into switch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86071 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 23:41:40 +00:00
Daniel Dunbar 938963f076 InitializePreprocessor cannot fail.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86048 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 21:13:15 +00:00
Daniel Dunbar 468fe24619 Move -undef flag into PreprocessorInitOptions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86047 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 21:13:02 +00:00
Daniel Dunbar 838be483dc Move -fcolor-diagnostics logic to driver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86014 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 06:24:57 +00:00
Daniel Dunbar 55efe142a8 Move logic for selection -fmessage-length= to driver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86013 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 06:24:47 +00:00
Daniel Dunbar eace874303 Factor out a diagnostic options class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86010 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 06:24:30 +00:00
Tanya Lattner 59876c2713 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 01:18:09 +00:00
Chris Lattner e6113de52d Implement support for the -undef command line option, patch by
Roman Divacky! PR5363


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85932 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 19:50:27 +00:00
Daniel Dunbar 1184191ac0 Sort export list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85832 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-02 22:23:08 +00:00
Daniel Dunbar 7c15e71fb2 Remove clang-cc code for handling -mmacosx-version-min and
-miphoneos-version-min.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85601 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 18:12:31 +00:00
Steve Naroff 0d69b8cc8e - Add/tweak some comments.
- change ObjCCategoryImplDecl::getCategoryClass() to getCategoryDecl().

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85528 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 21:11:04 +00:00
Daniel Dunbar 8cb6562f7b Move some clang-cc errors to use diagnostics, and simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85527 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 21:05:18 +00:00
Steve Naroff f9f6196e9f clang_getDeclSpelling(): For category implementations, make sure we hand back the category name (not the class name). This fixes <rdar://problem/7297518>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85521 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 18:55:50 +00:00
Daniel Dunbar 607d7f6d8f Reject -I- in driver instead of clang-cc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85469 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 01:53:44 +00:00
Daniel Dunbar bea5a84ea6 Formatting fixes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85468 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 01:53:18 +00:00
Steve Naroff f96b524306 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. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85425 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 20:44:47 +00:00
Zhongxing Xu f20288c916 make CallGraph more flexible by letting it accept ASTContext instead of ASTUnit.
Patch by Simone Pellegrini.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85386 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 12:23:03 +00:00
Steve Naroff 8814503469 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).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85238 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 14:35:18 +00:00
John Thompson 2e06fc877a Changes for building as a Windows DLL
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85234 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 13:42:56 +00:00
Ted Kremenek feb15e3f39 Unify Unix and Windows code paths when executing 'clang'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85163 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 22:14:08 +00:00
Ted Kremenek 779e5f487d Remove unnecessary calls to 'flush()'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85162 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 22:08:39 +00:00
Daniel Dunbar 09bdd599c1 clang-cc: Allow building for x86_64 with -mmacosx-version-min=10.4.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85132 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 17:52:49 +00:00
Rafael Espindola 8d737cc78c Rename -nostdclanginc to -nobuiltininc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85116 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 13:36:57 +00:00
Fariborz Jahanian cab9882dac Fixes a warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84909 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 22:49:47 +00:00
Ted Kremenek 8ee1f3fc0d 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84904 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 22:19:00 +00:00
Ted Kremenek fbcb2b716b Split clang_getCursor() into clang_getCursor() and clang_getCursorWithHint().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84873 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 17:22:53 +00:00
Ted Kremenek 379afec20c Add some explanatory diagnostics when clang_createTranslationUnitFromSource fails.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84825 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 03:24:01 +00:00
Ted Kremenek 139ba86a36 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'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84802 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 00:03:57 +00:00
Steve Naroff 6a6de8b4fc 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:-)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84760 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 13:56:23 +00:00
Steve Naroff e56b4baeba - 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()'.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84634 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-20 14:46:24 +00:00
Ted Kremenek c46e463f13 Fix inverted preprocessor guard, and fix the resulting compiler error that was unmasked.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84555 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-19 22:27:32 +00:00
Ted Kremenek 1374598619 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84548 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-19 22:15:09 +00:00
Ted Kremenek fc0622155f 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84539 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-19 21:44:57 +00:00
Ted Kremenek 49358d85d7 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84534 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-19 21:17:25 +00:00
Steve Naroff 36c4464ba6 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>).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84499 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-19 14:34:22 +00:00
Steve Naroff bade7de59d Change indenting for case/compound statements to conform to the rest of clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84498 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-19 13:41:39 +00:00
Benjamin Kramer c5a9e9511e CIndex: make variable non-static to avoid potential race conditions, per
Daniel's comment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84484 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-19 10:20:24 +00:00
Daniel Dunbar e013d685c6 Move clients to use IdentifierInfo::getNameStart() instead of getName()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84436 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 20:26:12 +00:00
Benjamin Kramer 63444b3a54 Try to unbreak MSVC build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84433 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 19:59:44 +00:00
Benjamin Kramer b14346b95e CIndex: fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84422 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 16:52:07 +00:00
Benjamin Kramer edcd8286f2 Missed a paren.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84421 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 16:20:58 +00:00
Benjamin Kramer 20d758132f CIndex: add a (untested) WIN32 codepath to get ClangPath.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 16:13:48 +00:00
Benjamin Kramer 5e4bc590b0 CIndex: compute ClangPath lazily.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84419 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 16:11:04 +00:00
Benjamin Kramer 0829a839b0 CIndex: replace fork/exec with our portable ExecuteAndWait wrapper.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84414 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 11:19:36 +00:00
Benjamin Kramer 9670762c0d CIndex: avoid a dangling pointer issue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84413 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 11:10:55 +00:00
Daniel Dunbar a47dd19171 Attempt to unbreak the MSVC build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84381 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 23:53:11 +00:00
Daniel Dunbar 8b88ca68e2 Simplify (move guard to caller instead of callee).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84325 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 09:04:56 +00:00
Ted Kremenek 85f5468d87 Fix compiler warning: "ISO C90 forbids mixed declarations and code"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84318 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 06:42:15 +00:00
Ted Kremenek 8ce88a449c Fix warning: 'warning: C++ style comments are not allowed in ISO C90'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84317 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 06:37:16 +00:00
Ted Kremenek dff76894ff Resolve FIXME: delete the 'Program' object in the destructor of CIndexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84313 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 06:21:47 +00:00
Ted Kremenek 5cf48766d6 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().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84296 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 00:34:24 +00:00
Douglas Gregor 02465750c8 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84275 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 21:24:31 +00:00
Douglas Gregor 7d1d49d297 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84267 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 20:01:17 +00:00
Ted Kremenek 74cd0694f9 Use an std::vector<> instead of an array of ARG_MAX size, as ARG_MAX may not be defined everywhere.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84220 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 23:21:22 +00:00
Steve Naroff e19944c939 Make sure temporary files get unlinked.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84208 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 22:23:48 +00:00
Ted Kremenek 8c4195eefb Add missing #include for wait().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84207 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 22:10:56 +00:00
Steve Naroff 37b5ac2909 Minor improvement to format...no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84203 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 20:50:09 +00:00
Steve Naroff 5b7d8e254f 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 20:04:39 +00:00
Mike Stump 43d8176d2e 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83594 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08 23:29:47 +00:00
Douglas Gregor 9a3dcf2234 Make sure that c-index-test links as a C++ executable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83335 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 22:29:42 +00:00
Douglas Gregor 2588830b88 Make sure that libCIndex links as a C++ library
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83331 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 22:25:29 +00:00
Eric Christopher f393c3b770 Fix C90 compile warning about mixed declarations and code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83327 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 21:33:42 +00:00
Steve Naroff f9adf8f930 - Fix assert in clang_getCursorDecl (having to do with recently added ObjC_ProtocolRef).
- Make sure CHECK: lines in test case match the expected output. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83316 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 17:58:19 +00:00
Rafael Espindola 1bb15a9afa 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83302 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 13:12:17 +00:00
Steve Naroff 85e2db7213 Add support for class and protocol references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83186 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 00:31:07 +00:00
Argyrios Kyrtzidis 05a7651c7a When pointing at a type decl reference, ASTLocation is a NamedDeclRef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83099 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 19:45:58 +00:00
Argyrios Kyrtzidis f4526e3fd4 Modify ASTLocation and apart from being a Decl or Stmt, allow it to also be:
-A NamedDecl reference
-A TypeLoc

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83095 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 19:44:27 +00:00
Douglas Gregor 214904e358 Set GNUMode only for the "gnu" language standard options, from Ken Dyck!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83064 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 14:42:43 +00:00
Daniel Dunbar 1cf13cdc2c Disable c-index-test on MSVC until someone figures out the real problem.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82830 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 01:21:38 +00:00
Steve Naroff 7416524283 Fix cut/paste error resulting in bad column info.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82810 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 22:15:54 +00:00
Steve Naroff ee9405e807 Add clang_getDeclSource().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82807 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 21:45:39 +00:00
Steve Naroff 699a07d8a0 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)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82798 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 21:32:34 +00:00
Douglas Gregor ac47bc76fe CMake build support for libCIndex and c-index-test. The indexing tests
are now running properly from within CMake.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82755 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 06:35:15 +00:00
Douglas Gregor 9773f6065b Hide clang-wpa executable behind a CMake variable so it won't be built by default
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82751 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 05:41:21 +00:00
Steve Naroff ff9e18cb38 Add test for C-based indexing API, using FileCheck utility.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82706 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 20:03:06 +00:00
Chris Lattner e7a5fd4a29 wpa is an experiment, don't build it by default, it adds to build times due to everything it links in.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82704 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 19:45:12 +00:00
Anders Carlsson 78762ebb9a Add a -dump-record-layouts argument to clang-cc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82703 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 18:54:49 +00:00
Steve Naroff f7469a38ca Some minor cleanups...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82646 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 20:00:53 +00:00
Steve Naroff 4ade6d6eae More work to enable more exhaustive testing of the indexing API.
Next step: Add actual some test cases:-)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82636 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 17:52:52 +00:00
Daniel Dunbar f44c585632 Push "clang-is-production" logic up to tools/driver, and make it hittable by
defining the CLANG_IS_PRODUCTION Makefile variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82583 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 22:31:13 +00:00
Douglas Gregor b657f115c3 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82571 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 21:11:38 +00:00
Steve Naroff fb5704295c - Implement support for various types of "refs" (initially to help test clang_getCursor()).
- Add missing prototypes for dispose functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82564 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 19:25:29 +00:00
Daniel Dunbar d172bf3927 This FIXME is done.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82509 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 02:17:27 +00:00
Fariborz Jahanian b924259cc5 Removed -fobjc-newgc-api option. clang now conforms to
gcc-style write-barrier api only.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82493 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 23:03:37 +00:00
Daniel Dunbar a674bf437e 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82432 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 03:03:56 +00:00
Daniel Dunbar 31b87d8006 Change ASTUnit to take the Diagnostic as an argument, the client should have control of this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82430 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 03:03:39 +00:00
Daniel Dunbar a39075952c 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).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82429 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 03:03:22 +00:00
Chris Lattner 59b2172751 switch command line 'parse' methods to use StringRef for efficiency, which
is also required for an llvm-side change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82344 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 00:39:15 +00:00
Douglas Gregor 81b747b7fc 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".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82166 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 21:32:03 +00:00
Steve Naroff 2bd6b9f298 Add clang_disposeTranslationUnit() and clang_disposeIndex().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82154 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 18:33:27 +00:00
Daniel Dunbar aca2ebdf41 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82107 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 00:48:13 +00:00
Daniel Dunbar 0794d8d50f clang-cc: Factor out code for creating one of the standard AST consumer actions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82106 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 00:48:00 +00:00
Daniel Dunbar 13fdf28968 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82104 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 00:47:46 +00:00
Daniel Dunbar 9f43534277 clang-cc: Remove -ObjC -ObjC++ handling from clang-cc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82103 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 00:47:27 +00:00
Fariborz Jahanian b123ea395e 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82082 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 21:37:16 +00:00
Mike Stump 3cbf5a0548 Be sure to use the correct version instead of the wrong one.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81925 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 21:49:22 +00:00
Steve Naroff 77128ddd30 - clang_getCursor(): Replace asserts with error codes (CXCursor_InvalidFile, CXCursor_NoDeclFound).
- Add predicate clang_isInvalid().
- Implement clang_getCursorFromDecl().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81908 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 20:25:34 +00:00
Daniel Dunbar 73b79596ba Add -target-abi clang-cc option, currently unused.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81731 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-14 00:02:12 +00:00
Chris Lattner 2f60af7dd4 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81646 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-12 22:45:58 +00:00
Steve Naroff 8b26cbd4e4 Make sure ObjCInterfaceDecl's that are forward declared always contain a valid location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81487 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 00:12:01 +00:00
Fariborz Jahanian d9a1db3a4d Non fragile ABI for GNU runtime. Patch bu David Chisnall.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81462 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-10 21:48:21 +00:00
Mike Stump 1eb4433ac4 Remove tabs, and whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 15:08:12 +00:00
Daniel Dunbar 2e30e594dd Use llvm::sys::getHostTriple, not LLVM_HOSTTRIPLE.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81013 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-04 17:43:10 +00:00
Steve Naroff 9efa767be8 Implement accessors clang_getCursorKind(), clang_getCursorDecl().
Implement clang_getCursor() - wired up to Argiris's work.
Implement callbacks for CXCursor_ObjCProtocolRef.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81004 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-04 15:44:05 +00:00
Steve Naroff 77accc11f0 Add ASTUnit::getOriginalSourceFileName() and use in clang_getTranslationUnitSpelling().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80932 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 18:19:54 +00:00
Steve Naroff af08ddc8f1 - 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80921 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 15:49:00 +00:00
Daniel Dunbar bce6f62ae7 Revert "Visit function/method bodies and issue callback for parameters and local
variables.", this is breaking x86_64-apple-darwin10 and Linux tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80896 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 05:59:50 +00:00
Daniel Dunbar 5345c391c6 Add basic support for -pthread.
- Patch by David Chisnall, with PCH and Darwin support mixed in.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80883 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 04:54:28 +00:00
Daniel Dunbar 4d861516e5 Tweak comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80882 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 04:54:12 +00:00
Steve Naroff 23d8bea705 Visit function/method bodies and issue callback for parameters and local variables.
Add clang_getTranslationUnitSpelling().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 00:32:06 +00:00
Daniel Dunbar d6970811dc Initialize targets before parsing command line options, so --version shows registered targets.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80849 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 23:20:15 +00:00
Eli Friedman 10c2d319a8 Fix warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80833 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 20:07:26 +00:00
Steve Naroff 1164d859c7 Fix some newly added bugs uncovered by the RELEASE build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80813 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 18:58:52 +00:00
Steve Naroff f334b4e3ed Start issuing callback for references (add some predicates, refactor some code).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80810 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 18:26:48 +00:00
Steve Naroff c857ea4d22 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80787 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 13:28:54 +00:00
Steve Naroff 2b8ee6c299 Add explicit "blind" client data to callback function (since we aren't using blocks).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80673 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 15:55:40 +00:00
David Chisnall 8a5a9aaddb Updated GNU runtime non-fragile ABI.
Added -fconstant-string-class= option.
Added __has_feature() test for non-fragile ABI.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80591 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 16:41:57 +00:00
Steve Naroff 2d4d629d8a Implement source/line/column hooks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80585 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 14:26:51 +00:00
Steve Naroff 89922f86f4 More fleshing out the C-based indexing API (under construction).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80529 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 00:59:03 +00:00
Benjamin Kramer d01a0bc444 gcc 4.4 needs cstdio for printf. Reorder includes while at it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80430 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29 12:56:35 +00:00
Ted Kremenek 80088a96bd Add CIndex dependencies: libLLVMC and libclangSema (for IdentifierResolver).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 18:33:53 +00:00
Ted Kremenek 2349672887 Tweak CIndex file to resolve to linking issues with the clang libraries. In
particular, clangFrontend was not being linked in.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80384 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 18:29:48 +00:00
Daniel Dunbar 1eb79b58e5 Hide IdxVisitor and remove unimplemented method (causing link errors on x86_64
linux builder).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80376 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 16:30:07 +00:00
Steve Naroff 50398199fb Lot's of little changes to get the C-based indexing API going...
Work in progress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80367 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 15:28:48 +00:00
Steve Naroff 7e8f8189d0 Add CX prefix to Cursor and move a comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80359 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 12:07:44 +00:00
Ted Kremenek f710789aa7 Update exports list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80306 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 23:50:46 +00:00
Steve Naroff 600866cc7d Fill in Index.h header file and add stubs to implementation file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80279 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 19:51:58 +00:00
Ted Kremenek d2fa56687f Add initial boilerplate for CIndex, a shared library that will vend high-level
source symbol information (harvested by Clang) through a C API.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80166 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 22:36:44 +00:00
Eli Friedman ab24c8dfb4 Since the HexFloats option only controls a warning, it shouldn't depend
on whether we're in GNUMode.  Adjust the code appropriately.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80132 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 20:15:14 +00:00
Dan Gohman b044c473a1 Update clang for raw_fd_ostream no longer requiring F_Force.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 15:36:09 +00:00
Chris Lattner 0fa0daafdf prune #includes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79889 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24 04:11:30 +00:00
Chris Lattner d57a7ef925 API changes to match llvm ToT.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79868 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 22:45:33 +00:00
Douglas Gregor 7f7b74888e 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.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79827 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 05:28:29 +00:00
Chris Lattner 92bcc27ada adjust for raw_fd_ostream api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79809 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 02:59:41 +00:00
Anders Carlsson 92f5822df6 Add a -fno-elide-constructors option to clang-cc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79782 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-22 22:30:33 +00:00
Daniel Dunbar 8165ced072 Don't install wpa or index-test tools.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79557 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-20 18:45:52 +00:00
Nate Begeman 2ef13e5abe 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78621 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 23:49:36 +00:00
Chris Lattner 797c3c4f5d 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 :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78586 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 19:03:04 +00:00
Daniel Dunbar 70121ebd65 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78554 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 03:40:28 +00:00
Daniel Dunbar 1df5109f47 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78551 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 03:01:36 +00:00
Nate Begeman 25b4fdb9d6 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78535 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-09 17:55:44 +00:00
Benjamin Kramer 21fde994b2 Remove duplicated colon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77891 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 12:12:11 +00:00
Mike Stump 738f8c278d Add beginnigs of rtti generation, wire up more of -fno-exceptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77751 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 23:15:31 +00:00
Argyrios Kyrtzidis 19b732a546 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77551 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-30 00:03:55 +00:00
Argyrios Kyrtzidis 87bcb504f6 Support ObjC methods as Entities.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77547 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 23:41:46 +00:00
Argyrios Kyrtzidis 0f3984809f Add TranslationUnit::getSelectorMap().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77542 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 23:41:08 +00:00
Argyrios Kyrtzidis 7f4656eb6b -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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77536 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 23:40:14 +00:00
Argyrios Kyrtzidis 768a6c94a5 Add getDeclReferenceMap() to the abstract interface of TranslationUnit class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77530 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 23:39:18 +00:00
Argyrios Kyrtzidis 0594545b5b Remove the TranslationUnit usage from clang-wpa.cpp since it's not really
necessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77529 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 23:39:09 +00:00
Argyrios Kyrtzidis 94431b5b4c Introduce a helper template for the Handler classes and use it instead
of the iterator of the Indexer class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77528 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 23:39:03 +00:00
Argyrios Kyrtzidis b17dc46c79 -Make IndexProvider an abstract interface for getting indexing information.
-Introduce Indexer as an IndexProvider implementation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77524 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 23:38:21 +00:00
Daniel Dunbar 70186ab134 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77423 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 02:40:09 +00:00
Zhongxing Xu 56a5d80877 Add two nodes to the call graph:
- Root is the main function or 0.
 - ExternalCallingNode has edges to all external functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76876 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 13:39:38 +00:00
Argyrios Kyrtzidis f7cf15ca3c 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76515 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 00:07:06 +00:00
Argyrios Kyrtzidis ec930d3d81 Add '\n' to the end of error message.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76506 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 00:05:10 +00:00
Argyrios Kyrtzidis dc50c64c13 Introduce ASTLocation::getReferencedDecl(), for getting the declaration that the ASTLocation references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76336 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-18 21:17:58 +00:00
Argyrios Kyrtzidis 1e4bc09988 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76298 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-18 08:50:35 +00:00
Daniel Dunbar 237a31bf66 Fix indentation / trailing white space.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76200 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 18:10:27 +00:00
Daniel Dunbar e3d6023cbf [llvm up] Add support for '#' component of QA_OVERRIDE_GCC3_OPTIONS.
- This silences the output about how command line arguments are being changed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76107 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 21:32:51 +00:00
Ted Kremenek 0d9ff0bcba Add 'clang-wpa' to the CMake-based build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76091 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 18:10:20 +00:00
Daniel Dunbar 9797a8760b Unbreak build?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75887 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 02:02:48 +00:00
Zhongxing Xu c5965992f5 update makefile.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75878 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 01:05:34 +00:00
Zhongxing Xu 22daf79314 add copyright comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75877 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 01:03:49 +00:00
Zhongxing Xu dc3240c5b7 Add a primitive clang whole primitive analyzer tool.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75874 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 01:00:25 +00:00
Owen Anderson d720046f18 Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75869 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 00:14:12 +00:00
Dan Gohman 92db284169 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75802 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-15 17:32:18 +00:00
Argyrios Kyrtzidis c7377632d0 Handle redeclarations properly at the index-test tool.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75605 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 03:20:31 +00:00
Argyrios Kyrtzidis be125444cf For index-test, if the ASTLocation points at a CallExpr, get a Decl out of it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75599 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 03:19:30 +00:00
Argyrios Kyrtzidis 12585542f5 Handle struct fields through the index-test tool.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75596 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 03:18:40 +00:00
Zhongxing Xu 96bac6b48e Fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74896 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 07:14:55 +00:00
Douglas Gregor e650c8c3bc 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>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74885 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 00:12:59 +00:00
Argyrios Kyrtzidis 44994051ca Use the "ASTLocation nomenclature" (instead of the ASTNode one) in index-test.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 21:35:26 +00:00
Argyrios Kyrtzidis 755c6b4215 Some changes to ASTLocation's methods
-Change hasStmt() to isStmt()
-Add isDecl()
-Add getSourceRange()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 21:35:20 +00:00
Argyrios Kyrtzidis 818e15b89f Move the 'ResolveLocationInAST' function from the Frontend library to the Index library.
Also, cut down its comments; more comments will be added to ASTLocation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74860 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 21:35:02 +00:00
Argyrios Kyrtzidis ccbcb70ee9 Move ASTLocation and DeclReferenceMap from the AST library to the Index library.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 21:34:47 +00:00
Argyrios Kyrtzidis 874012b1fb Rename 'ASTNode' -> 'ASTLocation'.
ASTLocation is a much better name for its intended purpose which to represent a "point" into the AST.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 21:34:20 +00:00
Argyrios Kyrtzidis 7b332d9ada 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74803 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-05 22:22:35 +00:00
Argyrios Kyrtzidis 49dd5851c4 Make use of ASTNode for return value of clang::ResolveLocationInAST() and in the index-test tool.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74798 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-05 22:21:40 +00:00
Douglas Gregor 2e22253e03 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".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74704 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 17:08:52 +00:00
Owen Anderson 8f1ca78009 Update for changes in LLVM. Hopefully this is the last one for a while.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74657 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 23:14:14 +00:00
Owen Anderson c93f49832d Hold the LLVMContext by reference instead of by pointer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74642 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 21:23:16 +00:00
Daniel Dunbar c88a88f6f7 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74634 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 20:03:04 +00:00
Owen Anderson 42253cc3bc Update for LLVMContext+Module change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74615 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 17:00:06 +00:00
Chris Lattner e4f2142d00 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74493 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 01:26:17 +00:00
Argyrios Kyrtzidis 512230c49b Remove redundant leftover code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74433 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29 17:38:09 +00:00
Bill Wendling 4ebe3e4c81 Make the StackProtector bitfield use enums instead of obscure numbers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74414 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-28 23:01:01 +00:00
Bill Wendling 45483f7a1b 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74405 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-28 07:36:13 +00:00
Nate Begeman 4e3629e676 OpenCL 1.0 patch 2/N: Language options & file extension
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74217 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 22:43:10 +00:00
Argyrios Kyrtzidis 119b7feb01 Check that index-test uses an up-to-date AST file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74214 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 22:15:12 +00:00
Argyrios Kyrtzidis 6e4a86ddad Add some comments and clean-up some leftover code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74207 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 21:54:50 +00:00
Argyrios Kyrtzidis 30b983b5b3 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 18:22:52 +00:00
Douglas Gregor 91a425cfd9 Make sure install Clang headers when building clang-cc
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74163 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 05:07:31 +00:00
Argyrios Kyrtzidis 34d25d85d6 Move the command line source location parsing from clang-cc.cpp into "include/Frontend/CommandLineSourceLoc.h".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74012 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 22:01:39 +00:00
Argyrios Kyrtzidis 5c7a6036bb Tiny correction on the command-line source location parser.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73758 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 06:32:46 +00:00
Chris Lattner 2fe119410f link in targets
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73619 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 17:25:50 +00:00
Chris Lattner a278f81f1d Remove old #includes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73618 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 17:23:16 +00:00
Douglas Gregor fbc283666c Make the clang executable target depend on clang-cc
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73568 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 22:26:26 +00:00
Douglas Gregor ebfc180d9b Update Clang to include the InitializeAllTargets and
InitializeAllAsmPrinters LLVM headers. Also includes some minor fixes
for the CMake-based build with Xcode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73544 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 20:13:51 +00:00
Chris Lattner 030e8fe5aa 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73492 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 16:18:48 +00:00
Chris Lattner 1b63e4f732 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73319 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 01:54:56 +00:00
Eli Friedman abc4e32603 Misc minor fixes for clang for the Windows target.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73050 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-08 06:11:14 +00:00
Devang Patel acebb397fa Set function Attribute::NoImplicitFloat appropriately.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72961 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 22:05:48 +00:00
Eli Friedman c4757bd1a3 Add -fsigned-char option to clang-cc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 07:12:17 +00:00
Devang Patel 24095dad88 Set function attribute llvm::Attribute::NoRedZone appropriately.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72902 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 23:32:02 +00:00
Torok Edwin a46c71abb1 forward -fno-color-diagnostics to clang-cc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72856 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 07:27:53 +00:00
Torok Edwin 603fca7281 Add ANSI color support for clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72855 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 07:18:23 +00:00
Daniel Dunbar 877db3852e 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72742 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-02 22:07:45 +00:00
Douglas Gregor 4fe0c8e9c7 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().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72597 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 00:08:05 +00:00
Daniel Dunbar 08e6dc65b2 Move clang-cc's -v output to the start (vs. end) of compilation, and change
clang -> clang-cc to be less confusing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72527 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-28 16:37:33 +00:00
Daniel Dunbar 0311d47665 Revert to using &...[0] for std::vector, apparently .data isn't generally
available (and it isn't necessary in this case).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72425 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-26 18:00:25 +00:00
Daniel Dunbar 549adebb1c Use .data() vs &...[0]
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-26 17:13:50 +00:00
Daniel Dunbar 8e6e70928a The driver/diagnostic client don't need to be on the heap.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72418 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-26 16:15:44 +00:00
Fariborz Jahanian 34e65770ad 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72275 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-22 20:17:16 +00:00
Douglas Gregor ee75c05c1a AST XML dump, from Olaf Krzikalla!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72224 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 20:55:50 +00:00
Eli Friedman 0ec78fa2c9 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72135 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 21:10:40 +00:00
Eli Friedman c219a1579c Remove the -arch option from clang-cc: for all practical purposes, it's
redundant with -triple.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72108 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 11:12:40 +00:00
Eli Friedman e71b85feb0 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72107 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 10:18:02 +00:00
Eli Friedman ba60149b92 CMake updates for r72099; untested, so please tell me if there are any
issues.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72100 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 04:21:30 +00:00
Eli Friedman b09f6e15c5 Move clang-cc.h to lib/Frontend/Utils.h, and move the associated .cpp
files to lib/Frontend.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72099 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 04:14:29 +00:00
Eli Friedman e1718aff22 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72097 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 03:57:28 +00:00
Eli Friedman b5c8f8bddc 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72096 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 03:35:57 +00:00
Eli Friedman 12d3b1d98e Move options for -E mode from PrintPreprocessedOutput.cpp to
clang-cc.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72095 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 03:06:47 +00:00
Eli Friedman f1db58547a Refactor -dM mode out of the main routine for -E handling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72090 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 01:32:34 +00:00
Eli Friedman 0eeb86e512 Move the warning options from Warnings.cpp to clang-cc.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72089 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 01:17:04 +00:00
Eli Friedman f54fce8ff8 Switch some utilities in clang-cc to take a stream instead of a
filename (or unconditionally using stdout).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72085 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 01:02:07 +00:00
Eli Friedman 2aa39cd55c Attempted CMake build fixes for r72060; this is untested, so please tell
me if there are any issues.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72063 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 23:06:15 +00:00
Eli Friedman 8ceb0d9e7a Build fixes for r72060; sorry for any inconvenience.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72062 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 23:02:01 +00:00
Eli Friedman 39d7c4d2d9 Move ASTConsumers.h to include/clang/Frontend, and move the associated
.cpp files to lib/Frontend.  (As proposed on cfe-dev.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72060 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 22:50:54 +00:00
Eli Friedman c6d656e2b0 Move the Wno-rewrite-macros option out of RewriteObjC.cpp in prepration
for moving ASTConsumers.h to include/clang/Frontend.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72059 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 22:39:16 +00:00
Eli Friedman bce831b1ec Rename the factory function for the ObjC rewriter to something sane.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72055 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 22:29:17 +00:00
Eli Friedman 4908d36c3a Move AnalysisConsumer out of ASTConsumers.h in preparation for moving
ASTConsumers.h to include/clang/Frontend.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72054 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 22:25:55 +00:00
Eli Friedman 66d6f04847 Refactor ASTConsumers to take a raw_ostream instead of a filename where
appropriate.  There shouldn't be any significant functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72052 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 22:20:00 +00:00
Eli Friedman f086e3bef1 Remove unused parameter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71996 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 07:39:39 +00:00
Eli Friedman 18d868f067 Add some comments to ASTConsumers.h describing what the different
ASTConsumers actually do.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71992 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 01:16:21 +00:00
Anders Carlsson 7f537c18c7 Make ActOnWhileStmt take a FullExprArg for the condition expr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-17 21:22:26 +00:00
Anders Carlsson 6b1d283fe8 Make ActOnExprStmt take a FullExprArg.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71989 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-17 21:11:30 +00:00
Anders Carlsson a99fad8ff1 Add the FullExprArg wrapper and use it for if statement conditions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71982 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-17 18:26:53 +00:00
Eli Friedman b3e229694a A couple of tweaks to make -ast-print produce code that's closer to
valid C code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71971 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-17 01:05:34 +00:00
Mike Stump c6e35aae23 Implement a FIXME, we now pass in the locations of the braces for enums.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71930 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-16 07:06:02 +00:00
Anders Carlsson a33d9b4ebf Disable access control by default. It can be enabled with the -faccess-control option. When we have better support for it, we can enable it by default again.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71706 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-13 19:49:53 +00:00
Chris Lattner cfe858aa7c remove the obsolete -fprint-source-range-info option
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71675 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-13 17:08:18 +00:00
Douglas Gregor b64c19365d Make precompiled headers work with -E. When we're only preprocessing
(with -E), we turn the PCH include into an implicit include of the
file from which the PCH file was generated.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71534 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 01:31:05 +00:00
Douglas Gregor 67187ceb21 Move terminal-width computation over to llvm::sys. Update to LLVM
r71448 required. Fixes PR 4148 and PR 4183.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71450 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 18:06:49 +00:00
Daniel Dunbar 913af35741 Remove -fobjc-tight-layout, seems to work!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71184 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 21:58:26 +00:00
Ted Kremenek 2c4036eda9 Fix <rdar://problem/6848739>. When using -analyze, -Werror has no effect.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71172 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 19:02:53 +00:00
Daniel Dunbar 1c4483065b If stderr isn't a terminal, don't try to guess the terminal width or
look at COLUMNS.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71120 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 21:28:42 +00:00
Daniel Dunbar 17ca3638e8 More x86 target feature support.
- Apologies for the extremely gross code duplication, I want to get
   this working and then decide how to get this information out of the
   back end.

 - This replaces -m[no-]sse4[12] by -m[no-]sse4, it appears gcc
   doesn't distinguish them?

 - -msse, etc. now properly disable/enable related features.

 - Don't always define __SSE3__...

 - The main missing functionality bit here is that we don't initialize
   the features based on the CPU for all -march options.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71117 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 21:07:50 +00:00
Chris Lattner 5aeb9e7a21 daniel is buggy :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71065 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 04:38:30 +00:00
Daniel Dunbar aa338bc431 Add missing include.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71063 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 04:07:06 +00:00
Daniel Dunbar fb4ac7b4bf Cleanup some FIXMEs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71062 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 03:48:17 +00:00
Daniel Dunbar 868bd0aa92 Improve handling of (X86) target features.
- This is a WIP...

 - This adds -march= handling to the driver, and fixes the defaulting
   of -mcpu on Darwin (which was using the wrong test).

Instead of handling -m{sse, ...} in the driver, pass them to clang-cc as
 -target-feature [+-]name

In clang-cc, communicate with the (clang) target to discover the legal
features of a target, and the features which are enabled based on
-mcpu. This is currently hardcoded just enough to not be a feature
regression, we need to get this information from the backend's
TableGen information somehow.

This is used to construct the full list of features which are being
used, which is in turn used to initialize the predefines.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71061 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 03:16:41 +00:00
Daniel Dunbar d25f00c21b Enable tight Objective-C interface layout unconditionally.
- I will remove the flag when I'm comfortable there is no fallout
   from this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70993 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 18:52:50 +00:00
Ted Kremenek 305d2d2b61 Increase scan-view max timeout to 1 minute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70896 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 19:02:41 +00:00
Daniel Dunbar d6884a0b90 Add -fobjc-tight-layout.
- This implements gcc style Objective-C interface layout (I
   think). Currently it is always off, there is no functionality
   change unless this is passed.
   
   For the curious, the deal is that gcc lays out the fields of a
   subclass as if they were part of the superclass. That is, the
   subclass fields immediately follow the super class fields instead
   of being padded to the alignment of the superclass structure.

 - Currently gcc uses the tight layout in 32-bit and 64-bit modes, and
   llvm-gcc uses it in 32-bit only, for reasons which aren't clear
   yet. We probably want to switch to matching gcc, once this makes it
   through testing... my hope is that we can also fix llvm-gcc in
   order to maintain compatibility between the compilers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70827 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 05:16:21 +00:00
Daniel Dunbar e5393fb93e PR4063, with feeling: Chain PP callbacks by default.
- This is somewhat cleaner and also fixes PR4063 for real, I had the
   order wrong so we were just creating an empty dependency file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70687 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 10:04:17 +00:00
Daniel Dunbar 0a70c64b09 PR4063: Fix dependency generation with -E.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70686 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 09:35:25 +00:00
Douglas Gregor 44cf08ecf6 Respect the COLUMNS environment variable for word-wrapping (so we get
word-wrapping by default in Emacs; yay!). Thanks, Daniel.

Use LLVM's System layer rather than calling isatty() directly.

Fix a thinko in printing the indentation string that was causing some
weird output.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70654 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 03:52:38 +00:00
Daniel Dunbar 45d604e039 Remove ccc from the makefile as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70650 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-02 23:50:24 +00:00
Daniel Dunbar b83074dfa3 ccc is dead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70649 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-02 22:13:56 +00:00
Douglas Gregor 68a0d783dd When -fmessage-length=N is not specified, and if standard error is
going to a terminal, word-wrap to the length of the terminal.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70611 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-02 00:03:46 +00:00
Douglas Gregor fffd93f383 Implement -fmessage-length=N, which word-wraps diagnostics to N columns.
Also, put a line of whitespace between the diagnostic and the source
code/caret line when the start of the actual source code text lines up
(or nearly lines up) with the most recent line of the diagnostic. For
example, here it's okay for the last line of the diagnostic to be
(vertically) next to the source line, because there is horizontal
whitespace to separate them:

decl-expr-ambiguity.cpp:12:16: error: function-style cast to a builtin
      type can only take one argument
  typeof(int)(a,5)<<a;

However, here is a case where we need the vertical separation (since
there is no horizontal separation):

message-length.c:10:46: warning: incompatible pointer types initializing 'void
      (int, float, char, float)', expected 'int (*)(int, float, short,
      float)'

      int (*fp1)(int, float, short, float) = f;

This is part one of <rdar://problem/6711348>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70578 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-01 21:53:04 +00:00
Bill Wendling 5532180ae3 Remove two unused options.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70457 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 00:55:13 +00:00
Bill Wendling 6e9b8f6d57 Use the new code gen optimization enum instead of passing in the optimization
level. This is more expressive.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70451 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 23:53:23 +00:00
Evan Cheng 306a6aa6a2 Match addPassesToEmitFile API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70409 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 21:02:33 +00:00
Steve Naroff 621edce9cd Integrate 3 months of ObjC rewriter fixes (from the Apple/objective-rewrite branch).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 16:37:50 +00:00
Douglas Gregor 1ab86ac922 Make all PCH-incompatibility warnings into errors, and abort
compilation if the user requested a PCH file but no such PCH file
exists.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70332 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 22:01:16 +00:00
Douglas Gregor e721f95069 Allow some differences between the predefines buffer used to build a
PCH file and the predefines buffer used when including the PCH
file. We (explicitly) detect conflicting macro definitions (rejecting
the PCH file) and about missing macro definitions (they'll be
automatically pulled from the PCH file anyway).

We're missing some checking to make sure that new macro definitions
won't have any impact on the PCH file itself (e.g., #define'ing an
identifier that the PCH file used).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70316 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 18:58:38 +00:00
Eli Friedman c71133f0cf Remove unused LangOptions NoExtensions and Boolean.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70282 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 03:28:55 +00:00