]> granicus.if.org Git - clang/log
clang
14 years agoMark a variable as used in the absence of asserts to silence a GCC warning.
Chandler Carruth [Thu, 6 May 2010 05:28:42 +0000 (05:28 +0000)]
Mark a variable as used in the absence of asserts to silence a GCC warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103165 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove a dependency on Frontend headers in the Driver library. Also saves
Chandler Carruth [Thu, 6 May 2010 04:55:18 +0000 (04:55 +0000)]
Remove a dependency on Frontend headers in the Driver library. Also saves
building and passing arguments to cc1 layer when setting values to their
defaults.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103162 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTurn -analyzer-inline-call on for C functions. This also fixed a bug that
Zhongxing Xu [Thu, 6 May 2010 03:38:27 +0000 (03:38 +0000)]
Turn -analyzer-inline-call on for C functions. This also fixed a bug that
after inlining post-call checking shouldn't be done.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103161 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake -analyzer-inline-call not a separate analysis. Instead it's a boolean
Zhongxing Xu [Thu, 6 May 2010 02:59:29 +0000 (02:59 +0000)]
Make -analyzer-inline-call not a separate analysis. Instead it's a boolean
flag now, and can be used with other analyses. Only turned it on for C++
methods for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103160 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPartial and full specializations of a class template may have a
Douglas Gregor [Thu, 6 May 2010 00:28:52 +0000 (00:28 +0000)]
Partial and full specializations of a class template may have a
different tag kind ("struct" vs. "class") than the primary template,
which has an affect on access control.

Should fix the last remaining Boost.Accumulors failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103144 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWorkaround a really serious caching bug in SourceManager::isBeforeInTranslationUnit...
Ted Kremenek [Thu, 6 May 2010 00:22:25 +0000 (00:22 +0000)]
Workaround a really serious caching bug in SourceManager::isBeforeInTranslationUnit() where the
method will sometimes return different results for the same input SourceLocations.  I haven't
unraveled this method completely yet, so this truly is a workaround until a better fix comes
along.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103143 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoClean up the {} and else placement. This fixes an ambiguous else as well as
Chandler Carruth [Thu, 6 May 2010 00:20:39 +0000 (00:20 +0000)]
Clean up the {} and else placement. This fixes an ambiguous else as well as
picking a more consistent pattern.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103142 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSilence a pedantic GCC warning by making the grouping of && and || explicit.
Chandler Carruth [Thu, 6 May 2010 00:15:06 +0000 (00:15 +0000)]
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

14 years agoAdd IgnoreParenImpCasts() to Expr, which is basically like IgnoreParenCasts
John McCall [Wed, 5 May 2010 22:59:52 +0000 (22:59 +0000)]
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

14 years agoPass the globaldecl into GetOrCreateLLVMFunction so that llvm
Chris Lattner [Wed, 5 May 2010 22:55:13 +0000 (22:55 +0000)]
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

14 years agoWhen implicit definition of the copy-assignment operator fails,
Douglas Gregor [Wed, 5 May 2010 22:38:15 +0000 (22:38 +0000)]
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

14 years agoThis patch deals with Sema Part of Setter/Getter synthesis
Fariborz Jahanian [Wed, 5 May 2010 21:52:17 +0000 (21:52 +0000)]
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

14 years agoWhen we emit a non-constant initializer for a global variable of
Douglas Gregor [Wed, 5 May 2010 20:15:55 +0000 (20:15 +0000)]
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

14 years agoTest commit.
mike-m [Wed, 5 May 2010 17:00:31 +0000 (17:00 +0000)]
Test commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103090 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFor thread-safe static initialization of local statics with
Douglas Gregor [Wed, 5 May 2010 15:38:32 +0000 (15:38 +0000)]
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

14 years agoReapplying patch to change StmtNodes.def to StmtNodes.td, this time
Sean Hunt [Wed, 5 May 2010 15:24:00 +0000 (15:24 +0000)]
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

14 years agoRevert r103072; I accidentally ended up deleting a bunch of trailing
Sean Hunt [Wed, 5 May 2010 15:23:54 +0000 (15:23 +0000)]
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

14 years ago Support for 'template' as a disambiguator (PR7030)
Douglas Gregor [Wed, 5 May 2010 05:58:24 +0000 (05:58 +0000)]
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

14 years agoadd a new --print-diagnostic-categories option, which causes the driver to
Chris Lattner [Wed, 5 May 2010 05:53:24 +0000 (05:53 +0000)]
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

14 years agoReimplement code generation for copying fields in the
Douglas Gregor [Wed, 5 May 2010 05:51:00 +0000 (05:51 +0000)]
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

14 years agoUse a more appropriate LLVM type for the vtable pointer.
Anders Carlsson [Wed, 5 May 2010 05:47:36 +0000 (05:47 +0000)]
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

14 years agoUnbreak CMake build.
Douglas Gregor [Wed, 5 May 2010 05:41:05 +0000 (05:41 +0000)]
Unbreak CMake build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103077 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofit in 80 cols
Chris Lattner [Wed, 5 May 2010 05:28:39 +0000 (05:28 +0000)]
fit in 80 cols

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103075 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd forgotten CMakeFiles.txt
Sean Hunt [Wed, 5 May 2010 04:50:38 +0000 (04:50 +0000)]
Add forgotten CMakeFiles.txt

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103074 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoChange StmtNodes.def to StmtNodes.td in anticipation of a rewrite of attributes
Sean Hunt [Wed, 5 May 2010 04:13:52 +0000 (04:13 +0000)]
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

14 years agodocument -fdiagnostics-show-category
Chris Lattner [Wed, 5 May 2010 01:35:28 +0000 (01:35 +0000)]
document -fdiagnostics-show-category

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103067 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRework clang_annotateTokens() to annotate tokens with information that more closely...
Ted Kremenek [Wed, 5 May 2010 00:55:23 +0000 (00:55 +0000)]
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

14 years agoMap Objective-C keywords to CXToken_Keyword.
Ted Kremenek [Wed, 5 May 2010 00:55:20 +0000 (00:55 +0000)]
Map Objective-C keywords to CXToken_Keyword.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103063 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMove post-processing of token annotations to method in AnnotateTokensWorker.
Ted Kremenek [Wed, 5 May 2010 00:55:17 +0000 (00:55 +0000)]
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

14 years agoRefactor visitor logic for clang_annotateTokens() into a worker class. No functional...
Ted Kremenek [Wed, 5 May 2010 00:55:15 +0000 (00:55 +0000)]
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

14 years agoadd a new -fdiagnostics-show-category=none/id/name option, giving control
Chris Lattner [Tue, 4 May 2010 21:55:25 +0000 (21:55 +0000)]
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

14 years agoWhen -fdiagnostics-print-source-range-info is specified,
Chris Lattner [Tue, 4 May 2010 21:13:21 +0000 (21:13 +0000)]
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

14 years agoEmit the globals, metadata, etc. associated with static variables even when
John McCall [Tue, 4 May 2010 20:45:42 +0000 (20:45 +0000)]
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

14 years agoadd the ability to associate 'category' names with diagnostics
Chris Lattner [Tue, 4 May 2010 20:44:26 +0000 (20:44 +0000)]
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

14 years agoFixes a code gen. crash when ivar object has trivial constructor.
Fariborz Jahanian [Tue, 4 May 2010 19:29:32 +0000 (19:29 +0000)]
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

14 years agoWhen instantiating a function that was declared via a typedef, e.g.,
Douglas Gregor [Tue, 4 May 2010 18:18:31 +0000 (18:18 +0000)]
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

14 years agoFixes a code gen crash when block is a reference type, etc.
Fariborz Jahanian [Tue, 4 May 2010 17:59:32 +0000 (17:59 +0000)]
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

14 years agoIntroduce a limit on the depth of the macro instantiation backtrace
Douglas Gregor [Tue, 4 May 2010 17:13:42 +0000 (17:13 +0000)]
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

14 years agoWhen creating a call to a base subobject's operator= in an
Douglas Gregor [Tue, 4 May 2010 15:20:55 +0000 (15:20 +0000)]
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

14 years agoLet StmtDumper.cpp handle using declarations.
Sebastian Redl [Tue, 4 May 2010 10:20:17 +0000 (10:20 +0000)]
Let StmtDumper.cpp handle using declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103006 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAn access is permitted if the current template instantiates to the appropriate
John McCall [Tue, 4 May 2010 05:11:27 +0000 (05:11 +0000)]
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

14 years agoWhen inheriting a default argument expression, inherit the full expression,
John McCall [Tue, 4 May 2010 01:53:42 +0000 (01:53 +0000)]
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

14 years agoFixes a Code Gen. Crash when calling destructor on a __block
Fariborz Jahanian [Tue, 4 May 2010 00:26:07 +0000 (00:26 +0000)]
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

14 years agoWhen computing the template arguments for the instantiation of a
Douglas Gregor [Mon, 3 May 2010 23:29:10 +0000 (23:29 +0000)]
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

14 years agoJust bail out immediately when emitting an unreachable function-local static
John McCall [Mon, 3 May 2010 21:39:56 +0000 (21:39 +0000)]
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

14 years agoTest for my last patch.
Fariborz Jahanian [Mon, 3 May 2010 21:06:59 +0000 (21:06 +0000)]
Test for my last patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102956 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFor the sake of Objective-c++ overload resolution,
Fariborz Jahanian [Mon, 3 May 2010 21:06:18 +0000 (21:06 +0000)]
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

14 years agoWhen instantiating a function-local variable definition, introduce the
Douglas Gregor [Mon, 3 May 2010 20:22:41 +0000 (20:22 +0000)]
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

14 years agoWorkaround: Don't add ObjCMethodDecls to the vector of TopLevelDecls since they don...
Ted Kremenek [Mon, 3 May 2010 20:16:35 +0000 (20:16 +0000)]
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

14 years agoIf we're generating code to create a pointer-to-member function
Douglas Gregor [Mon, 3 May 2010 20:00:27 +0000 (20:00 +0000)]
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

14 years agoDiagnose unused exception parameters under a different warning group
Douglas Gregor [Mon, 3 May 2010 18:51:14 +0000 (18:51 +0000)]
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

14 years agoComplain when we try to initialize an object of Objective-C class type
Douglas Gregor [Mon, 3 May 2010 18:24:37 +0000 (18:24 +0000)]
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

14 years agoIt's okay to reference an enum in a template definition, even though
Douglas Gregor [Mon, 3 May 2010 17:48:54 +0000 (17:48 +0000)]
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

14 years agoWhen computing the address of a virtual member function pointer, use the pointer...
Anders Carlsson [Mon, 3 May 2010 16:05:06 +0000 (16:05 +0000)]
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

14 years agoTry to unbreak clang-i686-darawin10 builder
Douglas Gregor [Mon, 3 May 2010 15:51:04 +0000 (15:51 +0000)]
Try to unbreak clang-i686-darawin10 builder

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102920 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDo not issue warning on unimplemented property in the class, if it
Fariborz Jahanian [Mon, 3 May 2010 15:49:20 +0000 (15:49 +0000)]
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

14 years agoGet rid of virt.cpp.
Anders Carlsson [Mon, 3 May 2010 15:49:15 +0000 (15:49 +0000)]
Get rid of virt.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102918 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoThe array form of 'new' can never have initializers.
Anders Carlsson [Mon, 3 May 2010 15:45:23 +0000 (15:45 +0000)]
The array form of 'new' can never have initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102917 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen creating the declaration reference for implicit copy-construction
Douglas Gregor [Mon, 3 May 2010 15:43:53 +0000 (15:43 +0000)]
When creating the declaration reference for implicit copy-construction
of a base class, give it real source-location information. Fixes PR7017.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102916 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen declaring a namespace alias, ignore previous declarations that
Douglas Gregor [Mon, 3 May 2010 15:37:31 +0000 (15:37 +0000)]
When declaring a namespace alias, ignore previous declarations that
aren't in scope. Fixes PR7014.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102915 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen instantiating a member function declared via a typedef, don't try
Douglas Gregor [Mon, 3 May 2010 15:32:18 +0000 (15:32 +0000)]
When instantiating a member function declared via a typedef, don't try
to enter the instantiated parameter declarations into the local
instantiation scope; they can't be referenced anyway. Fixes PR7022.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102914 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen a class contains a non-empty anonymous union or struct, mark is
Douglas Gregor [Mon, 3 May 2010 15:18:25 +0000 (15:18 +0000)]
When a class contains a non-empty anonymous union or struct, mark is
as non-empty. Fixes PR7021.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102913 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDon't build an aggregate constructor loop when the constructor is trivial.
Anders Carlsson [Mon, 3 May 2010 15:09:17 +0000 (15:09 +0000)]
Don't build an aggregate constructor loop when the constructor is trivial.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102912 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd test case that I forgot to check in.
Anders Carlsson [Mon, 3 May 2010 14:22:40 +0000 (14:22 +0000)]
Add test case that I forgot to check in.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102905 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoReplace a char*/size pair with stringref.
Benjamin Kramer [Mon, 3 May 2010 13:08:54 +0000 (13:08 +0000)]
Replace a char*/size pair with stringref.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102902 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSimplify.
Anders Carlsson [Mon, 3 May 2010 02:07:56 +0000 (02:07 +0000)]
Simplify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102896 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDon't copy or initialize empty classes. Fixes PR7012.
Anders Carlsson [Mon, 3 May 2010 01:20:20 +0000 (01:20 +0000)]
Don't copy or initialize empty classes. Fixes PR7012.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102891 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoStore the entire base subobject in SubVTTIndices.
Anders Carlsson [Mon, 3 May 2010 00:55:11 +0000 (00:55 +0000)]
Store the entire base subobject in SubVTTIndices.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102890 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove OldGetAddressOfBaseClass - bye bye ambiguities.
Anders Carlsson [Mon, 3 May 2010 00:32:27 +0000 (00:32 +0000)]
Remove OldGetAddressOfBaseClass - bye bye ambiguities.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102889 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoGet rid of the last caller of OldGetAddressOfBaseClass.
Anders Carlsson [Mon, 3 May 2010 00:29:58 +0000 (00:29 +0000)]
Get rid of the last caller of OldGetAddressOfBaseClass.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102888 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMore work towards getting rid of OldGetAddressOfBaseClass.
Anders Carlsson [Mon, 3 May 2010 00:07:07 +0000 (00:07 +0000)]
More work towards getting rid of OldGetAddressOfBaseClass.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102887 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoGet rid of a call to GetAddressOfDirectBaseInCompleteClass.
Anders Carlsson [Sun, 2 May 2010 23:57:15 +0000 (23:57 +0000)]
Get rid of a call to GetAddressOfDirectBaseInCompleteClass.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102886 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoHave getSubVTTIndex take a BaseSubobject instead of just a base.
Anders Carlsson [Sun, 2 May 2010 23:53:25 +0000 (23:53 +0000)]
Have getSubVTTIndex take a BaseSubobject instead of just a base.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102885 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoChange CXXConstructExpr::Create to take a ConstructionKind.
Anders Carlsson [Sun, 2 May 2010 23:53:04 +0000 (23:53 +0000)]
Change CXXConstructExpr::Create to take a ConstructionKind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102884 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPass ForVirtualBase all the way to GetVTTParameter.
Anders Carlsson [Sun, 2 May 2010 23:33:10 +0000 (23:33 +0000)]
Pass ForVirtualBase all the way to GetVTTParameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102883 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.
Anders Carlsson [Sun, 2 May 2010 23:29:11 +0000 (23:29 +0000)]
Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102882 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRevert my last change and add a 'ForVirtualBase' parameter to EmitCXXConstructorCall...
Anders Carlsson [Sun, 2 May 2010 23:20:53 +0000 (23:20 +0000)]
Revert my last change and add a 'ForVirtualBase' parameter to EmitCXXConstructorCall instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102881 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPass the construction kind down to EmitCXXConstructorCall.
Anders Carlsson [Sun, 2 May 2010 23:01:10 +0000 (23:01 +0000)]
Pass the construction kind down to EmitCXXConstructorCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102880 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd an enum to CXXConstructExpr so we can determine if the construction expression...
Anders Carlsson [Sun, 2 May 2010 22:54:08 +0000 (22:54 +0000)]
Add an enum to CXXConstructExpr so we can determine if the construction expression constructs a non-virtual or virtual base.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102879 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove another unused function.
Anders Carlsson [Sun, 2 May 2010 18:13:35 +0000 (18:13 +0000)]
Remove another unused function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102871 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove an unused function.
Anders Carlsson [Sun, 2 May 2010 18:12:22 +0000 (18:12 +0000)]
Remove an unused function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102870 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCodeGen: Shrink RValue. 4 words -> 2 words.
Benjamin Kramer [Sun, 2 May 2010 14:59:10 +0000 (14:59 +0000)]
CodeGen: Shrink RValue. 4 words -> 2 words.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102863 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAs per Chris' request, return the Instruction from EmitCall and add the metadata...
David Chisnall [Sun, 2 May 2010 13:41:58 +0000 (13:41 +0000)]
As per Chris' request, return the Instruction from EmitCall and add the metadata in the caller.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102862 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoComplete reimplementation of the synthesis for implicitly-defined copy
Douglas Gregor [Sat, 1 May 2010 20:49:11 +0000 (20:49 +0000)]
Complete reimplementation of the synthesis for implicitly-defined copy
assignment operators.

Previously, Sema provided type-checking and template instantiation for
copy assignment operators, then CodeGen would synthesize the actual
body of the copy constructor. Unfortunately, the two were not in sync,
and CodeGen might pick a copy-assignment operator that is different
from what Sema chose, leading to strange failures, e.g., link-time
failures when CodeGen called a copy-assignment operator that was not
instantiation, run-time failures when copy-assignment operators were
overloaded for const/non-const references and the wrong one was
picked, and run-time failures when by-value copy-assignment operators
did not have their arguments properly copy-initialized.

This implementation synthesizes the implicitly-defined copy assignment
operator bodies in Sema, so that the resulting ASTs encode exactly
what CodeGen needs to do; there is no longer any special code in
CodeGen to synthesize copy-assignment operators. The synthesis of the
body is relatively simple, and we generate one of three different
kinds of copy statements for each base or member:

  - For a class subobject, call the appropriate copy-assignment
    operator, after overload resolution has determined what that is.
  - For an array of scalar types or an array of class types that have
    trivial copy assignment operators, construct a call to
    __builtin_memcpy.
  - For an array of class types with non-trivial copy assignment
    operators, synthesize a (possibly nested!) for loop whose inner
    statement calls the copy constructor.
  - For a scalar type, use built-in assignment.

This patch fixes at least a few tests cases in Boost.Spirit that were
failing because CodeGen picked the wrong copy-assignment operator
(leading to link-time failures), and I suspect a number of undiagnosed
problems will also go away with this change.

Some of the diagnostics we had previously have gotten worse with this
change, since we're going through generic code for our
type-checking. I will improve this in a subsequent patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102853 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofix a broken link, diagnostickinds.td was fissioned.
Chris Lattner [Sat, 1 May 2010 17:35:19 +0000 (17:35 +0000)]
fix a broken link, diagnostickinds.td was fissioned.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102851 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSimplify EmitCopyCtorCall.
Anders Carlsson [Sat, 1 May 2010 17:07:40 +0000 (17:07 +0000)]
Simplify EmitCopyCtorCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102849 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSimplify EmitClassAggrMemberwiseCopy.
Anders Carlsson [Sat, 1 May 2010 17:02:18 +0000 (17:02 +0000)]
Simplify EmitClassAggrMemberwiseCopy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102848 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoBump default template instantiation depth to 1024, as required by C++0x
Douglas Gregor [Sat, 1 May 2010 16:59:21 +0000 (16:59 +0000)]
Bump default template instantiation depth to 1024, as required by C++0x

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102847 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoClean up EmitClassMemberwiseCopy further.
Anders Carlsson [Sat, 1 May 2010 16:54:05 +0000 (16:54 +0000)]
Clean up EmitClassMemberwiseCopy further.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102846 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoGet rid of a parameter from EmitClassMemberwiseCopy.
Anders Carlsson [Sat, 1 May 2010 16:49:43 +0000 (16:49 +0000)]
Get rid of a parameter from EmitClassMemberwiseCopy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102845 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen defining implicit copy constructors, use SetBaseOrMemberInitializers to initiali...
Anders Carlsson [Sat, 1 May 2010 16:39:01 +0000 (16:39 +0000)]
When defining implicit copy constructors, use SetBaseOrMemberInitializers to initialize the bases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102842 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdded an RAII object that helps set up/tear down the Sema context
Douglas Gregor [Sat, 1 May 2010 15:04:51 +0000 (15:04 +0000)]
Added an RAII object that helps set up/tear down the Sema context
information required to implicitly define a C++ special member
function. Use it rather than explicitly setting CurContext on entry
and exit, which is fragile.

Use this RAII object for the implicitly-defined default constructor,
copy constructor, copy assignment operator, and destructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102840 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAttach message send metadata to the lookup as well as to the call (GNU runtime).
David Chisnall [Sat, 1 May 2010 12:56:56 +0000 (12:56 +0000)]
Attach message send metadata to the lookup as well as to the call (GNU runtime).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102839 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake super message lookups cacheable (GNUstep Runtime)
David Chisnall [Sat, 1 May 2010 12:37:16 +0000 (12:37 +0000)]
Make super message lookups cacheable (GNUstep Runtime)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102837 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTweaked EmitCall() to permit the caller to provide some metadata to attach to the...
David Chisnall [Sat, 1 May 2010 11:15:56 +0000 (11:15 +0000)]
Tweaked EmitCall() to permit the caller to provide some metadata to attach to the call site.

Used this in CGObjCGNU to attach metadata about message sends to permit speculative inlining.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102833 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove empty directory.
Benjamin Kramer [Sat, 1 May 2010 10:30:16 +0000 (10:30 +0000)]
Remove empty directory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102832 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agowith recent optimizer changes, these all get devirtualized.
Chris Lattner [Sat, 1 May 2010 01:42:06 +0000 (01:42 +0000)]
with recent optimizer changes, these all get devirtualized.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102825 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIt turns out that basically every caller to RequireCompleteDeclContext
John McCall [Sat, 1 May 2010 00:40:08 +0000 (00:40 +0000)]
It turns out that basically every caller to RequireCompleteDeclContext
already knows what context it's looking in.  Just pass that context in
instead of (questionably) recalculating it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102818 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix NON_ANSI_COMPILE_FLAGS setting, for MSVC.
Daniel Dunbar [Sat, 1 May 2010 00:06:42 +0000 (00:06 +0000)]
Fix NON_ANSI_COMPILE_FLAGS setting, for MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102811 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd null check in CFGBuilder::VisitStmt() to make CFG construction
Ted Kremenek [Fri, 30 Apr 2010 22:25:53 +0000 (22:25 +0000)]
Add null check in CFGBuilder::VisitStmt() to make CFG construction
more resilient to bad code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102793 91177308-0d34-0410-b5e6-96231b3b80d8