Граф коммитов

21439 Коммитов

Автор SHA1 Сообщение Дата
Chandler Carruth 0ee93de27c Silence a pedantic GCC warning by making the grouping of && and || explicit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103141 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-06 00:15:06 +00:00
John McCall 2fc46bf1a9 Add IgnoreParenImpCasts() to Expr, which is basically like IgnoreParenCasts
except it only skips implicit casts.

Also fix ObjCImplicitGetterSetterRefExpr's child_begin to skip the base expression
if it's actually a type reference (which you get with static property references).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103132 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 22:59:52 +00:00
Chris Lattner 7e21ffb97e Pass the globaldecl into GetOrCreateLLVMFunction so that llvm
function attributes like byval get applied to the function 
definition. This fixes PR7058 and makes i386 llvm/clang bootstrap 
pass all the same tests as x86-64 bootstrap for me (the llvmc 
tests still fail in both).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103131 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 22:55:13 +00:00
Douglas Gregor 60a8fbb424 When implicit definition of the copy-assignment operator fails,
provide a note that shows where the copy-assignment operator was
needed. We used to have this, but I broke it during refactoring. 

Finishes PR6999.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103127 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 22:38:15 +00:00
Fariborz Jahanian 17cb326cb6 This patch deals with Sema Part of Setter/Getter synthesis
of properties which are of C++ objects. Code Gen to follow
(Radar 7468090).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103123 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 21:52:17 +00:00
Douglas Gregor c446d1816f When we emit a non-constant initializer for a global variable of
reference type, make sure that the initializer we build is the
of the appropriate type for the *reference*, not for the thing that it
refers to. Fixes PR7050.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103115 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 20:15:55 +00:00
mike-m a608737659 Test commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103090 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 17:00:31 +00:00
Douglas Gregor cc6a44b8bd For thread-safe static initialization of local statics with
destructors, place the __cxa_atexit call after the __cxa_guard_release
call, mimicking GCC/LLVM-GCC behavior. Noticed while debugging
something related.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103088 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 15:38:32 +00:00
Sean Hunt 4bfe196841 Reapplying patch to change StmtNodes.def to StmtNodes.td, this time
with no whitespace. This will allow statements to be referred to in
attribute TableGen files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103087 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 15:24:00 +00:00
Sean Hunt c302113179 Revert r103072; I accidentally ended up deleting a bunch of trailing
whitespace which makes this patch unreadable. Will recommit without the
whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 15:23:54 +00:00
Douglas Gregor 0278e123b4 Support for 'template' as a disambiguator (PR7030)
ParseOptionalCXXScopeSpecifier() only annotates the subset of
    template-ids which are not subject to lexical ambiguity. Add support
    for the more general case in ParseUnqualifiedId() to handle cases
    such as A::template B().

    Also improve some diagnostic locations.

Fixes PR7030, from Alp Toker!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103081 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 05:58:24 +00:00
Chris Lattner c3d26cc4ee 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103080 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 05:53:24 +00:00
Douglas Gregor fb8cc25342 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103079 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 05:51:00 +00:00
Anders Carlsson 68e3013ade Use a more appropriate LLVM type for the vtable pointer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103078 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 05:47:36 +00:00
Douglas Gregor 71b1d0e5f0 Unbreak CMake build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103077 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 05:41:05 +00:00
Chris Lattner 0e3cc05542 fit in 80 cols
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103075 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 05:28:39 +00:00
Sean Hunt 391c40cdfb Add forgotten CMakeFiles.txt
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103074 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 04:50:38 +00:00
Sean Hunt 9d90d62e16 Change StmtNodes.def to StmtNodes.td in anticipation of a rewrite of attributes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103072 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 04:13:52 +00:00
Chris Lattner 28a43a4361 document -fdiagnostics-show-category
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103067 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 01:35:28 +00:00
Ted Kremenek fbd84caf62 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103064 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 00:55:23 +00:00
Ted Kremenek aa8a66de0e Map Objective-C keywords to CXToken_Keyword.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103063 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 00:55:20 +00:00
Ted Kremenek 11949cbae3 Move post-processing of token annotations to method in AnnotateTokensWorker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103062 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 00:55:17 +00:00
Ted Kremenek 6db610934b Refactor visitor logic for clang_annotateTokens() into a worker class. No functionality change yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103061 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 00:55:15 +00:00
Chris Lattner 6fbe8398ba 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103056 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 21:55:25 +00:00
Chris Lattner c9b889044c 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103053 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 21:13:21 +00:00
John McCall fe67f3bfc0 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103052 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 20:45:42 +00:00
Chris Lattner 27b0f510d1 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103051 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 20:44:26 +00:00
Fariborz Jahanian 8b688ed1d5 Fixes a code gen. crash when ivar object has trivial constructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103028 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 19:29:32 +00:00
Douglas Gregor 5f970eee81 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103025 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 18:18:31 +00:00
Fariborz Jahanian d33ded52b0 Fixes a code gen crash when block is a reference type, etc.
(radar 7495203).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103022 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 17:59:32 +00:00
Douglas Gregor 6c1cb9916e 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103014 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 17:13:42 +00:00
Douglas Gregor 6cdc161527 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103010 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 15:20:55 +00:00
Sebastian Redl 0ca43595e9 Let StmtDumper.cpp handle using declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103006 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 10:20:17 +00:00
John McCall 01ebd9d188 An access is permitted if the current template instantiates to the appropriate
class.  Add some conservative support for the idea.  Fixes PR 7024.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102999 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 05:11:27 +00:00
John McCall 3d6c1782c4 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102998 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 01:53:42 +00:00
Fariborz Jahanian 3c347f25b5 Fixes a Code Gen. Crash when calling destructor on a __block
variabe. Blocks and their construction/destruction is
wip though. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102985 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 00:26:07 +00:00
Douglas Gregor e7089b0c6f When computing the template arguments for the instantiation of a
friend function template, be sure to adjust the computed template
argument lists based on the location of the definition of the function
template: it's possible that the definition we're instantiating with
and the template declaration that we found when creating the
specialization are in different contexts, which meant that we would
end up using the wrong template arguments for instantiation.

Fixes PR7013; all Boost.DynamicBitset tests now pass.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102974 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 23:29:10 +00:00
John McCall e65ce966b6 Just bail out immediately when emitting an unreachable function-local static
variable.  Surprisingly, this does seem to be the right way to solve this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102961 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 21:39:56 +00:00
Fariborz Jahanian a36f3ed3f1 Test for my last patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102956 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 21:06:59 +00:00
Fariborz Jahanian d8d3441911 For the sake of Objective-c++ overload resolution,
treat argument types of objective-c pointer types
which only differ in their protocol qualifiers as
the same type (radar 7925668).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102955 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 21:06:18 +00:00
Douglas Gregor f7d72f5a4a When instantiating a function-local variable definition, introduce the
mapping from the declaration in the template to the instantiated
declaration before transforming the initializer, in case some crazy
lunatic decides to use a variable in its own initializer. Fixes PR7016.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102945 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 20:22:41 +00:00
Ted Kremenek da5a428bf3 Workaround: Don't add ObjCMethodDecls to the vector of TopLevelDecls since they don't go in
the DeclContext for the translation unit.  This is to workaround a fundamental issue in how
ObjC decls (within an @implementation) are parsed before the ObjCContainerDecl is available.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102944 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 20:16:35 +00:00
Douglas Gregor e174bd05ca If we're generating code to create a pointer-to-member function
aggregate and the result of the aggregate is unused, bail out
early. Fixes PR7027.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102942 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 20:00:27 +00:00
Douglas Gregor 324b54d3f6 Diagnose unused exception parameters under a different warning group
(-Wunused-exception-parameter) than normal variables, since it's more
common to name and then ignore an exception parameter. This warning is
neither enabled by default nor by -Wall. Fixes <rdar://problem/7931045>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102931 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 18:51:14 +00:00
Douglas Gregor 4d9e7388cc Complain when we try to initialize an object of Objective-C class type
(which is ill-formed) with an initializer list. Also, change the
fallback from an assertion to a generic error message, which is far
friendlier. Fixes <rdar://problem/7730948>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102930 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 18:24:37 +00:00
Douglas Gregor 8fc6d236b8 It's okay to reference an enum in a template definition, even though
it's ill-formed to form an enum template. Fixes <rdar://problem/7933063>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102926 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 17:48:54 +00:00
Anders Carlsson 32897fd3bd When computing the address of a virtual member function pointer, use the pointer width instead of hardcoding for 64-bit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102921 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 16:05:06 +00:00
Douglas Gregor 7362258bb8 Try to unbreak clang-i686-darawin10 builder
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102920 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 15:51:04 +00:00
Fariborz Jahanian 738698d9d2 Do not issue warning on unimplemented property in the class, if it
conforms to a protocol as one of its super classes does. This is because
conforming super class will implement the property. This implements 
new warning rules for unimplemented properties (radar 7884086).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102919 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 15:49:20 +00:00
Anders Carlsson 6cfb1ca37b Get rid of virt.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102918 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 15:49:15 +00:00