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

834 Коммитов

Автор SHA1 Сообщение Дата
Daniel Dunbar 879c3eaab7 Remove unneeded CheckASTConsumer function.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58282 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 22:03:52 +00:00
Steve Naroff 80c28553e0 Fix testsuite regression for "crash.m".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58269 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 20:54:44 +00:00
Daniel Dunbar d611bac92c Don't double free module when IRgen fails.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58266 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 20:40:41 +00:00
Daniel Dunbar 7e9f1f7de8 Improve dependency file support.
- Add support for -MP (phony targets).
 
 - Use raw_ostream for output instead of std::string concatenation.
 
 - Break long lines in a GCC (4.2) compatible manner.

 - Output dependents in #included order (to match GCC).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 20:01:06 +00:00
Douglas Gregor 49badde06e Refactor the expression class hierarchy for casts. Most importantly:
- CastExpr is the root of all casts
  - ImplicitCastExpr is (still) used for all explicit casts
  - ExplicitCastExpr is now the root of all *explicit* casts
  - ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++
  - CXXFunctionalCastExpr inherits from ExplicitCastExpr
  - CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all
    of the C++ named cast expression types (static_cast, dynamic_cast, etc.)
  - Added classes CXXStaticCastExpr, CXXDynamicCastExpr, 
    CXXReinterpretCastExpr, and CXXConstCastExpr to 

Also, fixed returned-stack-addr.cpp, which broke once when we fixed
reinterpret_cast to diagnose double->int* conversions and again when
we eliminated implicit conversions to reference types. The fix is in
both testcase and SemaChecking.cpp.

Most of this patch is simply support for the renaming. There's very
little actual change in semantics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58264 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 19:41:14 +00:00
Steve Naroff a48396e10f Some fixups to the previous objc/blocks rewriter smerge.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58262 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 18:50:14 +00:00
Steve Naroff 54055232a5 Integrate the blocks and objc rewriters.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58253 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 17:20:55 +00:00
Chris Lattner 9d72851fec Rename Characteristic_t to CharacteristicKind
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58224 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 01:19:25 +00:00
Chris Lattner 418f6c7d14 Remember whether an initlist had a designator in the AST.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58218 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 23:43:26 +00:00
Chris Lattner 220ad7c8d1 pass designators into sema. This completes parser-level designator
support as far as I know.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58217 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 23:35:51 +00:00
Sebastian Redl ad3c91c267 Allow \n for newlines in expected error messages.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58198 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 19:05:16 +00:00
Argyrios Kyrtzidis 7fb5e48882 Don't give a default argument to ASTContext::getFunctionType for the TypeQuals parameter, it causes subtle bugs where TypeQuals, while necessary, are omitted from the call.
-Remove the default argument.
-Update all call sites of ASTContext::getFunctionType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58187 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 16:43:14 +00:00
Oscar Fuentes d2f4e5ea6e CMake: Builds and installs clang binary and libs (no docs yet). It
must be under the `tools' subdirectory of the LLVM *source* tree.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58180 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 00:56:18 +00:00
Ted Kremenek 9a30c2474f Use string literal for format string specifier; this prevents ErrMsg from being interpretted as a format string specifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58150 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-25 20:19:34 +00:00
Nuno Lopes 7d43a31832 2nd try to fix leakage of the module provider. note that moduleprovider takes ownership of the module
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58128 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 23:27:18 +00:00
Nuno Lopes dd49267500 fix leaking of the module provider
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58127 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 22:51:00 +00:00
Daniel Dunbar 750c358049 Add initial dependency file generation support. Patch by Kovarththanan
Rajaratnam, with some updates and formatting changes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58122 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 22:12:41 +00:00
Douglas Gregor 1f81230ac5 Move viewInheritance to CXXRecordDecl, and make sure it builds in Release mode, too
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58105 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 19:53:54 +00:00
Daniel Dunbar 6c308cc40a Use LINK_COMPONENTS instead of hard coding LLVM libraries.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58076 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 06:24:13 +00:00
Zhongxing Xu b406459d5b Fix linking error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58067 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 02:03:36 +00:00
Ted Kremenek 95c7b00fe8 Make the analyzer store (memory model) a command line option.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 01:04:59 +00:00
Ted Kremenek 7cae2f64a7 Added driver option "-cxx-inheritance-view" for viewing the C++ hierarchy of a class in GraphViz.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58051 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 23:36:29 +00:00
Daniel Dunbar 4c877cc89b Hook "fast" code generation to -O0.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58035 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 05:59:43 +00:00
Daniel Dunbar 70f92436f5 Add -O[0-3s] support (following llvm-gcc).
- Passes match llvm-gcc but many of the switches aren't wired.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58034 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 05:50:47 +00:00
Steve Naroff b9988c0c56 Fix <rdar://problem/6312683> clang block rewriter:
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58011 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 23:42:04 +00:00
Daniel Dunbar 8b7650ed5a Only create the target machine when emitting assembly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57993 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 18:29:51 +00:00
Daniel Dunbar ed2cb28552 [LLVM up] Get rid of std::ostream usage from Backend.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57990 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 17:40:45 +00:00
Chris Lattner a778d7d973 Add support for assembler-with-cpp (preprocessed .S files), patch by
Roman Divacky!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57988 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 17:29:21 +00:00
Daniel Dunbar 11292b0ce0 Update to use raw_ostream for PrintModulePass.
- Stop playing fast and loose with the std stream.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57948 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 03:28:13 +00:00
Daniel Dunbar d46075f8c3 Commito, didn't mean to remove this header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 23:54:00 +00:00
Daniel Dunbar d69bacc399 [LLVM up] Add basic -S option to clang.
- Split backend related consumer out into Backend.cpp, replaces
   LLVMCodeGenWriter.
 - Structure follows llvm-gcc to some extent.
 - Still need to implement all the options which impact code
   generation and the optimization passes which llvm-gcc uses at
   various levels.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57936 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 23:49:24 +00:00
Douglas Gregor 8e9bebdea6 Preliminary support for function overloading
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 16:13:35 +00:00
Steve Naroff 94ac21ea70 Fix <rdar://problem/6297052> confused in some way by embedded /* */ comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57903 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 13:37:27 +00:00
Steve Naroff fe6b0dc94a Fix <rdar://problem/6261178> clang-on-xcode: [sema] multiple method warning is over enthusiastic.
Fix <rdar://problem/6265257> warnings for ambiguous message send swamp other warnings.

Reworked Sema::MatchTwoMethodDeclarations() to optionally match based on method size and alignment (the default in GCC). Changed Sema::LookupInstanceMethodInGlobalPool() to use this feature.

Added -Wno-struct-selector-match to driver, however didn't hook it up yet. Added a FIXME that says this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57898 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 10:37:50 +00:00
Ted Kremenek 8588896b47 Added the start of a prototype implementation of PCH based on token caching.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57863 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 00:54:44 +00:00
Matthijs Kooijman 85b489739f Add newline at the end of file, to silence compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57818 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 08:12:48 +00:00
Daniel Dunbar 0d504c1da8 Remove unneeded EncodingRecordTypes argument to getObjCEncodingForType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 20:21:44 +00:00
Daniel Dunbar d3db401518 Add --disable-free flag to clang.
- Disables the freeing of the ASTContext and the TranslationUnit
   after parsing & sema.
 - Primarily for timing the impact on -fsyntax-only timings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57643 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-16 16:54:18 +00:00
Steve Naroff ca74360821 Tighten up blocks rewriter to handle casts and some other interesting cases.
This fixes <rdar://problem/6289007> clang block rewriter: ^ in cast is not rewritten.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 18:38:58 +00:00
Chris Lattner 99bd46c018 make the -rewrite-test a bit more interesting: it now
wraps comments in <i> tags.  Extend rewrite tokens to support
this minimal functionality.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57409 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 06:09:52 +00:00
Chris Lattner cff9cc95de start implementing a token rewriter. At this point, it just reads in a file
and lets a client iterate over it. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57407 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 05:44:03 +00:00
Chris Lattner b13c5eef36 Add a new -rewrite-test option, which is basically a
playground to experiment with some new rewriter approaches. For now
it is probably the most complex version of 'cat' ever invented.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57406 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 05:29:20 +00:00
Chris Lattner c106c106c6 Add a new -dump-raw-tokens option, which allows us to see raw tokens.
Rename -dumptokens to -dump-tokens.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57405 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 05:03:36 +00:00
Chris Lattner 590f0cc643 Change how raw lexers are handled: instead of creating them and then
using LexRawToken, create one and use LexFromRawLexer.  This avoids
twiddling the RawLexer flag around and simplifies some code (even 
speeding raw lexing up a tiny bit).

This change also improves the token paster to use a Lexer on the stack
instead of new/deleting it. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57393 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 01:15:46 +00:00
Steve Naroff e0109a5427 Fix/simplify RewriteBlocks::RewriteBlockPointerFunctionArgs().
This completes the fix for <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57350 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-10 15:33:34 +00:00
Daniel Dunbar 0b0ee502fc Disable blocks support in C++ mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57334 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-10 00:20:52 +00:00
Steve Naroff 84a969fed7 Touchup the rewriter to handle the new BlockExpr->BlockDecl dance.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57299 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08 17:31:13 +00:00
Steve Naroff 56ee6896f2 - Add BlockDecl AST node.
- Modify BlockExpr to reference the BlockDecl.

This is "cleanup" necessary to improve our lookup semantics for blocks (to fix <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?).

Still some follow-up work to finish this (forthcoming).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57298 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08 17:01:13 +00:00
Ted Kremenek ab9bae7583 Explicitly access the first Decl* referenced by a DeclStmt instead of using "getDecl()." Added a FIXME indicating that the call to RewriteObjCQualifiedInterfaceTypes() is meant to modifying the type-specifier; hopefully this will be a little more clean once DeclGroups contain type specifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57216 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 22:45:07 +00:00
Ted Kremenek 50a25e25db Use "DeclStmt::getSolitaryDecl()" when accessing the DeclStmt of an @catch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57215 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 22:39:38 +00:00
Ted Kremenek 1ed8e2a394 Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when rewriting Objective-c foreach statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57212 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 22:16:13 +00:00
Ted Kremenek fda4fede1b In RewriteFunctionBody, using DeclStmt::decl_iterator to rewrite the Decls in a DeclStmt instead of using getDecl() to fetch the first Decl.
Steve: Please review this patch.  'make test' passes, and my cursory scan of the rewriter leads me to believe this doesn't break anything, but I'm not sure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57195 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 18:47:09 +00:00
Daniel Dunbar 68c59184ee Allow -verify to be used with -rewrite-macros.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57093 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 01:38:39 +00:00
Daniel Dunbar 539ced1fdd Add dummy -ast-dump support for ObjC category implementations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57087 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 00:31:15 +00:00
Steve Naroff 22aed6574f Remove old diag that alerted the user to a limitation we no longer have:-)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57086 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 00:12:46 +00:00
Steve Naroff d3f779019c Create a function, eliminating some redundancy between SynthesizeBlockInitExpr() and SynthesizeBlockLiterals().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57083 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 00:06:12 +00:00
Steve Naroff acba0f2d0b Finish implementing copy/dispose helpers for imported block decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 23:47:37 +00:00
Daniel Dunbar b0adbba45c Set exit code properly on "Unexpected program action".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57080 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 23:42:49 +00:00
Steve Naroff 5e52b1763f Add indirection required for byref BlockDeclRefExpr's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57063 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 18:52:47 +00:00
Steve Naroff 3b0fd64cf3 Handle bookkeeping for imported blocks (in SynthesizeBlockImpl).
This code was "lost" with my recent changes to SynthesizeBlockFunc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 18:00:11 +00:00
Steve Naroff b65a4f1cc2 Cut/paste error...need to use the expression "name" for member references (or other complex expressions that can embed a block pointer type)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57054 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 17:45:51 +00:00
Steve Naroff 8e9216dab0 Clear the map that associated the rewritten block with it's corresponding BlockExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57053 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 17:10:02 +00:00
Steve Naroff 70f9550c27 Moved main control flow functions to bottom of file.
Reworked control flow to:
- rewrite the block expr body "in place".
- used Chris's new rewriter hook "getRewritenText" to "lift" the text for later use.
- finally, we do the block expr text replacement.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57052 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 17:06:23 +00:00
Steve Naroff 94ede6e443 Remove an old/vacuous if clause.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57036 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 23:00:50 +00:00
Steve Naroff 4e13b762e0 More fun & games with the block rewriter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57028 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 20:28:15 +00:00
Steve Naroff 39622b9ad9 Rewrite global block expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57004 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:38:09 +00:00
Steve Naroff 83ba14e260 - Add a convenience constructor to Type.
- Many rewriter modifications.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57003 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:04:50 +00:00
Steve Naroff 48a8c61adb Rework SynthesizeBlockImpl() to include a constructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57001 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 12:09:49 +00:00
Daniel Dunbar 1bfe1c2129 Pass postfix attributes to ActOnFields.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56992 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 02:03:53 +00:00
Steve Naroff 3ad29e2542 Get the right location to insert the synthesized block literals/functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56987 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 00:12:09 +00:00
Steve Naroff a0b75cf582 Name changes and some cleanup of preamble.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56984 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 23:30:43 +00:00
Steve Naroff 8af6a451ea Changed Sema::CheckForConstantInitializer to allow global block literals.
This commit also includes some name changes in the blocks rewriter (no functionality change).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56955 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 17:12:56 +00:00
Daniel Dunbar e553a726fa (llvm up) If the target triple is unspecified, automatically set the
OS version part to that of the host on darwin.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56943 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 01:21:33 +00:00
Daniel Dunbar 14bfdfec4e Drop code to validate OS part of target triple on darwin, too fragile.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56941 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 00:26:24 +00:00
Daniel Dunbar 320a054acf Fix help for --suppress-system-warnings
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56878 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 20:49:53 +00:00
Chris Lattner 079f2c467d Handle minor version numbers in __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
like "10.3.9"


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56873 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 20:30:12 +00:00
Chris Lattner ba0f25f754 Finish handling of -mmacosx-version-min. If you now do something like:
clang -mmacosx-version-min=10.4.9 ...

you'll end up with a target triple like "i686-apple-darwin8.9".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56871 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 20:16:56 +00:00
Chris Lattner 6a30c1fc7f start handling 'mmacosx-version-min', this is not complete yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56828 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 01:13:12 +00:00
Chris Lattner 0b9e736308 clean up a bunch of fixme's I added, by moving
DirectoryLookup::DirType into SourceManager.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 21:18:42 +00:00
Chris Lattner 1b9ad143c1 fit in 80 cols.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 20:05:14 +00:00
Daniel Dunbar fd96684034 Make clang preprocessed output a bit more like gcc output.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56636 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 01:13:35 +00:00
Steve Naroff cc2ece2e36 Fix a couple harmless warnings when compiling optimized with gcc (reported by mrs@apple.com).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 22:46:45 +00:00
Steve Naroff 1f6c3aebff Fix some const-ness to keep the VisualStudio C++ compiler happy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 17:22:34 +00:00
Steve Naroff ca3bb4f14f RewriteBlocks::RewriteBlockPointerDecl(): Handle TypedefDecl's and VarDecl's uniformly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56500 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 21:15:53 +00:00
Steve Naroff eab5f63207 Teach block rewriter to replace '^' with '*' in VarDecls.
Since we don't have DeclGroup's and location information for types, there is some fancy footwork to do this fairly reliably.

O.K...it's a kludge. One day, we can use this as motivation to do this more gracefully:-)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 19:24:41 +00:00
Ted Kremenek cfdf9b4edf Change implementation of NSError** coding-style check to be invoked at the end of the retain/release analysis.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56312 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 21:25:13 +00:00
Steve Naroff 1318895690 Add driver support for invoking block rewriter.
Also tweaked the create function to take an explicit output file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56305 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 14:10:13 +00:00
Ted Kremenek f45d18c08b Implemented one of the checks requested in PR 2600:
"Method accepting NSError** argument should have non-void return value to indicate that an error occurred."

Test case written, but the header needs to be delta-debugged reduced.  Will commit shortly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56297 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 06:33:41 +00:00
Steve Naroff 9c3c902835 Remove BlockStmtExpr.
Block literals are now represented by the concrete BlockExpr class.
This is cleanup (removes a FIXME).
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56288 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 18:37:59 +00:00
Steve Naroff 1c9f81b902 Add support for rewriting blocks...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56266 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 00:13:27 +00:00
Ted Kremenek a95d375044 Patch by Csaba Hruska!
"Here is a patch what replaces std::ostream with llvm::raw_ostream. This patch
covers the AST library, but ignores Analysis lib."


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56185 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-13 05:16:45 +00:00
Daniel Dunbar 2fe0997427 Add --suppress-system-warnings (on by default, use =0 to disable)
- For investigating warnings in system headers / builtins.
 - Currently also enables the behavior that allows silent redefinition
   of types in system headers. Conceptually these are separate but I
   didn't feel it was worth two options (or changing LangOptions).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56163 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-12 18:10:20 +00:00
Steve Naroff 378f47afee Fix <rdar://problem/6210791> clang ObjC rewriter: @try / @catch block with no @finally does not call objc_exception_try_exit.
Need a couple tweaks to RewriteObjCTryStmt(). Need to deal with implicit finally clauses (to make sure objc_exception_try_exit is called). Also fixed a related bug where we need to generate an implicit @catch else clause (to again make sure objc_exception_try_exit is called).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56104 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 15:29:03 +00:00
Argyrios Kyrtzidis d146552a1e LangOptions.C99 should be false in C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56092 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 04:21:06 +00:00
Douglas Gregor 233f74b29b Add support for expected-note to Clang's -verify option
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56089 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 02:46:36 +00:00
Steve Naroff 8bd3dc64d2 Fix <rdar://problem/6197841> try, finally with no catch stops the exception from being propagated
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56004 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 19:59:12 +00:00
Nico Weber e275e926b3 rename libclangSEMA to libclangSema
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-07 17:09:06 +00:00
Ted Kremenek 4b7c98378a Change struct forward declarations and definitions to use unique RecordDecls, as opposed to creating a single RecordDecl and reusing it.
This change effects both RecordDecls and CXXRecordDecls, but does not effect EnumDecls (yet).

The motivation of this patch is as follows:
- Capture more source information, necessary for refactoring/rewriting clients.

- Pave the way to resolve ownership issues with RecordDecls with the forthcoming
  addition of DeclGroups.

Current caveats:
- Until DeclGroups are in place, we will leak RecordDecls not explicitly
  referenced by the AST.  For example:

    typedef struct { ... } x;  

  The RecordDecl for the struct will be leaked because the TypedefDecl doesn't
  refer to it.  This will be solved with DeclGroups.
  
- This patch also (temporarily) breaks CodeGen.  More below.

High-level changes:
- As before, TagType still refers to a TagDecl, but it doesn't own it.  When
  a struct/union/class is first referenced, a RecordType and RecordDecl are
  created for it, and the RecordType refers to that RecordDecl.  Later, if
  a new RecordDecl is created, the pointer to a RecordDecl in RecordType is
  updated to point to the RecordDecl that defines the struct/union/class.

- TagDecl and RecordDecl now how a method 'getDefinition()' to return the
  TagDecl*/RecordDecl* that refers to the TagDecl* that defines a particular
  enum/struct/class/union. This is useful from going from a RecordDecl* that
  defines a forward declaration to the RecordDecl* that provides the actual
  definition. Note that this also works for EnumDecls, except that in this case
  there is no distinction between forward declarations and definitions (yet).

- Clients should no longer assume that 'isDefinition()' returns true from a
  RecordDecl if the corresponding struct/union/class has been defined.
  isDefinition() only returns true if a particular RecordDecl is the defining
  Decl. Use 'getDefinition()' instead to determine if a struct has been defined.

- The main changes to Sema happen in ActOnTag. To make the changes more
  incremental, I split off the processing of enums and structs et al into two
  code paths. Enums use the original code path (which is in ActOnTag) and
  structs use the ActOnTagStruct. Eventually the two code paths will be merged,
  but the idea was to preserve the original logic both for comparison and not to
  change the logic for both enums and structs all at once.

- There is NO CHAINING of RecordDecls for the same RecordType. All RecordDecls
  that correspond to the same type simply have a pointer to that type. If we
  need to figure out what are all the RecordDecls for a given type we can build
  a backmap.

- The diff in CXXRecordDecl.[cpp,h] is actually very small; it just mimics the
  changes to RecordDecl. For some reason 'svn' marks the entire file as changed.

Why is CodeGen broken:
- Codegen assumes that there is an equivalence between RecordDecl* and
  RecordType*. This was true before because we only created one RecordDecl* for
  a given RecordType*, but it is no longer true. I believe this shouldn't be too
  hard to change, but the patch was big enough as it is.
  
I have tested this patch on both the clang test suite, and by running the static analyzer over Postgresql and a large Apple-internal project (mix of Objective-C and C).  


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55839 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 17:16:31 +00:00
Daniel Dunbar 737bdb418c Workaround gcc bug causing crash on our preprocessed outputs.
- gcc is not happy if we start a preprocessed file with
#line 1 "XXX" 1
 - Workaround by making sure file starts with a simple #line change.

Also, factored WriteLineInfo out.

Also, fixed bug where FileType was not being correctly updated.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55825 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 03:22:57 +00:00
Ted Kremenek df042e6c2b Remove "NextDecl" from RecordDecl. This change touches many files that where RecordDecl or CXXRecordDecl was constructed, always with an argument of 'NULL' for the previous declaration.
The motivation behind this change is that chaining the RecordDecls is simply unnecessary.  Once we create multiple RecordDecls for the same struct/union/class, clients that care about all the declarations of the same struct can build a back map by seeing which Decls refer to the same RecordType.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55821 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 01:34:33 +00:00