Commit Graph

45563 Commits

Author SHA1 Message Date
Richard Smith a23ab514c2 PR14772: Support constant expression evaluation for _Atomic types.
* Treat _Atomic(T) as a literal type if T is a literal type.
 * Evaluate expressions of this type properly.
 * Fix a lurking bug where we built completely bogus ASTs for converting to
   _Atomic types in C++ in some cases, caught by the tests for this change.

llvm-svn: 182541
2013-05-23 00:30:41 +00:00
Aaron Ballman 317a77f1c7 Adding in parsing and the start of semantic support for __sptr and __uptr pointer type qualifiers. This patch also fixes the correlated __ptr32 and __ptr64 pointer qualifiers so that they are truly type attributes instead of declaration attributes.
For more information about __sptr and __uptr, see MSDN: http://msdn.microsoft.com/en-us/library/aa983399.aspx

Patch reviewed by Richard Smith.

llvm-svn: 182535
2013-05-22 23:25:32 +00:00
David Blaikie 469f07969e Debug Info: Handle function/method types using the most specific type
llvm-svn: 182533
2013-05-22 23:22:42 +00:00
Adrian Prantl 5f3601016c Comment and cleanup.
rdar://problem/13359718

llvm-svn: 182524
2013-05-22 21:37:49 +00:00
Pete Cooper f2ec16eb8b Insert explicit casts to try appease overload resolution in the buildbots
llvm-svn: 182514
2013-05-22 21:02:38 +00:00
Ted Kremenek f63269fdc5 Use scope-resolution operator to hopefully unbreak Windows builds.
llvm-svn: 182509
2013-05-22 20:01:35 +00:00
Ted Kremenek 561060b7f5 Simplifiy code using return value of erase().
llvm-svn: 182506
2013-05-22 19:25:03 +00:00
Ted Kremenek 0962e56f00 [analyzer; alternate edges] remove redundant adjacent "events" with the same text.
Fixes <rdar://problem/13949982>

llvm-svn: 182505
2013-05-22 19:10:41 +00:00
Adrian Prantl ef6fca5536 Bugfix for r181629:
- The return type should be a pointer to the class type.
- Make the condition more specific.

rdar://problem/13359718

llvm-svn: 182504
2013-05-22 19:10:15 +00:00
Ted Kremenek 55efcadc1c [analyzer;alternate edges] remove puny edges on the same line that span less than 3 columns.
These are legitimate control-flow edges, but visually they add
no value.

Implements <rdar://problem/13941325>.

llvm-svn: 182502
2013-05-22 18:52:35 +00:00
Ted Kremenek d2d2a9f17b Remove unnecessary assignment.
llvm-svn: 182501
2013-05-22 18:52:32 +00:00
Reid Kleckner fdf02a7abd Remove unused #include <map>
llvm-svn: 182500
2013-05-22 18:46:02 +00:00
Jordan Rose d8fb478b36 scan-build: use the xcodebuild specified by the user.
This is important if the user has multiple Xcodes installed on their
system -- we use xcodebuild to do a version check, and therefore we need
to make sure we match the actual build command.

Reported by Howard Ling!

llvm-svn: 182498
2013-05-22 18:09:57 +00:00
Jordan Rose 1bfe9c787f [analyzer] Don't crash if a block doesn't have a type signature.
Currently, blocks instantiated in templates lose their "signature as
written"; it's not clear if this is intentional. Change the analyzer's
use of BlockDecl::getSignatureAsWritten to check whether or not the
signature is actually there.

<rdar://problem/13954714>

llvm-svn: 182497
2013-05-22 18:09:44 +00:00
Reid Kleckner 7dafb23232 Use StringMap in MicrosoftMangle to resolve FIXME.
llvm-svn: 182488
2013-05-22 17:16:39 +00:00
Manuel Klimek 05c6789b00 Fix uninitialized access error found by valgrind.
llvm-svn: 182476
2013-05-22 14:01:08 +00:00
Justin Holewinski 9f3bfeb3b6 [NVPTX] Add entire list of supported builtins
llvm-svn: 182468
2013-05-22 12:58:29 +00:00
Manuel Klimek 4fe43002f8 Makes whitespace management more consistent.
Instead of selectively storing some changes and directly generating
replacements for others, we now notify the WhitespaceManager of the
whitespace before every token (and optionally with more changes inside
tokens).

Then, we run over all whitespace in the very end in original source
order, where we have all information available to correctly align
comments and escaped newlines.

The future direction is to pull more of the comment alignment
implementation that is now in the BreakableToken into the
WhitespaceManager.

This fixes a bug when aligning comments or escaped newlines in unwrapped
lines that are handled out of order:
  #define A \
    f({     \
      g();  \
    });
... now gets correctly layouted.

llvm-svn: 182467
2013-05-22 12:51:29 +00:00
Daniel Jasper a4c571cd1c Improve clang-format's stream formatting.
clang-format was a bit too aggressive when trying to keep labels and
values on the same line.

Before:
    llvm::outs()
         << "aaaaaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaa(
                                           aaaaaaaaaaaaaaaaaaaaaaaaaaaa);
After:
  llvm::outs() << "aaaaaaaaaaaaaaaaaaa: "
               << aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 182458
2013-05-22 09:13:26 +00:00
Daniel Jasper 53e8d854fd Fix function declaration behavior.
This only affects styles that prevent bin packing. There, a break after
a template declaration also forced a line break after the function name.

Before:
template <class SomeType, class SomeOtherType>
SomeType
SomeFunction(SomeType Type, SomeOtherType OtherType) {}

After:
template <class SomeType, class SomeOtherType>
SomeType SomeFunction(SomeType Type, SomeOtherType OtherType) {}

This fixes llvm.org/PR16072.

llvm-svn: 182457
2013-05-22 08:55:55 +00:00
Daniel Jasper 13c37b3483 Improve handling of trailing 'const'.
Reduce the preference for breaking before a trailing 'const' according
to review comments on r182362.

llvm-svn: 182455
2013-05-22 08:28:26 +00:00
Daniel Jasper f8114cf621 Cut-off clang-format analysis.
If clang-format is confronted with long and deeply nested lines (e.g.
complex static initializers or function calls), it can currently try too
hard to find the optimal solution and never finish. The reason is that
the memoization does not work effectively for deeply nested lines.

This patch removes an earlier workaround and instead opts for
accepting a non-optimal solution in rare cases. However, it only does
so only in cases where it would have to analyze an excessive number of
states (currently set to 10000 - the most complex line in Format.cpp
requires ~800 states) so this should not change the behavior in a
relevant way.

llvm-svn: 182449
2013-05-22 05:27:42 +00:00
Anna Zaks 2f74ff1b3c [analyzer] Do not assert on reports ending in calls within macros.
The crash is triggered by the newly added option (-analyzer-config report-in-main-source-file=true) introduced in r182058.

Note, ideally, we’d like to report the issue within the main source file here as well.
For now, just do not crash.

llvm-svn: 182445
2013-05-22 01:54:34 +00:00
Richard Smith eebe125f77 Fix crash-on-invalid: only use TransformAddressOfOperand when transforming the
operand of a unary address-of expression, not for *all* expressions!

llvm-svn: 182436
2013-05-21 23:29:46 +00:00
Richard Smith f9a458047a PR16090: C++1y: treat undeduced 'auto' as a literal type, so that constexpr
function templates can use it as a return type.

llvm-svn: 182433
2013-05-21 22:29:20 +00:00
Richard Smith f44d2a8a3e PR16094: I should have known Obj-C init-capture disambiguation couldn't be
*that* easy...

Try a bit harder to disambiguate. This is mostly straightforward, but for
=-style initializers, we actually need to know where an expression ends:

  [foo = bar baz]

is a message send, whereas

  [foo = bar + baz]

is a lambda-introducer. Handle this by parsing the expression eagerly, and
replacing it with an annotation token. By chance, we use the *exact same*
parsing rules in both cases (except that we need to assume we're inside a
message send for the parse, to turn off various forms of inapplicable
error recovery).

llvm-svn: 182432
2013-05-21 22:21:19 +00:00
Ted Kremenek 9f0629f669 [analyzer;alternate edges] prune out extra edges to a subexpression where we dive-in and out of a subexpression.
Fixes <rdar://problem/13941891>.

llvm-svn: 182426
2013-05-21 21:38:05 +00:00
Ted Kremenek 6d5bbec32e [analyzer; alternated edges] look through expressions just like Environment does.
llvm-svn: 182425
2013-05-21 21:38:02 +00:00
Fariborz Jahanian 6f829e34b3 Objective-C arc: don't count use of __weak
variables when they are used in such unevaluated 
contexts as __typeof, etc. // rdar://13942025

llvm-svn: 182423
2013-05-21 21:20:26 +00:00
Richard Smith ccc1181105 Refactor places which perform contextual implicit conversions to go through a
common function. The C++1y contextual implicit conversion rules themselves are
not yet implemented, however.

This also fixes a subtle bug where template instantiation context notes were
dropped for diagnostics coming from conversions for integral constant
expressions -- we were implicitly slicing a SemaDiagnosticBuilder into a
DiagnosticBuilder when producing these diagnostics, and losing their context
notes in the process.

llvm-svn: 182406
2013-05-21 19:05:48 +00:00
David Blaikie 8e5939b605 Debug Info: Simplify the code changed in r182403 to reduce indent & avoid a duplicate lookup in the insertion case
llvm-svn: 182404
2013-05-21 18:29:40 +00:00
David Blaikie 77a887bacb Debug Info: don't bother reinserting elements into maps we just retrieved them from
(no intended behavior change)

llvm-svn: 182403
2013-05-21 18:08:19 +00:00
David Blaikie fefc7f7a5d Fix whitespace
llvm-svn: 182400
2013-05-21 17:58:54 +00:00
Daniel Jasper a3c14575ef Fix off-by-one error in clang-format's emacs integration.
llvm-svn: 182395
2013-05-21 17:05:40 +00:00
Daniel Jasper a8048b8216 Fix behavior of clang-format's -cursor flag.
llvm-svn: 182386
2013-05-21 14:21:46 +00:00
Daniel Jasper 2a250b8b49 Let clang-format move the cursor appropriately.
With this patch, clang-format will try to keep the cursor at the
original code position in editor integrations (implemented for emacs and
vim). This means, after formatting, clang-format will try to keep the
cursor on the same character of the same token.

llvm-svn: 182373
2013-05-21 12:21:39 +00:00
Benjamin Kramer 5e36423aed Remove unused diagnostics.
llvm-svn: 182368
2013-05-21 10:57:36 +00:00
Daniel Jasper 5be31f728a Allow breaking before a trailing const.
Before:
void someLongFunction(
    int someLongParameter) const;

After:
void someLongFunction(int someLongParameter)
    const;

Also slightly cleanup tests.

llvm-svn: 182362
2013-05-21 09:16:31 +00:00
Richard Smith b39b9d5735 In -ast-dump, only dump comments when dumping the actual Decl to which they
attach, rather than merging all comments on the declaration chain. This gives a
more faithful dump, and has the side benefit of unbreaking uses of dump() from
within AST deserialization (where the redeclaration chain may not be sane).

llvm-svn: 182350
2013-05-21 05:24:00 +00:00
Ted Kremenek d4167a66e1 [analyzer; alternate edges] optimize edges for ObjC fast enumeration loops.
Fixes <rdar://problem/13942300>.

llvm-svn: 182342
2013-05-21 00:34:40 +00:00
Fariborz Jahanian 04eb8abba9 doc. parsing. HeaderDoc documentaton allows use of
@class command on an @interface declaration. Turn off
the warning for this case. // rdar://13927330

llvm-svn: 182334
2013-05-20 23:40:39 +00:00
Richard Smith 0b1f476888 Revert r182331, these checks should be based on the target not the host.
llvm-svn: 182333
2013-05-20 23:40:27 +00:00
Richard Smith fcf713ac24 Move two Darwin-specific hacks into #ifdef __APPLE__. These were stat'ing
nonexistent Darwin-specific files on every module build.

llvm-svn: 182331
2013-05-20 23:17:08 +00:00
David Blaikie f121b9302e PR14606: Debug Info for namespace aliases/DW_TAG_imported_module
This resolves the last of the PR14606 failures in the GDB 7.5 test
suite. (but there are still unresolved issues in the imported_decl case
- we need to implement optional/lazy decls for functions & variables
like we already do for types)

llvm-svn: 182329
2013-05-20 22:50:41 +00:00
Reid Kleckner 52d598e242 Warn on and drop dllimport attrs from variable definitions
AsmPrinter::EmitLinkage() does not handle dllimport linkage.  The LLVM
verifier should also be fixed to reject this.

llvm-svn: 182320
2013-05-20 21:53:29 +00:00
Fariborz Jahanian 0ebf87959f Objective-C [qoi]: When an class conforms to multiple
protocols that declare the same property of incompatible
types, issue a warning when class implementation synthesizes 
the property. // rdar://13075400

llvm-svn: 182316
2013-05-20 21:20:24 +00:00
Eric Christopher cbf5701f93 Make this const since it never changes (and should never change).
llvm-svn: 182309
2013-05-20 19:59:06 +00:00
DeLesley Hutchins 3b2c66bbda Thread safety analysis: fix use after free bug reported by Evgeniy Stepanov.
llvm-svn: 182305
2013-05-20 17:57:55 +00:00
Hans Wennborg b3ad90d52d ReleaseNotes.rst: typo
llvm-svn: 182294
2013-05-20 15:59:04 +00:00
Alexander Kornienko 06e0033427 Minor fix: don't crash on empty configuration file, consider empty configuration files invalid.
llvm-svn: 182290
2013-05-20 15:18:01 +00:00