]> granicus.if.org Git - clang/log
clang
13 years agoTurn on -momit-leaf-frame-pointer by default on all non-Darwin platforms.
Nick Lewycky [Wed, 2 Feb 2011 06:43:03 +0000 (06:43 +0000)]
Turn on -momit-leaf-frame-pointer by default on all non-Darwin platforms.
Fixes PR9121!

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

13 years agoUpdate this test following recent optimizer changes.
Dan Gohman [Wed, 2 Feb 2011 02:21:10 +0000 (02:21 +0000)]
Update this test following recent optimizer changes.

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

13 years agoRemove redundant check to not warn for warn_equality_with_extra_parens if we are...
Ted Kremenek [Wed, 2 Feb 2011 02:20:30 +0000 (02:20 +0000)]
Remove redundant check to not warn for warn_equality_with_extra_parens if we are in a macro.  This is checked twice.

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

13 years agoUnique code-completion strings. On Cocoa.h, this costs us about 4% in
Douglas Gregor [Tue, 1 Feb 2011 23:59:42 +0000 (23:59 +0000)]
Unique code-completion strings. On Cocoa.h, this costs us about 4% in
speed but saves us about 25% of the memory usage for strings.

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

13 years agoWhen diagnosing address-space changes, apply array-to-pointer decay first.
John McCall [Tue, 1 Feb 2011 23:28:01 +0000 (23:28 +0000)]
When diagnosing address-space changes, apply array-to-pointer decay first.

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

13 years ago-fapple-kext support for indirect call to virtuals dtors - wip.
Fariborz Jahanian [Tue, 1 Feb 2011 23:22:34 +0000 (23:22 +0000)]
-fapple-kext support for indirect call to virtuals dtors - wip.

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

13 years agoFix name lookup issue
Douglas Gregor [Tue, 1 Feb 2011 23:14:23 +0000 (23:14 +0000)]
Fix name lookup issue

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

13 years agoAdd support for x86-64 Mandriva 2010.2. Reported by 'rindolf' on IRC!
Nick Lewycky [Tue, 1 Feb 2011 23:03:29 +0000 (23:03 +0000)]
Add support for x86-64 Mandriva 2010.2. Reported by 'rindolf' on IRC!

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

13 years agoCreate a special allocator class for code completion, so that all of
Douglas Gregor [Tue, 1 Feb 2011 22:57:45 +0000 (22:57 +0000)]
Create a special allocator class for code completion, so that all of
the string copying goes through a single place that can have
associated state.

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

13 years agoUse tempfiles for the .o outputs.
Matt Beaumont-Gay [Tue, 1 Feb 2011 22:44:06 +0000 (22:44 +0000)]
Use tempfiles for the .o outputs.

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

13 years agoEnable the self-init checker in scan-build.
Ted Kremenek [Tue, 1 Feb 2011 22:36:11 +0000 (22:36 +0000)]
Enable the self-init checker in scan-build.

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

13 years agoDon't warn about extraneous '()' around a comparison if it occurs within a macro.
Ted Kremenek [Tue, 1 Feb 2011 22:36:09 +0000 (22:36 +0000)]
Don't warn about extraneous '()' around a comparison if it occurs within a macro.

Macros frequently contain extra '()' to make instantiation less error prone.
This warning was flagging a ton of times on postgresql because of its use of macros.

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

13 years agoDon't warn for "if ((a == b))" if the parens came from a macro. Thanks to Fariborz...
Argyrios Kyrtzidis [Tue, 1 Feb 2011 22:23:56 +0000 (22:23 +0000)]
Don't warn for "if ((a == b))" if the parens came from a macro. Thanks to Fariborz for the hint!

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

13 years agoDo the right thing for zero-initializing VLAs that don't have a zero
John McCall [Tue, 1 Feb 2011 21:35:06 +0000 (21:35 +0000)]
Do the right thing for zero-initializing VLAs that don't have a zero
bit-pattern.  It's not clear that this is actually useful given current
language restrictions.

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

13 years agoAdd updated Debian ARM include path.
Nick Lewycky [Tue, 1 Feb 2011 21:32:14 +0000 (21:32 +0000)]
Add updated Debian ARM include path.

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

13 years agoProvide constant strings for certain common code completion strings,
Douglas Gregor [Tue, 1 Feb 2011 21:15:40 +0000 (21:15 +0000)]
Provide constant strings for certain common code completion strings,
eliminating the need to copy those strings.

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

13 years agoAdd test case for dead stores checker to not flag dead assignments to 'self' within...
Ted Kremenek [Tue, 1 Feb 2011 20:45:26 +0000 (20:45 +0000)]
Add test case for dead stores checker to not flag dead assignments to 'self' within a nested assignment.

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

13 years agoFix the message. Thanks to Thomas Clement for noticing.
Argyrios Kyrtzidis [Tue, 1 Feb 2011 20:33:05 +0000 (20:33 +0000)]
Fix the message. Thanks to Thomas Clement for noticing.

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

13 years agoFor "if ((a == b))" only warn if 'a' is a modifiable l-value. Caught by John!
Argyrios Kyrtzidis [Tue, 1 Feb 2011 19:32:59 +0000 (19:32 +0000)]
For "if ((a == b))" only warn if 'a' is a modifiable l-value. Caught by John!

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

13 years ago[analyzer] Slightly improve the diagnostic message of ObjCSelfInitChecker.
Argyrios Kyrtzidis [Tue, 1 Feb 2011 19:32:55 +0000 (19:32 +0000)]
[analyzer] Slightly improve the diagnostic message of ObjCSelfInitChecker.

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

13 years agoAllocate CodeCompletionString and all of its components in a
Douglas Gregor [Tue, 1 Feb 2011 19:23:04 +0000 (19:23 +0000)]
Allocate CodeCompletionString and all of its components in a
BumpPtrAllocator, rather than manually new/delete'ing them. This
optimization also allows us to avoid allocating memory for and copying
constant strings (e.g., "return", "class").

This also required embedding the priority and availability of results
within the code completion string, to avoid extra memory allocation
within libclang.

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

13 years agoWarn for "if ((a == b))" where the equality expression is needlessly wrapped inside...
Argyrios Kyrtzidis [Tue, 1 Feb 2011 18:24:22 +0000 (18:24 +0000)]
Warn for "if ((a == b))" where the equality expression is needlessly wrapped inside parentheses.
It's highly likely that the user intended an assignment used as condition.

Addresses rdar://8848646.

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

13 years agoAdd temporary hack to -Wuninitialize to create a separate CFG (for C++ code) that...
Ted Kremenek [Tue, 1 Feb 2011 17:43:21 +0000 (17:43 +0000)]
Add temporary hack to -Wuninitialize to create a separate CFG (for C++ code) that doesn't include implicit dtors.

Implicit dtors confuse the ad hoc path-sensitivity of UninitializedValuesV2.cpp.  This isn't
the ideal solution, as it will directly impact compile time, but should significantly reduce
the noise of -Wuninitialized on some code bases.

This immediately "fixes" the false positive reported in PR 9063, although this
isn't the right fix in the long run.

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

13 years agoEnhance -Wuninitialized to better reason about || and &&, tracking dual dataflow...
Ted Kremenek [Tue, 1 Feb 2011 17:43:18 +0000 (17:43 +0000)]
Enhance -Wuninitialized to better reason about || and &&, tracking dual dataflow facts and properly merging them.

Fixes PR 9076.

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

13 years agoImplement access checking for the "delete" operator. Fixes PR9050,
Douglas Gregor [Tue, 1 Feb 2011 15:50:11 +0000 (15:50 +0000)]
Implement access checking for the "delete" operator. Fixes PR9050,
from Alex Miller!

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

13 years agoFix a thinko where I didn't update a consistency check for
Douglas Gregor [Tue, 1 Feb 2011 15:24:58 +0000 (15:24 +0000)]
Fix a thinko where I didn't update a consistency check for
PackExpansionType in the AST reader. We need more testing for variadic
templates + PCH, but this fixes PR9073.

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

13 years agoBasic support for -mms-bitfields, from Carl Norum!
Douglas Gregor [Tue, 1 Feb 2011 15:15:22 +0000 (15:15 +0000)]
Basic support for -mms-bitfields, from Carl Norum!

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

13 years agoSupport EFI target triple, from Carl Norum!
Douglas Gregor [Tue, 1 Feb 2011 15:06:18 +0000 (15:06 +0000)]
Support EFI target triple, from Carl Norum!

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

13 years agoMake that test case actually test something, and add another test.
John McCall [Tue, 1 Feb 2011 08:30:38 +0000 (08:30 +0000)]
Make that test case actually test something, and add another test.

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

13 years agoThe code trying to assign a typedef to an anonymous tag declaration was
John McCall [Tue, 1 Feb 2011 08:20:08 +0000 (08:20 +0000)]
The code trying to assign a typedef to an anonymous tag declaration was
extremely rambunctious, both on parsing and on template instantiation.
Calm it down, fixing an internal consistency assert on anonymous enum
instantiation manglings.

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

13 years agoRevert 124633. The linker has been told how to merge available_externally.
Rafael Espindola [Tue, 1 Feb 2011 05:45:26 +0000 (05:45 +0000)]
Revert 124633. The linker has been told how to merge available_externally.

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

13 years agoCorrect units in doxygen comment for NonVirtualSize.
Ken Dyck [Tue, 1 Feb 2011 02:03:12 +0000 (02:03 +0000)]
Correct units in doxygen comment for NonVirtualSize.

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

13 years agoConvert RecordLayout::NonVirtualSize from bit units to CharUnits.
Ken Dyck [Tue, 1 Feb 2011 01:52:10 +0000 (01:52 +0000)]
Convert RecordLayout::NonVirtualSize from bit units to CharUnits.

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

13 years agoWhen initializing struct members, the important thing is that the "initializing"...
Argyrios Kyrtzidis [Tue, 1 Feb 2011 00:52:10 +0000 (00:52 +0000)]
When initializing struct members, the important thing is that the "initializing" expression is
compatible, not having the same type.

Fix rdar://8183908 in which compatible vector types weren't initialized properly leading to a crash.

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

13 years agoSet visibility for available_externally globals. This is important for two reasons:
Rafael Espindola [Tue, 1 Feb 2011 00:37:17 +0000 (00:37 +0000)]
Set visibility for available_externally globals. This is important for two reasons:

* llvm-link would complains about mismatched visibility
* If we produce a relocation with an available_externally, it is good to know that
it is hidden.

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

13 years agoPerform the bad-address-space conversions check as part of
John McCall [Tue, 1 Feb 2011 00:10:29 +0000 (00:10 +0000)]
Perform the bad-address-space conversions check as part of
CheckPointerTypesForAssignment.

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

13 years agoImprove the diagnostic for -Wcustom-atomic-properties. Suggestion by Fariborz!
Argyrios Kyrtzidis [Mon, 31 Jan 2011 23:20:03 +0000 (23:20 +0000)]
Improve the diagnostic for -Wcustom-atomic-properties. Suggestion by Fariborz!

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

13 years agoMake Check*PointerTypesForAssignment private and tell them that they're
John McCall [Mon, 31 Jan 2011 23:13:11 +0000 (23:13 +0000)]
Make Check*PointerTypesForAssignment private and tell them that they're
working on canonical types already.

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

13 years agoHarden Lexer::GetBeginningOfToken() against bogus source locations and
Douglas Gregor [Mon, 31 Jan 2011 22:42:36 +0000 (22:42 +0000)]
Harden Lexer::GetBeginningOfToken() against bogus source locations and
the disappearance/alteration of files.

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

13 years agoSlightly reorganize CheckAssignmentConstraints and remove some redundant
John McCall [Mon, 31 Jan 2011 22:28:28 +0000 (22:28 +0000)]
Slightly reorganize CheckAssignmentConstraints and remove some redundant
logic.

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

13 years agoTeach Diagnostic::setClient() to free the existing, owned
Douglas Gregor [Mon, 31 Jan 2011 22:04:05 +0000 (22:04 +0000)]
Teach Diagnostic::setClient() to free the existing, owned
client. Fixes a libclang leak.

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

13 years agolibclang: Don't allow RemoveFileOnSignal to be called via libclang, badness can
Daniel Dunbar [Mon, 31 Jan 2011 22:00:44 +0000 (22:00 +0000)]
libclang: Don't allow RemoveFileOnSignal to be called via libclang, badness can
ensue.

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

13 years agoFrontend: Add an explicit RemoveFileOnSignal flag argument, to control the
Daniel Dunbar [Mon, 31 Jan 2011 22:00:42 +0000 (22:00 +0000)]
Frontend: Add an explicit RemoveFileOnSignal flag argument, to control the
automatic behavior (which is undesirable in a multithreaded context).

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

13 years agoAdd -Wcustom-atomic-properties which warns if an atomic-by-default property has custo...
Argyrios Kyrtzidis [Mon, 31 Jan 2011 21:34:11 +0000 (21:34 +0000)]
Add -Wcustom-atomic-properties which warns if an atomic-by-default property has custom getter or setter.

The rationale is that it is highly likely that the user's getter/setter isn't atomically implemented. Off by default.
Addresses rdar://8782645.

-Wcustom-atomic-properties and -Wimplicit-atomic-properties are under the -Watomic-properties group.

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

13 years agoDocument that set-xcode-analyzer should typically be run using sudo.
Ted Kremenek [Mon, 31 Jan 2011 20:45:38 +0000 (20:45 +0000)]
Document that set-xcode-analyzer should typically be run using sudo.

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

13 years agoImplement reasonable conversion ranking for Objective-C pointer
Douglas Gregor [Mon, 31 Jan 2011 18:51:41 +0000 (18:51 +0000)]
Implement reasonable conversion ranking for Objective-C pointer
conversions (<rdar://problem/8592139>) for overload resolution. The
conversion ranking mirrors C++'s conversion ranking fairly closely,
except that we use a same pseudo-subtyping relationship employed by
Objective-C pointer assignment rather than simple checking
derived-to-base conversions. This change covers:

  - Conversions to pointers to a specific object type are better than
  conversions to 'id', 'Class', qualified 'id', or qualified 'Class'
  (note: GCC doesn't perform this ranking, but it matches C++'s rules
  for ranking conversions to void*).
  - Conversions to qualified 'id' or qualified 'Class' are better than
  conversions to 'id' or 'Class', respectively.
  - When two conversion sequences convert to the same type, rank the
  conversions based on the relationship between the types we're
  converting from.
  - When two conversion sequences convert from the same non-id,
  non-Class type, rank the conversions based on the relationship of
  the types we're converting to. (note: GCC allows this ranking even
  when converting from 'id', which is extremeley dangerous).

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

13 years agoOnly warn for -Wnon-virtual-dtor for public destructors. Thanks to Benjamin Kramer...
Argyrios Kyrtzidis [Mon, 31 Jan 2011 17:10:25 +0000 (17:10 +0000)]
Only warn for -Wnon-virtual-dtor for public destructors. Thanks to Benjamin Kramer for the hint!

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

13 years agoImplement the suggested resolution to core issue 547, extended to also
Douglas Gregor [Mon, 31 Jan 2011 16:09:46 +0000 (16:09 +0000)]
Implement the suggested resolution to core issue 547, extended to also
allow ref-qualifiers on function types used as template type
arguments. GNU actually allows cv-qualifiers on function types in many
places where it shouldn't, so we currently categorize this as a GNU
extension.

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

13 years agoWarn if the class has virtual methods but non-virtual destructor. Addresses rdar...
Argyrios Kyrtzidis [Mon, 31 Jan 2011 07:05:00 +0000 (07:05 +0000)]
Warn if the class has virtual methods but non-virtual destructor. Addresses rdar://8756445.

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

13 years agoDon't warn that variables in C++ static member functions shadow fields. Fixes rdar...
Argyrios Kyrtzidis [Mon, 31 Jan 2011 07:04:54 +0000 (07:04 +0000)]
Don't warn that variables in C++ static member functions shadow fields. Fixes rdar://8900456.

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

13 years agoFix the diagnostic when we are shadowing an external variable and there exists a...
Argyrios Kyrtzidis [Mon, 31 Jan 2011 07:04:50 +0000 (07:04 +0000)]
Fix the diagnostic when we are shadowing an external variable and there exists a locally scoped extern with the same name.

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

13 years agoDiagnose if extern local variable is followed by non-extern and vice-versa.
Argyrios Kyrtzidis [Mon, 31 Jan 2011 07:04:46 +0000 (07:04 +0000)]
Diagnose if extern local variable is followed by non-extern and vice-versa.

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

13 years ago'extern' variables in functions don't shadow externs in global scope. Fixes rdar...
Argyrios Kyrtzidis [Mon, 31 Jan 2011 07:04:41 +0000 (07:04 +0000)]
'extern' variables in functions don't shadow externs in global scope. Fixes rdar://8883302.

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

13 years agoIf there were errors, disable 'unused' warnings since they will mostly be noise.
Argyrios Kyrtzidis [Mon, 31 Jan 2011 07:04:37 +0000 (07:04 +0000)]
If there were errors, disable 'unused' warnings since they will mostly be noise.
Fixes rdar://8736362.

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

13 years agoError for use of field from anonymous struct or union should say "invalid use of...
Argyrios Kyrtzidis [Mon, 31 Jan 2011 07:04:33 +0000 (07:04 +0000)]
Error for use of field from anonymous struct or union should say "invalid use of nonstatic data member"
not "call to non-static member function without an object argument".

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

13 years agoAmazing that there are still issues with the fields of anonymous struct/unions..
Argyrios Kyrtzidis [Mon, 31 Jan 2011 07:04:29 +0000 (07:04 +0000)]
Amazing that there are still issues with the fields of anonymous struct/unions..
Allow taking the address of such a field for a pointer-to-member constant. Fixes rdar://8818236.

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

13 years agoFix test that didn't actually test what it wanted to test.
Argyrios Kyrtzidis [Mon, 31 Jan 2011 07:04:24 +0000 (07:04 +0000)]
Fix test that didn't actually test what it wanted to test.

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

13 years agoAllow Microsoft attributes in a constructor's parameter list.
Francois Pichet [Mon, 31 Jan 2011 04:54:32 +0000 (04:54 +0000)]
Allow Microsoft attributes in a constructor's parameter list.
This fixes a few compile errors when parsing <regex> from MSVC 2008 with clang.

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

13 years agoWhen building with optimizations, emit vtables where the key is not in the
Anders Carlsson [Sun, 30 Jan 2011 20:45:54 +0000 (20:45 +0000)]
When building with optimizations, emit vtables where the key is not in the
current translation unit as available_externally.

This helps devirtualize the second example in PR3100, comment 18:

struct S { S() {}; virtual void xyzzy(); };
inline void foo(S *s) { s->xyzzy(); }
void bar() { S s; foo(&s); }

This involved four major changes:

1. In DefineUsedVTables, always mark virtual member functions as referenced for
   non-template classes and class template specializations.
2. In CodeGenVTables::ShouldEmitVTableInThisTU return true if optimizations are
   enabled, even if the key function is not implemented in this translation
   unit. We don't ever do this for code compiled with -fapple-kext, because we
   don't ever want to devirtualize virtual member function calls in that case.
3. Give the correct linkage for vtables where the key function is not defined.
4. Update the linkage for RTTI structures when necessary.

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

13 years agoAdd hardcoded -L/usr/lib after all -L options to the FreeBSD linker
Roman Divacky [Sun, 30 Jan 2011 08:12:24 +0000 (08:12 +0000)]
Add hardcoded -L/usr/lib after all -L options to the FreeBSD linker
invocation.

This mimics what gcc does and fixes libtool check for libraries.

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

13 years agoFix test.
Anders Carlsson [Sat, 29 Jan 2011 22:39:23 +0000 (22:39 +0000)]
Fix test.

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

13 years agoRemove dead code.
Anders Carlsson [Sat, 29 Jan 2011 22:15:18 +0000 (22:15 +0000)]
Remove dead code.

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

13 years agoWhen emitting RTTI for a non-class type, compute the visibility of the RTTI data...
Anders Carlsson [Sat, 29 Jan 2011 22:10:32 +0000 (22:10 +0000)]
When emitting RTTI for a non-class type, compute the visibility of the RTTI data based on the explicit visibility of the type.

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

13 years agoSupport for -plugin-arg- with -add-plugin
Nico Weber [Sat, 29 Jan 2011 21:21:49 +0000 (21:21 +0000)]
Support for -plugin-arg- with -add-plugin

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

13 years agoMove GetLLVMVisibility to CodeGenModule.
Anders Carlsson [Sat, 29 Jan 2011 20:59:35 +0000 (20:59 +0000)]
Move GetLLVMVisibility to CodeGenModule.

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

13 years agoUpdate tests.
Anders Carlsson [Sat, 29 Jan 2011 20:57:16 +0000 (20:57 +0000)]
Update tests.

I'm still not sure if having the typenames be visible with -hidden-weak-vtables, but I think it makes sense.

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

13 years agoAdd RTTIBuilder::GetAddrOfTypeName which uses the newly added CreateOrReplaceCXXRunti...
Anders Carlsson [Sat, 29 Jan 2011 20:36:11 +0000 (20:36 +0000)]
Add RTTIBuilder::GetAddrOfTypeName which uses the newly added CreateOrReplaceCXXRuntimeVariable.

Set the visibility for typeinfo names.

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

13 years agoChange CodeGenModule::setTypeVisibility to take a TypeVisibilityKind enum instead...
Anders Carlsson [Sat, 29 Jan 2011 20:24:48 +0000 (20:24 +0000)]
Change CodeGenModule::setTypeVisibility to take a TypeVisibilityKind enum instead of an "IsForRTTI" flag.

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

13 years agoAdd a test for RTTI visibility.
Anders Carlsson [Sat, 29 Jan 2011 19:52:22 +0000 (19:52 +0000)]
Add a test for RTTI visibility.

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

13 years agoReplace an isa/cast with a dyn_cast.
Anders Carlsson [Sat, 29 Jan 2011 19:41:00 +0000 (19:41 +0000)]
Replace an isa/cast with a dyn_cast.

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

13 years agoGet rid of an unneeded parameter from setGlobalVisibility.
Anders Carlsson [Sat, 29 Jan 2011 19:39:23 +0000 (19:39 +0000)]
Get rid of an unneeded parameter from setGlobalVisibility.

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

13 years agoGive VTTs the right visibility.
Anders Carlsson [Sat, 29 Jan 2011 19:34:19 +0000 (19:34 +0000)]
Give VTTs the right visibility.

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

13 years agoMake emitting a VTT a two-step process, much like emitting a VTable. You first get...
Anders Carlsson [Sat, 29 Jan 2011 19:16:51 +0000 (19:16 +0000)]
Make emitting a VTT a two-step process, much like emitting a VTable. You first get the address of the VTT, and then pass it to EmitVTTDefinition.

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

13 years agoUse CGM.CreateOrReplaceCXXRuntimeVariable in CGVTables.cpp
Anders Carlsson [Sat, 29 Jan 2011 18:25:07 +0000 (18:25 +0000)]
Use CGM.CreateOrReplaceCXXRuntimeVariable in CGVTables.cpp

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

13 years agoAdd a new function, to be used by CGRTTI, CGVTables and CGVTT (which each has their...
Anders Carlsson [Sat, 29 Jan 2011 18:20:20 +0000 (18:20 +0000)]
Add a new function, to be used by CGRTTI, CGVTables and CGVTT (which each has their own copy of this code).

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

13 years agoReplace a literal '8' with getCharWidth().
Ken Dyck [Sat, 29 Jan 2011 17:53:12 +0000 (17:53 +0000)]
Replace a literal '8' with getCharWidth().

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

13 years agoRemove IsDefinition from CodeGenModule::setTypeVisibility; it is always true.
Anders Carlsson [Sat, 29 Jan 2011 05:26:32 +0000 (05:26 +0000)]
Remove IsDefinition from CodeGenModule::setTypeVisibility; it is always true.

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

13 years agoWhen trying to get the most derived class, don't assume that we can ignore all casts...
Anders Carlsson [Sat, 29 Jan 2011 05:04:11 +0000 (05:04 +0000)]
When trying to get the most derived class, don't assume that we can ignore all casts. We can only ignore derived-to-base and no-op casts. Fixes selfhost.

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

13 years agoWhen calling a virtual member function on a base class and the most derived class...
Anders Carlsson [Sat, 29 Jan 2011 03:52:01 +0000 (03:52 +0000)]
When calling a virtual member function on a base class and the most derived class is marked 'final', we can devirtualize the call.

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

13 years agoWhen doing a derived-to-base class through a virtual class, we don't have to get...
Anders Carlsson [Sat, 29 Jan 2011 03:18:56 +0000 (03:18 +0000)]
When doing a derived-to-base class through a virtual class, we don't have to get the vbase offset from the vtable if the derived class is marked final.

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

13 years agoMore work to support -fapple-kext regarding
Fariborz Jahanian [Fri, 28 Jan 2011 23:42:29 +0000 (23:42 +0000)]
More work to support -fapple-kext regarding
indirect vf calls and addition of extra entry
at bottom of vtbls.

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

13 years agoDocument how to add an attribute to clang. This should be reviewed by someone
Jeffrey Yasskin [Fri, 28 Jan 2011 23:41:54 +0000 (23:41 +0000)]
Document how to add an attribute to clang.  This should be reviewed by someone
who actually knows how it works.

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

13 years agoFix some corner cases in the __is_base_of logic.
John McCall [Fri, 28 Jan 2011 22:02:36 +0000 (22:02 +0000)]
Fix some corner cases in the __is_base_of logic.

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

13 years agoAdd my new file to the CMake lists, sorry about that.
John McCall [Fri, 28 Jan 2011 20:10:46 +0000 (20:10 +0000)]
Add my new file to the CMake lists, sorry about that.

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

13 years agoMake the FreeBSD driver test more robust so it doesn't fail when there's a single...
Benjamin Kramer [Fri, 28 Jan 2011 18:28:30 +0000 (18:28 +0000)]
Make the FreeBSD driver test more robust so it doesn't fail when there's a single lib32 path.

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

13 years agoMove all the cleanups framework code into a single file.
John McCall [Fri, 28 Jan 2011 11:13:47 +0000 (11:13 +0000)]
Move all the cleanups framework code into a single file.
Pure motion.

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

13 years agoReorganize the value-dominance metaprogram and introduce a specialization
John McCall [Fri, 28 Jan 2011 10:53:53 +0000 (10:53 +0000)]
Reorganize the value-dominance metaprogram and introduce a specialization
for CodeGen's RValue type.

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

13 years agoConvert the exception-freeing cleanup over to the conditional cleanups code,
John McCall [Fri, 28 Jan 2011 08:37:24 +0000 (08:37 +0000)]
Convert the exception-freeing cleanup over to the conditional cleanups code,
fixing a crash which probably nobody was ever going to see.  In doing so,
fix a horrendous number of problems with the conditional-cleanups code.
Also, make conditional cleanups re-use the cleanup's activation variable,
which avoids some unfortunate repetitiveness.

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

13 years agoPR9037: Allow override, final, and new as an extension on inline members.
Nico Weber [Fri, 28 Jan 2011 06:07:34 +0000 (06:07 +0000)]
PR9037: Allow override, final, and new as an extension on inline members.

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

13 years agoNot really any point to testing control flow in this test without
John McCall [Fri, 28 Jan 2011 06:05:16 +0000 (06:05 +0000)]
Not really any point to testing control flow in this test without
ret duplication.

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

13 years agoUpdate exceptions.m for r124462.
Eric Christopher [Fri, 28 Jan 2011 05:13:18 +0000 (05:13 +0000)]
Update exceptions.m for r124462.

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

13 years agoGive OpaqueValueExpr a source location, because its source location
Douglas Gregor [Fri, 28 Jan 2011 02:26:04 +0000 (02:26 +0000)]
Give OpaqueValueExpr a source location, because its source location
might be queried in places where we absolutely require a valid
location (e.g., for template instantiation). Fixes some major
brokenness in the use of __is_convertible_to.

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

13 years agoAllow elision of invocations of move constructors from temporary objects.
Douglas Gregor [Thu, 27 Jan 2011 23:24:55 +0000 (23:24 +0000)]
Allow elision of invocations of move constructors from temporary objects.

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

13 years agoWhen producing IR for a lvalue-to-rvalue cast *as an lvalue*, only
Douglas Gregor [Thu, 27 Jan 2011 23:22:05 +0000 (23:22 +0000)]
When producing IR for a lvalue-to-rvalue cast *as an lvalue*, only
non-class prvalues actually require the realization of a
temporary. For everything else, we already have an lvalue (or class
prvalue) in the subexpression.

Note: we're missing some move elision in this case. I'll tackle that next.

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

13 years agoFix an objective-c rewriter bug rewriting a __block
Fariborz Jahanian [Thu, 27 Jan 2011 23:18:15 +0000 (23:18 +0000)]
Fix an objective-c rewriter bug rewriting a __block
variable declaration of a struct declared type.
// rdar://8918702

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

13 years agoTeach the evaluation of the __is_convertible_to trait to translate
Douglas Gregor [Thu, 27 Jan 2011 22:31:44 +0000 (22:31 +0000)]
Teach the evaluation of the __is_convertible_to trait to translate
access control errors into SFINAE errors, so that the trait provides
enough support to implement the C++0x std::is_convertible type trait.

To get there, the SFINAETrap now knows how to set up a SFINAE context
independent of any template instantiations or template argument
deduction steps, and (separately) can set a Sema flag to translate
access control errors into SFINAE errors. The latter can also be
useful if we decide that access control errors during template argument
deduction should cause substitution failure (rather than a hard error)
as has been proposed for C++0x.

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

13 years agoAdjust casing of attributes in examples.
Ted Kremenek [Thu, 27 Jan 2011 22:00:02 +0000 (22:00 +0000)]
Adjust casing of attributes in examples.

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

13 years agoSeparate the access-control diagnostics from other diagnostics that do not have SFINA...
Douglas Gregor [Thu, 27 Jan 2011 21:06:28 +0000 (21:06 +0000)]
Separate the access-control diagnostics from other diagnostics that do not have SFINAE behavior.

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

13 years agoDocument some serious badness in our evaluation of the type traits: we need to be...
Douglas Gregor [Thu, 27 Jan 2011 20:35:44 +0000 (20:35 +0000)]
Document some serious badness in our evaluation of the type traits: we need to be sure we have complete types in many cases

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

13 years agoImplement the Microsoft __is_convertible_to type trait, modeling the
Douglas Gregor [Thu, 27 Jan 2011 20:28:01 +0000 (20:28 +0000)]
Implement the Microsoft __is_convertible_to type trait, modeling the
semantics after the C++0x is_convertible type trait. This
implementation is not 100% complete, because it allows access errors
to be hard errors (rather than just evaluating false).

Original patch by Steven Watanabe!

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