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

16822 Коммитов

Автор SHA1 Сообщение Дата
John McCall f89e55ab1b Calculate the value kind of an expression when it's created and
store it on the expression node.  Also store an "object kind",
which distinguishes ordinary "addressed" l-values (like
variable references and pointer dereferences) and bitfield,
@property, and vector-component l-values.

Currently we're not using these for much, but I aim to switch
pretty much everything calculating l-valueness over to them.
For now they shouldn't necessarily be trusted.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119685 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 06:31:45 +00:00
Marcin Swiderski 6a02b609c2 Added method for handling CXXOperatorCallExpr differently from CallExpr if CXXOperatorCallExpr represents method call.
Also fixed returning ExpolodedNodeSet from VisitCXXMethodCallExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119684 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 06:29:23 +00:00
Anton Yartsev aa4fe05939 comparison of AltiVec vectors now gives bool result (fix for 7533)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119678 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 03:19:30 +00:00
Argyrios Kyrtzidis 1380a147d4 -Rename -Wargument-larger-than -> -Wlarge-by-value-copy
-Improve the diagnostic message
-Add some comments

Suggestions by Chris.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119594 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 00:20:36 +00:00
Argyrios Kyrtzidis 3532fdd1db Introduce option -Wargument-larger-than[=N] which warns about function definitions if they take by-value
or return by-value any POD that is larger than some threshold (default is 64 bytes).

Implements rdar://8548050.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119583 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 23:11:54 +00:00
Rafael Espindola fdda171790 Implement -pie.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119577 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 22:26:15 +00:00
Rafael Espindola dbe80d9933 Don't warn about
clang -w -c foo.s
Helps with the gdb testsuite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119574 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 22:13:25 +00:00
Douglas Gregor cf5442648d Do not produce "purely informative" code completion results for
Objective-C message sends, which have only whitespace in their
TypedText chunk. Such results have no purpose.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119569 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 21:36:08 +00:00
Marcin Swiderski 82c63bfa0c In EvalArguments allow for evaluation of first argument always as a lvalue. Will be used for CXXOperatorCallExpr that represents method call.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119567 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 21:27:36 +00:00
Rafael Espindola 7f6458b7e2 Don't warn about -w not being used in a link. Necessary to get sane
results in the gdb testsuite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119552 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 20:37:10 +00:00
Fariborz Jahanian de2676076b Warn if direct accessing synthesized ivar backing the property in
nonofragile-abi2. Fixes //rdar://8673791



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119543 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 19:41:23 +00:00
Argyrios Kyrtzidis 47d512c337 Don't emit warn_logical_and_in_logical_or for cases like "a && b || 0".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119540 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 19:18:19 +00:00
Argyrios Kyrtzidis d92ccaa769 Don't emit warn_logical_and_in_logical_or for macros. Fixes rdar://8678458
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119537 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 18:54:22 +00:00
Argyrios Kyrtzidis 567bb71a01 Don't warn for parentheses for the '&&' inside '||' for cases like:
assert(a || b && "bad");

since this is safe. This way we avoid a big source of such warnings which in this case are practically useless.

Note that we don't handle *all* cases where precedence wouldn't matter because of constants since
this is a bit costly to check, and IMO clarifying precedence with parentheses is good for
readability in general.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119533 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 18:26:36 +00:00
Dan Gohman 4659e1e2e0 Drop the warning about __attribute__((may_alias)) being used
on a non-type declaration, as GCC permits it on variables too.
This fixes PR8635.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119517 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 17:21:47 +00:00
Rafael Espindola db85e058ed Silence warning for "clang -O2 -O0 -c foo.c -o foo.o.
Fixes PR8607.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119498 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 15:16:14 +00:00
Zhongxing Xu 4ffcb9974c Add skeleton for handling various cfg dtors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119491 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 09:16:19 +00:00
Chris Lattner 5d93653247 When forming the !srcloc mdnode for an inline asm, add the SourceLocations
of all the lines of the inline asm.  With the refactoring and enhancement
of the backend, we can now reports errors on the correct source line when
an asm contains multiple lines of text.  For something like this:

void foo() {
  asm("push %rax\n"
      ".code32\n");
}

we used to get this: (note that the line 4 in t.c isn't helpful)

t.c:4:7: error: warning: ignoring directive for now
  asm("push %rax\n"
      ^
<inline asm>:2:1: note: instantiated into assembly here
.code32
^

now we get:

t.c:5:8: error: warning: ignoring directive for now
      ".code32\n"
       ^
<inline asm>:2:1: note: instantiated into assembly here
.code32
^

Note that we're pointing to line 5 properly now.  This implements
rdar://7839391 - inline asm errors should point to the right line in the asm
and makes the error message in PR8595 much less confusing.





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119489 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 08:25:26 +00:00
Chris Lattner 063e47667c adjust for llvm mainline, yay type safety
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119487 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 08:13:04 +00:00
Chris Lattner 08f92e3a5d a metric ton of refactoring later, Sema::getLocationOfStringLiteralByte
no longer depends on Preprocessor, so we can move it out of Sema into
a nice new StringLiteral::getLocationOfByte method that can be used by
any AST client.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119481 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 07:37:15 +00:00
Zhongxing Xu 8d6e89ee61 do not do post checks. Because at this point we just enter the call.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119480 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 07:31:08 +00:00
Chris Lattner b0607279cb move getSpelling from Preprocessor to Lexer, which it is more conceptually related to.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119479 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 07:26:20 +00:00
Zhongxing Xu 75072f2093 Remove comments. We are already doing actual method call by inlining it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119477 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 07:21:49 +00:00
Chris Lattner 0833dd0675 propagate preprocessor out of StringLiteralParser. It is now
possible to create one without a preprocessor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119476 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 07:21:13 +00:00
Chris Lattner a95880d651 push the preprocessor out of EncodeUCNEscape
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119475 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 07:12:42 +00:00
Chris Lattner 7ef5c27eb6 move AdvanceToTokenCharacter and getLocForEndOfToken from
Preprocessor to Lexer where they make more sense.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119474 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 07:05:50 +00:00
Chris Lattner 872a45e917 add a static version of PP::AdvanceToTokenCharacter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119472 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 06:55:10 +00:00
Chris Lattner 6c66f07854 push use of Preprocessor out farther.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119471 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 06:46:14 +00:00
Chris Lattner ca1475ea0e push use of Preprocessor out of getOffsetOfStringByte
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119470 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 06:35:43 +00:00
Chris Lattner 48cf9824fb add a static form of the efficient PP::getSpelling method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119469 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 06:31:48 +00:00
Chris Lattner 91f54ce93b refactor the interface to StringLiteralParser::getOffsetOfStringByte,
pushing the dependency on the preprocessor out a bit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119468 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 06:26:08 +00:00
Marcin Swiderski 0aac2ba128 Added mapping from 'this' to it's SymbolicRegion in BasicStoreManager::getInitialStore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119467 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 06:22:54 +00:00
Chris Lattner 47fc7e93b6 factor some code out to a helper function, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119464 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 05:58:54 +00:00
Douglas Gregor a4ffd85a66 For an Objective-C @synthesize statement, e.g.,
@synthesize foo = _foo;

keep track of the location of the ivar ("_foo"). Teach libclang to
visit the ivar as a member reference.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119447 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 01:03:52 +00:00
Ted Kremenek 8fec972a61 Add comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119436 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 00:50:34 +00:00
Rafael Espindola 53dd00bae3 Add support for distros that like x86_64-unknown-linux-gnu.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119425 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 00:25:26 +00:00
Fariborz Jahanian e38be61743 Fixes synthesis of type for the object which holds info.
about a __block cxx object.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119411 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 00:21:28 +00:00
Douglas Gregor e3c60a7ce9 Fix source-range information for Objective-C properties. Previously,
we were just getting a range covering only the property name, which is
certainly not correct (and broke token annotation, among other
things). 

Also, teach libclang about the relationship between
@synthesize/@dynamic and @property, so we get property name and
cursor-reference information for @synthesize and @dynamic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119409 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 00:13:31 +00:00
John McCall 74fb0edb44 Reset the lifetime-managed flag between emission of the agg conditional
branches.  Fixes PR8623.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119408 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 00:07:33 +00:00
Dan Gohman 34c26300b3 Front-end support for __attribute__((may_alias)). This is not
yet hooked up to anything yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119407 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 00:03:07 +00:00
John McCall 83ce9d4a55 Support compound complex operations as l-values in C++. Add a test
case based on CodeGen/volatile-1.c which tests the current C++
semantics, and note the many, many places we fall short of them.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119402 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 23:07:28 +00:00
Argyrios Kyrtzidis bee77f7535 Warn about arg1 && arg2 || arg3, as GCC 4.3+ does. Fixes rdar://8659922
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119381 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 21:00:12 +00:00
Douglas Gregor 73fc91275a Use an OwningPtr for the preamble buffer in ASTUnit. This plugs a leak
where we failed to free this buffer along one of the paths, and
detangles the code a little.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119379 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 20:45:51 +00:00
Anton Yartsev e19df18399 turned pointers into pointers to const in function parameters in all functions/builtins accepting pointers to a const-qualified type according to PIM and "Language Extensions for CBEA"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119376 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 20:09:36 +00:00
Fariborz Jahanian e220455a05 Implements __block API for c++ objects. There is still
issue with runtime which I am discussing it with Blaine.
This is wip (so no test yet).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119368 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 19:29:39 +00:00
Ted Kremenek b12fbc216f Static analyzer: Catch calls to malloc() with
allocation sizes of 0 bytes.

Fixes PR 2899.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119364 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 18:47:04 +00:00
Argyrios Kyrtzidis 4383e18fc3 Emit a specific diagnostic when typedefing C++ bool, mirroring gcc.
Fixes rdar://8365458

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119359 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 18:18:13 +00:00
Nico Weber 8ad8a1cc1e Add gcc-4.4.4 headers on Gentoo systems. Patch by Bertjan Broeksema!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119348 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 12:42:55 +00:00
Chandler Carruth 7c1a1ef39d Remove an unintended restriction on sysroots introduced during the Path
conversion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119346 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 11:30:11 +00:00
John McCall b418d74c11 Simplify some complex emission and implement correct semantics for
assignment to volatiles in C.  This in effect reverts some of mjs's
work in and around r72572.  Basically, the C++ standard is quite
clear, except that it lies about volatile behavior approximating
C's, whereas the C standard is almost actively misleading.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119344 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 10:08:07 +00:00