Commit Graph

4829 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 2d68810caf Read/write in PCH Sema's StdNamespace and StdBadAlloc and use a LazyDeclPtr for them that will deserialize them when needed.
llvm-svn: 110031
2010-08-02 07:14:54 +00:00
Argyrios Kyrtzidis 4f8e17379d Rename getStdNamespace -> getOrCreateStdNamespace, to better reflect its functionality.
No functionality change.

llvm-svn: 110030
2010-08-02 07:14:39 +00:00
John McCall 81c9cea24b Kill off RequiresGlobalConstructor in favor of isConstantInitializer.
Note some obvious false positives in the test case.

llvm-svn: 109986
2010-08-01 21:51:45 +00:00
John McCall 47e40931c9 Make a first pass at implementing -Wglobal-constructors. I'm worried that this
will end up bizarrely mirroring CGExprConstant, but that might be the hazard of
this feature.

llvm-svn: 109984
2010-08-01 20:20:59 +00:00
John McCall 6602bb1115 Instantiate attributes from the pattern record when instantiating
a class template.  Fixes rdar://problem/8243419.

llvm-svn: 109967
2010-08-01 02:01:53 +00:00
John McCall a755f0f74a Fix indentation.
llvm-svn: 109965
2010-08-01 01:25:24 +00:00
John McCall d4e1b767f3 Don't consider all local variables in C++ to mandate scope-checking, just
those with initializers.

llvm-svn: 109964
2010-08-01 01:24:59 +00:00
John McCall a95172baa0 Only run the jump-checker if there's a branch-protected scope *and* there's
a switch or goto somewhere in the function.  Indirect gotos trigger the
jump-checker regardless, because the conditions there are slightly more
elaborate and it's too marginal a case to be worth optimizing.

Turns off the jump-checker in a lot of cases in C++.  rdar://problem/7702918

llvm-svn: 109962
2010-08-01 00:26:45 +00:00
Ted Kremenek d21139a34f After a lengthy design discussion, add support for "ownership attributes" for malloc/free checking. Patch by Andrew McGregor!
llvm-svn: 109939
2010-07-31 01:52:11 +00:00
Sebastian Redl 671eee9e68 Correctly deal with using names for both functions and structs in chained PCH.
llvm-svn: 109871
2010-07-30 17:25:10 +00:00
Fariborz Jahanian 7b70eb4bb1 Tighten the rules when deciding if an ivar must be
auto-synthesized (nonfragile-abi2 specific).
Fixes radar 8251648.

llvm-svn: 109866
2010-07-30 16:59:05 +00:00
Abramo Bagnara ed5b6899ab Fixed typedef inside extern "C".
llvm-svn: 109865
2010-07-30 16:47:02 +00:00
John McCall 0925714eca If a TST_typename has a null type, mark the declarator invalid. Prevents
some downstream crashes, among them rdar://problem/8229840.

llvm-svn: 109850
2010-07-30 05:17:22 +00:00
Nate Begeman 1194bd2bd8 Wire up sema checking for __builtin_arm_usat and __builtin_arm_ssat immediates.
llvm-svn: 109814
2010-07-29 22:48:34 +00:00
Fariborz Jahanian c15dfd8a87 Tigthen the condition for issung ivar shadowing
variables to those in file scope (nonfragile-abi2).
Fixes radar 8248681.

llvm-svn: 109758
2010-07-29 16:53:53 +00:00
Douglas Gregor e9bf2d159c When dynamic_cast'ing from a type to itself, fill in the cast kind
with CK_NoOp. Fixes PR7727.

llvm-svn: 109757
2010-07-29 16:12:45 +00:00
Douglas Gregor 0bdcb8a239 When taking the address of a value of Objective-C object type (e.g.,
one because we're referencing a variable of type NSString &), the
resulting type is an ObjCObjectPointerType.

llvm-svn: 109753
2010-07-29 16:05:45 +00:00
Douglas Gregor 17ea3f5dbd Allow a looser form of compatibility checking (which ignores
qualifiers) when checking a K&R function definition against a previous
prototype. Fixes <rdar://problem/8193107>.

llvm-svn: 109751
2010-07-29 15:18:02 +00:00
Douglas Gregor f65f490ae9 When deleting a value of class type, make sure that type is complete
before looking for conversions to pointer type. Fixes <rdar://problem/8248780>.

llvm-svn: 109749
2010-07-29 14:44:35 +00:00
Douglas Gregor 43397fc4dc Don't set out-of-line template specialization/definition information
for AST nodes that aren't actually out-of-line (i.e., require a
nested-name-specifier). Fixes <rdar://problem/8204126>.

llvm-svn: 109704
2010-07-28 23:59:57 +00:00
Douglas Gregor a9c3e82755 Don't die when a member access refers to a non-class member via a
qualified name. Fixes <rdar://problem/8231724>.

llvm-svn: 109682
2010-07-28 22:27:52 +00:00
Douglas Gregor 85b5063f2c When performing code completion for a case statement in a switch whose
condition is not of enumeration type, provide code-completion results
containing all values of integral or enumeral type.

llvm-svn: 109677
2010-07-28 21:50:18 +00:00
Douglas Gregor bbfd2c0a86 Enable expression transformations in the current-instantiation
rebuilder, i.e., remove a silly short-sighted hack from long
ago. Thanks to Abramo Bagnara for the test case/bug report!

llvm-svn: 109583
2010-07-28 15:14:14 +00:00
Douglas Gregor df65c8ed2a When a nested-name-specifier refers into a current instantiation that has
dependent bases, construct a dependent nested-name-specifier rather
than complaining that the name could not be found within the current
instantiation itself. Fixes PR7725.

llvm-svn: 109582
2010-07-28 14:49:07 +00:00
Eli Friedman 7530049b16 Fix a minor crash bug with constructs like Obj.Class::ENUM_VALUE.
llvm-svn: 109537
2010-07-27 20:51:02 +00:00
Eli Friedman 6b197e0651 PR7724: Don't try to evaluate value-dependent expressions.
llvm-svn: 109532
2010-07-27 19:14:53 +00:00
Michael J. Spencer 2c35bc1232 Revert r109428 "Hoist argument type checking into CheckFormatHandler. This is prep for scanf format"
Got errors about ASTContext being undefined with Visual Studio 2010.

llvm-svn: 109491
2010-07-27 04:46:02 +00:00
Dan Gohman 4888f1a210 Minor code simplification.
llvm-svn: 109443
2010-07-26 21:33:22 +00:00
Dan Gohman 28ade550f4 Fix namespace polution.
llvm-svn: 109440
2010-07-26 21:25:24 +00:00
Ted Kremenek df4472bca0 Hoist argument type checking into CheckFormatHandler. This is prep for scanf format
string argument type checking.

llvm-svn: 109428
2010-07-26 19:45:54 +00:00
Ted Kremenek 6adb7e35ab Consolidate #args checking for scanf/printf format strings.
llvm-svn: 109427
2010-07-26 19:45:42 +00:00
Sebastian Redl ae8cbb7220 Make sure that implicit qualification and derived-to-base conversions of xvalues preserve xvalue-ness. Unfortunately I have no idea how to test this property; there doesn't seem to be a syntactical construct that triggers such a conversion and still allows the distinction between prvalues and xvalues to be made.
llvm-svn: 109406
2010-07-26 17:52:21 +00:00
Nick Lewycky 19b9f958e1 Add source location information to C++ base specifiers.
llvm-svn: 109396
2010-07-26 16:56:01 +00:00
Douglas Gregor a9b2dbc1a4 Kill off the last Destroy method in the AST library
llvm-svn: 109378
2010-07-25 18:23:53 +00:00
Douglas Gregor b412e174db Remove the vast majority of the Destroy methods from the AST library,
since we aren't going to be calling them ever.

llvm-svn: 109377
2010-07-25 18:17:45 +00:00
Eli Friedman e4686d7acf Remove dead code.
llvm-svn: 109358
2010-07-24 21:35:09 +00:00
Eli Friedman 9255adfb7a PR7698: Make sure we correctly handle the initialization of an array with
dependent size.

llvm-svn: 109356
2010-07-24 21:19:15 +00:00
Chris Lattner 938533db60 turn down the logical bitwise confusion warning to not warn
when the RHS of the ||/&& is ever 0 or 1.  This handles a variety of
creative idioms for "true" used in C programs and fixes many false 
positives at the expense of a few false negatives.  This fixes
rdar://8230351.

llvm-svn: 109314
2010-07-24 01:10:11 +00:00
John McCall 2ca705eb13 Support catching Objective C pointers in C++ under the non-fragile NeXT runtime.
Diagnose attempts to do this under the GNU or fragile NeXT runtimes.

llvm-svn: 109298
2010-07-24 00:37:23 +00:00
Douglas Gregor 536f091f95 Be careful; even though we had a proper name at the beginning of
Sema::ActOnDeclarator doesn't mean that the Decl we ended up creating
has a useful name. <rdar://problem/8229910>

llvm-svn: 109296
2010-07-24 00:10:38 +00:00
John McCall dd762d1e5b We never want to pop the translation unit DC, so assert if this happens.
llvm-svn: 109280
2010-07-23 22:45:07 +00:00
Fariborz Jahanian 946274471d Allow __func__ and __FUNCTION__ and __PRETTY_FUNCTION__ inside blocks.
Radar 8218839.

llvm-svn: 109272
2010-07-23 21:53:24 +00:00
Eli Friedman d4c75cddde Fix for PR7694: make sure to pass in a RecordType to CheckBaseClassAccess;
fixes crashes on both valid and invalid code.  The diagnostic here could
potentially be improved, but it's good enough as-is.

llvm-svn: 109257
2010-07-23 19:25:41 +00:00
Douglas Gregor 5cc2c8b9c3 Vectors are not integer types, so the type system should not classify
them as such. Type::is(Signed|Unsigned|)IntegerType() now return false
for vector types, and new functions
has(Signed|Unsigned|)IntegerRepresentation() cover integer types and
vector-of-integer types. This fixes a bunch of latent bugs.

Patch from Anton Yartsev!

llvm-svn: 109229
2010-07-23 15:58:24 +00:00
Bill Wendling 8abd1ca8d2 Remove unneeded iostream include.
llvm-svn: 109219
2010-07-23 07:19:31 +00:00
Fariborz Jahanian 86151343b4 Warn when property ivar lookup finds a global variable
of same name. In nonfragile-abi2, lookup accesses a synthesized
ivar. This is a transition warning.  Radar 8225011.

llvm-svn: 109197
2010-07-22 23:33:21 +00:00
Fariborz Jahanian 6e7e8cc19d atch for implementation of objective-c's -Wselector
warning flag in clang. Little more to do
for a PCH issue. Radar 6507158.

llvm-svn: 109129
2010-07-22 18:24:20 +00:00
Ted Kremenek 1ddd6d2b6b Upgrade "'X' is unavailable" from a warning to an error. This matches GCC's behavior. Note that
GCC emits a warning instead of an error when using an unavailable Objective-C protocol, so now
Clang's behavior is more strict in this case, but more consistent.  We will need to see how much
this fires on real code and determine whether this case should be downgraded to a warning.

Fixes <rdar://problem/8213093>.

llvm-svn: 109033
2010-07-21 20:43:11 +00:00
Fariborz Jahanian da2da9c93e Added extra check when looking for location of '=' in
a copy initialization.

llvm-svn: 109025
2010-07-21 18:40:47 +00:00
Fariborz Jahanian 3fd2a555d3 Fix source location of the initializer in
a copy initialization. Back out hack in objc rewriter.
fixes radar 8213998.

llvm-svn: 109024
2010-07-21 18:31:47 +00:00