Commit Graph

56590 Commits

Author SHA1 Message Date
Pavel Labath bb917683b6 Test commit, no changes.
llvm-svn: 226552
2015-01-20 09:47:57 +00:00
Alexey Bataev 42971a3342 [OPENMP] Fixed DSA processing for predetermined shared variables.
This patch allows to use predetermined shared variables in private clauses in
parallel or tasks regions.

llvm-svn: 226549
2015-01-20 07:03:46 +00:00
Sameer Sahasrabuddhe 450a58b8af Introduce SPIR calling conventions.
This implements Section 3.7 from the SPIR 1.2 spec:

    SPIR kernels should use "spir_kernel" calling convention.
    Non-kernel functions use "spir_func" calling convention. All
    other calling conventions are disallowed.

The patch works only for OpenCL source. Any other uses will need
to ensure that kernels are assigned the spir_kernel calling
convention correctly.

llvm-svn: 226548
2015-01-20 06:44:32 +00:00
Duncan P. N. Exon Smith 7fd74acd0b CodeGen: Update LoopAttributes for LLVM API change
`MDNode::getTemporary()` returns a `unique_ptr<>` as of r226504.

llvm-svn: 226505
2015-01-19 21:30:48 +00:00
Adam Nemet f893edeaea [AVX512] Add sub-vector FP extracts
Analogous to AVX2, these need to be implemented as macros to properly
propagate the immediate index operand.

Part of <rdar://problem/17688758>

llvm-svn: 226496
2015-01-19 20:12:05 +00:00
Adrian Prantl 7c6f944cdf Migrate all uses of DIVariable's FlagIndirectVariable to use a DIExpression
with a DW_OP_deref instead.

llvm-svn: 226474
2015-01-19 17:51:58 +00:00
Rafael Espindola f9b1730d41 Add comdat to thunks.
llvm-svn: 226465
2015-01-19 14:02:14 +00:00
Rafael Espindola 1be4c4546c Make this test a bit stricter. NFC.
llvm-svn: 226463
2015-01-19 13:59:31 +00:00
Daniel Jasper 9b79efb51f clang-format: Fix crasher on weird comments.
Crashing input:
  /\
  / comment

llvm-svn: 226454
2015-01-19 11:49:32 +00:00
Daniel Jasper 193cdd381b clang-format: Fix crasher on incomplete condition compilation.
Previously crashing input:
  void f(
  #if A
      );
  #else
  #endif

llvm-svn: 226451
2015-01-19 10:52:16 +00:00
Daniel Jasper 20e8c3be3c clang-format: Fix crash on invalid code.
Input "a<," made clang-format crash.

llvm-svn: 226450
2015-01-19 10:51:42 +00:00
Daniel Jasper 675b4f8350 clang-format: Fix clang-format crash on invalid code.
llvm-svn: 226449
2015-01-19 10:51:23 +00:00
Daniel Jasper 9d22bcc53e clang-format: Fix assertion when trying to build a nullptr StringRef.
llvm-svn: 226448
2015-01-19 10:51:05 +00:00
Daniel Jasper 2bd7a64d12 clang-format: Fix endless loop on incomplete try-catch-block.
llvm-svn: 226447
2015-01-19 10:50:51 +00:00
Daniel Jasper b1567c106f clang-format: Remove assert that isn't helpful.
This assert would trigger on:
  #d , = }

llvm-svn: 226446
2015-01-19 10:50:08 +00:00
Manuel Klimek 7a95ce4399 Make clang-format work in emacs buffers with unicode characters.
Emacs functions by default use character positions; convert characters
to offsets when handing parameters to clang-format and convert byte
offsets we get from clang-format back to character positions.
Reworked the code a bit so the 0-based to 1-based offset calculations
are done in the same place where we do the multi-byte to offset mapping.

llvm-svn: 226445
2015-01-19 10:48:04 +00:00
David Majnemer 6b90356ab4 Add back a check removed in r226436
It shouldn't have been removed, the code which replaced it didn't cover
this case.

llvm-svn: 226442
2015-01-19 10:21:22 +00:00
NAKAMURA Takumi 6a1565c7e5 SemaDeclCXX.cpp: Suppress a warning. [-Wunused-variable]
llvm-svn: 226441
2015-01-19 09:49:59 +00:00
David Majnemer 2dc8146643 Sema: Variable definitions cannot be __attribute__((alias))
Things that are OK:
  extern int var1 __attribute((alias("v1")));
  static int var2 __attribute((alias("v2")));

Things that are not OK:
  int var3 __attribute((alias("v3")));
  extern int var4 __attribute((alias("v4"))) = 4;

We choose to accpet:
  struct S { static int var5 __attribute((alias("v5"))); };

  This code causes assertion failues in GCC 4.8 and ICC 13.0.1, we have
  no reason to reject it.

This partially fixes PR22217.

llvm-svn: 226436
2015-01-19 09:00:28 +00:00
Craig Topper e954fd4cfa [X86] Change AVX512 intrinsics to take a 8-bit immediate for the comparision kind instead of a 32-bit immediate. This matches an equivalent change in llvm.
llvm-svn: 226431
2015-01-19 06:08:02 +00:00
Alexey Bataev 3255bf3aac [OPENMP] Disable copyprivate an nowait clauses in 'single' directive.
The copyprivate clause must not be used with the nowait clause in single
directive.

llvm-svn: 226429
2015-01-19 05:20:46 +00:00
Nathan Sidwell 44b21749b9 PR6037
Warn on inaccessible direct base

llvm-svn: 226423
2015-01-19 01:44:02 +00:00
Craig Topper a3306ca626 [x86] Teach Sema to check size of comparison immediate on avx512 cmpps/cmppd buitins.
llvm-svn: 226422
2015-01-19 01:18:22 +00:00
Craig Topper f557b09f14 [x86] Mark that the AVX-512 cmpps/cmppd builtins need an ICE for the comparison immediate. This requires converting to a macro in the header file.
llvm-svn: 226421
2015-01-19 01:18:19 +00:00
Serge Pavlov 25a8afa957 Handle unscoped enumeration in nested name specifier.
If an unscoped enum is used as a nested name specifier and the language dialect
is not C++ 11, issue an extension warning.
This fixes PR16951.

Differential Revision: http://reviews.llvm.org/D6389

llvm-svn: 226413
2015-01-18 20:04:35 +00:00
Serge Pavlov f80df57d39 Update error message text.
Previously if an enumeration was used in a nested name specifier in pre-C++11
language dialect, error message was 'XXX is not a class, namespace, or scoped
enumeration'. This patch removes the word 'scoped' as in C++11 any enumeration
may be used in this context.

llvm-svn: 226410
2015-01-18 19:05:48 +00:00
David Blaikie a0a1a8726f Add comment after API changes in r225090
Code review suggestion by Eric Christopher.

llvm-svn: 226395
2015-01-18 02:48:07 +00:00
David Blaikie c6593075bf DebugInfo: Attribute complex expressions to the source location of the expression
Just as r225956 did for scalar expressions (CGExprScalar::Visit), do the
same for complex expressions.

llvm-svn: 226390
2015-01-18 01:57:54 +00:00
Nico Weber 7a92e1ad3d Address review feedback from r215780: Use a flag insteda of the heap. No behavior change.
llvm-svn: 226389
2015-01-18 01:50:35 +00:00
David Blaikie 01fb5fb128 DebugInfo: Attribute aggregate expressions to the source location of the expression
Just as r225956 did for scalar expressions (CGExprScalar::Visit), do the
same for aggregate expressions.

llvm-svn: 226388
2015-01-18 01:48:19 +00:00
David Blaikie 1c39bbb741 Refactor test so it's not lazily emitted on a global, simplifying ordering when more test cases are added
llvm-svn: 226384
2015-01-18 00:37:04 +00:00
David Blaikie 7d2a2ac57b Recommit r225083 (reverted in r225361) now that calls to aggregate initializers from in class non-static data members are explicitly attributed to the desired line.
The code setting the debug location being removed here was accidentally
leaking a location into the call to the non-static data member's ctor
call. Without it the call had no location and could cause assertion
failures if it was inlined. Now that it has a location (and a correct
one at that) this code should hopefully be no longer needed.

It's possible of course that other parts of the debug info are also
relying on the debug locations being set here to leak to where they're
needed - so we might see the same assertions again & will have to
investigate what the dependence was/is. But the chances are good that
any of those are debug info line table quality bugs we've just not found
yet anyway - so it'll be good to flush them out.

llvm-svn: 226383
2015-01-18 00:14:21 +00:00
David Blaikie a81d410d4f DebugInfo: Correct the debug location of non-static data member initializers
This was causing some trouble for otherwise dead code removed in r225085
(reverted in r225361). The location being set for function arguments was
leaking out to the call which wasn't setting its own location (so a
quality bug turned into a crasher with r225085). Fix this so r225085 can
be recommitted.

llvm-svn: 226382
2015-01-18 00:12:58 +00:00
Chandler Carruth 6f4d3a2e39 [msan] Fix a uninitialized-use bug in the template argument diffing
logic.

In one place we would try to check for the difference between integers
even if we were missing one of the integers. This would eventually end
up reading uninitialized data out of the APSInt objects. The fix is to
short circuit the sameness test when we don't have integers on both
sides.

This fixes a test failure I was seeing with MSan. Not sure whether other
bots were seeing it or not, but yay MSan. In particular the feature to
very carefully track origins back through stores throughout the program
was invaluable.

llvm-svn: 226375
2015-01-17 14:20:14 +00:00
Nico Weber 261c58c486 Add tests for two more asserts that r226365 fixed according to SLi's bot.
llvm-svn: 226371
2015-01-17 04:27:09 +00:00
Nico Weber e52e3b58c4 Add a test for something that used to crash before r226365.
llvm-svn: 226370
2015-01-17 04:14:31 +00:00
Nico Weber 71e377d6ee If a function decl cannot be merged, mark it as invalid.
Clang currently crashes on

    class C {
      C() = default;
      C() = delete;
    };

My cunning plan for fixing this was to change the `if (!FnD)` in
Parser::ParseCXXInlineMethodDef() to `if (!FnD || FnD->isInvalidDecl)` – but
alas, the second constructor decl wasn't marked as invalid.  This lets
Sema::MergeFunctionDecl() return true on function redeclarations, which leads
to them being marked invalid.

This also improves error messages when functions are redeclared.

llvm-svn: 226365
2015-01-17 02:33:17 +00:00
Nico Weber b6cb695135 Wrap to 80 columns. No behavior change.
llvm-svn: 226364
2015-01-17 02:27:54 +00:00
Nico Weber f56c85bc06 Address review feedback from r226306. No intended behavior change.
llvm-svn: 226363
2015-01-17 02:26:40 +00:00
Rafael Espindola d3e0469a84 Make sure all weak destructors go in a comdat in the ms abi.
Destructors have a special treatment in getFunctionLinkage. Instead of
duplicating the logic, check the resulting linkage.

llvm-svn: 226361
2015-01-17 01:47:39 +00:00
Richard Trieu dcd7bb022a Clean up a string comparison with StringRef. Suggestion by David Majnemer.
llvm-svn: 226359
2015-01-17 00:56:10 +00:00
Richard Trieu d4b05cef6b Remove std::move that was preventing return value optimization.
llvm-svn: 226357
2015-01-17 00:46:55 +00:00
Steven Wu cb0d13fc23 Adding option -fno-inline-asm to disallow inline asm
Summary:
This patch add a new option to dis-allow all inline asm.
Any GCC style inline asm will be reported as an error.

Reviewers: rnk, echristo

Reviewed By: rnk, echristo

Subscribers: bob.wilson, rnk, echristo, rsmith, cfe-commits

Differential Revision: http://reviews.llvm.org/D6870

llvm-svn: 226340
2015-01-16 23:05:28 +00:00
Jordan Rose a34d04d35e Suggest objc_method_family(none) for a property named -newFoo or similar.
As mentioned in the previous commit, if a property (declared with @property)
has a name that matches a special Objective-C method family, the getter picks
up that family despite being declared by the property. The most correct way
to solve this problem is to add the 'objc_method_family' attribute to the
getter with an argument of 'none', which unfortunately requires an explicit
declaration of the getter.

This commit adds a note to the existing error (ARC) or warning (MRR) for
such a poorly-named property that suggests the solution; if there's already
a declaration of the getter, it even includes a fix-it.

llvm-svn: 226339
2015-01-16 23:04:31 +00:00
Jordan Rose 16ba553f75 ObjC getters with names like "newItem" should still be linked to the @property.
Two years ago I added a compile-time "optimization" to
ObjCMethodDecl::findPropertyDecl: exit early if the current method is part
of a special Objective-C method family (like 'new' or 'init'). However, if a
property (declared with @property) has a name that matches a method family,
the getter picks up that family despite being declared by the property. The
early exit then made ObjCMethodDecl::findPropertyDecl decide that there
was no associated property, despite the method itself being marked as an
accessor. This corrects that by removing the early exit.

This does /not/ change the fact that such a getter is considered to return a
value with a +1 retain count. The best way to eliminate this is by adding the
objc_method_family(none) attribute to the getter, but unlike the existing
ns_returns_not_retained that can't be applied directly to the property -- you
have to redeclare the getter instead.

(It'd be nice if @property just implied objc_method_family(none) for its
getter, but that would be a backwards-incompatible change.)

rdar://problem/19038838

llvm-svn: 226338
2015-01-16 23:04:26 +00:00
David Blaikie 71fb83ea7a Isolate test for PR22096 to clang.
Emitting inlinable calls without debug locations (in functions with
debug info, to functions with debug info) is problematic for debug info
when inlining occurs. Test specifically that we don't do that in this
case - thus the test isn't simply "don't crash", it's "include debug
location for this call" (granted it's the wrong location - fix for that
is coming)

llvm-svn: 226337
2015-01-16 22:55:09 +00:00
Kaelyn Takata ae9e97c9d6 Fix a case where delayed typo correction should have resolved an
ambiguity but wasn't.

In the new test case, "click" wasn't being corrected properly because
Sema::ClassifyName would call CorrectTypo for "click" then later
Sema::DiagnoseEmptyLookup would call CorrectTypoDelayed for the same use
of "click" (the former by the parser needing to determine what the
identifier is so it knows how to parse the statement, i.e. is it the
beginning of a declaration or an expression). CorrectTypo would record
that typo correction for "click" failed and CorrectTypoDelayed would see
that and not even try to correct the typo, even though in this case
CorrectTypo failed due to an ambiguity (both "Click" and "clock" having
an edit distance of one from "click") that could be resolved with more
information. The fix is two-fold:
  1) Have CorrectTypo not record failed corrections if the reason for
     the failure was two or more corrections with the same edit
     distance, and
  2) Make the CorrectionCandidateCallback used by
     Parser::ParseCastExpression reject FunctionDecl candidates when the
     next token after the identifier is a ".", "=", or "->" since
     functions cannot be assigned to and do not have members that can be
     referenced.

The reason for two correction spots is that from r222549 until r224375
landed, the first correction attempt would fail completely but the
second would suggest "clock" while having the note point to the
declaration of "Click".

llvm-svn: 226334
2015-01-16 22:11:04 +00:00
Eric Christopher 49b425d9d2 Remove pathname dependence. Also rewrite test to use FileCheck
at the same time.

Patch by David Callahan.

llvm-svn: 226331
2015-01-16 22:03:52 +00:00
Sean Silva 2a995148e8 Fix some copypasta typos in asserts.
Fixes PR22236

Patch by Nicolas Brunie! <nicolas.brunie@kalray.eu>

llvm-svn: 226328
2015-01-16 21:44:26 +00:00
Rafael Espindola 4af2cdb732 Also put vtables in a comdat when rtti is disabled.
llvm-svn: 226325
2015-01-16 21:41:44 +00:00
Nico Weber a089c7cb4b Wrap to 80 columns. No behavior change.
llvm-svn: 226320
2015-01-16 21:09:43 +00:00
Rafael Espindola d9b26d563a Add comdat to string literal variables on COFF.
llvm-svn: 226317
2015-01-16 20:32:35 +00:00
Nico Weber a7f137da65 Spell 0 in an enum-appropriate way. No behavior change.
llvm-svn: 226307
2015-01-16 19:35:01 +00:00
Nico Weber d89e6f79f7 Don't crash if a declarator in a friend decl doesn't have a name.
There was already an explicit check for that for the first decl.  Move that
to a different place so that it's called for the following decls too.  Also
don't randomly set the BitfieldSize ExprResult to true (this sets a pointer to
true internally).

Found by SLi's bot.

llvm-svn: 226306
2015-01-16 19:34:13 +00:00
Rafael Espindola 654542a5ed Add comdats to the RTTI variables in the microsoft abi.
llvm-svn: 226303
2015-01-16 19:23:42 +00:00
Adam Nemet c0cff244fc [AVX512] Add intrinsics for masked aligned FP loads and stores
Part of <rdar://problem/17688758>

llvm-svn: 226298
2015-01-16 18:51:50 +00:00
Adam Nemet d47dec4690 Fix typo in r225922.
llvm-svn: 226297
2015-01-16 18:51:46 +00:00
Tim Northover 7ad87af277 AArch64: implement AAPCS layout rules for bit-fields.
llvm-svn: 226294
2015-01-16 18:44:04 +00:00
Rafael Espindola 77abc3a7da Add comdats to dynamic init functions in the microsoft abi.
llvm-svn: 226286
2015-01-16 16:04:45 +00:00
Rafael Espindola a8eb9931ad Make this test a bit stricter. NFC.
llvm-svn: 226285
2015-01-16 16:02:03 +00:00
Alexander Kornienko d1f1fa2636 Attempt to fix the build with XCode 5.0.2 (and probably 5.1.1).
llvm-svn: 226282
2015-01-16 15:57:15 +00:00
Rafael Espindola 694cb5d9b7 Add comdats to constructs and destructor in the microsoft abi.
llvm-svn: 226280
2015-01-16 15:37:11 +00:00
Nathan Sidwell 9609002b4a restore fix for 18645, buildbot apparently gave a false positive.
Correct logic concerning 'T &&' deduction against lvalues.

llvm-svn: 226278
2015-01-16 15:20:14 +00:00
Alexey Bataev 24b04aa393 [OPENMP] Fixed data-sharing attributes processing for variables with global
storage.
This fix allows to use non-constant global variables, static local variables and static data
members in data-sharing attribute clauses in parallel and task regions.

llvm-svn: 226250
2015-01-16 07:11:33 +00:00
Rafael Espindola cb92c19fc4 Use a trivial comdat for C++ tables.
This produces comdats for vtables, typeinfo, typeinfo names, and vtts.

When combined with llvm not producing implicit comdats, not doing this would
cause code bloat on ELF and link errors on COFF.

llvm-svn: 226227
2015-01-15 23:18:01 +00:00
Rafael Espindola dbee8a7a7a Use a trivial comdat for inline ctor/dtor when not using C5/D5.
When combined with llvm not producing implicit comdats, not doing this would
cause code bloat on ELF and link errors on COFF.

llvm-svn: 226211
2015-01-15 21:36:08 +00:00
Hal Finkel 74618cc622 [PowerPC] Add a target option for invariant function descriptors
The PPC backend will now assume that PPC64 ELFv1 function descriptors are
invariant. This must be true for well-defined C/C++ code, but I'm providing an
option to disable this assumption in case someone's JIT-engine needs it.

llvm-svn: 226209
2015-01-15 21:22:22 +00:00
Hans Wennborg fd76d91366 Warn about dllexported explicit class template instantiation declarations (PR22035)
Clang would previously become confused and crash here.

It does not make a lot of sense to export these, so warning seems appropriate.

MSVC will export some member functions for this kind of specializations, whereas
MinGW ignores the dllexport-edness. The latter behaviour seems better.

Differential Revision: http://reviews.llvm.org/D6984

llvm-svn: 226208
2015-01-15 21:18:30 +00:00
Nathan Sidwell c116802ef3 PR 20146
reject CV void return type on C definitions per 6.9.1/3

llvm-svn: 226178
2015-01-15 16:45:53 +00:00
Chandler Carruth a9711a9aa4 [PM] Track an LLVM API update which separates the TargetLibraryInfo
object from the pass that provides access to it.

We should probably refactor the createTLI code here in Clang in light of
the new structure, but I wanted this patch to be a minimal one that just
patches the behavior back together.

llvm-svn: 226158
2015-01-15 10:42:26 +00:00
David Majnemer 10fd83d11f AST: alignof might be dependent because of alignment attributes
Dependent alignment attributes should make an alignof expression
dependent as well.

llvm-svn: 226156
2015-01-15 10:04:14 +00:00
NAKAMURA Takumi 3a1e1a5424 [CMake] clangCodeGen: Prune a redundant "Target" out of libdeps. It is supplied by Analysis.
llvm-svn: 226152
2015-01-15 08:51:01 +00:00
David Majnemer f8637360e2 AST: Ensure implicit records have default visibility
Types composed with certain implicit record types would have their RTTI
marked as hidden because the implicit record type didn't have any
visibility.

This manifests itself as triggering false positives from tools like
clang's -fsantize=function feature.  The RTTI for a function type's
return type wouldn't match if the return type was an implicit record
type.

Patch by Stephan Bergmann!

llvm-svn: 226148
2015-01-15 08:41:25 +00:00
NAKAMURA Takumi 98501ea07a [CMake] Update libdeps on clangCodeGen, corresponding to r226079.
llvm-svn: 226142
2015-01-15 07:28:53 +00:00
Simon Atanasyan e6694eb245 [Mips] Define macros `__mips_isa_rev` in case of mips32r6/mips64r6 options
llvm-svn: 226136
2015-01-15 07:04:48 +00:00
David Majnemer 8e1a913cfa Sema: Recover when a function template is in an extern "C" block
llvm-svn: 226135
2015-01-15 07:04:38 +00:00
Nico Weber 8afb37e1a1 Remove unused parameter, followup to r179639. No behavior change.
llvm-svn: 226128
2015-01-15 06:00:15 +00:00
Nico Weber b6a5d05a8a Remove ASTConsumer::HandleVTable()'s bool parameter.
Sema calls HandleVTable() with a bool parameter which is then threaded through
three layers.  The only effect of this bool is an early return at the last
layer.

Instead, remove this parameter and call HandleVTable() only if the bool is
true.  No intended behavior change.

llvm-svn: 226096
2015-01-15 04:07:35 +00:00
Richard Smith 6eece29d8f PR13699: Include friend declarations in code completion results if they had a
prior visible declaration. Prefer to take template parameter names from the
first declaration.

Testcase from a patch by Francisco Lopes!

llvm-svn: 226083
2015-01-15 02:27:20 +00:00
Chandler Carruth 418bd1ab30 [PM] Update for LLVM r226078 which moved TargetLibraryInfo to the
Analysis library.

llvm-svn: 226079
2015-01-15 02:16:55 +00:00
Richard Smith 64e033f9c4 Fix crash-on-invalid and name lookup when recovering from ~X::X() typo.
llvm-svn: 226067
2015-01-15 00:48:52 +00:00
Duncan P. N. Exon Smith 8d3ef611ce IR: Move MDLocation into place (clang testcases)
Update testcases to match LLVM change in r226048.

llvm-svn: 226049
2015-01-14 22:28:03 +00:00
Steven Wu 76c508bc9a Revert "More robust deployment target parsing on darwin"
This breaks green-dragon. Revert it and investigate.

llvm-svn: 226011
2015-01-14 18:22:29 +00:00
Hans Wennborg fb8b408ba0 docs/conf.py: update for 3.7
llvm-svn: 226010
2015-01-14 18:14:05 +00:00
Hans Wennborg 0a7ec77ee0 ReleaseNotes.rst: update to 3.7
The 3.6 release notes are in the 3.6 branch.

llvm-svn: 226009
2015-01-14 18:14:03 +00:00
Hans Wennborg a38fb96796 Update cxx_dr_status.html after 3.6 branch
llvm-svn: 226008
2015-01-14 18:14:00 +00:00
Steven Wu faf31e7cc5 More robust deployment target parsing on darwin
Summary:
This is a more robust way of figuring out implicit deployment target
from isysroot. It also handles iphone simulator target.

Reviewers: bob.wilson, t.p.northover

Reviewed By: t.p.northover

Subscribers: t.p.northover, cfe-commits

Differential Revision: http://reviews.llvm.org/D6939

llvm-svn: 226005
2015-01-14 18:01:27 +00:00
Daniel Jasper 1cd3c71c01 clang-format: Disable flag for Google's Java and Javascript styles.
Disable AlwaysBreakBeforeMultilineString, as the style guides don't
really say to do so.

llvm-svn: 225982
2015-01-14 12:24:59 +00:00
Daniel Sanders 998c910262 [mips] Handle transparent unions correctly.
Summary:
This fixes MultiSource/Applications/lemon on big-endian N32 by correcting the
handling of the argument to wait(). glibc defines it as a transparent union of
void* and int*. Such unions are passed according to the rules of the first
member so the argument must be passed as if it were a void* (sign extended from
i32 to i64) and not as a union (shifted to the upper bits of an i64).

wait() already behaves correctly on big-endian O32 and N64 since the union is
already the same size as an argument slot.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6963

llvm-svn: 225981
2015-01-14 12:00:12 +00:00
Chandler Carruth 0d9593ddec [cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.py
Sorry for the noise, I managed to miss a bunch of recent regressions of
include orderings here. This should actually sort all the includes for
Clang. Again, no functionality changed, this is just a mechanical
cleanup that I try to run periodically to keep the #include lines as
regular as possible across the project.

llvm-svn: 225979
2015-01-14 11:29:14 +00:00
Chandler Carruth 575bc3ba62 [cleanup] Re-sort the #include lines using llvm/utils/sort_includes.py
No functionality changed, this is a purely mechanical cleanup to ensure
the #include order remains consistent across the project.

llvm-svn: 225975
2015-01-14 11:23:58 +00:00
Daniel Jasper e189d46512 clang-format: [Java] Support try blocks with resources.
Before:
  try
    (SomeResource rs = someFunction()) {
      Something();
    }

After:
  try (SomeResource rs = someFunction()) {
    Something();
  }

llvm-svn: 225973
2015-01-14 10:48:41 +00:00
Daniel Jasper 190fbda6de clang-format: [Java] Prefer not to break in parameter annotations.
Before:
  boolean someFunction(@Param(aaaaaaaaaaaaaaaa)
                       String aaaaa,
      String bbbbbbbbbbbbbbb) {}

After:
  boolean someFunction(
      @Param(aaaaaaaaaaaaaaaa) String aaaaa,
      String bbbbbbbbbbbbbbb) {}

llvm-svn: 225971
2015-01-14 10:36:31 +00:00
Daniel Jasper 16dbe0bc44 clang-format: [Java] Understand "import static".
llvm-svn: 225965
2015-01-14 10:02:49 +00:00
Daniel Jasper 404658aede clang-format: [Java] Don't let annotations confuse return type analysis.
Before:
  @Test
  ReturnType
  doSomething(String aaaaaaaaaaaaa, String bbbbbbbbbbbbbbb) {}

After:
  @Test
  ReturnType doSomething(
      String aaaaaaaaaaaaa, String bbbbbbbbbbbbbbb) {}

llvm-svn: 225964
2015-01-14 10:00:20 +00:00
Daniel Jasper 3e1bd1407b clang-format: [Java] Don't line-wrap before annotations' l_parens.
Before:
  @SomeAnnotation
  (aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa)
  int i;

After:
  @SomeAnnotation(
      aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa)
  int i;

llvm-svn: 225963
2015-01-14 09:51:32 +00:00
Daniel Jasper a831c58e53 clang-format: [Java] Don't get confused by leading annotations.
Before:
  @Test(a)
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      aaaaaaaaaaaaaaaaaaaaaaa);

After:
  @Test(a)
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =
      aaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 225962
2015-01-14 09:47:57 +00:00
Brad Smith 0ebb309e47 The assembler is now enabled by default.
llvm-svn: 225961
2015-01-14 08:23:49 +00:00
David Majnemer d1091e5e34 Sema: It's cheaper to ask LookupResult::empty than to calculate linkage
llvm-svn: 225960
2015-01-14 08:08:52 +00:00
Brad Smith b7c9aff1bb Use the integrated assembler by default on 32-bit PowerPC and SPARC.
llvm-svn: 225958
2015-01-14 07:55:36 +00:00
David Blaikie 66e4197f07 Reapply r225000 (reverted in r225555): DebugInfo: Generalize debug info location handling (and follow-up commits).
Several pieces of code were relying on implicit debug location setting
which usually lead to incorrect line information anyway. So I've fixed
those (in r225955 and r225845) separately which should pave the way for
this commit to be cleanly reapplied.

The reason these implicit dependencies resulted in crashes with this
patch is that the debug location would no longer implicitly leak from
one place to another, but be set back to invalid. Once a call with
no/invalid location was emitted, if that call was ever inlined it could
produce invalid debugloc chains and assert during LLVM's codegen.

There may be further cases of such bugs in this patch - they're hard to
flush out with regression testing, so I'll keep an eye out for reports
and investigate/fix them ASAP if they come up.

Original commit message:

Reapply "DebugInfo: Generalize debug info location handling"

Originally committed in r224385 and reverted in r224441 due to concerns
this change might've introduced a crash. Turns out this change fixes the
crash introduced by one of my earlier more specific location handling
changes (those specific fixes are reverted by this patch, in favor of
the more general solution).

Recommitted in r224941 and reverted in r224970 after it caused a crash
when building compiler-rt. Looks to be due to this change zeroing out
the debug location when emitting default arguments (which were meant to
inherit their outer expression's location) thus creating call
instructions without locations - these create problems for inlining and
must not be created. That is fixed and tested in this version of the
change.

Original commit message:

This is a more scalable (fixed in mostly one place, rather than many
places that will need constant improvement/maintenance) solution to
several commits I've made recently to increase source fidelity for
subexpressions.

This resetting had to be done at the DebugLoc level (not the
SourceLocation level) to preserve scoping information (if the resetting
was done with CGDebugInfo::EmitLocation, it would've caused the tail end
of an expression's codegen to end up in a potentially different scope
than the start, even though it was at the same source location). The
drawback to this is that it might leave CGDebugInfo out of sync. Ideally
CGDebugInfo shouldn't have a duplicate sense of the current
SourceLocation, but for now it seems it does... - I don't think I'm
going to tackle removing that just now.

I expect this'll probably cause some more buildbot fallout & I'll
investigate that as it comes up.

Also these sort of improvements might be starting to show a weakness/bug
in LLVM's line table handling: we don't correctly emit is_stmt for
statements, we just put it on every line table entry. This means one
statement split over multiple lines appears as multiple 'statements' and
two statements on one line (without column info) are treated as one
statement.

I don't think we have any IR representation of statements that would
help us distinguish these cases and identify the beginning of each
statement - so that might be something we need to add (possibly to the
lexical scope chain - a scope for each statement). This does cause some
problems for GDB and possibly other DWARF consumers.

llvm-svn: 225956
2015-01-14 07:38:27 +00:00
David Blaikie 47d28e07c1 DebugInof: Correct the location of exception cleanups in global ctors/dtors and ObjC methods
Without setting the CurEHLocation these cleanups would be attributed to
whatever the last active debug line location was (the 'fn' call in the
included test cases). By setting CurEHLocation correctly the line
information is improved/corrected.

This quality bug turned into a crasher with r225000 when, instead of
allowing the last location to persist, it would be zero'd out. This
could lead to a function call (such as the dtor) being made without a
debug location - if that call was subsequently inlined (and the caller
and callee had debug info, just not the call instruction) the inliner
would violate important constraints about the debug location chains by
not updating the inlined instructions to chain up to the callee
locations.

So, by fixing this bug, I am addressing the assertion failures
introduced by r225000 and should be able to recommit that patch with
impunity...

llvm-svn: 225955
2015-01-14 07:10:46 +00:00
JF Bastien c7af264486 Revert "Insert random noops to increase security against ROP attacks (clang)"
This reverts commit:
http://reviews.llvm.org/D3393

llvm-svn: 225947
2015-01-14 05:24:11 +00:00
David Majnemer b5d2d45c5c Sema: Relax parsing of '#' in constraints
llvm-svn: 225942
2015-01-14 05:11:09 +00:00
David Majnemer ce12ed20c6 Sema: Check type compatibility with the most recent decl when merging
We would check the type information from the declaration found by lookup
but we would neglect checking compatibility with the most recent
declaration.  This would make it possible for us to not correctly
diagnose inconsistencies with declarations which were made in a
different scope.

llvm-svn: 225934
2015-01-14 02:27:38 +00:00
Adam Nemet 63a951eb1c [AVX512] Add FP unpack intrinsics
These are implemented with __builtin_shufflevector just like AVX.

We have some tests on the LLVM side to assert that these shufflevectors do
indeed generate the corresponding unpck instruction.

Part of <rdar://problem/17688758>

llvm-svn: 225922
2015-01-14 01:31:17 +00:00
JF Bastien 4cb557039d Insert random noops to increase security against ROP attacks (clang)
A pass that adds random noops to X86 binaries to introduce diversity with the goal of increasing security against most return-oriented programming attacks.

Command line options:
  -noop-insertion // Enable noop insertion.
  -noop-insertion-percentage=X // X% of assembly instructions will have a noop prepended (default: 50%, requires -noop-insertion)
  -max-noops-per-instruction=X // Randomly generate X noops per instruction. ie. roll the dice X times with probability set above (default: 1). This doesn't guarantee X noop instructions.

In addition, the following 'quick switch' in clang enables basic diversity using default settings (currently: noop insertion and schedule randomization; it is intended to be extended in the future).
  -fdiversify

This is the clang part of the patch.
llvm part: D3392

http://reviews.llvm.org/D3393
Patch by Stephen Crane (@rinon)

llvm-svn: 225910
2015-01-14 01:07:51 +00:00
Alexey Samsonov 7af6af4225 Update HelpText for -fsanitize= option.
There are too many available sanitizers now - redirect to
user manual instead of listing them all.

llvm-svn: 225894
2015-01-14 00:51:17 +00:00
Eric Christopher 2b8ef99aa8 Update for move in llvm.
llvm-svn: 225892
2015-01-14 00:50:32 +00:00
Richard Smith 43d3f55072 Look through sugar when determining whether a type is a scoped enumeration
type. Patch by Stephan Bergmann!

llvm-svn: 225889
2015-01-14 00:33:10 +00:00
David Majnemer a3b04cea04 Sema: An extern declaration can't be a redeclaration of a parameter
In the following:
void f(int x) { extern int x; }

The second declaration of 'x' shouldn't be considered a redeclaration of
the parameter.

This is a different approach to r225780.

llvm-svn: 225875
2015-01-14 00:31:13 +00:00
David Blaikie f142580dea Sink a parameter into the callee since it's always the same expression in terms of another parameter
llvm-svn: 225856
2015-01-14 00:04:42 +00:00
David Blaikie 1ae04916cc DebugInfo: Correct the location of EH cleanup for blocks
This was previously piggybacking on whatever happened to be the last
location set on CGDebugInfo/DIBuilder, which was wrong (it was often the
current location, such as the 'fn()' call site, not the end of the
block). With my improvements to set/unset the location in a scoped
manner (r225000) this went from a bad quality situation, to a crash.
Fixing this goes part-way to unblocking the recommit of r225000.

It's likely that any call to CodeGenFunction::StartFunction without the
CurEHLocation set represents a similar bug or risk of a bug. Perhaps
there are some callers that know they won't generate EH cleanups, but
I'm not sure.

I considered a generic catch-fix in StartFunction (just fallback to the
GlobalDecl's location) but that seemed like it'd mask bugs where the EH
location shouldn't be the same as the decl's location (& indeed by not
using that stop-gap I found this bug). We'll see how long I can hold out
on the generic catch-all. I might eventually be able to add an assertion
in.

llvm-svn: 225845
2015-01-13 23:06:27 +00:00
Nico Weber ed50166b6b clang-format: [Java] Detect `native` keyword.
Before:
  public native<X> Foo foo();

After:
  public native <X> Foo foo();

llvm-svn: 225839
2015-01-13 22:32:50 +00:00
Ben Langmuir c67a774e17 Add [extern_c] attribute to _Builtin_intrinsics module
This allows users to import this module inside an extern "C" {} block.

llvm-svn: 225835
2015-01-13 21:54:32 +00:00
Roman Divacky ed94e2f455 Mention FreeBSD support.
llvm-svn: 225834
2015-01-13 21:31:03 +00:00
Paul Robinson 080b1f3055 When attribute 'optnone' appears on the same declaration with a
conflicting attribute, warn about the conflict and pick a "winning"
attribute to preserve, instead of emitting an error.  This matches the
behavior when the conflicting attributes are on different declarations.

Along the way I discovered that conflicts involving __forceinline were
reported as 'always_inline' (alternate spelling, same attribute) so
fixed that up to report the attribute as spelled in the source.

llvm-svn: 225813
2015-01-13 18:34:56 +00:00
Ben Langmuir c1d88ea5a7 Inherit attributes when infering a framework module
If a module map contains
framework module * [extern_c] {}

We will now infer [extern_c] on the inferred framework modules (we
already inferred [system] as a special case).

llvm-svn: 225803
2015-01-13 17:47:44 +00:00
Ben Langmuir 7615f00e51 Handle [extern_c] attribute in module printer
I'm not sure why we have OS.indent(Indent+2) for the system attribute,
but presumably we want the same behaviour for all attributes...

llvm-svn: 225802
2015-01-13 17:47:38 +00:00
Ben Langmuir d3d7f3b5bd Remove unused method canInferFrameworkModule
llvm-svn: 225801
2015-01-13 17:47:29 +00:00
Daniel Sanders cdcb580d4e [mips] Fix va_arg() for pointer types on big-endian N32.
Summary:
The Mips ABI's treat pointers in the same way as integers. They are
sign-extended to 32-bit for O32, and 64-bit for N32/N64. This doesn't matter
for O32 and N64 where pointers are already the correct width but it does matter
for big-endian N32, where pointers are 32-bit and need promoting.

The caller side is already passing pointers correctly. This patch corrects the
callee.

Reviewers: vmedic, atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6812

llvm-svn: 225782
2015-01-13 10:47:00 +00:00
David Majnemer cdf8a71d36 Revert "Sema: An extern declaration can't be a redeclaration of a parameter"
This reverts commit r225780, we can't compile line 181 in
sanitizer_platform_limits_posix.cc with this commit.

llvm-svn: 225781
2015-01-13 10:14:57 +00:00
David Majnemer c3691827c0 Sema: An extern declaration can't be a redeclaration of a parameter
In the following:
void f(int x) { extern int x; }

The second declaration of 'x' shouldn't be considered a redeclaration of
the parameter.

llvm-svn: 225780
2015-01-13 09:55:56 +00:00
Manuel Klimek 1ba46c661c Update clang-format.el to use xml output and patch in the returned chunks.
This leads to better undo behavior and avoids window content jumping
around.

Patch by Johann Klähn.

llvm-svn: 225777
2015-01-13 08:35:34 +00:00
David Majnemer d5946f51a5 Parse: Switch to using EOF tokens for late parsed attributes
The EOF token injection technique is preferable to using
isBeforeInTranslationUnit to determine whether or not additional cleanup
is needed.  I don't have an example off-hand that requires it but it is
nicer nonetheless.

llvm-svn: 225776
2015-01-13 08:35:24 +00:00
David Majnemer b3c6d52d3a Parse: Don't crash when default argument in typedef consists of sole '='
We'd crash trying to make the SourceRange for the tokens we'd like to
highlight.  Don't assume there is more than one token makes up the
default argument.

llvm-svn: 225774
2015-01-13 07:42:33 +00:00
David Majnemer 906ed278b9 Parse: Don't crash if missing an initializer expression
llvm-svn: 225768
2015-01-13 05:28:24 +00:00
David Majnemer a7ea1b1466 Parse: use the EOF token method to lex inline method bodies
Mark the end of the method body with an EOF token, collect it once we
expect to be done with method body parsing.  No functionality change
intended.

llvm-svn: 225765
2015-01-13 05:06:20 +00:00
David Majnemer 7cceba5d76 Parse: Further simplify ParseLexedMethodDeclaration
No functionality change intended, just moving code around to make it
simpler.

llvm-svn: 225763
2015-01-13 04:20:57 +00:00
Nico Weber 8b51ae93e4 Mark vtable used on explicit destructor definitions.
There are two things in a C++ program that need to read the vtable pointer:
Constructors and destructors.  (A few other operations -- virtual calls,
dynamic cast, rtti -- read the vtable pointer off a this pointer, but for
this they don't need the vtable symbol.)  Implicit constructors and destructors
and explicit constructors already marked the vtable as used, but explicit
destructors didn't.

Note that the only thing sema's "mark a class's vtable used" does is to mark all 
final overriders of the class as referenced, it does _not_ cause emission of
the vtable itself.  This is done on demand by codegen, independent of sema,
since sema might emit functions that are not referenced.  (The exception are
vtables that are forced via key functions -- these are forced onto codegen
by sema.)

This bug went unnoticed for years because it doesn't have observable effects
(yet -- I want to change this in PR20337, which is why I noticed this).

r213109 made it so that _calls_ to constructors don't mark the vtable used.
Currently, _calls_ to destructors still mark the vtable used.  If that
wasn't the case, this program would tickle the problem:

  test.h:
    template <typename T>
    struct B {
      int* p;
      virtual ~B() { delete p; }
      virtual void f() {}
    };

    struct __attribute__((visibility("default"))) C {
      C();
      B<int> m;
    };

  test2.cc:
    #include "test.h"
    int main() {
      C* c = new C;
      delete c;
    }

  test3.cc:
    #include "test.h"
    C::C() {}

  # This bin/clang++ binary doesn't MarkVTableUsed() for virtual dtor calls:
  $ bin/clang++ -shared test3.cc -std=c++11 -O2  -fvisibility=hidden \
        -fvisibility-inlines-hidden  -o libtest3.dylib
  $ bin/clang++ test2.cc -std=c++11 -O2  -fvisibility=hidden \
        -fvisibility-inlines-hidden  libtest3.dylib 
  Undefined symbols for architecture x86_64:
    "B<int>::f()", referenced from:
        vtable for B<int> in test2-af8f4f.o
  ld: symbol(s) not found for architecture x86_64

What's happening here is that there's a copy of B's vtable hidden in
libtest3.dylib, because C's constructor caused an implicit instantiation of that
(and implicit constructors generate vtables).
test2.cc calls C's destructDr, which destroys the B<int> member,
which wants to overwrite the vtable back to B (think of B as the base of a class
hierarchy, and of hierarchical destruction -- maybe we shouldn't do the vtable
writing in destructors of final classes), but there's nothing in test2.cc that
marks B's vtable used.  So codegen writes out the vtable, but since it wasn't
marked used, sema didn't mark all the virtual functions (in particular f())
as used.

Note that this change makes us reject programs we didn't reject before (see
the included Sema test case), but both gcc and cl also reject this code, and
clang used to reject it before r213109.

llvm-svn: 225761
2015-01-13 03:52:11 +00:00
Alexey Bataev 26a3924a4f [OPENMP] Consider global named register variables as threadprivate by default.
Register are thread-local by default, so we have to consider them as threadprivate.

llvm-svn: 225759
2015-01-13 03:35:30 +00:00
Richard Trieu 36d0b2b49f Extend the self move warning to record types.
Move the logic for checking self moves into SemaChecking and add that function
to Sema since it is now used in multiple places.

llvm-svn: 225756
2015-01-13 02:32:02 +00:00
Richard Smith b1c217e492 If we don't find a matching ) for a ( in an exception specification, keep the tokens around so we can diagnose an error rather than silently discarding them.
llvm-svn: 225755
2015-01-13 02:24:58 +00:00
Richard Smith 00a4a85d2b PR22208: On FreeBSD systems, __STDC_MB_MIGHT_NEQ_WC__ is expected to be defined
even though every basic source character literal has the same numerical value
as a narrow or wide character literal.

It appears that the FreeBSD folks are trying to use this macro to mean
something other than what the relevant standards say it means, but their usage
is conforming, so put up with it.

llvm-svn: 225751
2015-01-13 01:47:45 +00:00
Nico Weber c4b8e79396 Simplify a test. No behavior change.
Templates don't have key functions (cf computeKeyFunction() in
RecordLayoutBuilder.cpp), so don't have something that looks like one.

Also, instead of a vcall to force generation of the vtable, just construct
the object.  This is how the repro on PR5557 (what the test is for) worked too.

llvm-svn: 225741
2015-01-13 00:24:46 +00:00
Alexey Samsonov 8845952b54 Reimplement -fsanitize-recover family of flags.
Introduce the following -fsanitize-recover flags:
  - -fsanitize-recover=<list>: Enable recovery for selected checks or
      group of checks. It is forbidden to explicitly list unrecoverable
      sanitizers here (that is, "address", "unreachable", "return").
  - -fno-sanitize-recover=<list>: Disable recovery for selected checks or
     group of checks.
  - -f(no-)?sanitize-recover is now a synonym for
    -f(no-)?sanitize-recover=undefined,integer and will soon be deprecated.

These flags are parsed left to right, and mask of "recoverable"
sanitizer is updated accordingly, much like what we do for -fsanitize= flags.
-fsanitize= and -fsanitize-recover= flag families are independent.

CodeGen change: If there is a single UBSan handler function, responsible
for implementing multiple checks, which have different recoverable setting,
then we emit two handler calls instead of one:
the first one for the set of "unrecoverable" checks, another one - for
set of "recoverable" checks. If all checks implemented by a handler have the
same recoverability setting, then the generated code will be the same.

llvm-svn: 225719
2015-01-12 22:39:12 +00:00
Rafael Espindola 0d4fb98504 [patch][pr19848] Produce explicit comdats in clang.
The llvm IR until recently had no support for comdats. This was a problem when
targeting C++ on ELF/COFF as just using weak linkage would cause quite a bit of
dead bits to remain on the executable (unless -ffunction-sections,
-fdata-sections and --gc-sections were used).

To fix the problem, llvm's codegen will just assume that any weak or linkonce
that is not in an explicit comdat should be output in one with the same name as
the global.

This unfortunately breaks cases like pr19848 where a weak symbol is not
xpected to be part of any comdat.

Now that we have explicit comdats in the IR, we can finally get both cases
right.

This first patch just makes clang give explicit comdats to GlobalValues where
t is allowed to.

A followup patch to llvm will then stop implicitly producing comdats.

llvm-svn: 225705
2015-01-12 22:13:53 +00:00
Nico Weber 0a02992dc0 Wrap to 80 columns. No behavior change.
llvm-svn: 225703
2015-01-12 21:24:10 +00:00
Nico Weber f867c17ab5 Don't use a doc comment in a function body.
llvm-svn: 225701
2015-01-12 21:22:27 +00:00
Nathan Sidwell 822f041619 reverting due to build bot failure
llvm-svn: 225684
2015-01-12 20:13:20 +00:00
Ben Langmuir 74d5e7a79e Fix typo Block.h vs Blocks.h
Thanks for Jeremy for noticing!

llvm-svn: 225666
2015-01-12 19:42:27 +00:00
Bill Seurer cf2c96b0f6 [PowerPC]To provide better compatibility with gcc I added the __bool keyword to the Alitivec support in clang. __bool is functionally identical to using bool when declaring vector types. For example:
vector bool char v_bc;
vector __bool char v___bc;

clang already supported vector/__vector and pixel/__pixel but was missing __bool.

http://llvm.org/bugs/show_bug.cgi?id=19220

For reference: https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/PowerPC-AltiVec_002fVSX-Built-in-Functions.html

http://reviews.llvm.org/D6882

llvm-svn: 225664
2015-01-12 19:35:51 +00:00
Ben Langmuir a0c32e9310 Fix bogus 'method is unavailable' errors with modules
This just tweaks the fix from r224892 (which handled PCHs) to work with
modules, where we will serialize each method individually and hence the
hasMoreThanOneDecl bit needs to be updated as we add the methods.

llvm-svn: 225659
2015-01-12 19:27:00 +00:00
Toma Tabacu cfab40f95b [mips] Explain why we need to always clobber for MIPS inline asm. NFC.
llvm-svn: 225632
2015-01-12 14:41:30 +00:00
Alexander Kornienko 00691cf3bb Fix assertion in BreakableBlockComment (http://llvm.org/PR21916).
Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D6894

llvm-svn: 225628
2015-01-12 13:11:12 +00:00
NAKAMURA Takumi b70f83eb10 Suppress clang/test/Driver/rewrite-map-in-diagnostics.c on win32 for now. This doesn't fail on "env clang". Investigating.
llvm-svn: 225626
2015-01-12 11:39:04 +00:00
Daniel Jasper d6a1cab1bc clang-format: Improve format of lambdas in ctor initializers.
Before:
  Constructor()
      : Constructor([] { // comment
        int i;
      }) {}

After:
  Constructor()
      : Constructor([] { // comment
          int i;
        }) {}

llvm-svn: 225625
2015-01-12 10:23:24 +00:00
Alexey Bataev 19acc3d351 Rename RefersToCapturedVariable to RefersToEnclosingVariableOrCapture, NFC
llvm-svn: 225624
2015-01-12 10:17:46 +00:00
Daniel Jasper 2337f28063 clang-format: Fix formatting of inline asm.
Specifically, adjust the leading "__asm {" and trailing "}" while still
leaving the assembly inside it alone.

This fixes llvm.org/PR22190.

llvm-svn: 225623
2015-01-12 10:14:56 +00:00
David Majnemer 83de336b71 Parse: Get rid of cxx_exceptspec_end, use EOF instead
Similar to r225619, use a special EOF token to mark the end of the
exception specification instead of cxx_exceptspec_end.  Use the current
scope as the marker.

llvm-svn: 225622
2015-01-12 09:16:57 +00:00
David Majnemer bba1234849 Parse: Just a small tidy-up in ParseLexedMethodDeclaration
No functional change intended, just tidy up the parse flow.

llvm-svn: 225620
2015-01-12 06:51:15 +00:00
David Majnemer 06b7d006b8 Parse: Get rid of tok::cxx_defaultarg_end, use EOF instead
I added setEofData/getEofData to solve this sort of problem back in
r224505.  Use the Param's decl to tell us if this is *our* EOF token.

llvm-svn: 225619
2015-01-12 05:17:40 +00:00
David Majnemer 234b8188df Parse: It's cleaner to handle cxx_defaultarg_end in SkipUntil directly
llvm-svn: 225616
2015-01-12 03:36:37 +00:00
David Majnemer a3aef35d54 Parse: Don't let BalancedDelimiterTracker consume cxx_defaultarg_end
It is not correct to let it consume the cxx_defaultarg_end token.  I'm
starting to wonder if it makes more sense to stop SkipUntil from
consuming such tokens.

llvm-svn: 225615
2015-01-12 03:14:18 +00:00
Saleem Abdulrasool 3661a82ef6 Driver: include rewrite maps in the diagnostics
The rewrite map files are not copied, and so cannot be tracked as temporary
files.  Add them explicitly to the list of files that we request from the user
to be attached to bug reports.

llvm-svn: 225614
2015-01-12 02:33:09 +00:00
David Majnemer 89296ee2c3 Parse: Don't parse beyond the end of the synthetic default argument tok
Recovery from malformed lambda introducers would find us consuming the
synthetic default argument token, which is bad.  Instead, stop right
before that token.

llvm-svn: 225613
2015-01-12 02:28:16 +00:00
David Majnemer b6b5643b36 Basic: Numeric constraints are multidigit
Clang would treat the digits in an "11m" input constraint separately as
if it was handling constraint 1 twice instead of constraint 11.

llvm-svn: 225606
2015-01-11 10:22:41 +00:00
David Majnemer 55164f901b Basic: [asmSymbolicName] follows the same rule as numbers in asm inputs
Input constraints like "0" and "[foo]" should be treated the same when
it comes to their corresponding output constraint.

This fixes PR21850.

llvm-svn: 225605
2015-01-11 09:57:13 +00:00
David Majnemer c71a566d00 Basic: The asm constraint '#m' isn't valid, reject it
llvm-svn: 225603
2015-01-11 09:39:03 +00:00
David Majnemer f1fdf4a80c CodeGen: Simplify consecutive '%' modifiers
LLVM the consecutive '%' modifiers are redundant, skip them.

llvm-svn: 225602
2015-01-11 09:13:56 +00:00
David Majnemer 14d4e7bdbf CodeGen: Simplify consecutive '&' modifiers
LLVM the consecutive '&' modifiers are redundant, skip them.

llvm-svn: 225601
2015-01-11 09:09:01 +00:00
David Majnemer 50cb05591d Basic: The asm constraint '+#r' isn't valid, reject it
llvm-svn: 225600
2015-01-11 08:52:38 +00:00
Chandler Carruth 68fba279bc Don't rely on the default constructor default constructing a begin and
end iterator for iterator_range<>. I removed this constructor because
for some iterators (notably pointers) it left begin and end
uninitialized. It also is an usual constraint that an iterator default
constructs to a valid end iterator such that the pair of them for
a valid range. In the three places where this was used in Clang,
explicitly build the empty range from the iterators and comment on why
default constructed iterators make sense here.

llvm-svn: 225594
2015-01-11 01:43:06 +00:00
Nathan Sidwell f9701c6e83 fix pr18645. Correct logic concerning 'T &&' deduction against lvalues.
llvm-svn: 225587
2015-01-10 18:16:25 +00:00
David Majnemer a0040df38c Sema: The asm constraint '+&m' isn't valid, reject it
Don't permit '+&m' to make it to CodeGen, it's invalid.

llvm-svn: 225586
2015-01-10 10:43:19 +00:00
Richard Trieu 17ddb829aa Add a new warning, -Wself-move, to Clang.
-Wself-move is similiar to -Wself-assign.  This warning is triggered when
a value is attempted to be moved to itself.  See r221008 for a bug that
would have been caught with this warning.

llvm-svn: 225581
2015-01-10 06:04:18 +00:00
Richard Smith dbc8249224 Fix temporary lifetime extension from an initializer using braced "functional"
cast notation T{...} when T is a reference type.

llvm-svn: 225571
2015-01-10 01:28:13 +00:00
Hans Wennborg 43a0f99b10 Don't emit implicit template instantiations eagerly (PR21718)
Their linkage can change if they are later explicitly instantiated. We would
previously emit such functions eagerly (as opposed to lazily on first use) if
they have a 'dllexport' or 'used' attribute, and fail an assert when hitting the
explicit instantiation.

This is achieved by replacing the old CodeGenModule::MayDeferGeneration() method
with two new ones: MustBeEmitted() and MayBeEmittedEagerly().

Differential Revision: http://reviews.llvm.org/D6674

llvm-svn: 225570
2015-01-10 01:19:48 +00:00
David Blaikie 9cdf582f72 Remove unnecessary/incorrect XFAIL after the revert of 225000
llvm-svn: 225561
2015-01-09 23:38:45 +00:00
Nico Weber beb03938e9 clang-format: [Java] Support formatting qualified annotations.
llvm-svn: 225559
2015-01-09 23:25:06 +00:00
David Blaikie f353d3ecd0 Revert "DebugInfo: Generalize debug info location handling" and related commits
This reverts commit r225000, r225021, r225083, r225086, r225090.

The root change (r225000) still has several issues where it's caused
calls to be emitted without debug locations. This causes assertion
failures if/when those calls are inlined.

I'll work up some test cases and fixes before recommitting this.

llvm-svn: 225555
2015-01-09 23:00:28 +00:00
David Majnemer d527199c37 Parse: Don't crash when an annotation token shows up in a C++11 attr
It's not safe to blindly call getIdentifierInfo without checking the
token is not an annotation token.

llvm-svn: 225533
2015-01-09 18:09:39 +00:00
Hans Wennborg a7707220e3 Driver: tweak the code for determining default image name
It seemed odd to have to make DefaultImageName be a mutable member of Driver.
We don't need to the full result of computeTargetTriple() to determine the
image name; just base it on DefaultTargetTriple.

llvm-svn: 225530
2015-01-09 17:38:53 +00:00
David Majnemer 0fe3f4d731 Sema: Don't crash when variable is redefined as a constexpr function
We have a diagnostic describing that constexpr changed in C++14 when
compiling in C++11 mode.  While doing this, it examines the previous
declaration and assumes that it is a function.  However it is possible,
in the context of error recovery, for this to not be the case.

llvm-svn: 225518
2015-01-09 10:33:23 +00:00
Manuel Klimek 949ff4d9f2 Add the shifted cursor position to XML output, so it can be used by editor integrations.
llvm-svn: 225516
2015-01-09 10:03:47 +00:00
Olivier Goffart aabcb80096 Fix test from my previous commit
(I should have re-run the test after running clang-format)

llvm-svn: 225515
2015-01-09 09:42:32 +00:00
David Majnemer 02e764487f Parse: Don't crash when namespace is in GNU statement expr
Parser::ParseNamespace can get a little confused when it found itself
inside a compound statement inside of a non-static data member
initializer.

Try to determine that the statement expression's scope makes sense
before trying to parse it's contents.

llvm-svn: 225514
2015-01-09 09:38:14 +00:00
Olivier Goffart ed13fab4bc Fix crash in typo correction while correcting enum within a struct in C
llvm-svn: 225513
2015-01-09 09:37:26 +00:00
David Majnemer aa30dd7497 Sema: RecordDecl shouldn't have a FunctionDecl as a Decl
RecordDecls should have things like CXXMethodDecls or FriendDecls as a
decl but not things like FunctionDecls.

llvm-svn: 225511
2015-01-09 07:36:13 +00:00
David Majnemer 8c6db7056a Sema: Don't crash when specializing a global scope function in a class
We assumed that class-scope specializations would result in a
CXXMethodDecl for that class.  However, globally qualified functions
will result in normal FunctionDecls.

llvm-svn: 225508
2015-01-09 06:10:21 +00:00
David Majnemer baff294c1c Sema: Remove some dead code from CreateNewFunctionDecl
The same code is already in Sema::ActOnFunctionDeclarator, the only
caller of CreateNewFunctionDecl.

llvm-svn: 225506
2015-01-09 05:56:10 +00:00
David Majnemer e01c466c67 Parse: Don't crash when trailing return type is missing
Sema::CheckParmsForFunctionDef can't cope with a null TypeSourceInfo.
Don't let the AST contain the malformed lambda.

This fixes PR22122.

llvm-svn: 225505
2015-01-09 05:10:55 +00:00
Saleem Abdulrasool 76a4b95ad8 Driver: begin threading frontend support for SymbolRewriter
Allow blessed access to the symbol rewriter from the driver. Although the
symbol rewriter could be invoked through tools like opt and llc, it would not
accessible from the frontend. This allows us to read the rewrite map files in
the frontend rather than the backend and enable symbol rewriting for actually
performing the symbol interpositioning.

llvm-svn: 225504
2015-01-09 05:10:20 +00:00
Justin Bogner 203f91e311 InstrProf: Don't emit counter increments in dead code
We were previously emitting counter increments even if we didn't have
an insertion point, which would result in a CallInst with no
parent. This leads to a crash, as in pr22166, if we try to do
GlobalDCE.

llvm-svn: 225495
2015-01-09 01:46:40 +00:00
David Majnemer 4f217684c7 Sema: Dependent array designators cannot be checked
We forgot to mark designated initializer expression that contain type
dependent array designators as type dependent.  This would lead to
crashes when we try to determine which array element we were trying to
initialize.

This fixes PR22056.

llvm-svn: 225494
2015-01-09 01:39:09 +00:00
Richard Smith 70b13043a2 PR22117: Fix a case where we would get confused about which function parameter
we're instantiating, if there's a ParmVarDecl within a FunctionDecl context
that is not a parameter of that function. Add some asserts to catch this kind
of issue more generally, and fix another bug exposed by those asserts where we
were missing a local instantiation scope around substitution of
explicitly-specified template arguments.

llvm-svn: 225490
2015-01-09 01:19:56 +00:00
Richard Smith b5d1a73988 Don't invent a '$auto-x-y' name for auto types in generic lambdas. This is no
better than the 'template-parameter-x-y' name that we'd get in AST printing,
and is worse in several ways (it's harder to distinguish it from a
user-supplied name, it's wrong after substituting some number of outer
levels, it wastes time and space constructing an IdentifierInfo, ...).

llvm-svn: 225489
2015-01-09 00:59:40 +00:00
Richard Trieu 94a9ae776d Use APSInt::isSameValue instead of operator== in a place where two APSInt's
may have different sizes.  Fixes PR22017

llvm-svn: 225488
2015-01-09 00:58:16 +00:00
Duncan P. N. Exon Smith 4bbe428cc5 IR: Add 'distinct' MDNodes to bitcode and assembly (clang)
Update testcases for LLVM change in r225474 to make `MDNode`s explicitly
distinct (when they aren't uniqued).

Part of PR22111.

llvm-svn: 225475
2015-01-08 22:39:28 +00:00
Manuel Klimek 295b7b6800 Improve clang-format.el.
- includes header/footer as required by MELPA
- correctly handles buffers that are not associated with a file
- displays stderr and exit code of clang-format process
- customizable via the emacs customization interface and file-/directory-
  local variables

Patch by Johann Klähn.

llvm-svn: 225447
2015-01-08 15:29:03 +00:00
Daniel Jasper d05d3a8919 clang-format: Force line break between "endl" and "<<".
This makes piped output easier to read in many instances.

Before:
  llvm::errs() << aaaa << std::endl << bbbb << std::endl;

After:
  llvm::errs() << aaaa << std::endl
               << bbbb << std::endl;

Also fix a few instance of "don't use else after return" as per the
coding standards.

llvm-svn: 225444
2015-01-08 13:56:57 +00:00
Logan Chien d3d385d624 Frontend: Fix SourceColumnMap assertion failure on non-ascii characters.
If there are some non-ascii character in the input source code, the
column index might be smallar than the byte index.  This will result
in two possible assertion failures.  This CL fixes the computation of
the column index and byte index.

1. The assertion in startOfNextColumn() and startOfPreviousColumn()
   should not be raised when the byte index is greater than the column
   index since the non-ascii characters may use more than one bytes to
   store a character in a column.

2. The length of the caret line should be equal to the number of columns
   of source line, instead of the length of the source line.  Otherwise,
   the assertion in selectInterestingSourceRegion will be raised because
   the removed columns plus the kept columns are not greater than the max
   column, which means that we should not remove any column at all.

llvm-svn: 225442
2015-01-08 13:19:07 +00:00
Daniel Jasper b13135bc08 clang-format: Improve template parameter detection.
Before:
  struct A < std::enable_if<sizeof(T2) <sizeof(int32)>::type>;

After:
  struct A<std::enable_if<sizeof(T2) < sizeof(int32)>::type>;

llvm-svn: 225435
2015-01-08 08:48:21 +00:00
Richard Trieu 8ac1419dfd Attempt to fix test from r225423 to get build bots green.
llvm-svn: 225426
2015-01-08 02:40:08 +00:00
Richard Trieu b3b8bb0029 When the diagnostic text is simply "%0", sanitize the string for any
unprintable characters.  Fixes PR22048.

llvm-svn: 225423
2015-01-08 01:27:03 +00:00
Nico Weber 462fd1ede5 Wrap to 80 columns. No behavior change.
llvm-svn: 225414
2015-01-07 23:50:05 +00:00
Nico Weber e6264cf661 Add help text for mmacosx-version-min=, mios-version-min=.
I keep forgetting the exact spelling of -macosx-version-min=, and now I can
run `bin/clang --help | grep version -A 2` to remind myself.  While here,
also document -mios-version-min=.  Don't document -mios-simulator-version-min=
as it's just an alias for -mios-version-min= these days.

llvm-svn: 225409
2015-01-07 22:40:55 +00:00
Kaelyn Takata 42118a9524 Handle OpaqueValueExprs more intelligently in the TransformTypos tree
transform.

Also diagnose typos in the initializer of an invalid C++ declaration.
Both issues were hit using the same line of test code, depending on
whether the code was treated as C or C++.

Fixes PR22092.

llvm-svn: 225389
2015-01-07 21:16:39 +00:00
Nico Weber c1d42ad99a Slightly simplify the test from r225361.
Shorter and doesn't need -O2 -- but still suboptimal as it's still doing
-emit-obj.  dblaikie says he'll improve this when he'll reland his change
with a fix.

llvm-svn: 225364
2015-01-07 18:47:51 +00:00
Nico Weber ece3d3c26e clang-format: Let Chromium use the Google default for AlignTrailingComments.
r225141 changed the defaults of AllowShortIfStatementsOnASingleLine and
AlignTrailingComments for Google style and added explicit overrides for
Chromium style to undo these changes.  For AllowShortIfStatementsOnASingleLine
that's good as the Android style guide (which Chromium uses for Java) explicitly
permits single-line ifs. But it's silent on trailing comments, to it makes
sense for Chromium style to just follow Google style.

llvm-svn: 225363
2015-01-07 18:41:10 +00:00
Nico Weber eac50037fb Revert r225085, it caused PR22096.
PR22096 has several test cases that assert that look fairly different. I'm
adding one of those as an automated test, but when relanding the other cases
should probably be checked as well.

llvm-svn: 225361
2015-01-07 18:23:08 +00:00
Adrian Prantl 0772dbd125 Debug info: pass in the correct size for a pointer to a member function.
This corrects a bug I introduced in r224781.

llvm-svn: 225359
2015-01-07 17:49:30 +00:00
Daniel Jasper 4953210478 clang-format: Understand single-line comments at the end of blocks.
This prevents clang-format from moving/aligning the comment in the
snippet:
  void f() {
    int i; // some comment
    // some unrelated comment
  }

llvm-svn: 225352
2015-01-07 14:00:11 +00:00
Daniel Jasper 6a9682038f clang-format: Fix unary operator detection.
Before:
  ** outparam = 1;

After:
  **outparam = 1;

llvm-svn: 225349
2015-01-07 12:19:53 +00:00
Nico Weber 4c2ffb24f9 Fix comment typo.
llvm-svn: 225340
2015-01-07 05:25:05 +00:00
Nico Weber f1cebf0d17 Fix grammar-o in comment.
llvm-svn: 225324
2015-01-06 23:54:59 +00:00
Rafael Espindola c7bd85424c Suppress clang warnings in a codegen test.
This makes the output of FileCheck way easier to read since this test hits
many warnings.

llvm-svn: 225322
2015-01-06 23:53:13 +00:00
Matt Arsenault 6365ffea3e Add __builtin_amdgpu_class
llvm-svn: 225314
2015-01-06 23:14:57 +00:00
Hal Finkel 5ba18f7a72 [PowerPC] Add support for -mcmpb
In r225106, support for the CMPB instruction was added to the PowerPC backend.
This adds the associated GCC-compatible feature flag.

llvm-svn: 225312
2015-01-06 23:06:41 +00:00
Rafael Espindola c0f4a30ee7 Update for .ll syntax change.
llvm-svn: 225303
2015-01-06 22:55:40 +00:00
Tom Stellard d8e38a3206 R600: Handle amdgcn triple
For now there is no difference between amdgcn and r600.

llvm-svn: 225294
2015-01-06 20:34:47 +00:00
Saleem Abdulrasool fb99fc96c9 Basic: fix compilation with MSVC
MSVC doesn't like the instantiation of the structure in the initializer list.
Initialize it in the constructor body to repair the build.

TargetInfo.h(545) : error C2143: syntax error : missing ')' before '{'
TargetInfo.h(545) : error C2143: syntax error : missing ';' before '}'
TargetInfo.h(545) : error C2059: syntax error : ')'
TargetInfo.h(545) : error C2059: syntax error : ','
TargetInfo.h(547) : error C2143: syntax error : missing ';' before '{'
TargetInfo.h(547) : error C2447: '{' : missing function header (old-style formal list?)

llvm-svn: 225247
2015-01-06 05:55:56 +00:00
Saleem Abdulrasool a2823578e6 Sema: analyze I,J,K,M,N,O constraints
Add additional constraint checking for target specific behaviour for inline
assembly constraints.  We would previously silently let all arguments through
for these constraints.  In cases where the constraints were violated, we could
end up failing to select instructions and triggering assertions or worse,
silently ignoring instructions.

llvm-svn: 225244
2015-01-06 04:26:34 +00:00
Brad Smith ba26f586a0 Set the default ISA for OpenBSD/mips64 to MIPS III.
llvm-svn: 225241
2015-01-06 02:53:17 +00:00
Kostya Serebryany 2d88f3d623 Allow -fsanitize-coverage=N with ubsan, clang part
Summary:
Allow -fsanitize-coverage=N with ubsan, clang part.
This simply allows the flag combination.
The LLVM will work out of the box, the compile-rt part
will follow as a separate patch.

Test Plan: check-clang

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6849

llvm-svn: 225229
2015-01-06 01:02:48 +00:00
Duncan P. N. Exon Smith 0aa050fbf2 Revert "Use the integrated assembler by default on 32-bit PowerPC and SPARC"
This reverts commit r225212.  It's failing on multiple buildbots [1][2].

[1]: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/22032
[2]: http://lab.llvm.org:8080/green/view/Clang/job/clang-stage1-cmake-RA-incremental_check/2357/

llvm-svn: 225221
2015-01-05 23:31:42 +00:00
Brad Smith a2e3e368e7 Use the integrated assembler by default on 32-bit PowerPC and SPARC
llvm-svn: 225212
2015-01-05 21:44:15 +00:00
Francisco Lopes da Silva 37e8f2d6a7 Fix lit for builds under /opt
llvm-svn: 225196
2015-01-05 19:59:24 +00:00
Rafael Espindola 58d4c5a9c0 Make this test a bit stricter.
The first function is named __cxx_global_var_init, which is a substring of
the following functions @__cxx_global_var_init(1,2,3,etc).

llvm-svn: 225191
2015-01-05 18:48:18 +00:00
Rafael Espindola 6f39d8525c Disable warnings in this test.
This makes it a lot easier to read the output from FileCheck when it fails.

llvm-svn: 225190
2015-01-05 18:19:35 +00:00
Samuel Antao 4ae1f67ccf Fix clash of gcc toolchains in driver regression tests.
For some regression tests the path to the right toolchain is specified using the -sysroot switch. However, if clang was configured with a custom gcc toolchain (either by using GCC_INSTALL_PREFIX in cmake or the equivalent configure command), the path to the custom gcc toolchain path takes precedence to the one specified by sysroot. This causes several regression tests to fail as they will be using an unexpected path. This patch fixes this issue by adding --gcc-toolchain='' to all tests that rely on that. The empty string causes the driver to pick the path from sysroot instead.

llvm-svn: 225182
2015-01-05 17:07:42 +00:00
Samuel Benzaquen 45ed4f9542 Fix dangling pointer in isDerivedFrom.
Summary:
Replace usage of StringRef with std::string in AST_MATCHER* generated
matchers to make sure they keep their own copy of the string.
The value could be a temporary and it causes the pointer to be dangling
by the time the matcher is executed.

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D6843

llvm-svn: 225180
2015-01-05 15:26:42 +00:00
NAKAMURA Takumi b0f54e7909 clang/CMakeLists.txt: Introduce LLVM_SHLIB_OUTPUT_INTDIR also here, or plugins tests might fail.
llvm-svn: 225170
2015-01-05 14:06:14 +00:00
Rafael Espindola 7a45e8794f Fix formatting. NFC.
llvm-svn: 225168
2015-01-05 13:44:59 +00:00
Daniel Jasper 77ef2be2e4 clang-format: [Java] Fix incorrect detection of cast.
After:
  return (a instanceof List<?>) ? aaaaaaaaaaaaaaaaaaaaaaa(
                                      aaaaaaaaaaaaaaaaaaaaa)
                                : aaaaaaaaaaaaaaaaaaaaaaa;

After:
  return (a instanceof List<?>)
      ? aaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa)
      : aaaaaaaaaaaaaaaaaaaaaaa;

llvm-svn: 225161
2015-01-05 10:33:39 +00:00
Daniel Jasper 5f1fa85e5b clang-format: [Java] Fix incorrect recognition of annonymous classes.
Before:
  someFunction(new Runnable() { public void run() { System.out.println(42);
  }
  });

After:
  someFunction(new Runnable() {
    public void run() {
      System.out.println(42);
    }
  });

llvm-svn: 225142
2015-01-04 20:40:51 +00:00
Daniel Jasper fd4ed18402 clang-format: [Java] Change a few flags for Google's Java style.
No tests added as all of these are already tested separately.

llvm-svn: 225141
2015-01-04 20:40:45 +00:00
Nico Weber 49e6bc024d Remove an assert that's not true on invalid code.
r185773 added an assert that checked that a CXXUnresolvedConstructExpr either
has a valid rparen, or exactly one argument.  This doesn't have to be true for
invalid inputs.  Convert the assert to an if, and add a test for this case.

Found by SLi's afl bot.

llvm-svn: 225140
2015-01-04 20:32:12 +00:00
Yaron Keren 7c91552cd9 Fix default image name to 'a.exe' on Windows, instead 'a.out'.
This applies to mingw as clang-cl already has its own logic for the filename.

llvm-svn: 225134
2015-01-04 13:48:30 +00:00
Daniel Jasper 428f0b1430 clang-format: Re-enable comment re-indentation for Java/JS.
This was broken by r224120.

llvm-svn: 225130
2015-01-04 09:11:17 +00:00
Nico Weber 3ce01c34c0 Fix indentation. No behavior change.
llvm-svn: 225129
2015-01-04 08:07:54 +00:00
Nico Weber 05c680adb1 Wrap to 80 columns, no behavior change.
llvm-svn: 225128
2015-01-04 07:59:35 +00:00
Nico Weber 227822e116 Document that GetTypeForDeclarator() cannot return a null type.
Also add a few asserts for this.  The existing code assumes this in a bunch
of places already (see e.g. the assert at the top of ParseTypedefDecl(), and
there are many unchecked calls on the result of GetTypeForDeclarator()), and
from looking through the code this should always be true from what I can tell.
This allows removing ASTContext::getNullTypeSourceInfo() too as that's now
unused.

No behavior change intended.

llvm-svn: 225125
2015-01-04 05:29:21 +00:00
Nico Weber 3632e034ba Crash less enthusiasticially on _Atomic or __restrict__ on invalid types.
Many places in Sema cannot handle isNull() types.  This is fine, because in
most places the type building code recovers by falling back to IntTy.  In
GetFullTypeForDeclarator(), this is done at the end of the getNumTypeObjects()
loop body.  This function calls BuildQualifiedType() before this fallback is
done though, so it explicitly needs to check for isNull() types.

llvm-svn: 225124
2015-01-04 04:53:10 +00:00
Nico Weber 744cc5b5dd Wrap to 80 columns, no behavior change.
llvm-svn: 225122
2015-01-04 00:47:22 +00:00
David Majnemer 99b98f07d4 AST: Remove overzealous assertion from IsModifiable
It's reasonable to ask if an l-value with class type is modifiable.

llvm-svn: 225121
2015-01-04 00:44:32 +00:00
David Majnemer 22fe771f78 Parse: __attribute__((keyword)) shouldn't error
Weird constructs like __attribute__((inline)) or
__attibute__((typename)) should result in warnings, not errors.

llvm-svn: 225118
2015-01-03 19:41:00 +00:00
Aaron Ballman 409af50858 Volatile reads are side-effecting operations, but in the general case of access through a volatile-qualified type, we're not certain of the underlying object's side-effects on access.
Treat volatile accesses as "maybe" instead of "definite" side effects for the purposes of warning on evaluations in an unevaluated context. No longer diagnose on idiomatic code like:

int * volatile v;
(void)sizeof(*v);

llvm-svn: 225116
2015-01-03 17:00:12 +00:00
Rafael Espindola f733b422d0 Remove -Werror from test.
It is not needed since we FileCheck for the warning and -Werror itself can end up
unused.

llvm-svn: 225102
2015-01-03 00:28:47 +00:00
Rafael Espindola 577637a6af Really don't warn about -flto/fno-lto :-(
This should fix the last bots.

llvm-svn: 225100
2015-01-03 00:06:04 +00:00
Rafael Espindola 16042fc2b9 Also avoid warning on -flto/-fno-lto on linux.
On OS X a .s file is preprocessed, it is not on linux, which is why the warning was still
showing up on linux but not OS X.

llvm-svn: 225095
2015-01-02 23:23:52 +00:00
Rafael Espindola 5640ae48db Don't warn on unused -fno-lto.
It is somewhat common for CFLAGS to be used with .s files. We were
already ignoring -flto. This patch just does the same for -fno-lto.

llvm-svn: 225093
2015-01-02 22:56:15 +00:00
David Blaikie b9a23c9155 DebugInfo: Provide a less subtle way to set the debug location of simple ret instructions
un-XFAILing the test XFAIL'd in r225086 after it regressed in r225083.

llvm-svn: 225090
2015-01-02 22:07:26 +00:00
Saleem Abdulrasool 61770ab26f Driver: honour the clang-cl behaviour on ARM as well
Unfortunately, MSVC does not indicate to the driver what target is being used.
This means that we cannot correctly select the target architecture for the
clang_rt component.  This breaks down when targeting windows with the clang
driver as opposed to the clang-cl driver.  This should fix the native ARM
buildbot tests.

llvm-svn: 225089
2015-01-02 21:47:33 +00:00
Saleem Abdulrasool 1d59f49f9c Driver: reuse getCompilerRT in place of addSanitizerRTWindows
The logic for addSanitizerRTWindows was performing the same logical operation as
getCompilerRT, which was previously fully generalised for Linux and Windows.
This avoids having a duplication of the logic for building up the name of a
clang_rt component.  This change does move the current limitation for Windows
into getArchNameForCompilerRTLib, where it is assumed that the architecture for
Windows is always i386.

llvm-svn: 225087
2015-01-02 20:00:55 +00:00
David Blaikie 5e9e13f54a Temporarily XFAIL fallout from r225083 while investigating.
Between this behavior and that fixed by r225083/r225000, I'll take the
latter over the former for now, but I'm immediately working on
understanding/addressing this behavior too.

(the fact that the code change in r225083 caused this change in behavior
is a bit troubling anyway - given that it looks & claims to be just a
preformance thing)

llvm-svn: 225086
2015-01-02 19:49:28 +00:00
David Blaikie fcee870c17 DebugInfo: Remove some now-unnecessary location handling around function arguments.
r225000 generalized debug info line info handling for expressions such
that this code is no longer necessary.

This removes the last use of CGDebugInfo::getLocation, but not all the
uses of CGDebugInfo::CurLoc, which is still used internally in
CGDebugInfo. I'd like to do away with all of that & might succeed after
a few more patches.

llvm-svn: 225085
2015-01-02 19:49:10 +00:00
David Blaikie ba90b04b7b DebugInfo: Fix cases where location failed to be updated after r225000
The optimization (that appears to have been here since the earliest
implementation (r50848) & has become more complicated over the years) to
avoid recreating the debugloc if it would be the same was out of date
because ApplyDebugLocation was not re-updating the CurLoc/PrevLoc. This
optimization doesn't look terribly beneficial/necessary, so I'm removing
it - if it turns up in benchmarks, I'm happy to reconsider/reimplement
this with justification, but for now it just seems to add
complexity/problems.

llvm-svn: 225083
2015-01-02 19:06:25 +00:00
Nick Lewycky 0b72773c8a Instantiation of a CXXMethodDecl may fail when the parameter type cannot be instantiated. Do not crash in this case. Fixes PR22040!
The FIXME in the test is caused by TemplateDeclInstantiator::VisitCXXRecordDecl
returning a nullptr instead of creating an invalid decl. This is a common
pattern across all of TemplateDeclInstantiator, so I'm not comfortable changing
it. The reason it's not invalid in the class template is due to support for an
MSVC extension, see r137573.

llvm-svn: 225071
2015-01-02 01:33:12 +00:00
David Majnemer 602cfe7d62 CodeGen: Don't crash when a lambda uses a local constexpr variable
The DeclRefExpr might be for a variable initialized by a constant
expression which hasn't been ODR used.
Emit the initializer for the variable instead of trying to capture the
variable itself.

This fixes PR22071.

llvm-svn: 225060
2015-01-01 09:49:44 +00:00