Commit Graph

9265 Commits

Author SHA1 Message Date
Douglas Gregor f88e35ba0b When using a precompiled preamble with detailed preprocessing records,
trap the serialized preprocessing records (macro definitions, macro
instantiations, macro definitions) from the generation of the
precompiled preamble, then replay those when walking the list of
preprocessed entities. This eliminates a bug where clang_getCursor()
wasn't able to find preprocessed-entity cursors in the preamble.

llvm-svn: 120396
2010-11-30 06:16:57 +00:00
Nico Weber ebd45a004d Fix bug in r120299 spotted by dgregor.
llvm-svn: 120389
2010-11-30 04:44:33 +00:00
John McCall 4cec5f806b Fix another case of giving the wrong value kind to a dependent cast to
a non-dependent type.

llvm-svn: 120384
2010-11-30 02:05:44 +00:00
Nick Lewycky 5421621d2b Replace \r\n with \n. No functional change.
llvm-svn: 120379
2010-11-30 01:47:38 +00:00
Argyrios Kyrtzidis 091d97c709 Revert r120331 since it causes spurious warnings and a possible assertion hit when self-host.
llvm-svn: 120351
2010-11-29 23:42:03 +00:00
Fariborz Jahanian e1802eefac Incomplete enum types not to be treated as integer type
when checking for integer signed/unsigned-ness. PR8694,
// rdar://8707031

llvm-svn: 120345
2010-11-29 23:18:09 +00:00
Argyrios Kyrtzidis 569cad9734 Emit warnings if we are returning a reference to a local temporary.
The issue was brought to our attention by Matthieu Monrocq.

llvm-svn: 120331
2010-11-29 22:32:08 +00:00
Nico Weber 44887f69d5 Always use a function's decl context when building default arguments. Fixes http://http://llvm.org/pr8479.
llvm-svn: 120299
2010-11-29 18:19:25 +00:00
John McCall 032092ffc2 Revert r120063, it was wrong.
llvm-svn: 120296
2010-11-29 18:01:58 +00:00
Douglas Gregor 6399366d17 Add a test for C++ [stmt.label]p1, from Sashan!
llvm-svn: 120291
2010-11-29 16:37:40 +00:00
NAKAMURA Takumi c66906a6cb test/CMakeLists.txt: Implement the target "check-all". For now, it has no dependencies.
llvm-svn: 120280
2010-11-29 01:18:56 +00:00
Nico Weber dcf6fc5dc4 Revert parts of r120266 that I did not mean to commit
llvm-svn: 120267
2010-11-28 22:58:38 +00:00
Nico Weber 20c9f1db48 Minor whitespace and comment fixes. No functionality change.
llvm-svn: 120266
2010-11-28 22:53:37 +00:00
Anders Carlsson 66bbf50877 Look through parentheses when deciding whether an expr is a temporary object. Fixes PR8683.
llvm-svn: 120247
2010-11-28 16:40:49 +00:00
Sebastian Redl 002a3c506a Forgot a file in r120182
llvm-svn: 120184
2010-11-26 18:37:14 +00:00
Sebastian Redl 346203105f Allow access to non-static members without an object in sizeof expressions, in C++0x. Patch by Jakub Wieczorek.
llvm-svn: 120182
2010-11-26 16:28:07 +00:00
John McCall 29ac8e2ecd For internal consistency's sake, compute the value kind of a dependent cast
based on the known properties of the casted-to type.  Fixes a crash on spirit.

llvm-svn: 120180
2010-11-26 10:57:22 +00:00
Zhongxing Xu ec0b8e32ee Regionstore: support derived-to-base cast by creating a CXXBaseObjectRegion.
llvm-svn: 120173
2010-11-26 08:21:53 +00:00
Zhongxing Xu 33f13595c9 handle CXXFunctionalCastExpr in visitLValue and Environment.
llvm-svn: 120143
2010-11-25 03:18:57 +00:00
Nick Lewycky ef4f456866 Tie DefineVTablesUsed() in with recursive function instantiation so that we emit
a useful template instantiation stack. Fixes PR8640.

This also causes a slight change to where the "instantianted from" note shows up
in truly esoteric cases (see the change to test/SemaCXX/destructor.cpp), but
that isn't directly the fault of this patch.

llvm-svn: 120135
2010-11-25 00:35:20 +00:00
Anders Carlsson 0c75b49dc1 Fix a (probably very old) regression where we weren't using the typedef name for anonymous tag types.
llvm-svn: 120113
2010-11-24 21:05:09 +00:00
Zhongxing Xu 8be65a792f When getting CXXThisRegion from CXXMethodDecl, use the qualifiers. This is
to be consistent with the type of 'this' expr in the method.
此行及以下内容将会被忽略--

M    test/Analysis/method-call.cpp
M    include/clang/Checker/PathSensitive/GRExprEngine.h
M    lib/Checker/GRCXXExprEngine.cpp

llvm-svn: 120094
2010-11-24 13:48:50 +00:00
John McCall 8a1013f8c3 Redeclarations of using declarations are not okay in function scopes.
Not sure what I was thinking before.

Fixes PR8668.

llvm-svn: 120063
2010-11-23 22:03:51 +00:00
John McCall 20c00e0e7b This test does not need to test the alignment of pointers. Make it pass
on 64-bit systems.

llvm-svn: 120014
2010-11-23 10:15:48 +00:00
Francois Pichet ce87a7e45c long => int to make the test pass on system where sizeof(long) = 64.
llvm-svn: 120005
2010-11-23 07:15:13 +00:00
Francois Pichet 0c71f6c5d3 Microsoft C anonymous struct implementation.
Documentation: http://msdn.microsoft.com/en-us/library/z2cx9y4f.aspx

llvm-svn: 120000
2010-11-23 06:07:27 +00:00
Nico Weber 13c13d4da8 Remove one I just added, add a more focused test for why the current code is correct.
llvm-svn: 119969
2010-11-22 13:12:28 +00:00
Nico Weber 774303425b Fix the source range of CXXNewExprs. Fixes http://llvm.org/pr8661.
llvm-svn: 119966
2010-11-22 10:30:56 +00:00
NAKAMURA Takumi 3c3b3a7d8b test/Sema/x86-builtin-palignr.c: Now we can remove XFAIL:win32, according to r119958.
llvm-svn: 119961
2010-11-22 09:29:49 +00:00
Zhanyong Wan 6dace61730 Fix PR8419. Reviewed by kremenek and xuzhongxing.
llvm-svn: 119960
2010-11-22 08:45:56 +00:00
Chandler Carruth 45c2fb1e69 Undo part of my previous commit to mm_malloc.h, going back to the use of
stdlib.h. There were numerous problems with forward declaring 'malloc' and
'free', but the most important is that these are reserved by POSIX and may be
implemented via a function-like macro.

As suggested by Dale Johannesen, I'm instead guarding the only include of this
in our builtin headers with __STDC_HOSTED__, and I've removed the include of
the header from the test suite. I'll discuss with folks whether we want to have
a hosted section of the test suite or not, and add it (and perhaps other tests)
back there if that's the direction.

llvm-svn: 119958
2010-11-22 08:06:31 +00:00
Anders Carlsson a369f8dc3a The 'X' printf type has a valid alternative form. Fixes PR8641.
llvm-svn: 119946
2010-11-21 18:34:21 +00:00
Zhongxing Xu 2c966716ff Handle CFGAutomaticObjDtor.
llvm-svn: 119897
2010-11-20 06:53:12 +00:00
Argyrios Kyrtzidis 90ee2a4ecf Don't warn for empty 'if' body if there is a macro that expands to nothing, e.g:
if (condition)
    CALL(0); // empty macro but don't warn for empty body.

Fixes rdar://8436021.

llvm-svn: 119838
2010-11-19 20:54:25 +00:00
Fariborz Jahanian e7d62020a7 objc_msgSend is not a builtin type in non-objc mode.
Fixes //rdar://8686888

llvm-svn: 119813
2010-11-19 18:16:46 +00:00
Douglas Gregor 3a001f48e4 When parsing something that looks like an ill-formed
protocol-qualifier list without a leading type (e.g., <#blah#>), don't
complain about it being an archaic protocol-qualifier list unless it
actually parses as one.

llvm-svn: 119805
2010-11-19 17:10:50 +00:00
Douglas Gregor a750e8e6d8 Extend the libclang diagnostic API to provide information about the
option name, category ID, and category name corresponding to a diagnostic.

llvm-svn: 119802
2010-11-19 16:18:16 +00:00
Fariborz Jahanian 148d113e55 Fix a bug where write-barriers for assignment through reference
types was not being generated for objc pointers.
// rdar://8681766.

llvm-svn: 119751
2010-11-18 22:39:16 +00:00
John McCall 4bc41aee2b Add an assertion, fix a whole bunch of bugs, comment the assertion
out because there are still bugs left.

llvm-svn: 119722
2010-11-18 19:01:18 +00:00
John McCall 7decc9e4ea 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.

llvm-svn: 119685
2010-11-18 06:31:45 +00:00
Anton Yartsev 3f8f2886c1 comparison of AltiVec vectors now gives bool result (fix for 7533)
llvm-svn: 119678
2010-11-18 03:19:30 +00:00
Argyrios Kyrtzidis ef6c8da50f -Rename -Wargument-larger-than -> -Wlarge-by-value-copy
-Improve the diagnostic message
-Add some comments

Suggestions by Chris.

llvm-svn: 119594
2010-11-18 00:20:36 +00:00
Argyrios Kyrtzidis af84ec0a96 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.

llvm-svn: 119583
2010-11-17 23:11:54 +00:00
Douglas Gregor b4a7c0385d 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.

llvm-svn: 119569
2010-11-17 21:36:08 +00:00
Fariborz Jahanian 8046af7d50 Warn if direct accessing synthesized ivar backing the property in
nonofragile-abi2. Fixes //rdar://8673791

llvm-svn: 119543
2010-11-17 19:41:23 +00:00
Argyrios Kyrtzidis 56e879d1da Don't emit warn_logical_and_in_logical_or for cases like "a && b || 0".
llvm-svn: 119540
2010-11-17 19:18:19 +00:00
Argyrios Kyrtzidis 14a96625b8 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.

llvm-svn: 119533
2010-11-17 18:26:36 +00:00
Douglas Gregor 30313cbb80 When libclang is walking a member access expression, don't walk into
an implicit "this"; it causes clang_getCursor() to find the implicit
"this" expression (which isn't written in the source!) rather than the
actual member.

llvm-svn: 119516
2010-11-17 17:15:08 +00:00
Douglas Gregor 29ee422861 When comparing the source range of a declaration against the region of
interest (e.g., as used by clang_getCursor()), count the
decl-specifier-seq as part of the source range, as we do for
clang_annotateTokens(). Makes clang_getCursor() work properly for the
result types of functions, for example.

llvm-svn: 119514
2010-11-17 17:14:07 +00:00
Douglas Gregor b1b71e50a0 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.

llvm-svn: 119447
2010-11-17 01:03:52 +00:00