]> granicus.if.org Git - clang/log
clang
11 years ago[analyzer] An ObjC for-in loop runs 0 times if the collection is nil.
Jordan Rose [Fri, 26 Apr 2013 21:43:01 +0000 (21:43 +0000)]
[analyzer] An ObjC for-in loop runs 0 times if the collection is nil.

In an Objective-C for-in loop "for (id element in collection) {}", the loop
will run 0 times if the collection is nil. This is because the for-in loop
is implemented using a protocol method that returns 0 when there are no
elements to iterate, and messages to nil will result in a 0 return value.

At some point we may want to actually model this message send, but for now
we may as well get the nil case correct, and avoid the false positives that
would come with this case.

<rdar://problem/13744632>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180639 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Model casts to bool differently from other numbers.
Jordan Rose [Fri, 26 Apr 2013 21:42:55 +0000 (21:42 +0000)]
[analyzer] Model casts to bool differently from other numbers.

Casts to bool (and _Bool) are equivalent to checks against zero,
not truncations to 1 bit or 8 bits.

This improved reasoning does cause a change in the behavior of the alpha
BoolAssignment checker. Previously, this checker complained about statements
like "bool x = y" if 'y' was known not to be 0 or 1. Now it does not, since
that conversion is well-defined. It's hard to say what the "best" behavior
here is: this conversion is safe, but might be better written as an explicit
comparison against zero.

More usefully, besides improving our model of booleans, this fixes spurious
warnings when returning the address of a local variable cast to bool.

<rdar://problem/13296133>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180638 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Consolidate BoolAssignmentChecker tests by using two RUN lines.
Jordan Rose [Fri, 26 Apr 2013 21:42:47 +0000 (21:42 +0000)]
[analyzer] Consolidate BoolAssignmentChecker tests by using two RUN lines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180637 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[PCH/modules] Require the preprocessing record option to match the used PCH, if modul...
Argyrios Kyrtzidis [Fri, 26 Apr 2013 21:33:40 +0000 (21:33 +0000)]
[PCH/modules] Require the preprocessing record option to match the used PCH, if modules are enabled.

The preprocessing record becomes important when modules are enabled, since it is used to calculate the
module cache hash.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180635 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[Modules] Fix an issue where the reconstructed redeclaration chain was incomplete...
Argyrios Kyrtzidis [Fri, 26 Apr 2013 21:33:35 +0000 (21:33 +0000)]
[Modules] Fix an issue where the reconstructed redeclaration chain was incomplete, missing the definition from a module.

-Make sure that a deserialized external decl gets added to the TU scope.
-When associating an identifier with a set of decls, use the most recent local ones,
  if they exist, otherwise associating decls from modules (that came after a local one)
  will lead to an incomplete reconstructed re-declaration chain.

rdar://13712705

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180634 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[frontend] Make -chain-include work when used with modules.
Argyrios Kyrtzidis [Fri, 26 Apr 2013 21:33:27 +0000 (21:33 +0000)]
[frontend] Make -chain-include work when used with modules.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180633 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoArrayRefize code. No functionality change.
Benjamin Kramer [Fri, 26 Apr 2013 21:32:52 +0000 (21:32 +0000)]
ArrayRefize code. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180632 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agodocument parsing. When a sub-class (c++ Objective-C) missing
Fariborz Jahanian [Fri, 26 Apr 2013 20:55:38 +0000 (20:55 +0000)]
document parsing. When a sub-class (c++ Objective-C) missing
a comment, grab the first comment found in its class
heirarchy. Also, when a category is mossing a comment,
grab comment of its primary class. // rdar://13647476

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180629 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[driver] Implement the -fdebug-compilation-dir in a way that is compatible with
Chad Rosier [Fri, 26 Apr 2013 20:49:50 +0000 (20:49 +0000)]
[driver] Implement the -fdebug-compilation-dir in a way that is compatible with
gcc.  No test case included as I'm having problems finding a test case where
the inode/dev don't match.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180628 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDocumentation: improve description of make_shared transformation, as suggested by...
Dmitri Gribenko [Fri, 26 Apr 2013 20:20:30 +0000 (20:20 +0000)]
Documentation: improve description of make_shared transformation, as suggested by David Blaikie

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180627 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoComment parsing: -fparse-all-comments: recognize empty line comments
Dmitri Gribenko [Fri, 26 Apr 2013 20:12:49 +0000 (20:12 +0000)]
Comment parsing: -fparse-all-comments: recognize empty line comments

In -fparse-all-comments mode empty '//' comments were recognized as
RCK_Invalid, and were not merged with next and previous lines.

Patch by Amin Shali.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180625 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImplement C++1y decltype(auto).
Richard Smith [Fri, 26 Apr 2013 16:15:35 +0000 (16:15 +0000)]
Implement C++1y decltype(auto).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180610 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoC++1y: support simple variable assignments in constexpr functions.
Richard Smith [Fri, 26 Apr 2013 14:36:30 +0000 (14:36 +0000)]
C++1y: support simple variable assignments in constexpr functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180603 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse bitfilds.
Rafael Espindola [Fri, 26 Apr 2013 12:31:12 +0000 (12:31 +0000)]
Use bitfilds.

On a 32 bit build this moves LinkageSpecDecl from 52 to 48 bytes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180601 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSupport debug info for using directives at global/namespace scope.
David Blaikie [Fri, 26 Apr 2013 05:41:06 +0000 (05:41 +0000)]
Support debug info for using directives at global/namespace scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180594 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd r180263 back, but fix hasBraces() to be correct during parsing.
Rafael Espindola [Fri, 26 Apr 2013 01:30:23 +0000 (01:30 +0000)]
Add r180263 back, but fix hasBraces() to be correct during parsing.

Original commit message:

Fix a case in linkage computation that should check for single line extern "C".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180591 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd a testcase for a recent regression.
Rafael Espindola [Fri, 26 Apr 2013 00:29:11 +0000 (00:29 +0000)]
Add a testcase for a recent regression.

Thanks to Bill Wendling for the original testcase.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180586 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFurther wordsmith release notes for the static analyzer.
Ted Kremenek [Fri, 26 Apr 2013 00:01:34 +0000 (00:01 +0000)]
Further wordsmith release notes for the static analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180585 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert r180263. It's causing failures.
Bill Wendling [Thu, 25 Apr 2013 23:15:02 +0000 (23:15 +0000)]
Revert r180263. It's causing failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180583 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd Static Analyzer section to the Release Notes for clang 3.3
Anna Zaks [Thu, 25 Apr 2013 23:14:38 +0000 (23:14 +0000)]
Add Static Analyzer section to the Release Notes for clang 3.3

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180582 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C: This is a small modification to my
Fariborz Jahanian [Thu, 25 Apr 2013 21:59:34 +0000 (21:59 +0000)]
Objective-C: This is a small modification to my
patch -n r180198.
When reporting on missing property accessor implementation in
categories, do not report when they are declared in primary class,
class's protocol, or one of it super classes or in of the other
categories. // rdar://13713098

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180580 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Teach DeadStoreChecker to look though BO_Comma and disregard the LHS.
Anna Zaks [Thu, 25 Apr 2013 21:52:35 +0000 (21:52 +0000)]
[analyzer] Teach DeadStoreChecker to look though BO_Comma and disregard the LHS.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180579 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPut friend decls in the correct context.
Rafael Espindola [Thu, 25 Apr 2013 20:12:36 +0000 (20:12 +0000)]
Put friend decls in the correct context.

When we find a friend declaration we have to skip transparent contexts for doing
lookups, but we should not skip them when inserting the new decl if the lookup
found nothing.

Fixes PR15841.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180571 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix a possible null pointer dereference found by the analyzer.
Anna Zaks [Thu, 25 Apr 2013 16:26:20 +0000 (16:26 +0000)]
Fix a possible null pointer dereference found by the analyzer.

When computing the other parameters, ‘op’ is checked for being null before it’s dereferenced.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180271 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix header comment.
Benjamin Kramer [Thu, 25 Apr 2013 16:14:14 +0000 (16:14 +0000)]
Fix header comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180268 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd an idea for cpp11-migrate and cpp14-migrate
Dmitri Gribenko [Thu, 25 Apr 2013 16:07:10 +0000 (16:07 +0000)]
Add an idea for cpp11-migrate and cpp14-migrate

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180266 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImprove clang-format's memoization behavior.
Daniel Jasper [Thu, 25 Apr 2013 13:31:51 +0000 (13:31 +0000)]
Improve clang-format's memoization behavior.

Deeply nested expressions basically break clang-format's memoization.
This patch slightly improves the situations and makes expressions like

  aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(
      aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(
          aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(
              aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(
                  aaaaa(aaaaa())))))))))))))))))))))))))))))))))))))));

work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180264 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix a case in linkage computation that should check for single line extern "C".
Rafael Espindola [Thu, 25 Apr 2013 13:10:46 +0000 (13:10 +0000)]
Fix a case in linkage computation that should check for single line extern "C".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180263 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDon't mark 'extern "C" void f(void)' as having extern storage class.
Rafael Espindola [Thu, 25 Apr 2013 12:11:36 +0000 (12:11 +0000)]
Don't mark 'extern "C" void f(void)' as having extern storage class.

Instead, we check for one line extern "C" context in linkage computation and
when deciding if a variable is a definition.

This hopefully completes the transition to having "as written" semantics for
hasExternalStorage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180258 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd option to align escaped newlines left.
Daniel Jasper [Thu, 25 Apr 2013 08:56:26 +0000 (08:56 +0000)]
Add option to align escaped newlines left.

This enables formattings like:

  #define A   \
    int aaaa; \
    int b;    \
    int ccc;  \
    int dddddddddd;

Enabling this for Google/Chromium styles only as I don't know whether it
is desired for Clang/LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180253 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix scrolling bug in clang-format's emacs integration.
Daniel Jasper [Thu, 25 Apr 2013 07:06:48 +0000 (07:06 +0000)]
Fix scrolling bug in clang-format's emacs integration.

This patch ensure that nothing scrolls even if the same buffer is opened
in multiple windows.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180252 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-cxxabi] Fix a number of bugs in the mangler.
Peter Collingbourne [Thu, 25 Apr 2013 04:25:40 +0000 (04:25 +0000)]
[ms-cxxabi] Fix a number of bugs in the mangler.

This includes the following fixes:
 - Implement 4 subtly different variants of qualifier mangling and use them
   in what I believe are the right places.
 - Fix handling of array types.  Previously we were always decaying them,
   which is wrong if the type appears as a template argument, pointee,
   referent etc.
Fixes PR13182.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180250 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd "-no-canonical-prefixes" to a test case.
Richard Trieu [Thu, 25 Apr 2013 01:17:23 +0000 (01:17 +0000)]
Add "-no-canonical-prefixes" to a test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180239 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Fix a crash in RetainCountChecker - we should not rely on CallEnter::getCa...
Anna Zaks [Thu, 25 Apr 2013 00:41:32 +0000 (00:41 +0000)]
[analyzer] Fix a crash in RetainCountChecker - we should not rely on CallEnter::getCallExpr to return non-NULL

We get a CallEnter with a null expression, when processing a destructor. All other users of
CallEnter::getCallExpr work fine with null as return value.

(Addresses PR15832, Thanks to Jordan for reducing the test case!)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180234 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[neonemitter tests] Change triple of emitted tests to thumbv7s to match the target...
Michael Gottesman [Thu, 25 Apr 2013 00:10:14 +0000 (00:10 +0000)]
[neonemitter tests] Change triple of emitted tests to thumbv7s to match the target cpu being swift. Also specify the target-abi to apcs-gnu.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180233 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C parsing [qoi]: Recover gracefully with good diagnostic
Fariborz Jahanian [Wed, 24 Apr 2013 23:23:47 +0000 (23:23 +0000)]
Objective-C parsing [qoi]: Recover gracefully with good diagnostic
when class implementation declaration adds protocol qualifier
list. // rdar://12233858

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180228 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C arc: Improve disgnostics when 'weak'
Fariborz Jahanian [Wed, 24 Apr 2013 19:13:05 +0000 (19:13 +0000)]
Objective-C arc: Improve disgnostics when 'weak'
property cannot be synthesized because its backing
ivar does not support weak references.
// rdar://13676793

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180211 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemoving example-dynarray.cpp test since it's of no value.
Jyotsna Verma [Wed, 24 Apr 2013 18:44:44 +0000 (18:44 +0000)]
Removing example-dynarray.cpp test since it's of no value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180208 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[driver] Test that last option wins between -Ofast and -O2.
Chad Rosier [Wed, 24 Apr 2013 18:43:57 +0000 (18:43 +0000)]
[driver] Test that last option wins between -Ofast and -O2.
Part of rdar://13622687

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180207 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[driver] Put -fvectorize under the -Ofast umbrella flag.
Chad Rosier [Wed, 24 Apr 2013 18:29:59 +0000 (18:29 +0000)]
[driver] Put -fvectorize under the -Ofast umbrella flag.
Part of rdar://13622687

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180206 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[driver] Improve the implementation of the -Ofast option.
Chad Rosier [Wed, 24 Apr 2013 18:09:54 +0000 (18:09 +0000)]
[driver] Improve the implementation of the -Ofast option.

Specifically, allow the flags that fall under this umbrella (i.e., -O3,
-ffast-math, and -fstrict-aliasing) to be overridden/disabled with the
individual -O[0|1|2|s|z]/-fno- flags.

This also fixes the handling of various floating point optimization
flags that are modified by -ffast-math (and thus -Ofast as well).
Part of rdar://13622687

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180204 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[driver] Add a hasFlag API that accepts a positive alias.
Chad Rosier [Wed, 24 Apr 2013 18:01:26 +0000 (18:01 +0000)]
[driver] Add a hasFlag API that accepts a positive alias.
Part of rdar://13622687

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180203 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C: When reporting on missing property accessor implementation in
Fariborz Jahanian [Wed, 24 Apr 2013 17:06:38 +0000 (17:06 +0000)]
Objective-C: When reporting on missing property accessor implementation in
categories, do not report when they are declared in primary class,
class's protocol, or one of it super classes. This is because,
its class is going to implement them. // rdar://13713098

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180198 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFlip flag to merge short if-statements into one line for Google style.
Daniel Jasper [Wed, 24 Apr 2013 13:46:00 +0000 (13:46 +0000)]
Flip flag to merge short if-statements into one line for Google style.

This now allows clang-format to do:
if (a) return;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180187 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoclang-format support for multiple input files.
Alexander Kornienko [Wed, 24 Apr 2013 12:46:44 +0000 (12:46 +0000)]
clang-format support for multiple input files.

Summary:
Added support for multiple input files, that can be used both with and
without in-place edit (-i) option. Added checks for -offset and -length options:
don't allow them on multiple files, check that they don't fall outside input
file, made both options unsigned, so that there's no need to check for negative
values. Removed "-1 can be used for end-of-file" from -length description.

Reviewers: djasper, klimek

Reviewed By: djasper

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D719

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180185 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Refactoring + explanatory comment.
Anton Yartsev [Wed, 24 Apr 2013 10:24:38 +0000 (10:24 +0000)]
[analyzer] Refactoring + explanatory comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180181 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRelease note the change to clang_CXCursorSet_contains().
Ted Kremenek [Wed, 24 Apr 2013 07:33:52 +0000 (07:33 +0000)]
Release note the change to clang_CXCursorSet_contains().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180178 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix typo in comparison in clang_CXCursorSet_contains().
Ted Kremenek [Wed, 24 Apr 2013 07:25:40 +0000 (07:25 +0000)]
Fix typo in comparison in clang_CXCursorSet_contains().

Fixes PR 10124.

Patch by Jens Kilian.

Thanks to Nikola Smiljanic for following up.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180177 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert "Remove CXCursorSet and related APIs. There are no known clients."
Ted Kremenek [Wed, 24 Apr 2013 07:17:12 +0000 (07:17 +0000)]
Revert "Remove CXCursorSet and related APIs.  There are no known clients."

Apparently there are...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180176 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd test case for -Wdeprecated-objc-pointer-introspection, and
Ted Kremenek [Wed, 24 Apr 2013 06:52:20 +0000 (06:52 +0000)]
Add test case for -Wdeprecated-objc-pointer-introspection, and
tweak warning to suggest that it is just a bad thing to do.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180175 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove CXCursorSet and related APIs. There are no known clients.
Ted Kremenek [Wed, 24 Apr 2013 06:52:14 +0000 (06:52 +0000)]
Remove CXCursorSet and related APIs.  There are no known clients.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180174 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix comment alignment behavior.
Daniel Jasper [Wed, 24 Apr 2013 06:33:59 +0000 (06:33 +0000)]
Fix comment alignment behavior.

In the following snippet, clang-format incorrectly aligned the
trailing comment, when only the last line was formatted:

  int aaaaaa; // comment
  int b;
  int c; // Formatting only this line moved this comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180173 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd some more required SPARC v9 predefined macros.
Jakob Stoklund Olesen [Wed, 24 Apr 2013 04:36:38 +0000 (04:36 +0000)]
Add some more required SPARC v9 predefined macros.

Solaris/AuroraUX only need __arch64__, the BSDs need the other variants.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180172 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] IvarInvalidation: correctly handle cases where only partial invalidators...
Anna Zaks [Wed, 24 Apr 2013 02:49:16 +0000 (02:49 +0000)]
[analyzer] IvarInvalidation: correctly handle cases where only partial invalidators exist

 - If only partial invalidators exist and there are no full invalidators in @implementation, report every ivar that has
not been invalidated. (Previously, we reported the first Ivar in the list, which could actually have been invalidated
by a partial invalidator. The code assumed you cannot have only partial invalidators.)

- Do not report missing invalidation method declaration if a partial invalidation method declaration exists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180170 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Set the allocation site to be the uniqueing location for retain count...
Anna Zaks [Tue, 23 Apr 2013 23:57:50 +0000 (23:57 +0000)]
[analyzer] Set the allocation site to be the uniqueing location for retain count checker leaks.

The uniqueing location is the location which is part of the hash used to determine if two reports are
the same. This is used by the CmpRuns.py script to compare two analyzer runs and determine which
warnings are new.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180166 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Refactor BugReport::getLocation and PathDiagnosticLocation::createEndOfPat...
Anna Zaks [Tue, 23 Apr 2013 23:57:43 +0000 (23:57 +0000)]
[analyzer] Refactor BugReport::getLocation and PathDiagnosticLocation::createEndOfPath for greater code reuse

The 2 functions were computing the same location using different logic (each one had edge case bugs that the other
one did not). Refactor them to rely on the same logic.

The location of the warning reported in text/command line output format will now match that of the plist file.

There is one change in the plist output as well. When reporting an error on a BinaryOperator, we use the location of the
operator instead of the beginning of the BinaryOperator expression. This matches our output on command line and
looks better in most cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180165 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUpdate checker build.
Ted Kremenek [Tue, 23 Apr 2013 23:55:03 +0000 (23:55 +0000)]
Update checker build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180164 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[libclang] Introduce a CXCursor_ObjCSelfExpr cursor, which is the equivalent of CXCur...
Argyrios Kyrtzidis [Tue, 23 Apr 2013 17:57:17 +0000 (17:57 +0000)]
[libclang] Introduce a CXCursor_ObjCSelfExpr cursor, which is the equivalent of CXCursor_CXXThisExpr for C++ code.

rdar://13717006

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180127 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMake compares unsigned. The expression can't become negative anyways.
Benjamin Kramer [Tue, 23 Apr 2013 14:42:47 +0000 (14:42 +0000)]
Make compares unsigned. The expression can't become negative anyways.

Silences a sign compare warning on 32 bit archs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180110 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix formatting of complex #if expressions.
Daniel Jasper [Tue, 23 Apr 2013 13:54:04 +0000 (13:54 +0000)]
Fix formatting of complex #if expressions.

Before:
  #if !defined(AAAAAAAAAAAAAAAA) && (defined CCCCCCCC ||                         \
                                     defined DDDDDDDD) && defined(BBBBBBBB)

After:
  #if !defined(AAAAAAAAAAAAAAAA) && (defined CCCCCCCC || defined DDDDDDDD) &&    \
      defined(BBBBBBBB)

This fixes llvm.org/PR15828.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180105 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWarn that scoped enumerations are a C++11 extenstion when compiling in
Richard Trieu [Tue, 23 Apr 2013 02:47:36 +0000 (02:47 +0000)]
Warn that scoped enumerations are a C++11 extenstion when compiling in
C++98 mode.  This improves on the previous diagnostic message of:

error: expected identifier or '{'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180076 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] RetainCountChecker: Clean up path notes for autorelease.
Jordan Rose [Tue, 23 Apr 2013 01:42:25 +0000 (01:42 +0000)]
[analyzer] RetainCountChecker: Clean up path notes for autorelease.

No functionality change.

<rdar://problem/13710586>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180075 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[scan-build] Whitelist all -mXXXX options.
Ted Kremenek [Tue, 23 Apr 2013 00:10:55 +0000 (00:10 +0000)]
[scan-build] Whitelist all -mXXXX options.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180073 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWhen modifying an implicit instantiation with information from an explicit one, make...
Argyrios Kyrtzidis [Mon, 22 Apr 2013 23:23:42 +0000 (23:23 +0000)]
When modifying an implicit instantiation with information from an explicit one, make sure to reset the "right brace" location.

Otherwise the source range of the explicit instantiation may become invalid (begin location will be after the end location).

rdar://13706991

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180070 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Model strsep(), particularly that it returns its input.
Jordan Rose [Mon, 22 Apr 2013 23:18:42 +0000 (23:18 +0000)]
[analyzer] Model strsep(), particularly that it returns its input.

This handles the false positive leak warning in PR15374, and also serves
as a basic model for the strsep() function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180069 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd triple to tbaa-struct.cpp to appease bots
Manman Ren [Mon, 22 Apr 2013 22:50:27 +0000 (22:50 +0000)]
Add triple to tbaa-struct.cpp to appease bots

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180065 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd a warning for Objective-C pointer introspection, which is solely the job of the...
Ted Kremenek [Mon, 22 Apr 2013 22:46:52 +0000 (22:46 +0000)]
Add a warning for Objective-C pointer introspection, which is solely the job of the Objective-C runtime.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180062 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRename this test to make it more general for including more tests.
Ted Kremenek [Mon, 22 Apr 2013 22:09:21 +0000 (22:09 +0000)]
Rename this test to make it more general for including more tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180056 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-inline asm] Set the OpDecl to the InlineAsmIdentifierInfo struct.
Chad Rosier [Mon, 22 Apr 2013 22:05:00 +0000 (22:05 +0000)]
[ms-inline asm] Set the OpDecl to the InlineAsmIdentifierInfo struct.
Part of rdar://13663589

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180055 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Treat reinterpret_cast like a base cast in certain cases.
Jordan Rose [Mon, 22 Apr 2013 21:36:49 +0000 (21:36 +0000)]
[analyzer] Treat reinterpret_cast like a base cast in certain cases.

The analyzer represents all pointer-to-pointer bitcasts the same way, but
this can be problematic if an implicit base cast gets layered on top of a
manual base cast (performed with reinterpret_cast instead of static_cast).
Fix this (and avoid a valid assertion) by looking through cast regions.

Using reinterpret_cast this way is only valid if the base class is at the
same offset as the derived class; this is checked by -Wreinterpret-base-class.
In the interest of performance, the analyzer doesn't repeat this check
anywhere; it will just silently do the wrong thing (use the wrong offsets
for fields of the base class) if the user code is wrong.

PR15394

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180052 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Type information from C++ new expressions is perfect.
Jordan Rose [Mon, 22 Apr 2013 21:36:44 +0000 (21:36 +0000)]
[analyzer] Type information from C++ new expressions is perfect.

This improves our handling of dynamic_cast and devirtualization for
objects allocated by 'new'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180051 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[Mips] Remove "REQUIRES: mips-registered-target" from some MIPS-related
Simon Atanasyan [Mon, 22 Apr 2013 20:26:27 +0000 (20:26 +0000)]
[Mips] Remove "REQUIRES: mips-registered-target" from some MIPS-related
driver tests. These tests check the driver only and do not require mips
target.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180042 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTBAA: make sure zero-length bitfield works for tbaa.struct and path-aware tbaa
Manman Ren [Mon, 22 Apr 2013 19:50:07 +0000 (19:50 +0000)]
TBAA: make sure zero-length bitfield works for tbaa.struct and path-aware tbaa

For ms structs, zero-length bitfields following non-bitfield members are
completely ignored, we should not increase the field index.
Before the fix, we will have an assertion failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180038 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-inline asm] Refactor/clean up the SemaLookup interface. No functional
Chad Rosier [Mon, 22 Apr 2013 17:01:37 +0000 (17:01 +0000)]
[ms-inline asm] Refactor/clean up the SemaLookup interface.  No functional
change indended.
Part of rdar://13663589

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180027 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMove debug info tests for scoped enums into a separate file.
Adrian Prantl [Mon, 22 Apr 2013 16:47:50 +0000 (16:47 +0000)]
Move debug info tests for scoped enums into a separate file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180026 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse the ugly PRIx64 macro to make format string portable.
Benjamin Kramer [Mon, 22 Apr 2013 16:10:38 +0000 (16:10 +0000)]
Use the ugly PRIx64 macro to make format string portable.

This is debugging code so functionality isn't a concern, but mingw32 warns
because it doesn't understand the %llx format specifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180024 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoC++1y constexpr extensions, round 1: Allow most forms of declaration and
Richard Smith [Mon, 22 Apr 2013 15:31:51 +0000 (15:31 +0000)]
C++1y constexpr extensions, round 1: Allow most forms of declaration and
statement in constexpr functions. Everything which doesn't require variable
mutation is also allowed as an extension in C++11. 'void' becomes a literal
type to support constexpr functions which return 'void'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180022 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agocmake: Only add -pedantic if LLVM didn't add it. Don't unconditionally add
Richard Smith [Mon, 22 Apr 2013 14:51:21 +0000 (14:51 +0000)]
cmake: Only add -pedantic if LLVM didn't add it. Don't unconditionally add
-Wall -W, since it's already provided by LLVM's cmake config, and that
overrides fixes (such as -Wno-uninitialized) which LLVM's cmake setup may have
provided.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180018 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix array constant expression evaluation bug: we can have different values for
Richard Smith [Mon, 22 Apr 2013 14:44:29 +0000 (14:44 +0000)]
Fix array constant expression evaluation bug: we can have different values for
different array elements, even if they're all constructed using the same
default constructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180017 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDon't emit _ZTW wrappers for TLS variables which don't use the C++ thread_local keyword.
Richard Smith [Mon, 22 Apr 2013 08:06:17 +0000 (08:06 +0000)]
Don't emit _ZTW wrappers for TLS variables which don't use the C++ thread_local keyword.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180004 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCleanup: test source file does not need to be executable
Arnaud A. de Grandmaison [Mon, 22 Apr 2013 08:00:37 +0000 (08:00 +0000)]
Cleanup: test source file does not need to be executable

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180002 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix bin-packing behavior of constructor initialziers.
Daniel Jasper [Mon, 22 Apr 2013 07:59:53 +0000 (07:59 +0000)]
Fix bin-packing behavior of constructor initialziers.

In Google style, constructor initializers need to be all on one line or
one initializer per line if that does not fit. Without this patch, this
non-bin-packing-behavior incorrectly extends to the parameters of the
initializers.

Before:
Constructor()
    : aaaaa(aaaaaaaaaaaaaaaaaaaaaa,
            aaaaaaaaaaaaaaaaaaaaaa,
            aaaaaaaaaaaaaaaaaaaaaa) {}

After:
Constructor()
    : aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
            aaaaaaaaaaaaaaaaaaaaaa) {}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180001 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert "Revert "PR14606: Debug info for using directives/DW_TAG_imported_module""
David Blaikie [Mon, 22 Apr 2013 06:13:21 +0000 (06:13 +0000)]
Revert "Revert "PR14606: Debug info for using directives/DW_TAG_imported_module""

This reverts commit 179839 now that the corresponding LLVM patch has been fixed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179997 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd a triple to make a test resilient to non-TLS hosts (eg: darwin10)
David Blaikie [Mon, 22 Apr 2013 04:18:25 +0000 (04:18 +0000)]
Add a triple to make a test resilient to non-TLS hosts (eg: darwin10)

Making the test introduced in r179962 resilient to being run on darwin10 hosts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179992 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix return type of isBitfield in the binding definition
Dmitri Gribenko [Sun, 21 Apr 2013 18:35:51 +0000 (18:35 +0000)]
Fix return type of isBitfield in the binding definition

Patch by Loïc Jaquemet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179984 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[Mips] Convert a GNU style Mips ABI name to the name accepted by LLVM
Simon Atanasyan [Sun, 21 Apr 2013 13:30:10 +0000 (13:30 +0000)]
[Mips] Convert a GNU style Mips ABI name to the name accepted by LLVM
Mips backend.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179981 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[Mips] Do not add unnecessary Mips toolchain path to the list
Simon Atanasyan [Sun, 21 Apr 2013 12:55:59 +0000 (12:55 +0000)]
[Mips] Do not add unnecessary Mips toolchain path to the list
of system include directories with extern "C" semantics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179979 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoThe 'constexpr implies const' rule for non-static member functions is gone in
Richard Smith [Sun, 21 Apr 2013 01:08:50 +0000 (01:08 +0000)]
The 'constexpr implies const' rule for non-static member functions is gone in
C++1y, so stop adding the 'const' there. Provide a compatibility warning for
code relying on this in C++11, with a fix-it hint. Update our lazily-written
tests to add the const, except for those ones which were testing our
implementation of this rule.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179969 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDisable VLA diagnostic in C++1y mode, and add some tests.
Richard Smith [Sat, 20 Apr 2013 23:28:26 +0000 (23:28 +0000)]
Disable VLA diagnostic in C++1y mode, and add some tests.

Still to do here:
  - we have a collection of syntactic accepts-invalids to diagnose
  - support non-PODs in VLAs, including dynamic initialization /
    destruction
  - runtime checks (and throw std::bad_array_length) for bad bound
  - support VLA capture by reference in lambdas
  - properly support VLAs in range-based for (don't recompute bound)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179962 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd another test I forgot to svn add.
Richard Smith [Sat, 20 Apr 2013 22:23:29 +0000 (22:23 +0000)]
Add another test I forgot to svn add.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179959 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoC++1y: Allow aggregates to have default initializers.
Richard Smith [Sat, 20 Apr 2013 22:23:05 +0000 (22:23 +0000)]
C++1y: Allow aggregates to have default initializers.

Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in
CXXCtorInitializers and in InitListExprs to represent a default initializer.

There's an additional complication here: because the default initializer can
refer to the initialized object via its 'this' pointer, we need to make sure
that 'this' points to the right thing within the evaluation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179958 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUpdate some stuff on the open projects page to reflect things we've already done.
Richard Smith [Sat, 20 Apr 2013 16:20:44 +0000 (16:20 +0000)]
Update some stuff on the open projects page to reflect things we've already done.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179953 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSwitch C++11 open project to C++1y :)
Richard Smith [Sat, 20 Apr 2013 15:57:27 +0000 (15:57 +0000)]
Switch C++11 open project to C++1y :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179951 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd note that some of these links are dead for now.
Richard Smith [Sat, 20 Apr 2013 13:22:50 +0000 (13:22 +0000)]
Add note that some of these links are dead for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179950 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoVLAs in C++14!
Richard Smith [Sat, 20 Apr 2013 13:20:33 +0000 (13:20 +0000)]
VLAs in C++14!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179949 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoVariable templates and generic lambdas are approved for C++14.
Richard Smith [Sat, 20 Apr 2013 12:58:57 +0000 (12:58 +0000)]
Variable templates and generic lambdas are approved for C++14.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179947 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoClarifying memory allocation: approved for C++14. Move from N/A to no, since we curre...
Richard Smith [Sat, 20 Apr 2013 12:57:49 +0000 (12:57 +0000)]
Clarifying memory allocation: approved for C++14. Move from N/A to no, since we currently relax 'operator new' calls which didn't come from new-expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179946 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoNo digit separators for C++14.
Richard Smith [Sat, 20 Apr 2013 12:56:37 +0000 (12:56 +0000)]
No digit separators for C++14.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179945 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoGeneralized constexpr is approved for C++14.
Richard Smith [Sat, 20 Apr 2013 12:49:36 +0000 (12:49 +0000)]
Generalized constexpr is approved for C++14.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179944 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMore approved C++14 features.
Richard Smith [Sat, 20 Apr 2013 12:47:36 +0000 (12:47 +0000)]
More approved C++14 features.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179943 91177308-0d34-0410-b5e6-96231b3b80d8