Commit Graph

30299 Commits

Author SHA1 Message Date
Fariborz Jahanian e970c1b12a 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

llvm-svn: 180629
2013-04-26 20:55:38 +00:00
Chad Rosier a35d5a38fe [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.

llvm-svn: 180628
2013-04-26 20:49:50 +00:00
Dmitri Gribenko e9585628ae 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.

llvm-svn: 180625
2013-04-26 20:12:49 +00:00
Richard Smith 74aeef50a0 Implement C++1y decltype(auto).
llvm-svn: 180610
2013-04-26 16:15:35 +00:00
Richard Smith 3da88fac54 C++1y: support simple variable assignments in constexpr functions.
llvm-svn: 180603
2013-04-26 14:36:30 +00:00
David Blaikie 60a9fbf921 Support debug info for using directives at global/namespace scope.
llvm-svn: 180594
2013-04-26 05:41:06 +00:00
Rafael Espindola 327be3cc20 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".

llvm-svn: 180591
2013-04-26 01:30:23 +00:00
Bill Wendling afddaa4719 Revert r180263. It's causing failures.
llvm-svn: 180583
2013-04-25 23:15:02 +00:00
Fariborz Jahanian 73e244a49f 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

llvm-svn: 180580
2013-04-25 21:59:34 +00:00
Anna Zaks 144579e299 [analyzer] Teach DeadStoreChecker to look though BO_Comma and disregard the LHS.
llvm-svn: 180579
2013-04-25 21:52:35 +00:00
Rafael Espindola 3626b7e451 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.

llvm-svn: 180571
2013-04-25 20:12:36 +00:00
Benjamin Kramer beea351287 Fix header comment.
llvm-svn: 180268
2013-04-25 16:14:14 +00:00
Daniel Jasper e3c0e0144e 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.

llvm-svn: 180264
2013-04-25 13:31:51 +00:00
Rafael Espindola 7e2e4fafc0 Fix a case in linkage computation that should check for single line extern "C".
llvm-svn: 180263
2013-04-25 13:10:46 +00:00
Rafael Espindola bff5956cfa 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.

llvm-svn: 180258
2013-04-25 12:11:36 +00:00
Daniel Jasper 6fe2f009df 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.

llvm-svn: 180253
2013-04-25 08:56:26 +00:00
Peter Collingbourne 2816c023ea [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

llvm-svn: 180250
2013-04-25 04:25:40 +00:00
Anna Zaks 99394bbd02 [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!)

llvm-svn: 180234
2013-04-25 00:41:32 +00:00
Fariborz Jahanian 46ed4d978e Objective-C parsing [qoi]: Recover gracefully with good diagnostic
when class implementation declaration adds protocol qualifier
list. // rdar://12233858

llvm-svn: 180228
2013-04-24 23:23:47 +00:00
Fariborz Jahanian 6a41337132 Objective-C arc: Improve disgnostics when 'weak'
property cannot be synthesized because its backing
ivar does not support weak references.
// rdar://13676793

llvm-svn: 180211
2013-04-24 19:13:05 +00:00
Chad Rosier 679b07500e [driver] Put -fvectorize under the -Ofast umbrella flag.
Part of rdar://13622687

llvm-svn: 180206
2013-04-24 18:29:59 +00:00
Chad Rosier b71f6aa33c [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

llvm-svn: 180204
2013-04-24 18:09:54 +00:00
Chad Rosier cba3b88da5 [driver] Add a hasFlag API that accepts a positive alias.
Part of rdar://13622687

llvm-svn: 180203
2013-04-24 18:01:26 +00:00
Fariborz Jahanian eb3f1007d8 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

llvm-svn: 180198
2013-04-24 17:06:38 +00:00
Daniel Jasper 085a2edaea Flip flag to merge short if-statements into one line for Google style.
This now allows clang-format to do:
if (a) return;

llvm-svn: 180187
2013-04-24 13:46:00 +00:00
Anton Yartsev 67f1ab0de8 [analyzer] Refactoring + explanatory comment.
llvm-svn: 180181
2013-04-24 10:24:38 +00:00
Daniel Jasper 770eb7c5f9 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.

llvm-svn: 180173
2013-04-24 06:33:59 +00:00
Jakob Stoklund Olesen f759989bcd Add some more required SPARC v9 predefined macros.
Solaris/AuroraUX only need __arch64__, the BSDs need the other variants.

llvm-svn: 180172
2013-04-24 04:36:38 +00:00
Anna Zaks 7712f38978 [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.

llvm-svn: 180170
2013-04-24 02:49:16 +00:00
Anna Zaks 404028798f [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.

llvm-svn: 180166
2013-04-23 23:57:50 +00:00
Anna Zaks 4e16b29c13 [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.

llvm-svn: 180165
2013-04-23 23:57:43 +00:00
Benjamin Kramer d408de6a2e Make compares unsigned. The expression can't become negative anyways.
Silences a sign compare warning on 32 bit archs.

llvm-svn: 180110
2013-04-23 14:42:47 +00:00
Daniel Jasper 4431aa99ab 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.

llvm-svn: 180105
2013-04-23 13:54:04 +00:00
Richard Trieu d0d87b5972 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 '{'
llvm-svn: 180076
2013-04-23 02:47:36 +00:00
Jordan Rose 7467f06533 [analyzer] RetainCountChecker: Clean up path notes for autorelease.
No functionality change.

<rdar://problem/13710586>

llvm-svn: 180075
2013-04-23 01:42:25 +00:00
Argyrios Kyrtzidis 40bcfd71b6 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

llvm-svn: 180070
2013-04-22 23:23:42 +00:00
Jordan Rose 6e3cf2ba85 [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.

llvm-svn: 180069
2013-04-22 23:18:42 +00:00
Ted Kremenek ebeabab9a9 Add a warning for Objective-C pointer introspection, which is solely the job of the Objective-C runtime.
llvm-svn: 180062
2013-04-22 22:46:52 +00:00
Chad Rosier 7359d4793e [ms-inline asm] Set the OpDecl to the InlineAsmIdentifierInfo struct.
Part of rdar://13663589

llvm-svn: 180055
2013-04-22 22:05:00 +00:00
Jordan Rose b957113b3f [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

llvm-svn: 180052
2013-04-22 21:36:49 +00:00
Jordan Rose 3437669ca9 [analyzer] Type information from C++ new expressions is perfect.
This improves our handling of dynamic_cast and devirtualization for
objects allocated by 'new'.

llvm-svn: 180051
2013-04-22 21:36:44 +00:00
Manman Ren 09a3912b5c 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.

llvm-svn: 180038
2013-04-22 19:50:07 +00:00
Chad Rosier b18a285525 [ms-inline asm] Refactor/clean up the SemaLookup interface. No functional
change indended.
Part of rdar://13663589

llvm-svn: 180027
2013-04-22 17:01:37 +00:00
Benjamin Kramer c272794899 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.

llvm-svn: 180024
2013-04-22 16:10:38 +00:00
Richard Smith d9f663b510 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'.

llvm-svn: 180022
2013-04-22 15:31:51 +00:00
Richard Smith 9543c5e371 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.

llvm-svn: 180017
2013-04-22 14:44:29 +00:00
Richard Smith 1847baa20e Don't emit _ZTW wrappers for TLS variables which don't use the C++ thread_local keyword.
llvm-svn: 180004
2013-04-22 08:06:17 +00:00
Daniel Jasper cc960fa645 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(aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaa,
            aaaaaaaaaaaaaaaaaaaaaa) {}

llvm-svn: 180001
2013-04-22 07:59:53 +00:00
David Blaikie 9f88fe865c 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.

llvm-svn: 179997
2013-04-22 06:13:21 +00:00
Simon Atanasyan 4938ddb1ab [Mips] Convert a GNU style Mips ABI name to the name accepted by LLVM
Mips backend.

llvm-svn: 179981
2013-04-21 13:30:10 +00:00