Commit Graph

13109 Commits

Author SHA1 Message Date
Eli Friedman e0afc98742 Make clang's AST model sizeof and typeof with potentially-evaluated operands correctly, similar to what we already do with typeid.
llvm-svn: 148610
2012-01-21 01:01:51 +00:00
Fariborz Jahanian 1630c15b0f arg migrator: change all "assign" of object properties
to "strong" when migrating from GC. // rdar://10532449

llvm-svn: 148607
2012-01-21 00:43:53 +00:00
Douglas Gregor 3aa55267c4 Fix the code completion string for variadic macros with more than one
argument, which was broken and very ugly (and even had a test case to
make *sure* it was broken and ugly). Fixes <rdar://problem/10609117>.

llvm-svn: 148606
2012-01-21 00:43:38 +00:00
Seth Cantrell a7956f92df add tests for wide character encodings
and fix typo

llvm-svn: 148603
2012-01-21 00:16:11 +00:00
DeLesley Hutchins 68f7b1a647 Handle thread safety attributes on functions with separate definitions and declarations.
llvm-svn: 148599
2012-01-20 23:24:41 +00:00
DeLesley Hutchins 30398dd410 Delayed template instantiation of late-parsed attributes.
llvm-svn: 148595
2012-01-20 22:50:54 +00:00
DeLesley Hutchins ceec3063e2 Instantiate dependent attributes when instantiating templates.
llvm-svn: 148592
2012-01-20 22:37:06 +00:00
Ted Kremenek 9139892728 The 'l' length modifier makes sense with the scanlist conversion specifier.
llvm-svn: 148586
2012-01-20 22:11:52 +00:00
Eric Christopher f3ed1bc8ac Testcase for PR11345.
llvm-svn: 148585
2012-01-20 22:10:18 +00:00
Bob Wilson 1052b0c467 Remove unnecessary and incorrect redirection of stderr.
llvm-svn: 148583
2012-01-20 22:01:45 +00:00
Sebastian Pop 422377cfd3 rename -ccc-host-triple into -target
llvm-svn: 148582
2012-01-20 22:01:23 +00:00
Ted Kremenek e7b9d4342b Tighten format string diagnostic and make it a bit clearer (and a bit closer to GCC's).
llvm-svn: 148579
2012-01-20 21:52:58 +00:00
Anna Zaks 8298af85a6 [analyzer] Add taint awareness to DivZeroChecker.
llvm-svn: 148566
2012-01-20 20:28:31 +00:00
Fariborz Jahanian 9652adf2af arc migrator: replace "retain" attribute with "strong"
which have same semantics in mrr as well as arr.
// rdar://10688312

llvm-svn: 148559
2012-01-20 19:15:02 +00:00
Ted Kremenek b9ff6b2302 Reenable DeadStoresChecker under --analyze, and move the IdempotentOperationsChecker to the 'experimental' category. Fixes <rdar://problem/10146347>.
llvm-svn: 148533
2012-01-20 06:00:17 +00:00
Ted Kremenek 89eaf8d531 Implement checker that looks for calls to mktemps and friends that have fewer than 6 Xs. Implements <rdar://problem/6336672>.
llvm-svn: 148531
2012-01-20 05:35:06 +00:00
Ted Kremenek c54dc9515d Turn 'SecuritySyntaxChecker' into a "meta" security checker for insecure APIs. Now
multiple checks are exposed as separate checkers, but CheckerManager only creates
one Checker object.

llvm-svn: 148525
2012-01-20 01:44:29 +00:00
Argyrios Kyrtzidis 908c4dcc5d [libclang] Fix crash when indexing attributes, rdar://10702250.
llvm-svn: 148524
2012-01-20 01:38:51 +00:00
Eli Friedman 456f01833b Remove PotentiallyPotentiallyEvaluated, and replace it with a much simpler and less error-prone way of handling the relevant cases. Towards marking of whether a declaration is used more accurately.
llvm-svn: 148522
2012-01-20 01:26:23 +00:00
Anna Zaks 3b754b25bd [analyzer] Add socket API as a source of taint.
llvm-svn: 148518
2012-01-20 00:11:19 +00:00
Richard Smith ab3fe0f9ba Further testing for instantiation of out-of-line constexpr static data member
template definitions.

llvm-svn: 148506
2012-01-19 22:50:02 +00:00
Richard Smith 45bb45523f An instantiation of a constexpr static data member in a class template is
constexpr.

llvm-svn: 148505
2012-01-19 22:46:17 +00:00
Richard Trieu 4972a6dd08 Extend the error of invalid token after declarations to include fixits for
!=, %=, ^=, &=, *=, -=, |=, /=, <<=, <=, >=, and >>= to =.

llvm-svn: 148499
2012-01-19 22:01:51 +00:00
Tanya Lattner 3dd33b296a A few style changes.
Change CheckVectorLogicalOperands to pass params by ref.
Add another test case.

llvm-svn: 148452
2012-01-19 01:16:16 +00:00
Richard Smith f8379a0fc3 constexpr: converted constant expression handling for enumerator values, case
values and non-type template arguments of integral and enumeration types.

This change causes some legal C++98 code to no longer compile in C++11 mode, by
enforcing the C++11 rule that narrowing integral conversions are not permitted
in the final implicit conversion sequence for the above cases.

llvm-svn: 148439
2012-01-18 23:55:52 +00:00
Richard Trieu c64d3230d2 Change the error when a '+=' follows a declaration to suggest a fixit to '=' instead of just suggesting a ';'.
Old error:
plusequaldeclare1.cc:3:8: error: expected ';' at end of declaration
  int x += 6;
       ^
       ;

New error:
plusequaldeclare1.cc:3:9: error: invalid '+=' at end of declaration; did you
      mean '='?
  int x += 6;
        ^~
        =

llvm-svn: 148433
2012-01-18 22:54:52 +00:00
Kaelyn Uhrain b1378408e4 Convert SemaDecl.cpp to pass callback objects to CorrectTypo.
Includes tests highlighting the cases where accuracy has improved
(there is one call that does no filtering beyond selecting the set
of allowed keywords, and one call that only triggers for ObjC code
for which a test by someone who knows ObjC would be welcome). Also
fixes a small typo in one of the suggestion messages, and drops a
malformed "expected-note" for a suggestion that did not occur even
when the malformed note was committed as r145930.

llvm-svn: 148420
2012-01-18 21:41:41 +00:00
Fariborz Jahanian 28324b0066 objc: deprecate direct usage of 'isa' of objc objects
in favor of usage of api's intended for.
// rdar://8290002

llvm-svn: 148404
2012-01-18 19:08:56 +00:00
Douglas Gregor 226173ae93 In the driver, -fmodules enables modules for C/Objective-C but one
also needs -fcxx-modules to enable modules for C++/Objective-C++.

llvm-svn: 148393
2012-01-18 15:19:58 +00:00
Seth Cantrell 6255c257e9 Add and update tests for character literals
llvm-svn: 148392
2012-01-18 12:27:10 +00:00
Richard Smith 66e05fe630 Move narrowing conversion detection code from SemaInit to SemaOverload, ready
for it to be used in converted constant expression checking, and fix a couple
of issues:
 - Conversion operators implicitly invoked prior to the narrowing conversion
   were not being correctly handled when determining whether a constant value
   was narrowed.
 - For conversions from floating-point to integral types, the diagnostic text
   incorrectly always claimed that the source expression was not a constant
   expression.

llvm-svn: 148381
2012-01-18 05:21:49 +00:00
Nick Lewycky e2367d2508 Add testcase for r148375!
llvm-svn: 148378
2012-01-18 04:28:31 +00:00
Eli Friedman 7bda7f7533 Make PotentiallyPotentiallyEvaluated contexts work correctly when referencing a class field from outside an instance method.
llvm-svn: 148376
2012-01-18 03:53:45 +00:00
Richard Smith 9cf080fba3 A call to strlen is not a constant expression, even if we're treating it as a
builtin.

llvm-svn: 148374
2012-01-18 03:06:12 +00:00
Eli Friedman 1f4f9ddee8 The value of a case statement is a potentially evaluated context. Found by inspection.
llvm-svn: 148373
2012-01-18 02:54:10 +00:00
Anna Zaks 560dbe9ac9 [analyzer] Taint: warn when tainted data is used to specify a buffer
size (Ex: in malloc, memcpy, strncpy..)

(Maybe some of this could migrate to the CString checker. One issue
with that is that we might want to separate security issues from
regular API misuse.)

llvm-svn: 148371
2012-01-18 02:45:11 +00:00
Anna Zaks 5d324e509c [analyzer] Taint: add taint propagation rules for string and memory copy
functions.

llvm-svn: 148370
2012-01-18 02:45:07 +00:00
Eli Friedman fbc0dff6f8 Fix a couple issues where we didn't correctly delay diagnostics in PotentiallyPotentiallyEvaluated contexts. In preparation for making sizeof() PotentiallyPotentiallyEvaluated.
llvm-svn: 148367
2012-01-18 01:05:54 +00:00
Fariborz Jahanian 07b5f4ca03 output body of folded case again.
llvm-svn: 148361
2012-01-17 23:55:19 +00:00
Fariborz Jahanian 9ce39e299d Folding away unreachable case statement.
patch (slightly revised) by Aaron Ballman.

llvm-svn: 148359
2012-01-17 23:39:50 +00:00
Fariborz Jahanian c72a807039 objc-arc: when 'assign' attribute is unspecified,
rely on property's type for its life-time to avoid
bogus warning with -Warc-unsafe-retained-assign.
// rdar://10694932

llvm-svn: 148355
2012-01-17 22:58:16 +00:00
Sebastian Redl 42acd4a05b Auto deduction support for std::initializer_list, including for-range support. This means you can now write:
for (int i : {1, 4, 512, 23, 251}) {}

llvm-svn: 148353
2012-01-17 22:50:08 +00:00
Sebastian Redl 43144e72b5 Template argument deduction for std::initializer_list arguments from initializer lists.
llvm-svn: 148352
2012-01-17 22:49:58 +00:00
Sebastian Redl 10f0fc04a8 Basic overloading support for std::initializer_list.
llvm-svn: 148350
2012-01-17 22:49:48 +00:00
Sebastian Redl c1839b1b09 Sema support for initialization of std::initializer_list from initializer lists.
This does not yet support CodeGen.

llvm-svn: 148349
2012-01-17 22:49:42 +00:00
Bob Wilson 206e2302eb Disable -Wduplicate-method-match by default. <rdar://problem/10663536>
llvm-svn: 148343
2012-01-17 22:24:32 +00:00
Eli Friedman 419b1ff677 Correctly resolve an overload set passed to an overloaded operator=. PR11784.
llvm-svn: 148335
2012-01-17 21:27:43 +00:00
Richard Smith 4ef685becf Enable constant evaluation of implicit calls to constexpr conversion operators.
llvm-svn: 148333
2012-01-17 21:17:26 +00:00
John McCall 9701731a3e When initializing a catch variable in ARC, be sure to emit retains
or whatever else is required for the initialization instead of
assuming it can be done with a simple store.

Fixes PR11732.

llvm-svn: 148325
2012-01-17 20:16:56 +00:00
Jean-Daniel Dupas 0ae6e671cc Fix a couples of issues in format strings checking.
PR 10274: format function attribute with the NSString archetype yields no compiler warnings
PR 10275: format function attribute isn't checked in Objective-C methods

llvm-svn: 148324
2012-01-17 20:03:31 +00:00