Граф коммитов

43461 Коммитов

Автор SHA1 Сообщение Дата
Richard Smith 5b8d0af423 Revert accidental commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178707 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 22:50:34 +00:00
Richard Smith 4382867f04 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178706 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 22:49:41 +00:00
Anna Zaks 702077f141 [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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178701 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 21:34:12 +00:00
Argyrios Kyrtzidis 4ad33d0f97 [preprocessor] Minor optimization following r178671.
Don't bother looking for parameter index of 'B' token if 'A' is not a parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178699 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 21:29:07 +00:00
John McCall 78037ac3e7 Complain about attempts to befriend declarations via a using
declaration.  Patch by Stephen Lin!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178698 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 21:19:47 +00:00
Jordan Rose 08291a937a [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>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178697 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 21:16:58 +00:00
Anna Zaks 88530f880e [analyzer] Rename “Mac OS X API”, “Mac OS API” -> “API Misuse (Apple)”
As they are relevant on both Mac and iOS.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178687 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 19:28:22 +00:00
Anna Zaks 841f16846e [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178686 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 19:28:19 +00:00
Anna Zaks cabc3fddae [analyzer] make peelOffOuterExpr in BugReporterVisitors recursively peel off select Exprs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178685 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 19:28:15 +00:00
Anna Zaks c1bef5671e [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.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178684 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 19:28:12 +00:00
Anna Zaks 3d3fb9078f [analyzer] Fix typo.
Thanks Jordan!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178683 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 19:28:05 +00:00
Rafael Espindola d2615cc53b 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 4f8a3eb2ce.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178682 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 19:27:57 +00:00
Rafael Espindola 4f8a3eb2ce 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 8f187f62cb.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178681 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 19:22:20 +00:00
Fariborz Jahanian f9f30791dd 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178680 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 19:11:21 +00:00
Argyrios Kyrtzidis bd25ff8632 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178671 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 17:39:30 +00:00
Nico Weber 9f4f5f1ca1 Emit a nicer diagnostic for misplaced attributes on ObjC directives.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178670 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 17:36:11 +00:00
Jyotsna Verma 2efbe47856 Test Hexagon tool-chain when configured as OSless target.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178669 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 17:17:48 +00:00
Kaelyn Uhrain 20a7cf4d78 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178668 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 16:59:49 +00:00
Rafael Espindola 8f187f62cb 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178663 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 15:50:00 +00:00
Daniel Jasper 8ed9f2b25f 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) {
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178641 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 13:36:17 +00:00
Alexander Kornienko 4128e19d6f 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178638 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 12:38:53 +00:00
Andy Gibbs 74b9fa16e5 Enable use of _Static_assert inside structs and unions in C11 mode (as per C11 6.7.2.1p1).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178632 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 09:46:04 +00:00
Andy Gibbs f50f3f7cee Assert that Parser::ParseStructUnionBody is not called for C++ code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178631 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 09:31:19 +00:00
Daniel Jasper 3776ef3a6c Cleanup, add comments and address review comments.
No functional changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178626 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 07:21:51 +00:00
Argyrios Kyrtzidis b2dbfd8669 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178622 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 05:11:33 +00:00
Douglas Gregor 670b2e6e9e Use getPredefinesFileID() appropriately.
Thanks to Argyrios for the pointer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178616 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 03:16:36 +00:00
Richard Trieu d3ec874e84 Refactor the Get* functions to be more consistant among themselves.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178613 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 03:06:48 +00:00
Richard Trieu 709caea14f 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!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178611 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 02:31:17 +00:00
Richard Trieu fa3d275865 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!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178610 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 02:22:12 +00:00
Richard Trieu 625785d370 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!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178609 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 02:11:36 +00:00
Eric Christopher 54c63523ec Move this file into the correct directory.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178607 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 01:58:56 +00:00
Eric Christopher d3e22dfb77 From PR9121 gcc defaulted to omitting the frame pointer on linux,
however, it doesn't do that unless we're optimizing. Change
that and haul out to a helper function. Also make this a driver
test appropriate rather than an assembly test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178606 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 01:58:53 +00:00
Jordan Rose d4582b8e6d Escape more @ signs in Doxygen comments.
Doxygen treats "@command" the same as "\command" in a doc comment, so
whenever we talk about Objective-C things like "@interface" we have to
make sure to escape them.

Let's try to keep Clang -Wdocumentation-clean!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178603 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 01:39:23 +00:00
Jordan Rose ecee1651c1 [analyzer] Better model for copying of array fields in implicit copy ctors.
- Find the correct region to represent the first array element when
  constructing a CXXConstructorCall.
- If the array is trivial, model the copy with a primitive load/store.
- Don't warn about the "uninitialized" subscript in the AST -- we don't use
  the helper variable that Sema provides.

<rdar://problem/13091608>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178602 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 01:39:08 +00:00
John McCall 73c56bb0c8 In ObjC++ on legacy runtimes, push an EH cleanup as well as
a normal cleanup when entering a @try or @synchronized to
ensure that we clean that up if an exception is triggered.

Apparently GCC did this, so it's hard to argue that we shouldn't
do at least as much.

rdar://12364847

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178599 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 00:56:07 +00:00
Fariborz Jahanian 7b47adcbea Objective-C arc [qui]. Don't issue the bridge cast
warning when doing a __bride cast in non-arc
mode (which has no retain count effect).
// rdar://13514210


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178592 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 23:48:59 +00:00
Aaron Ballman 77e2788803 Silencing warnings in MSVC due to duplicate identifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178591 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 23:47:53 +00:00
Eric Christopher f068c92f22 Revert "Revert r178079, it caused PR15637."
This reverts commit r178497 since the backend has been fixed.

Also add a test to ensure that we're emitting template information for unions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178587 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 22:59:11 +00:00
Stefanus Du Toit 58b65d953e Update assertion string to new name of ArithAssignBinaryOperator
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178572 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 20:18:18 +00:00
Chad Rosier 148bab27d3 [ms-inline asm] Test case for r178566.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178568 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 20:03:29 +00:00
Richard Smith 0ab5b4c438 If a defaulted special member is implicitly deleted, check whether it's
overriding a non-deleted virtual function. The existing check for this doesn't
catch this case, because it fires before we mark the method as deleted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178563 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 19:38:47 +00:00
Fariborz Jahanian 0c70181854 Objective-C: Provide fixit hints when warning
about 'isa' ivar being explicitely accessed
when base is a user class object reference.
// rdar://13503456


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178562 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 18:57:54 +00:00
Richard Smith 1b461b0ad0 Remove dead store.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178561 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 18:57:50 +00:00
Edwin Vane 7b69cd0944 Adding a hasLocalQualifiers() AST Matcher.
Updated tests and docs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178556 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 18:15:55 +00:00
Alexander Kornienko 8b0822b304 Moved fallthrough regression test to switch-implicit-fallthrough.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178554 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 17:55:01 +00:00
Reid Kleckner cb428a1ac0 [ms-cxxabi] Rename enum and remove dead case per Jordan's suggestion
The IHM_ prefix was a fairly gross abbreviation to try to hit three
characters for uniqueness.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178551 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 17:40:19 +00:00
Reid Kleckner 4ba4929527 [ms-cxxabi] Remove unused variable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178550 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 17:24:20 +00:00
Reid Kleckner 4410489163 [ms-cxxabi] Move MS inheritance model calculation into MemberPointerType
Summary:
This makes it possible to share code between lib/AST/MicrosoftCXXABI.cpp
and lib/CodeGen/MicrosoftCXXABI.cpp.  No functionality change.

Also adds comments about the layout of the member pointer structs as I
currently understand them.

Reviewers: rjmccall

CC: timurrrr, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178548 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 16:23:57 +00:00
Alexander Kornienko b0707c9a93 Fixed "fallthrough annotation does not directly precede switch label" warning in
case when [[clang::fallthrough]]; is used in a method of a local class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178543 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 15:20:32 +00:00
Daniel Jasper 3791130df5 Fix some inconsistent use of indentation.
Basically we have always special-cased the top-level statement of an
unwrapped line (the one with ParenLevel == 0) and that lead to several
inconsistencies. All added tests were formatted in a strange way, for
example:

Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();
if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
            .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()) {
}

After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();
if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()) {
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178542 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 14:33:13 +00:00