Commit Graph

83192 Commits

Author SHA1 Message Date
Chris Lattner 86ed5b016a add a new --print-diagnostic-categories option, which causes the driver to
print out all of the category numbers with their description.  This is useful
for clients that want to map the numbers produced by 
--fdiagnostics-show-category=id to their human readable string form.  The
output is simple but utilitarian:

$ clang --print-diagnostic-categories
1,Format String
2,Something Else

This implements rdar://7928193

llvm-svn: 103080
2010-05-05 05:53:24 +00:00
Douglas Gregor 94f9a4820a Reimplement code generation for copying fields in the
implicitly-generated copy constructor. Previously, Sema would perform
some checking and instantiation to determine which copy constructors,
etc., would be called, then CodeGen would attempt to figure out which
copy constructor to call... but would get it wrong, or poke at an
uninstantiated default argument, or fail in other ways.

The new scheme is similar to what we now do for the implicit
copy-assignment operator, where Sema performs all of the semantic
analysis and builds specific ASTs that look similar to the ASTs we'd
get from explicitly writing the copy constructor, so that CodeGen need
only do a direct translation.

However, it's not quite that simple because one cannot explicit write
elementwise copy-construction of an array. So, I've extended
CXXBaseOrMemberInitializer to contain a list of indexing variables
used to copy-construct the elements. For example, if we have:

  struct A { A(const A&); };
  
  struct B {
    A array[2][3];
  };

then we generate an implicit copy assignment operator for B that looks
something like this:

  B::B(const B &other) : array[i0][i1](other.array[i0][i1]) { }

CodeGen will loop over the invented variables i0 and i1 to visit all
elements in the array, so that each element in the destination array
will be copy-constructed from the corresponding element in the source
array. Of course, if we're dealing with arrays of scalars or class
types with trivial copy-assignment operators, we just generate a
memcpy rather than a loop.

Fixes PR6928, PR5989, and PR6887. Boost.Regex now compiles and passes
all of its regression tests.

Conspicuously missing from this patch is handling for the exceptional
case, where we need to destruct those objects that we have
constructed. I'll address that case separately.

llvm-svn: 103079
2010-05-05 05:51:00 +00:00
Anders Carlsson 58fe1756fb Use a more appropriate LLVM type for the vtable pointer.
llvm-svn: 103078
2010-05-05 05:47:36 +00:00
Douglas Gregor ecc60b99f9 Unbreak CMake build.
llvm-svn: 103077
2010-05-05 05:41:05 +00:00
Chris Lattner 5561bf3d11 fit in 80 cols
llvm-svn: 103075
2010-05-05 05:28:39 +00:00
Alexis Hunt 620a79f32b Add forgotten CMakeFiles.txt
llvm-svn: 103074
2010-05-05 04:50:38 +00:00
Alexis Hunt 40dde1ac92 Include the right header for toupper
llvm-svn: 103073
2010-05-05 04:31:44 +00:00
Alexis Hunt b9f408a873 Change StmtNodes.def to StmtNodes.td in anticipation of a rewrite of attributes
llvm-svn: 103072
2010-05-05 04:13:52 +00:00
Alexis Hunt f4cdc84160 Add an emitter to handle the list of clang statement nodes.
llvm-svn: 103071
2010-05-05 04:13:08 +00:00
Chris Lattner 336119f089 document -fdiagnostics-show-category
llvm-svn: 103067
2010-05-05 01:35:28 +00:00
Ted Kremenek 680fe51e2c Rework clang_annotateTokens() to annotate tokens with information that more closely matches
clang_getCursor().  Tokens are now annotated with the cursor (for the matching AST element)
that most closely encompasses that token.

llvm-svn: 103064
2010-05-05 00:55:23 +00:00
Ted Kremenek 15cbc3a8a5 Map Objective-C keywords to CXToken_Keyword.
llvm-svn: 103063
2010-05-05 00:55:20 +00:00
Ted Kremenek 458c2f190a Move post-processing of token annotations to method in AnnotateTokensWorker.
llvm-svn: 103062
2010-05-05 00:55:17 +00:00
Ted Kremenek 63ac5999f1 Refactor visitor logic for clang_annotateTokens() into a worker class. No functionality change yet.
llvm-svn: 103061
2010-05-05 00:55:15 +00:00
Bob Wilson d1b38e317d Combine the implementations of the core part of the SSAUpdater and
MachineSSAUpdater to avoid duplicating all the code.

llvm-svn: 103060
2010-05-04 23:18:19 +00:00
Eric Christopher a00830df31 Update comment.
llvm-svn: 103057
2010-05-04 22:13:03 +00:00
Chris Lattner bf6fac8415 add a new -fdiagnostics-show-category=none/id/name option, giving control
over choice of:

t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat]
t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,1]
t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,Format String]

dox to come.

llvm-svn: 103056
2010-05-04 21:55:25 +00:00
Chris Lattner 4531cc5529 When -fdiagnostics-print-source-range-info is specified,
print the diagnostic category number in the [] at the end
of the line.  For example:

$ cat t.c 
#include <stdio.h>
void foo() {
 printf("%s", 4);
}
$  clang t.c -fsyntax-only -fdiagnostics-print-source-range-info
t.c:3:11:{3:10-3:12}{3:15-3:16}: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,1]
  printf("%s", 4);
          ~^   ~
1 warning generated.

Clients that want category information can now pick the number 
out of the output, rdar://7928231.

More coming.

llvm-svn: 103053
2010-05-04 21:13:21 +00:00
John McCall 4a39ab8078 Emit the globals, metadata, etc. associated with static variables even when
they're unreachable.  This matters because (if they're POD, or if this is C)
the scope containing the variable might be reachable even if the variable
isn't.  Fixes PR7044.

llvm-svn: 103052
2010-05-04 20:45:42 +00:00
Chris Lattner 216c33beba add the ability to associate 'category' names with diagnostics
and diagnostic groups.  This allows the compiler to group 
diagnostics together (e.g. "Logic Warning", 
"Format String Warning", etc) like the static analyzer does.
This is not exposed through anything in the compiler yet.

llvm-svn: 103051
2010-05-04 20:44:26 +00:00
Chris Lattner b3d221964b add the ability to associate 'category' names with clang diagnostics
and diagnostic groups.  This allows the compiler to group 
diagnostics together (e.g. "Logic Warning", 
"Format String Warning", etc) like the static analyzer does.  
This is not exposed through anything in the compiler yet.

llvm-svn: 103050
2010-05-04 20:44:23 +00:00
Evan Cheng 8e6b40a881 With -neon-reg-sequence, models forming a Q register from a pair of consecutive D registers as a REG_SEQUENCE.
llvm-svn: 103047
2010-05-04 20:39:49 +00:00
Evan Cheng a3a7b0099c Do not pre-allocate for registers which form a REG_SEQUENCE.
llvm-svn: 103041
2010-05-04 20:38:12 +00:00
Evan Cheng 4c908f4181 Teach PHI elimination to remove REG_SEQUENCE instructions and update references of the source operands with references of the destination with subreg indices. e.g.
%reg1029<def>, %reg1030<def> = VLD1q16 %reg1024<kill>, ...
%reg1031<def> = REG_SEQUENCE %reg1029<kill>, 5, %reg1030<kill>, 6
=>
%reg1031:5<def>, %reg1031:6<def> = VLD1q16 %reg1024<kill>, ...

PHI elimination now does more than phi elimination. It is really a de-SSA pass.

llvm-svn: 103039
2010-05-04 20:26:52 +00:00
Duncan Sands 687900ed83 Use llvm.foo as the intrinsic, rather than llvm.dbg.value. Since the
values passed to llvm.dbg.value were not valid for the intrinsic, it
might have caused trouble one day if the verifier ever started checking
for valid debug info.

llvm-svn: 103038
2010-05-04 20:09:25 +00:00
Bob Wilson a2fda8b648 Defer adding critical edges to the "toSplit" list until after checking for
indirect branches in all the predecessors.  This avoids unnecessarily
splitting edges in cases where load PRE is not possible anyway.
Thanks to Jakub Staszak for pointing this out.

llvm-svn: 103034
2010-05-04 20:03:21 +00:00
Fariborz Jahanian 60c7e16b64 Fixes a code gen. crash when ivar object has trivial constructor.
llvm-svn: 103028
2010-05-04 19:29:32 +00:00
Douglas Gregor c8be95274d When instantiating a function that was declared via a typedef, e.g.,
typedef int functype(int, int);
    functype func;

also instantiate the synthesized function parameters for the resulting
function declaration. 

With this change, Boost.Wave builds and passes all of its regression
tests.

llvm-svn: 103025
2010-05-04 18:18:31 +00:00
Chris Lattner a25ee78fc0 one more thing.
llvm-svn: 103024
2010-05-04 18:16:00 +00:00
Chris Lattner f3d99aaa22 update instructions for llvm-gcc4, the brave new world! PR7037
llvm-svn: 103023
2010-05-04 18:15:33 +00:00
Fariborz Jahanian eeb233793d Fixes a code gen crash when block is a reference type, etc.
(radar 7495203).

llvm-svn: 103022
2010-05-04 17:59:32 +00:00
Chris Lattner 0185047b3f "on the rare occasion the SPU BE produces illegal assembly - it tries to emit an add instruction of the form 'a reg, reg, imm'."
Patch by Kalle Raiskila!

llvm-svn: 103021
2010-05-04 17:58:46 +00:00
Daniel Dunbar c3e0bafc6d MC/X86: Chris pointed that 'as' isn't consistent in accepting the long form of
instructions which have no direct register usage.

Darwin 'as' accepts:
  add $0, (%rax)
but rejects
  mov $0, (%rax)
for example.

Given that, only accept suffix matches which match exactly one form. We still
need to emit nice diagnostics for failures...

llvm-svn: 103015
2010-05-04 17:31:02 +00:00
Douglas Gregor cd121fb013 Introduce a limit on the depth of the macro instantiation backtrace
printed in a diagnostic, similar to the limit we already have on the
depth of the template instantiation backtrace. The macro instantiation
backtrace is limited to 10 "instantiated from:" diagnostics; when it's
longer than that, we'll show the first half, then say how many were
suppressed, then show the second half. The limit can be changed with
-fmacro-instantiation-limit=N, and turned off with N=0.

This eliminates a lot of note spew with libraries making use of the
Boost.Preprocess library.

llvm-svn: 103014
2010-05-04 17:13:42 +00:00
Evan Cheng a5c0cc329e Rename variables for consistency.
llvm-svn: 103013
2010-05-04 17:12:26 +00:00
Daniel Dunbar 9b816a1bb3 MC/X86: Add "support" for matching ATT style mnemonic prefixes.
- The idea is that when a match fails, we just try to match each of +'b', +'w',
   +'l'. If exactly one matches, we assume this is a mnemonic prefix and accept
   it. If all match, we assume it is width generic, and take the 'l' form.

 - This would be a horrible hack, if it weren't so simple. Therefore it is an
   elegant solution! Chris gets the credit for this particular elegant
   solution. :)

 - Next step to making this more robust is to have the X86 matcher generate the
   mnemonic prefix information. Ideally we would also compute up-front exactly
   which mnemonic to attempt to match, but this may require more custom code in
   the matcher than is really worth it.

llvm-svn: 103012
2010-05-04 16:12:42 +00:00
Douglas Gregor 40c92bbe4f When creating a call to a base subobject's operator= in an
implicitly-defined copy assignment operator, suppress the protected
access check. This eliminates the remaining failure in the
Boost.SmartPtr library (that was a product of the copy-assignment
generation rewrite) and, presumably, the Boost.TR1 library as well.

llvm-svn: 103010
2010-05-04 15:20:55 +00:00
Duncan Sands 8815f38312 Fix a problem exposed by my previous commit and noticed by a release-asserts
buildbot: the debugging and non-debugging versions of getFunction were not
functionally equivalent: the non-debugging version wrongly assumed that if a
metadata operand was not metadata, then it had a non-null containing function.
This is not true, since the operand might be a global value, constant etc.

llvm-svn: 103008
2010-05-04 14:25:42 +00:00
Duncan Sands c2928c6ef5 Fix a variant of PR6112 found by thinking about it: when doing
RAUW of a global variable with a local variable in function F,
if function local metadata M in function G was using the global
then M would become function-local to both F and G, which is not
allowed.  See the testcase for an example.  Fixed by detecting
this situation and zapping the metadata operand when it occurs.

llvm-svn: 103007
2010-05-04 12:43:36 +00:00
Sebastian Redl 80fecfff45 Let StmtDumper.cpp handle using declarations.
llvm-svn: 103006
2010-05-04 10:20:17 +00:00
Gabor Greif 4c0f838637 fix operand indexes when outputting InvokeInsts
llvm-svn: 103003
2010-05-04 09:23:54 +00:00
Devang Patel 075e9b5d66 Set DW_AT_APPLE_omit_frame_ptr in endFunction() where MachineFunction is available all the time.
llvm-svn: 103001
2010-05-04 06:15:30 +00:00
Chris Lattner 2dd1552588 improve bullets, patch by Mike Miller
llvm-svn: 103000
2010-05-04 05:19:07 +00:00
John McCall 9720514f3b An access is permitted if the current template instantiates to the appropriate
class.  Add some conservative support for the idea.  Fixes PR 7024.

llvm-svn: 102999
2010-05-04 05:11:27 +00:00
John McCall e61b02bcaf When inheriting a default argument expression, inherit the full expression,
not just the inner expression.  This is important if the expression has any
temporaries.  Fixes PR 7028.

Basically a symptom of really tragic method names.

llvm-svn: 102998
2010-05-04 01:53:42 +00:00
Dan Gohman 70a3b12193 Use the SCEVAddRecExpr::getPostIncExpr utility function instead
of doing the same thing manually.

llvm-svn: 102997
2010-05-04 01:12:27 +00:00
Dan Gohman 5f18c547da Fix a copy+pasto.
llvm-svn: 102996
2010-05-04 01:11:15 +00:00
Devang Patel 801b8ea42a Do not ignore debug loc attached with llvm.dbg.declare while collecting debug info used by a module.
llvm-svn: 102995
2010-05-04 01:05:02 +00:00
Evan Cheng 55869af998 Instruction selection optimizations may have moved the def of a function argument out of the entry block. rdar://7937489
llvm-svn: 102993
2010-05-04 00:58:39 +00:00
Kevin Enderby 8f0037097f Fix to r102952. The MOV64toSDrm record in X86Instr64bit.td needed the opcode
changed to 0x7E from 0x6E as well as the previous change of RPDI to S3SI.

llvm-svn: 102991
2010-05-04 00:42:46 +00:00