]> granicus.if.org Git - clang/log
clang
12 years agoDuring block layout, after padding up to the max field alignment,
John McCall [Tue, 1 May 2012 20:28:00 +0000 (20:28 +0000)]
During block layout, after padding up to the max field alignment,
the alignment might actually exceed the max field alignment;  don't
assert in this case.

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

12 years agoDiagnostics should start with a lower-case letter.
Patrick Beard [Tue, 1 May 2012 20:27:10 +0000 (20:27 +0000)]
Diagnostics should start with a lower-case letter.

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

12 years agoIn C++11 mode, implement the C++11 semantics for
Douglas Gregor [Tue, 1 May 2012 20:23:02 +0000 (20:23 +0000)]
In C++11 mode, implement the C++11 semantics for
[basic.lookup.classref]p1 and p4, which concerns name lookup for
nested-name-specifiers and template names, respectively, in a member
access expression. C++98/03 forces us to look both in the scope of the
object and in the current scope, then compare the results. C++11 just
takes the result from the scope of the object, if something is
found. Fixes <rdar://problem/11328502>.

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

12 years agoFix CMake build
Douglas Gregor [Tue, 1 May 2012 20:08:24 +0000 (20:08 +0000)]
Fix CMake build

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

12 years agoTest verified.
John McCall [Tue, 1 May 2012 19:57:05 +0000 (19:57 +0000)]
Test verified.

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

12 years agoSpacing.
Chad Rosier [Tue, 1 May 2012 19:53:37 +0000 (19:53 +0000)]
Spacing.

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

12 years agoImplement simplify_type traits for redecl_iterator.
David Blaikie [Tue, 1 May 2012 19:49:42 +0000 (19:49 +0000)]
Implement simplify_type traits for redecl_iterator.

Based on Chandler Carruth's feedback on r155869.

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

12 years agoRemove variables made dead by r155923
David Blaikie [Tue, 1 May 2012 19:49:38 +0000 (19:49 +0000)]
Remove variables made dead by r155923

This makes Clang's build warning free again.

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

12 years agoGet rid of storelv4si builtin as it can be expressed directly. This is general
Chad Rosier [Tue, 1 May 2012 18:11:51 +0000 (18:11 +0000)]
Get rid of storelv4si builtin as it can be expressed directly.  This is general
goodness because it provides opportunites to cleanup things.  For example,

uint64_t t1(__m128i vA)
{
  uint64_t Alo;
  _mm_storel_epi64((__m128i*)&Alo, vA);
  return Alo;
}

was generating

movq %xmm0, -8(%rbp)
movq -8(%rbp), %rax

and now generates

movd %xmm0, %rax

rdar://11282581

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

12 years agoRemove dead code found by static analyzer.
Ted Kremenek [Tue, 1 May 2012 17:56:57 +0000 (17:56 +0000)]
Remove dead code found by static analyzer.

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

12 years agoPush variable declaration into nested scope (the only place where it is used). Found...
Ted Kremenek [Tue, 1 May 2012 17:56:53 +0000 (17:56 +0000)]
Push variable declaration into nested scope (the only place where it is used).  Found by static analyzer.

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

12 years agomodern objective-c translation of private ivars.
Fariborz Jahanian [Tue, 1 May 2012 17:46:45 +0000 (17:46 +0000)]
modern objective-c translation of private ivars.
// rdar://11351299

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

12 years agoRestructure some of the member-pointer tests, implicitly
John McCall [Tue, 1 May 2012 17:32:20 +0000 (17:32 +0000)]
Restructure some of the member-pointer tests, implicitly
removing some that were added without a triple (and moving
their tests into files that appropriately test multiple
architectures).

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

12 years agoUnify Options.td and CC1Options.td, in a first step towards unifying the serializatio...
James Molloy [Tue, 1 May 2012 14:57:16 +0000 (14:57 +0000)]
Unify Options.td and CC1Options.td, in a first step towards unifying the serialization logic in Frontend and Driver.

Reviewed by Eric, Doug and Chandler, and here: http://llvm.org/reviews/r/7/

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

12 years agoMake some helper functions static.
Benjamin Kramer [Tue, 1 May 2012 14:34:11 +0000 (14:34 +0000)]
Make some helper functions static.

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

12 years agoclang/test/CodeGenCXX: Fix two tests, destructors.cpp and microsoft-abi-array-cookies...
NAKAMURA Takumi [Tue, 1 May 2012 11:13:04 +0000 (11:13 +0000)]
clang/test/CodeGenCXX: Fix two tests, destructors.cpp and microsoft-abi-array-cookies.cpp, for -Asserts.

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

12 years agoclang/test/Rewriter: Remove XFAIL and add -U__declspec to other 9 tests. mingw32...
NAKAMURA Takumi [Tue, 1 May 2012 10:52:06 +0000 (10:52 +0000)]
clang/test/Rewriter: Remove XFAIL and add -U__declspec to other 9 tests. mingw32 tends to define built-in __declspec.

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

12 years agoclang/test/Rewriter/rewrite-modern-extern-c-func-decl.mm: Remove XFAIL and add -U__de...
NAKAMURA Takumi [Tue, 1 May 2012 10:51:55 +0000 (10:51 +0000)]
clang/test/Rewriter/rewrite-modern-extern-c-func-decl.mm: Remove XFAIL and add -U__declspec. mingw32 tends to define built-in __declspec.

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

12 years agoAdd a disclaimer to the new test, plus a user-declared ctor
John McCall [Tue, 1 May 2012 08:59:06 +0000 (08:59 +0000)]
Add a disclaimer to the new test, plus a user-declared ctor
to force the emission of vtordisps.

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

12 years agoAdd support for laying out vtordisps according to our current
John McCall [Tue, 1 May 2012 08:55:32 +0000 (08:55 +0000)]
Add support for laying out vtordisps according to our current
working knowledge of the Microsoft ABI.  Based on a patch by
Dmitry Sokolov.

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

12 years agoFix compilation with mingw-w64.
Abramo Bagnara [Tue, 1 May 2012 08:38:19 +0000 (08:38 +0000)]
Fix compilation with mingw-w64.

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

12 years agoEnable AVX on AMD Bulldozer processors.
Craig Topper [Tue, 1 May 2012 07:18:03 +0000 (07:18 +0000)]
Enable AVX on AMD Bulldozer processors.

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

12 years agoAbstract the emission of global destructors into ABI-specific code
John McCall [Tue, 1 May 2012 06:13:13 +0000 (06:13 +0000)]
Abstract the emission of global destructors into ABI-specific code
and only consider using __cxa_atexit in the Itanium logic.  The
default logic is to use atexit().

Emit "guarded" initializers in Microsoft mode unconditionally.
This is definitely not correct, but it's closer to correct than
just not emitting the initializer.

Based on a patch by Timur Iskhodzhanov!

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

12 years agoPR12710 - broken default argument handling for templates.
David Blaikie [Tue, 1 May 2012 06:05:57 +0000 (06:05 +0000)]
PR12710 - broken default argument handling for templates.

I broke this in r155838 by not actually instantiating non-dependent default arg
expressions. The motivation for that change was to avoid producing duplicate
conversion warnings for such default args (we produce them once when we parse
the template - there's no need to produce them at each instantiation) but
without actually instantiating the default arg, things break in weird ways.

Technically, I think we could still get the right diagnostic experience without
the bugs if we instantiated the non-dependent args (for non-dependent params
only) immediately, rather than lazily. But I'm not sure if such a refactoring/
change would be desirable so here's the conservative fix for now.

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

12 years agoPlace several uncovered warnings under warning flags, and tweak diagnostic output...
Ted Kremenek [Tue, 1 May 2012 05:56:02 +0000 (05:56 +0000)]
Place several uncovered warnings under warning flags, and tweak diagnostic output including the term "gc" (in lowercase).

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

12 years agoRemove some not-very-stable assumptions from this testcase.
John McCall [Tue, 1 May 2012 05:29:32 +0000 (05:29 +0000)]
Remove some not-very-stable assumptions from this testcase.

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

12 years agoTeach RetainCountchecker about IORegistryEntrySearchCFProperty returning retained...
Ted Kremenek [Tue, 1 May 2012 05:28:27 +0000 (05:28 +0000)]
Teach RetainCountchecker about IORegistryEntrySearchCFProperty returning retained objects.  I know there is an SDK enhancement request for this to have the cf_returns_retained annotation, so this is just a stop gap.

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

12 years agoRefactor the C++ ABI code a little bit to take advantage of
John McCall [Tue, 1 May 2012 05:23:51 +0000 (05:23 +0000)]
Refactor the C++ ABI code a little bit to take advantage of
what I'm going to treat as basically universal properties of
array-cookie code.  Implement MS array cookies on top of that.
Based on a patch by Timur Iskhodzhanov!

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

12 years agoFix use of uninitialized variable caught by GCC's -Wmaybe-uninitialized.
David Blaikie [Tue, 1 May 2012 02:45:39 +0000 (02:45 +0000)]
Fix use of uninitialized variable caught by GCC's -Wmaybe-uninitialized.

Review by Doug Gregor.

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

12 years agoWhen mangling a synthetic function declaration, we might not have
John McCall [Tue, 1 May 2012 02:33:44 +0000 (02:33 +0000)]
When mangling a synthetic function declaration, we might not have
type-source information for its parameters.  Don't crash when
mangling them in the MS C++ ABI.  Patch by Timur Iskhodzhanov!

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

12 years agoRevert r155874.
Douglas Gregor [Tue, 1 May 2012 02:04:03 +0000 (02:04 +0000)]
Revert r155874.

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

12 years agoRemove the unused DestroyAttrs, noticed by Michael Han.
Douglas Gregor [Tue, 1 May 2012 01:56:29 +0000 (01:56 +0000)]
Remove the unused DestroyAttrs, noticed by Michael Han.

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

12 years agoTurn the mixed-sign-comparison diagnostic into a runtime behavior
Douglas Gregor [Tue, 1 May 2012 01:53:49 +0000 (01:53 +0000)]
Turn the mixed-sign-comparison diagnostic into a runtime behavior
diagnostic, from Eitan Adler!

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

12 years agoPrint inline for inline namespaces, from Faisal Vali
Douglas Gregor [Tue, 1 May 2012 01:43:38 +0000 (01:43 +0000)]
Print inline for inline namespaces, from Faisal Vali

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

12 years agoMove a non portable test to FileCheck, from Jonathan Gray!
Douglas Gregor [Tue, 1 May 2012 01:42:40 +0000 (01:42 +0000)]
Move a non portable test to FileCheck, from Jonathan Gray!

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

12 years agoMove warn_cxx0x_right_shift_in_template_arg to CXX11Compat group, from
Douglas Gregor [Tue, 1 May 2012 01:32:13 +0000 (01:32 +0000)]
Move warn_cxx0x_right_shift_in_template_arg to CXX11Compat group, from
Dmitri Gribenko!

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

12 years agoLet's use the correct bool this time.
Kaelyn Uhrain [Tue, 1 May 2012 01:17:53 +0000 (01:17 +0000)]
Let's use the correct bool this time.

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

12 years agoA couple of very small tweaks suggested by Doug in reply to r155580 and r155163.
Kaelyn Uhrain [Tue, 1 May 2012 01:16:25 +0000 (01:16 +0000)]
A couple of very small tweaks suggested by Doug in reply to r155580 and r155163.

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

12 years agoRemove ref/value inconsistency in redecl_iterator.
David Blaikie [Tue, 1 May 2012 00:48:43 +0000 (00:48 +0000)]
Remove ref/value inconsistency in redecl_iterator.

Similar to r155808 - this mistake has been made in a few iterators.

Based on Chandler Carruth's feedback to r155808 I added an implicit conversion
to Decl* to ease adoption/usage. Useful for the pointer comparison, but not the
dyn_cast (due to template argument deduction causing the conversion not to be
used) - there for future convenience, though. This idiom (op T* for iterators)
seems to be fairly idiomatic within the LLVM codebase & I'll likely add it as I
fix up the other iterators here.

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

12 years agoMy first effort to do this more subtly failed, so elaborately
John McCall [Tue, 1 May 2012 00:38:49 +0000 (00:38 +0000)]
My first effort to do this more subtly failed, so elaborately
test for an invalid declaration at every single place in the
constant evaluator that's about to request a struct layout.

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

12 years agomalloc size checker: Ignore const'ness of pointer types when determining of a sizeof...
Ted Kremenek [Tue, 1 May 2012 00:10:19 +0000 (00:10 +0000)]
malloc size checker: Ignore const'ness of pointer types when determining of a sizeof() type is compatible with a pointed type.

Fixes <rdar://problem/11292586>.

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

12 years agoAdd support for openSUSE 12.2, from Ismail Donmez!
Douglas Gregor [Mon, 30 Apr 2012 23:42:57 +0000 (23:42 +0000)]
Add support for openSUSE 12.2, from Ismail Donmez!

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

12 years agoclang_getCursorLexicalParent should return a translation unit cursor for declarations...
Douglas Gregor [Mon, 30 Apr 2012 23:41:16 +0000 (23:41 +0000)]
clang_getCursorLexicalParent should return a translation unit cursor for declarations at the global scope, from Evan P. Fixes PR9083.

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

12 years agoRemove -Wc++98-compat warning for an outrageously-rare circumstance of 'this'
Richard Smith [Mon, 30 Apr 2012 23:33:33 +0000 (23:33 +0000)]
Remove -Wc++98-compat warning for an outrageously-rare circumstance of 'this'
being used in an exception specification in a way which isn't otherwise
ill-formed in C++98: this warning also incorrectly triggered on uses of 'this'
inside thread-safety attributes, and the mechanism required to tell these cases
apart is more complex than can be justified by the (minimal) value of this part
of -Wc++98-compat.

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

12 years agoWhen going through references to check if the function returns the address
Argyrios Kyrtzidis [Mon, 30 Apr 2012 23:23:55 +0000 (23:23 +0000)]
When going through references to check if the function returns the address
of a local variable, make sure we don't infinitely recurse when the
reference binds to itself.

e.g:

int* func() {
    int& i = i;    // assign non-exist variable to a reference which has same name.
    return &i;    // return pointer
}

rdar://11345441

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

12 years agomodern objective-c translator. named aggregate types
Fariborz Jahanian [Mon, 30 Apr 2012 23:20:30 +0000 (23:20 +0000)]
modern objective-c translator. named aggregate types
defined inside the objc class belong to class's
decl. scope. This is to conform to objective-c
rules. // rdar://11351299

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

12 years agoFor RecursiveASTVisitor, do data recursion for CXXOperatorCallExpr.
Argyrios Kyrtzidis [Mon, 30 Apr 2012 22:12:26 +0000 (22:12 +0000)]
For RecursiveASTVisitor, do data recursion for CXXOperatorCallExpr.

rdar://11289247

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

12 years agoStore the source range of a CXXOperatorCallExpr in the Expr object instead of
Argyrios Kyrtzidis [Mon, 30 Apr 2012 22:12:22 +0000 (22:12 +0000)]
Store the source range of a CXXOperatorCallExpr in the Expr object instead of
calculating it recursively.

boost::assign::tuple_list_of uses the trick of chaining call operator expressions in order to declare a "list of tuples", e.g:
    std::vector<tuple> v = boost::assign::tuple_list_of(1, "foo")(2, "bar")(3, "qqq");

Due to CXXOperatorCallExpr calculating its source range recursively we would get
significant slowdowns with a large number of chained call operator expressions and the
potential for stack overflow.

rdar://11350116

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

12 years agominor refactoring of modern objc translator.
Fariborz Jahanian [Mon, 30 Apr 2012 19:46:53 +0000 (19:46 +0000)]
minor refactoring of modern objc translator.

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

12 years agoFix C versus C++ linkage issue.
Ted Kremenek [Mon, 30 Apr 2012 19:33:45 +0000 (19:33 +0000)]
Fix C versus C++ linkage issue.

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

12 years agoReduce malloc() traffic of clang_getOverridenCursors() by using a pool of SmallVector...
Ted Kremenek [Mon, 30 Apr 2012 19:06:49 +0000 (19:06 +0000)]
Reduce malloc() traffic of clang_getOverridenCursors() by using a pool of SmallVector<CXCursor> objects
under the covers.

Fixes <rdar://problem/11289160>.

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

12 years agoAdd FixItHint for -Wnull-conversion to initialize with an appropriate literal.
David Blaikie [Mon, 30 Apr 2012 18:27:22 +0000 (18:27 +0000)]
Add FixItHint for -Wnull-conversion to initialize with an appropriate literal.

Reviewed by Doug Gregor.

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

12 years agoFix PR12378: provide conversion warnings on default args of function templates
David Blaikie [Mon, 30 Apr 2012 18:21:31 +0000 (18:21 +0000)]
Fix PR12378: provide conversion warnings on default args of function templates

Apparently we weren't checking default arguments when they were instantiated.
This adds the check, fixes the lack of instantiation caching (which seems like
it was mostly implemented but just missed the last step), and avoids
implementing non-dependent default args (for non-dependent parameter types) as
uninstantiated default arguments (so that we don't warn once for every
instantiation when it's not instantiation dependent).

Reviewed by Richard Smith.

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

12 years agoHandleDeclarator() returns NULL for semantic disasters. Deal with it
Douglas Gregor [Mon, 30 Apr 2012 18:13:01 +0000 (18:13 +0000)]
HandleDeclarator() returns NULL for semantic disasters. Deal with it
when we're in an Objective-C container context. Fixes
<rdar://problem/11286701>.

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

12 years agoAdd -Wloop-analysis. This warning will fire on for loops which the variables
Richard Trieu [Mon, 30 Apr 2012 18:01:30 +0000 (18:01 +0000)]
Add -Wloop-analysis.  This warning will fire on for loops which the variables
in the loop conditional do not change.

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

12 years agomodern objective-c translation: de-virtualize all
Fariborz Jahanian [Mon, 30 Apr 2012 16:57:52 +0000 (16:57 +0000)]
modern objective-c translation: de-virtualize all
local rewriting functions.

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

12 years agoRestore paren, bracket and brace counts in parser when
Douglas Gregor [Mon, 30 Apr 2012 16:20:27 +0000 (16:20 +0000)]
Restore paren, bracket and brace counts in parser when
TentativeParsingAction is reverted, from Pasi Parviainen! Fixes
PR12480 / <rdar://problem/11341251>.

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

12 years agoRemove the ref/value inconsistency in filter_decl_iterator.
David Blaikie [Mon, 30 Apr 2012 02:36:29 +0000 (02:36 +0000)]
Remove the ref/value inconsistency in filter_decl_iterator.

filter_decl_iterator had a weird mismatch where both op* and op-> returned T*
making it difficult to generalize this filtering behavior into a reusable
library of any kind.

This change errs on the side of value, making op-> return T* and op* return
T&.

(reviewed by Richard Smith)

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

12 years agoCorrect CFGBlock's front() and back() to return by const ref rather than value.
David Blaikie [Mon, 30 Apr 2012 00:42:50 +0000 (00:42 +0000)]
Correct CFGBlock's front() and back() to return by const ref rather than value.

This ought to fix PR11926, a crash when when running Clang built with GCC 4.7

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

12 years agoPR11926 + duplicates: Fix crash in -Wuninitialized when using a compiler like
Richard Smith [Mon, 30 Apr 2012 00:16:51 +0000 (00:16 +0000)]
PR11926 + duplicates: Fix crash in -Wuninitialized when using a compiler like
g++4.7, which reuses stack space allocated for temporaries. CFGElement::getAs
returns a suitably-cast version of 'this'. Patch by Markus Trippelsdorf!

No test: this code has the same observable behavior as the old code when built
with most compilers, and the tests were already failing when built with a
compiler for which this produced a broken binary.

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

12 years agoPR9546, DR1268: A prvalue cannot be reinterpret_cast to an rvalue reference
Richard Smith [Sun, 29 Apr 2012 08:24:44 +0000 (08:24 +0000)]
PR9546, DR1268: A prvalue cannot be reinterpret_cast to an rvalue reference
type. But a glvalue can be reinterpret_cast to either flavor of reference.

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

12 years agoPR12688: ParseCXXClassMemberDeclaration's sometimes-null ThisDecl takes another
Richard Smith [Sun, 29 Apr 2012 07:31:09 +0000 (07:31 +0000)]
PR12688: ParseCXXClassMemberDeclaration's sometimes-null ThisDecl takes another
victim. Don't crash if we have a delay-parsed exception specification for a
class member which is invalid in a way which precludes building a FunctionDecl.

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

12 years ago[class.copy]p23: Fix an assertion caused by incorrect argument numbering in a
Richard Smith [Sun, 29 Apr 2012 06:32:34 +0000 (06:32 +0000)]
[class.copy]p23: Fix an assertion caused by incorrect argument numbering in a
diagnostic, add a test for this paragraph, and tighten up the diagnostic wording
a little.

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

12 years agoCurrently __builtin_annotation() only annotates an i32.
Julien Lerouge [Sat, 28 Apr 2012 17:39:16 +0000 (17:39 +0000)]
Currently __builtin_annotation() only annotates an i32.

        i32 __builtin_annotation(i32, string);

Applying it to i64 (e.g., long long) generates the following IR.

        trunc i64 {{.*}} to i32
        call i32 @llvm.annotation.i32
        zext i32 {{.*}} to i64

The redundant truncation and extension make the result difficult to use.

This patch makes __builtin_annotation() generic.

        type __builtin_annotation(type, string);

For the i64 example, it simplifies the generated IR to:

        call i64 @llvm.annotation.i64

Patch by Xi Wang!

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

12 years agoimprove error recovery for extra ')'s after a if/switch/while condition. Before:
Chris Lattner [Sat, 28 Apr 2012 16:24:20 +0000 (16:24 +0000)]
improve error recovery for extra ')'s after a if/switch/while condition.  Before:

t.c:3:9: error: expected expression
  if (x)) {
        ^

.. which isn't even true - a statement or expression is fine.  After:

t.c:3:9: error: extraneous ')' after condition, expected a statement
  if (x)) {
        ^

This is the second part of PR12595

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

12 years agoswitch some uses of ExpectAndConsume(tok::semi to use ExpectAndConsumeSemi. This...
Chris Lattner [Sat, 28 Apr 2012 16:12:17 +0000 (16:12 +0000)]
switch some uses of ExpectAndConsume(tok::semi to use ExpectAndConsumeSemi.  This allows
us to improve this diagnostic (telling us to insert another ")":

t.c:2:19: error: expected ';' at end of declaration
  int x = 4+(5-12));
                  ^
                  ;
to:
t.c:2:19: error: extraneous ')' before ';'
  int x = 4+(5-12));
                  ^

...telling us to remove the ")".  This is PR12595.  There are more uses of ExpectAndConsumeSemi
that could be switched over, but I don't hit them on a daily basis :)

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

12 years agoisCXX98PODType: Avoid dispatch on the language standard when recursing.
Benjamin Kramer [Sat, 28 Apr 2012 13:37:45 +0000 (13:37 +0000)]
isCXX98PODType: Avoid dispatch on the language standard when recursing.

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

12 years agoC++11 weakens the requirement for types used with offsetof from POD to standard layou...
Benjamin Kramer [Sat, 28 Apr 2012 11:14:51 +0000 (11:14 +0000)]
C++11 weakens the requirement for types used with offsetof from POD to standard layout type.

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

12 years agoRename isPODType (using the C++98 rules) into isCXX98PODType and make isPODType decid...
Benjamin Kramer [Sat, 28 Apr 2012 10:00:42 +0000 (10:00 +0000)]
Rename isPODType (using the C++98 rules) into isCXX98PODType and make isPODType decide which one to use based on LangOptions.

- -Wc++98-compat depends on the c++98 definition
- Now __is_pod returns the right thing in c++11 and c++98 mode
- All changes to the type traits test are validated against g++ 4.7

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

12 years agoRevert "Use the C++11 definition of PODness for __is_pod in C++11 mode."
Benjamin Kramer [Sat, 28 Apr 2012 10:00:33 +0000 (10:00 +0000)]
Revert "Use the C++11 definition of PODness for __is_pod in C++11 mode."

This is just papering over a major bug in isPODType, real fix coming up soon.

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

12 years agoUse the C++11 definition of PODness for __is_pod in C++11 mode.
Benjamin Kramer [Sat, 28 Apr 2012 09:07:58 +0000 (09:07 +0000)]
Use the C++11 definition of PODness for __is_pod in C++11 mode.

Keep the old definition for C++98 so we don't break tr1::is_pod.

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

12 years ago[analyzer] Remove references to idx::TranslationUnit. Index is dead, cross-TU inlinin...
Jordy Rose [Sat, 28 Apr 2012 01:58:08 +0000 (01:58 +0000)]
[analyzer] Remove references to idx::TranslationUnit. Index is dead, cross-TU inlining never panned out.

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

12 years agoMake the diagnostic for "unexpected ':' in nested name specifier" a bit easier on...
Nico Weber [Fri, 27 Apr 2012 22:50:22 +0000 (22:50 +0000)]
Make the diagnostic for "unexpected ':' in nested name specifier" a bit easier on the eyes.

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

12 years agoobjective-c modern translator: Correctly translate
Fariborz Jahanian [Fri, 27 Apr 2012 22:48:54 +0000 (22:48 +0000)]
objective-c modern translator: Correctly translate
nonfragile ivar access code when ivar type is a
locally defined struct/union type. // rdar://11323187

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

12 years agoWhen @encode'ing a C++ class that has empty base classes, we can end
Douglas Gregor [Fri, 27 Apr 2012 22:30:01 +0000 (22:30 +0000)]
When @encode'ing a C++ class that has empty base classes, we can end
up with gaps when the class inherits from the same empty base class
more than once. Fixes <rdar://problem/11324167>.

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

12 years agoBump up the MaxDepth in the BalancedDelimiterTracker.
Chad Rosier [Fri, 27 Apr 2012 22:14:13 +0000 (22:14 +0000)]
Bump up the MaxDepth in the BalancedDelimiterTracker.

The Avida Project (http://avida.devosoft.org) exceeds the 256 limit.
rdar://11289131

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

12 years agomodern objective-c translator: _OBJC_PROTOCOL_REFERENCE_*
Fariborz Jahanian [Fri, 27 Apr 2012 21:39:49 +0000 (21:39 +0000)]
modern objective-c translator: _OBJC_PROTOCOL_REFERENCE_*
symbols should be static. // rdar://11337074

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

12 years ago[driver] Don't try to set the deployment target when there is no bound
Chad Rosier [Fri, 27 Apr 2012 19:51:11 +0000 (19:51 +0000)]
[driver] Don't try to set the deployment target when there is no bound
architecture; this was happening for tools such as lipo and dsymutil.
Also, if no -arch option has been specified, set the architecture based
on the TC default.
rdar://11329656

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

12 years agoPR12224 (sort of): Diagnose inheriting constructor declarations in C++11 mode.
Richard Smith [Fri, 27 Apr 2012 19:33:05 +0000 (19:33 +0000)]
PR12224 (sort of): Diagnose inheriting constructor declarations in C++11 mode.
We do not support IRGen for these, and get some parts of the semantic analysis
wrong.

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

12 years agoImrpove the note text for when a non-type decl hides a tag type
Kaelyn Uhrain [Fri, 27 Apr 2012 18:26:49 +0000 (18:26 +0000)]
Imrpove the note text for when a non-type decl hides a tag type

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

12 years agoFix logic such that we only call getToolChain once. No functional change
Chad Rosier [Fri, 27 Apr 2012 16:50:38 +0000 (16:50 +0000)]
Fix logic such that we only call getToolChain once.  No functional change
intended.

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

12 years agoRemove redundant calls to BAA->getArchName(). No functional change
Chad Rosier [Fri, 27 Apr 2012 16:48:16 +0000 (16:48 +0000)]
Remove redundant calls to BAA->getArchName().  No functional change
intended.

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

12 years agoRevert 155679; Not a typo.
Chad Rosier [Fri, 27 Apr 2012 14:58:16 +0000 (14:58 +0000)]
Revert 155679; Not a typo.

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

12 years agoUse enum to set debug info size generated by Clang
Alexey Samsonov [Fri, 27 Apr 2012 07:24:20 +0000 (07:24 +0000)]
Use enum to set debug info size generated by Clang

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

12 years agoUse a deque instead of an ImmutableList in AnalysisConsumer to preserve the file...
Ted Kremenek [Fri, 27 Apr 2012 04:54:28 +0000 (04:54 +0000)]
Use a deque instead of an ImmutableList in AnalysisConsumer to preserve the file order that functions are visited.  Should fix the buildbots.

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

12 years agotest/Rewriter: Mark 4 tests as XFAIL:mingw32, due to predefined __declspec(a) issue.
NAKAMURA Takumi [Fri, 27 Apr 2012 04:36:34 +0000 (04:36 +0000)]
test/Rewriter: Mark 4 tests as XFAIL:mingw32, due to predefined __declspec(a) issue.

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

12 years agotest/Driver/fast-math.c: Mark this as XFAIL:cygming. They use gcc driver for as.
NAKAMURA Takumi [Fri, 27 Apr 2012 04:36:27 +0000 (04:36 +0000)]
test/Driver/fast-math.c: Mark this as XFAIL:cygming. They use gcc driver for as.

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

12 years agoAdd test case for rdar://11293995
Argyrios Kyrtzidis [Fri, 27 Apr 2012 04:31:46 +0000 (04:31 +0000)]
Add test case for rdar://11293995

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

12 years agoAdd a missing check in CodeGen of packed classes with vtables. <rdar://problem/11324...
Eli Friedman [Fri, 27 Apr 2012 02:34:46 +0000 (02:34 +0000)]
Add a missing check in CodeGen of packed classes with vtables.  <rdar://problem/11324125>.

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

12 years agoThe release notes are no place for modesty.
Richard Smith [Fri, 27 Apr 2012 00:40:44 +0000 (00:40 +0000)]
The release notes are no place for modesty.

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

12 years agoChange FunctionSummary.h's definition of SetOfDecls to be an ImmutableList instead
Ted Kremenek [Fri, 27 Apr 2012 00:38:33 +0000 (00:38 +0000)]
Change FunctionSummary.h's definition of SetOfDecls to be an ImmutableList instead
of a mutable SmallPtrSet.  While iterating over LocalTUDecls, there were cases
where we could modify LocalTUDecls, which could result in invalidating an iterator
and an analyzer crash.  Along the way, switch some uses of std::queue to std::dequeue,
which should be slightly more efficient.

Unfortunately, this is a difficult case to create a test case for.

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

12 years agoTypo.
Chad Rosier [Fri, 27 Apr 2012 00:35:50 +0000 (00:35 +0000)]
Typo.

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

12 years agoAdd note to help explain why a tag such as 'struct' is needed to refer
Kaelyn Uhrain [Thu, 26 Apr 2012 23:36:17 +0000 (23:36 +0000)]
Add note to help explain why a tag such as 'struct' is needed to refer
to a given type, when the reason is that there is a non-type decl with
the same name.

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

12 years agomodern objective-c transltion: Fixes a translation bug
Fariborz Jahanian [Thu, 26 Apr 2012 23:20:25 +0000 (23:20 +0000)]
modern objective-c transltion: Fixes a translation bug
of writing a __block variable being initialized with
a constructed object. // rdar://11326988

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

12 years agoAdd a missing ExpressionEvaluationContext for template default arguments. Fixes...
Eli Friedman [Thu, 26 Apr 2012 22:43:24 +0000 (22:43 +0000)]
Add a missing ExpressionEvaluationContext for template default arguments.  Fixes PR12581.

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

12 years agoRemove svn:eol-style from the test I just added. Sorry :-/
Nico Weber [Thu, 26 Apr 2012 21:43:56 +0000 (21:43 +0000)]
Remove svn:eol-style from the test I just added. Sorry :-/

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

12 years agoRevert r154981, because it caused PR12674.
Nico Weber [Thu, 26 Apr 2012 21:39:46 +0000 (21:39 +0000)]
Revert r154981, because it caused PR12674.

Add a test for PR12674.

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

12 years agoTest case for previosu patch.
Fariborz Jahanian [Thu, 26 Apr 2012 21:34:02 +0000 (21:34 +0000)]
Test case for previosu patch.
// rdar://11323676

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

12 years agoobjective-c IRGen. Fixes a getter synthesis bug
Fariborz Jahanian [Thu, 26 Apr 2012 21:33:14 +0000 (21:33 +0000)]
objective-c IRGen. Fixes a getter synthesis bug
where getter type is super class of its property
type, resulting in an assert. // rdar://11323676

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

12 years agoFix a bug with block layout when the block contains something
John McCall [Thu, 26 Apr 2012 21:14:42 +0000 (21:14 +0000)]
Fix a bug with block layout when the block contains something
more aligned than the block header but also contains something
smaller than the block-header alignment but not exactly half
the difference between the large alignment and the header
alignment.  Got that?

I'm really not sure what I was thinking with the buggy computation
here, but the fix is pretty obvious.

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