Commit Graph

22798 Commits

Author SHA1 Message Date
Anna Zaks c95a6c4c9f [analyzer] Address Jordy's comments for r145985.
llvm-svn: 146683
2011-12-15 21:33:26 +00:00
Douglas Gregor 95ab186240 When name lookup finds a module-private Objective-C class declaration,
check whether any previous declarations of the class were visible.

llvm-svn: 146680
2011-12-15 20:36:27 +00:00
Douglas Gregor dc9166c8e1 Keep track of all declarations of an Objective-C class (both forward
declarations and definitions) as ObjCInterfaceDecls within the same
redeclaration chain. This new representation matches what we do for
C/C++ variables/functions/classes/templates/etc., and makes it
possible to answer the query "where are all of the declarations of
this class?"

llvm-svn: 146679
2011-12-15 20:29:51 +00:00
Richard Smith 0cc85787f7 Refactor and simplify AddInitializerToDecl.
llvm-svn: 146673
2011-12-15 19:20:59 +00:00
Douglas Gregor a323c4c3cd Extend ObjCInterfaceDecl::DefinitionData to contain a pointer to the
definition, and implement ObjCInterfaceDecl::getDefinition()
efficiently based on that.

llvm-svn: 146669
2011-12-15 18:17:27 +00:00
Douglas Gregor 66b310c653 Introduce the core infrastructure needed to model a complete
redeclaration chain for Objective-C classes, including:
  - Using the first declaration as the canonical declaration.
  - Using the definition as the primary DeclContext
  - Making sure that all declarations have a pointer to the definition
  data, and the definition knows that it is the definition.
  - Serialization support for when a definition gets added to a
  declaration that comes from an AST file.

However, note that we're not taking advantage of much of this code
yet, because we're still re-using ObjCInterfaceDecls.

llvm-svn: 146667
2011-12-15 18:03:09 +00:00
Douglas Gregor 2039ca061f Two null Decl*'s don't refer to the same declaration, because they
don't refer to anything. Amusingly, we were relying on this in one
place. Thanks to Chandler for noticing the weirdness in
declaresSameEntity.

llvm-svn: 146659
2011-12-15 17:15:07 +00:00
Hans Wennborg 23926bd2d7 Support the 'a' length modifier in scanf format strings as a C90
extension.

This fixes gcc.dg/format/c90-scanf-3.c and ext-4.c (test for excess
errors).

llvm-svn: 146649
2011-12-15 10:25:47 +00:00
Argyrios Kyrtzidis a0caa29d6f Revert r146646 that was a mistake, and make the intended change in the right file.
Log:
[libclang] Try to unbreak mingw build.

llvm-svn: 146647
2011-12-15 05:53:37 +00:00
Argyrios Kyrtzidis d99472f4cd [libclang] Try to unbreak mingw build.
llvm-svn: 146646
2011-12-15 05:48:43 +00:00
Douglas Gregor c0ac7d688e Move the definition-specific data of ObjCInterfaceDecl into a
separately-allocated DefinitionData structure, which we manage the
same way as CXXRecordDecl::DefinitionData. This prepares the way for
making ObjCInterfaceDecls redeclarable, to more accurately model
forward declarations of Objective-C classes and eliminate the mutation
of ObjCInterfaceDecl that causes us serious trouble in the AST reader.

Note that ObjCInterfaceDecl's accessors are fairly robust against
being applied to forward declarations, because Clang (and Sema in
particular) doesn't perform RequireCompleteType/hasDefinition() checks
everywhere it has to. Each of these overly-robust cases is marked with
a FIXME, which we can tackle over time.

llvm-svn: 146644
2011-12-15 05:27:12 +00:00
Eli Friedman a109e92a66 <climits> has UINT_MAX, not <limits>.
llvm-svn: 146638
2011-12-15 04:24:37 +00:00
Anna Zaks f8548b080d Another fixit for r146633 (to make debian-fnt bot happy), try including limits instead.
llvm-svn: 146637
2011-12-15 03:27:51 +00:00
Anna Zaks 2c74eedbba Fixit for r146633. Make sure UINT_MAX is defined on all platforms.
(Attempt to turn debian-fnt buildbot back to green.)

llvm-svn: 146635
2011-12-15 02:58:00 +00:00
Eli Friedman 8349dc1fd6 Enhance the -Wsign-compare handling to suppress the -Wsign-compare warning in the case of a shifted bitfield. PR11572.
llvm-svn: 146634
2011-12-15 02:41:52 +00:00
Anna Zaks a2510070ee Add support for matching one or more (aka regex +) diagnostic messages with -verify.
Ex:
// expected-warning + {{tainted}

llvm-svn: 146633
2011-12-15 02:28:16 +00:00
Eli Friedman 3715d1f435 gcov-style profiling support for OpenBSD. Patch by Jonathan Gray.
llvm-svn: 146631
2011-12-15 02:15:56 +00:00
Anna Zaks 30373150a1 [analyzer] Ensure that the order in which checker callbacks are called
is deterministic.

Non-determinism was the reason for the test which caused the earlier
buildbot failures, so re-enable the test.

llvm-svn: 146628
2011-12-15 01:36:04 +00:00
Fariborz Jahanian 9e49b6a6ff objc: do not auto synthesize properties declared in
protocols; with a warning. // rdar://10567333

llvm-svn: 146626
2011-12-15 01:03:18 +00:00
Douglas Gregor 95715f9ecf In debugger support mode, if we have a top-level message send
expression with an unknown result type, assume that the result type is
'id'. Fixes <rdar://problem/10400663>.

llvm-svn: 146622
2011-12-15 00:53:32 +00:00
Richard Trieu 553b2b2e5d Modify how the -verify flag works. Currently, the verification string and
diagnostic message are compared.  If either is a substring of the other, then
no error is given.  This gives rise to an unexpected case:

  // expect-error{{candidate function has different number of parameters}}

will match the following error messages from Clang:

  candidate function has different number of parameters (expected 1 but has 2)
  candidate function has different number of parameters

It will also match these other error messages:

  candidate function
  function has different number of parameters
  number of parameters

This patch will change so that the verification string must be a substring of
the diagnostic message before accepting.  Also, all the failing tests from this
change have been corrected.  Some stats from this cleanup:

87 - removed extra spaces around verification strings
70 - wording updates to diagnostics
40 - extra leading or trailing characters (typos, unmatched parens or quotes)
35 - diagnostic level was included (error:, warning:, or note:)
18 - flag name put in the warning (-Wprotocol)

llvm-svn: 146619
2011-12-15 00:38:15 +00:00
Douglas Gregor 0b144e160a Replace all comparisons between ObjCInterfaceDecl pointers with calls
to declaresSameEntity(), as a baby step toward tracking forward
declarations of Objective-C classes precisely. Part of
<rdar://problem/10583531>.

llvm-svn: 146618
2011-12-15 00:29:59 +00:00
Richard Smith 902ca2138f Produce more detailed diagnostics when static_assert condition is not an ICE.
llvm-svn: 146607
2011-12-14 23:32:26 +00:00
Rafael Espindola 00b29189b7 Fix typos.
llvm-svn: 146595
2011-12-14 21:50:24 +00:00
Douglas Gregor 7234103225 Don't consider an overloaded operator& when the expression is actually
going to be a pointer-to-member constant. Fixes <rdar://problem/10544564>.

llvm-svn: 146587
2011-12-14 21:23:13 +00:00
Rafael Espindola 224dd63fff Don't use the frame pointer on linux x86 and x86_64 if optimizing. This
matches gcc's behavior.

Fixes PR8186.

llvm-svn: 146586
2011-12-14 21:02:23 +00:00
DeLesley Hutchins 36f5d8518b Allow empty argument lists in thread safety attributes
llvm-svn: 146580
2011-12-14 19:36:06 +00:00
David Blaikie 96b4874b50 Move & comment the 'decltype in declarator-id' as suggested by Doug Gregor.
llvm-svn: 146576
2011-12-14 18:59:02 +00:00
Bob Wilson 16c4195548 Fix obvious error in _mm_test_all_zeros. PR11565.
Patch by Mathias Gaunard!

llvm-svn: 146565
2011-12-14 17:17:16 +00:00
Douglas Gregor 40d009ff0c Eliminate the vistigial ObjCClassDecl::ObjCClassRef, and inline its
members into ObjCClassDecl, saving ourselves one pointer per forward
declaration.

llvm-svn: 146564
2011-12-14 17:12:03 +00:00
Douglas Gregor 4a814568b2 When name lookup comes across a declaration that is in a module that
is not visible, look for any previous declarations of that entity that
might be visible.

llvm-svn: 146563
2011-12-14 16:03:29 +00:00
Matt Beaumont-Gay 5533a55172 r146430 lost some compile-time performance on MultiSource/Benchmarks/MiBench/security-rijndael; this gets most of it back.
llvm-svn: 146562
2011-12-14 16:02:15 +00:00
Bob Wilson 721d4b858d Enable stack protectors by default for iOS. <rdar://problem/8836680>
llvm-svn: 146552
2011-12-14 06:08:25 +00:00
Anna Zaks 099fe3fb28 [analyzer] Treat stdin as a source of taint.
Some of the test cases do not currently work because the analyzer core
does not seem to call checkers for pre/post DeclRefExpr visits.
(Opened radar://10573500. To be fixed later on.)

llvm-svn: 146536
2011-12-14 00:56:18 +00:00
Anna Zaks 04b57c25bc [analyzer] Minor refactor to addTaint.
llvm-svn: 146535
2011-12-14 00:56:15 +00:00
Anna Zaks eefc0e9342 [analyzer] Mark output of fscanf and fopen as tainted.
llvm-svn: 146533
2011-12-14 00:56:02 +00:00
Anna Zaks d6bb3227de [analyzer] Mark getenv output as tainted.
Also, allow adding taint to a region (not only a symbolic value).

llvm-svn: 146532
2011-12-14 00:55:58 +00:00
Chad Rosier 1332d9b26a Per discussion on the list, remove BitcodeVerify pass to reimplement as a free function.
llvm-svn: 146530
2011-12-14 00:29:23 +00:00
Richard Trieu 96ed5b6b47 Make the diagnostic message more consistant. Update the type comparison to
handle non-pointer types.  This is for the extra info printed when function
types are compared.

llvm-svn: 146525
2011-12-13 23:19:45 +00:00
Fariborz Jahanian c17c86b56c objc: diagnose duplicate declaration of methods
in classes. // rdar://10535349

llvm-svn: 146504
2011-12-13 19:40:34 +00:00
Abramo Bagnara d541a4c70d Added an assertion about overflow in sizeof evaluation. This does not solve the underlying structural issue that is waiting for a proper solution.
llvm-svn: 146482
2011-12-13 11:23:52 +00:00
David Blaikie 42b99e08e6 Disallow decltype in qualified declarator-ids.
llvm-svn: 146480
2011-12-13 08:03:36 +00:00
Richard Smith 357362d00b Add checks and diagnostics for many of the cases which C++11 considers to not
be constant expressions.

llvm-svn: 146479
2011-12-13 06:39:58 +00:00
Douglas Gregor 4dc71835f5 Set umbrella directory correctly when we infer a framework module
llvm-svn: 146451
2011-12-12 23:55:05 +00:00
Nick Lewycky 12eae8085c Fix "control may reach end of non-void function" warning.
llvm-svn: 146448
2011-12-12 23:36:07 +00:00
Francois Pichet 025131601d Implement the Microsoft __if_exists/if_not_exists extension in initializer-list.
Necessary to parse Microsoft ATL code.

Example: 
  int array[] = {
    0, 
    __if_exists(CLASS::Type) {2, }
    3
  };

will declare an array of 2 or 3 elements depending on if CLASS::Type exists or not.

llvm-svn: 146447
2011-12-12 23:24:39 +00:00
Douglas Gregor 18b5864b83 Tweak submodule ID handling in the AST writer
llvm-svn: 146445
2011-12-12 23:17:57 +00:00
Fariborz Jahanian b989e6e50a objc-arc: better diagnostic when block is declared
inside a struct/union.

llvm-svn: 146444
2011-12-12 23:17:04 +00:00
Eli Friedman 3c840aad54 Make CGRecordLayoutBuilder correctly switch over to a packed class when a class has a base whose alignment will break the class layout. <rdar://problem/10551376>.
llvm-svn: 146443
2011-12-12 23:13:20 +00:00
Chad Rosier c4399f779b Add frontend flags to enable bitcode verifier pass.
llvm-svn: 146441
2011-12-12 23:05:47 +00:00