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

5288 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 77a52233f7 Give string literals const element typesin C++, and cope with the deprecated C++ conversion from a string literal to a pointer-to-non-const-character
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56137 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-12 00:47:35 +00:00
Daniel Dunbar 5e155f0c9b Iterate on sema for :? in Objective-C:
- Follow C99 behavior of using other operand type when one of
   operands is a null pointer constant.
 - Fix overenthusiastic devolving of any Objective-C types to id:
   o If either operand has an Objective-C object type then:
     - If both operands are interfaces and either operand can be
       assigned to the other, use that type as the composite type.
     - Otherwise, if either type is id, use id as the composite type.
     - Otherwise, warn about incompatible types and use id as the
       composite type.
 - Return handling of qualified idea to separate test following
   general pointer type checking.
   o Upgraded from old code to allow devolving to id (without warning,
     which matches GCC).
 - <rdar://problem/6212771>

Add test case for issues fixed above, XFAIL though because it exposed
a new issue in property handling.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56135 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 23:12:46 +00:00
Argyrios Kyrtzidis 14d08c0c77 Add comments about C++ clause 3.3.2p4 that mentions that the condition declaration should be local to an if/switch/while/for statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56134 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 23:08:39 +00:00
Ted Kremenek 1346268d7f Echo stderr/stdout from clang subprocess to both the stderr of ccc-analyzer and
to an output file. This way users can both see the output of 'clang' as well as
enable background logging of files that clang encounters problems on.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56130 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 23:05:26 +00:00
Ted Kremenek 20b2bae90c Bug fix: <rdar://problem/6164367>
scan-build now correctly processes path prefixes that contain multiple '+'
characters or other regex control characters.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56121 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 21:15:10 +00:00
Mon P Wang 3e877ec791 Added SSE41 pminsd, pmaxsd, roundps and a few others
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56114 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 19:22:31 +00:00
Ted Kremenek 0e6893840f Check if the environment variable TERM is defined before using it.
This fixes: <rdar://problem/6164279> scan-build gives error when invoked without TERM variable


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56110 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 18:17:51 +00:00
Ted Kremenek d9331a4318 Update Xcode project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56109 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 18:14:22 +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
Douglas Gregor 7de3d7940d bool is not an extension in C++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56103 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 12:06:59 +00:00
Anders Carlsson dde0a94120 Make sure to store the exception in the catch parameter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56102 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 09:15:33 +00:00
Anders Carlsson 1452f5599d Make sure to emit the catch parameter as well as the catch body.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56101 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 08:21:54 +00:00
Anders Carlsson 4b7ff6ebd7 Fix stupid mistake I made in the exception handling code
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56100 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 06:35:14 +00:00
Argyrios Kyrtzidis 6314ff264c Do implicit conversion to bool for the condition in a do-while statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56096 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 05:16:22 +00:00
Argyrios Kyrtzidis 143db71d8d Fix do-while scoping in C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56095 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 04:46:46 +00:00
Argyrios Kyrtzidis c39a3d7673 Allow array-to-pointer conversion for rvalues.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56094 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 04:25:59 +00:00
Argyrios Kyrtzidis 24b41fa823 CXXConditionDeclExpr expression node is an lvalue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56093 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 04:22:26 +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
Argyrios Kyrtzidis 488d37e8c0 Revert r56078, getLang().C99 being true in C++ is a bug that will be fixed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56090 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 03:06:46 +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
Daniel Dunbar 8951dbd225 Use ABIArgInfo for decisions about function arguments (not just return
value).
 - Added ABIArgInfo::ByVal (mostly supported) and ABIArgInfo::Expand
   (asserted out).

 - Added classifyArgumentType which currently just uses
   ABIArgInfo::Default or ByVal. This nearly matches old behavior, but
   we now set ByVal in a few situations we may have left it off before
   (on complex, for example).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56086 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 01:48:57 +00:00
Daniel Dunbar 91e19b2029 Fix two bugs exposed by array passing assert:
(1) Additional arguments to variadic methods should have default
promotions applied.

(2) Additional arguments to non-variadic methods were allowed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56084 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 00:50:25 +00:00
Daniel Dunbar 9776ba0d84 Add ObjCMethodDecl::getSourceRange.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56083 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 00:47:15 +00:00
Argyrios Kyrtzidis e281b4cb3c Fold Parser::ParseTag into Parser::ParseEnumSpecifier, as suggested in this post:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-September/002721.html

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56081 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 00:21:41 +00:00
Daniel Dunbar 6660c8a4cc Bug fix, apply default argument promotion in message sends for which
no method declaration was found.
 - This was allowing arrays to pass "by value" among other things.

Add assert in CodeGen that arguments cannot have array type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56080 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 00:04:36 +00:00
Daniel Dunbar 637cebb67c Refactor common Obj-C message send checking code into
CheckMessageArgumentTypes.
 - No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56079 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 00:01:56 +00:00
Argyrios Kyrtzidis fe7e4f08fe -getLang().C99 is true in C++ too, remove the use of the C99orCXX variable.
-Scoping in C99 works good for C++ too, remove the C++-specific comments.

If someone thinks that the C++-specific comments are necessary for clarification, let me know and I'll put them back on.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56078 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 23:46:08 +00:00
Argyrios Kyrtzidis 4c0f56b999 In the 'condition.cpp' test case, make sure that condition declarations are local to the statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56077 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 23:34:50 +00:00
Daniel Dunbar 0b7a5c0a1e Add XFAIL test case for:
<rdar://problem/6211479> [sema] array type invalid for Obj-C property


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56075 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 23:11:23 +00:00
Steve Naroff 61f40a2b67 More semantic analysis for blocks...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56064 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 19:17:48 +00:00
Steve Naroff 1f3b0d5cca Sema::ActOnIdentifierExpr(): Lookup block arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56063 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 18:33:00 +00:00
Argyrios Kyrtzidis 957163829d Add some C++-specific comments in the parsing methods of if/switch/while/for.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56060 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 17:38:35 +00:00
Daniel Dunbar 639ffe4709 Implement ABIArgType::Coerce support.
- As a test, enable basic usage for some common x86-32 cases. This
    increases our x86-32 compliance (on other targets our compliance
    will just be broken in a different way).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56051 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 07:04:09 +00:00
Daniel Dunbar 62d5c1b503 Add CodeGenTypes::GetFunctionType overload for getting the effective
type of a call.

Change NeXT runtime to use this instead of trying to bitcasting
internally (which doesn't respect the ABI).

Fix subtle bug, use of ConvertTypeRecursive instead of ConvertType is
bad inside GetFunctionType.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56050 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 07:00:50 +00:00
Daniel Dunbar 45c25ba11c Move FunctionType conversion into CGCall.cpp:
- Added CodeGenTypes::GetFunctionType, taking a CGFunctionInfo.
 - Updated Obj-C runtimes to use this instead of rolling the
   llvm::FunctionType by hand.
 - Killed CodeGenTypes::{ConvertReturnType, DecodeArgumentTypes}.

Add ABIArgInfo class to encapsulate ABI decision of how to lower types
to LLVM.
 - Will move to target sometime soon.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56047 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 04:01:49 +00:00
Daniel Dunbar 2c8e0f32b9 Add ABIArgInfo class to encapsulate ABI decision of how to lower types
to LLVM.
 - Will move to target sometime soon.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56046 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 02:41:04 +00:00
Argyrios Kyrtzidis e3a09e6ad0 Implement CodeGen support for the 'CXXConditionDeclExpr' expression node, which represents a 'condition' declaration, e.g: "if (int x=0) {...}".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56045 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 02:36:38 +00:00
Argyrios Kyrtzidis 5921093cf1 Implement Sema support for the 'condition' part of C++ selection-statements and iteration-statements (if/switch/while/for).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56044 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 02:17:11 +00:00
Argyrios Kyrtzidis 4189a76f55 Change line endings: CRLF -> LF
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56043 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 02:14:49 +00:00
Argyrios Kyrtzidis 2fac626e2a Use Sema::isDeclInScope instead of IdentifierResolver::isDeclInScope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56042 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 02:11:07 +00:00
Daniel Dunbar b768807c49 Tweak CGCall functions again:
- Realized these functions will eventually need access to more data,
   moved to CodeGenModule. Eventually they should probably live
   together in some other helper class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56039 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 00:41:16 +00:00
Daniel Dunbar 5323a4b0a1 Tweak CGCall functions:
- Move actual param attr list creation to
   CodeGenFunction::ConstructParamAttrList.
 - Make ReturnTypeUsesSret static.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56038 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 00:32:18 +00:00
Daniel Dunbar 3913f184c8 Add CodeGenFunction::ReturnTypeUsesSret
- Hook so NeXT runtime doesn't depend on ABI.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56034 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 23:48:28 +00:00
Argyrios Kyrtzidis 9e922b1663 Add new 'CXXConditionDeclExpr' expression node used for a 'condition' declaration, e.g: "if (int x=0) {...}".
It is a subclass of DeclRefExpr and the main difference is that CXXConditionDeclExpr owns the declaration that it references.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56033 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 23:47:53 +00:00
Daniel Dunbar 17b708d618 Move ABI specific code for functions / calls to CGCall.cpp:
- Factor out EmitFunction{Pro,Epi}log


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56031 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 23:27:19 +00:00
Daniel Dunbar 7c086516f3 Factor CodeGenFunction::StartFunction out of GenerateCode and
StartObjCMethod.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56030 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 23:14:03 +00:00
Argyrios Kyrtzidis f99cb05166 Make IdentifierResolver::isDeclInScope regard declarations of a parent 'control' scope as part of the current scope.
The 'control' scope is the 'condition' scope of if/switch/while statements and the scope that contains the for-init-statement and 'condition' of a for statement.

e.g:
if (int x = 0 /*'control' scope*/) {
  // x will be regarded as part of this substatement scope.
} else {
  // and as part of this substatement scope too.
}


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56020 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 21:57:58 +00:00
Argyrios Kyrtzidis eb7c388bc7 Add a LangOptions member to IdentifierResolver.
Make Sema pass the LangOptions to IdentifierResolver's constructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56015 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 21:32:02 +00:00
Argyrios Kyrtzidis 15a12d0824 Add Sema::isDeclInScope which wraps IdentifierResolver::isDeclInScope.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56014 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 21:18:04 +00:00
Daniel Dunbar 5ca2084cf9 Use a unified return block.
- For the time being this means our emitted code is somewhat worse,
   especially for aggregates. This will be fixed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56013 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 21:00:17 +00:00