Commit Graph

56231 Commits

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