Commit Graph

44609 Commits

Author SHA1 Message Date
Fariborz Jahanian 83f1be1bfc Objective-C: Issue deprecated warning when using a
deprecated typedef to subclass or invoke a class method.
// rdar://13569424

llvm-svn: 178775
2013-04-04 18:45:52 +00:00
Ted Kremenek f5603128df Add test case to show that 'availability' and 'deprecated' do *not* inherit when redeclaring ObjC properties.
llvm-svn: 178770
2013-04-04 17:58:30 +00:00
Rafael Espindola 8f45ddf5d9 Use isExternalLinkage instead of hasExternalLinkage.
Having these not be the same makes an easy to misuse API. We should audit the
uses and probably rename to something like

foo->hasExternalLinkage():
  The c++ standard one. That is UniqueExternalLinkage or ExternalLinkage.

foo->hasUniqueExternalLinkage():
  Is UniqueExternalLinkage.

foo->hasCogeGenExternalLinkage():
  Is ExternalLinkage.

llvm-svn: 178768
2013-04-04 17:16:12 +00:00
Benjamin Kramer 08db461ca7 Make helpers static & 80 cols.
llvm-svn: 178767
2013-04-04 17:07:04 +00:00
Rafael Espindola 2b0b13bc44 Fix a recent linkage regression.
Now that we don't have a semantic storage class, use the linkage.

Thanks to Bruce Stephens for reporting this.

llvm-svn: 178766
2013-04-04 16:43:41 +00:00
Alexey Samsonov c01f4f0d4d Propagate path to ASan/MSan symbolizer into test environment to produce useful reports on errors.
llvm-svn: 178750
2013-04-04 07:41:20 +00:00
Eric Christopher 006208cfad Plumb through the -fsplit-stack option using the existing backend
support.

Caveat: Other than the existing segmented stacks support, no
claims are made of this working.

llvm-svn: 178744
2013-04-04 06:29:47 +00:00
Ted Kremenek 51b7ed4de5 Revert r177948. We decided that we do not want ObjC property redeclarations to inherit "deprecated".
llvm-svn: 178743
2013-04-04 05:29:15 +00:00
Rafael Espindola 7b51ae8e0e Add hasExternalLinkageUncached back with the test that Richard provided, but
keep the call at the current location.

llvm-svn: 178741
2013-04-04 04:40:17 +00:00
Richard Smith 5dacbec4aa Don't build this test with modules for now, it's causing buildbot failures.
llvm-svn: 178740
2013-04-04 03:48:33 +00:00
Rafael Espindola 4dc336b20f Avoid computing the linkage instead of avoiding caching it.
This mostly reverts 178733, but keeps the tests.

I don't claim to understand how hidden sub modules work or when we need to see
them (is that documented?), but this has the same semantics and avoids adding
hasExternalLinkageUncached which has the same foot gun potential as the old
hasExternalLinkage.

Last but not least, not computing linkage when it is not needed is more
efficient.

llvm-svn: 178739
2013-04-04 03:27:32 +00:00
Richard Smith 584f7dcc0e Add tests that build modules for our builtin headers, and fix two buglets exposed by doing so.
llvm-svn: 178736
2013-04-04 02:55:24 +00:00
Rafael Espindola 869fe0448b Fix linkage related crash.
This test was exactly the opposite of what it should be. We should check if
there old decl has linkage (where it makes sense) and if the new decl has
the extern keyword.

llvm-svn: 178735
2013-04-04 02:47:57 +00:00
Richard Smith 86c0d06194 Fix 41 of the 61 tests which fail with modules enabled: we were computing and
caching the linkage for a declaration before we set up its redeclaration chain,
when determining whether a declaration could be a redeclaration of something
from an unimported submodule. We actually want to look at the declaration as if
it were not a redeclaration here, so compute the linkage but don't cache it.

llvm-svn: 178733
2013-04-04 01:51:11 +00:00
John McCall e48f389ce6 Be sure to check ARC conventions on the implicit method declarations
of a property just in case the property's getter happens to be +1.
We won't synthesize a getter for such a property, but we will allow
the user to define a +1 method for it.
rdar://13115896

llvm-svn: 178731
2013-04-04 01:38:37 +00:00
Rafael Espindola 5515ff804f cmake: mark clang as needing exported symbol.
This is a nop right now, but committing this first avoids a temporary breakage
when the llvm files change to not default to exporting symbols.

llvm-svn: 178723
2013-04-04 00:58:40 +00:00
John McCall 770a4c1a37 Protect the values of array and dictionary literals from the
ARC optimizer while they're held in local unsafe buffers.

Based on a patch by Jesse Rusak!

rdar://13573224

llvm-svn: 178721
2013-04-04 00:20:38 +00:00
Nico Weber 69a7914fec Make the ObjC attributes diagnostics a bit more informative.
llvm-svn: 178720
2013-04-04 00:15:10 +00:00
Tanya Lattner daa74b93c9 Update OpenCL comments to mention spec section and version.
llvm-svn: 178716
2013-04-03 23:55:58 +00:00
Douglas Gregor 151976694a <rdar://problem/13560075> Teach name lookup for builtin names to find hidden declarations.
Normal name lookup ignores any hidden declarations. When name lookup
for builtin declarations fails, we just synthesize a new
declaration at the point of use. With modules, this could lead to
multiple declarations of the same builtin, if one came from a (hidden)
submodule that was later made visible. Teach name lookup to always
find builtin names, so we don't create these redundant declarations in
the first place.

llvm-svn: 178711
2013-04-03 23:06:26 +00:00
Richard Smith e8a9d61f47 Revert accidental commit.
llvm-svn: 178707
2013-04-03 22:50:34 +00:00
Richard Smith c0fbba7d8a Pare back r164351 somewhat. The problem that change was addressing was that we
don't serialize a lookup map for the translation unit outside C++ mode, so we
can't tell when lookup within the TU needs to look within modules. Only apply
the fix outside C++ mode, and only to the translation unit.

llvm-svn: 178706
2013-04-03 22:49:41 +00:00
Anna Zaks d3254b4462 [analyzer] Allow tracknullOrUndef look through the ternary operator even when condition is unknown
Improvement of r178684 and r178685.

Jordan has pointed out that I should not rely on the value of the condition to know which expression branch
has been taken. It will not work in cases the branch condition is an unknown value (ex: we do not track the constraints for floats).
The better way of doing this would be to find out if the current node is the right or left successor of the node
that has the ternary operator as a terminator (which is how this is done in other places, like ConditionBRVisitor).

llvm-svn: 178701
2013-04-03 21:34:12 +00:00
Argyrios Kyrtzidis f0eaa64c98 [preprocessor] Minor optimization following r178671.
Don't bother looking for parameter index of 'B' token if 'A' is not a parameter.

llvm-svn: 178699
2013-04-03 21:29:07 +00:00
John McCall c70fca60da Complain about attempts to befriend declarations via a using
declaration.  Patch by Stephen Lin!

llvm-svn: 178698
2013-04-03 21:19:47 +00:00
Jordan Rose 8647ffcda5 [analyzer] Correctly handle destructors for lifetime-extended temporaries.
The lifetime of a temporary can be extended when it is immediately bound
to a local reference:

  const Value &MyVal = Value("temporary");

In this case, the temporary object's lifetime is extended for the entire
scope of the reference; at the end of the scope it is destroyed.

The analyzer was modeling this improperly in two ways:
- Since we don't model temporary constructors just yet, we create a fake
  temporary region when it comes time to "materialize" a temporary into
  a real object (lvalue). This wasn't taking base casts into account when
  the bindings being materialized was Unknown; now it always respects base
  casts except when the temporary region is itself a pointer.
- When actually destroying the region, the analyzer did not actually load
  from the reference variable -- it was basically destroying the reference
  instead of its referent. Now it does do the load.

This will be more useful whenever we finally start modeling temporaries,
or at least those that get bound to local reference variables.

<rdar://problem/13552274>

llvm-svn: 178697
2013-04-03 21:16:58 +00:00
Anna Zaks 8ef07e5181 [analyzer] Rename “Mac OS X API”, “Mac OS API” -> “API Misuse (Apple)”
As they are relevant on both Mac and iOS.

llvm-svn: 178687
2013-04-03 19:28:22 +00:00
Anna Zaks c610bcacde [analyzer] Warn when nil receiver results in forming null reference
This also allows us to ensure IDC/return null suppression gets triggered in such cases.

llvm-svn: 178686
2013-04-03 19:28:19 +00:00
Anna Zaks b5d2fe8a1d [analyzer] make peelOffOuterExpr in BugReporterVisitors recursively peel off select Exprs
llvm-svn: 178685
2013-04-03 19:28:15 +00:00
Anna Zaks ede0983f88 [analyzer] Properly handle the ternary operator in trackNullOrUndefValue
1) Look for the node where the condition expression is live when checking if
it is constrained to true or false.

2) Fix a bug in ProgramState::isNull, which was masking the problem. When
the expression is not a symbol (,which is the case when it is Unknown) return
unconstrained value, instead of value constrained to “false”!
(Thankfully other callers of isNull have not been effected by the bug.)

llvm-svn: 178684
2013-04-03 19:28:12 +00:00
Anna Zaks ddef54cad6 [analyzer] Fix typo.
Thanks Jordan!

llvm-svn: 178683
2013-04-03 19:28:05 +00:00
Rafael Espindola 6ae7e50be4 Add 178663 back.
http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green
before it processed the reverted 178663, so it could not have been the culprit.

Revert "Revert 178663."

This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41.

llvm-svn: 178682
2013-04-03 19:27:57 +00:00
Rafael Espindola 985a3abee4 Revert 178663.
Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb

Revert "Don't compute a patched/semantic storage class."

This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05.

llvm-svn: 178681
2013-04-03 19:22:20 +00:00
Fariborz Jahanian 3a65ce3a56 Objective-C modern rewriter. Fixes a bug
rewriting typedef for a qualified object type
and also when two declarations happen to be on the
same line. // rdar://13562505

llvm-svn: 178680
2013-04-03 19:11:21 +00:00
Argyrios Kyrtzidis 0c2f30b9d3 [preprocessor] Allow comparing two macro definitions syntactically instead of only lexically.
Syntactically means the function macro parameter names do not need to use the same
identifiers in order for the definitions to be considered identical.

Syntactic equivalence is a microsoft extension for macro redefinitions and we'll also
use this kind of comparison to check for ambiguous macros coming from modules.

rdar://13562254

llvm-svn: 178671
2013-04-03 17:39:30 +00:00
Nico Weber 04e213b6b6 Emit a nicer diagnostic for misplaced attributes on ObjC directives.
llvm-svn: 178670
2013-04-03 17:36:11 +00:00
Jyotsna Verma 0707b125e3 Test Hexagon tool-chain when configured as OSless target.
llvm-svn: 178669
2013-04-03 17:17:48 +00:00
Kaelyn Uhrain 989b7ca092 Give the default CorrectionCandidateCallback::ValidateCandidate some
smarts so that it doesn't approve of keywords and/or type names when it
knows (based on its flags) that those kinds of corrections are not
wanted.

llvm-svn: 178668
2013-04-03 16:59:49 +00:00
Rafael Espindola adea16bd9e Don't compute a patched/semantic storage class.
For variables and functions clang used to store two storage classes. The one
"as written" in the code and a patched one, which, for example, propagates
static to the following decls.

This apparently is from the days clang lacked linkage computation. It is now
redundant and this patch removes it.

llvm-svn: 178663
2013-04-03 15:50:00 +00:00
Daniel Jasper a628c98bd3 Improve formatting of for loops and multi-variable DeclStmts.
This combines several related changes:
a) Don't break before after the variable types in for loops with a
   single variable.
b) Better indent DeclStmts defining multiple variables.

Before:
bool aaaaaaaaaaaaaaaaaaaaaaaaa =
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa),
     bbbbbbbbbbbbbbbbbbbbbbbbb =
         bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(bbbbbbbbbbbbbbbb);
for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         aaaaaaaaaaa = aaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaa;
     aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) {
}

After:
bool aaaaaaaaaaaaaaaaaaaaaaaaa =
         aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaa),
     bbbbbbbbbbbbbbbbbbbbbbbbb =
         bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(bbbbbbbbbbbbbbbb);
for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa =
         aaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaa;
     aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) {
}

llvm-svn: 178641
2013-04-03 13:36:17 +00:00
Alexander Kornienko b1be9d6e74 Even better way to handle comments adjacent to preprocessor directives.
Summary:
It turns out that we don't need to store CommentsBeforeNextToken in the
line state, but rather flush them before we start parsing preprocessor
directives. This fixes wrong comment indentation in code blocks in macro calls
(the test is included).

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D617

llvm-svn: 178638
2013-04-03 12:38:53 +00:00
Andy Gibbs c804e08a67 Enable use of _Static_assert inside structs and unions in C11 mode (as per C11 6.7.2.1p1).
llvm-svn: 178632
2013-04-03 09:46:04 +00:00
Andy Gibbs 22e140bee4 Assert that Parser::ParseStructUnionBody is not called for C++ code.
llvm-svn: 178631
2013-04-03 09:31:19 +00:00
Daniel Jasper 5188e6b295 Cleanup, add comments and address review comments.
No functional changes.

llvm-svn: 178626
2013-04-03 07:21:51 +00:00
Argyrios Kyrtzidis 3e612b419a [modules] If a submodule has re-definitions of the same macro, only the last definition will be used as the "exported" one.
Fixes rdar://13562262

llvm-svn: 178622
2013-04-03 05:11:33 +00:00
Douglas Gregor 05ba2a055d Use getPredefinesFileID() appropriately.
Thanks to Argyrios for the pointer.

llvm-svn: 178616
2013-04-03 03:16:36 +00:00
Richard Trieu 17f13ecc5b Refactor the Get* functions to be more consistant among themselves.
llvm-svn: 178613
2013-04-03 03:06:48 +00:00
Richard Trieu bcd06c0220 Do not assume the template argument is an integer only because the
expressions are integer.  It can also be ValueDecl expressions

Use the type information from the TemplateParameterList instead

Patch by Olivier Goffart!

llvm-svn: 178611
2013-04-03 02:31:17 +00:00
Richard Trieu ad13f55356 Fix a crasher in Template Diffing.
When support was added for declaration arguments, the case of variadic
declaration arguments was not supported.  This patch fixes that problem by
not crashing when certain ValueDecl's are null.

Patch by Olivier Goffart!

llvm-svn: 178610
2013-04-03 02:22:12 +00:00
Richard Trieu 981de5cef3 Fix a crasher in Template Diffing.
Value depenedent expressions for default arguments cannot be evaluated.
Instead, use the desugared template type to get an argument expression that
can be used.  This is needed for both integer and declaration arguements.

Also, move this common code into a separate function.

Patch by Olivier Goffart!

llvm-svn: 178609
2013-04-03 02:11:36 +00:00