]> granicus.if.org Git - clang/log
clang
14 years agoClean up test case and remove XFAIL. This test can now distinguish between
Ted Kremenek [Mon, 17 May 2010 23:03:33 +0000 (23:03 +0000)]
Clean up test case and remove XFAIL.  This test can now distinguish between
cases where Clang can suggest and fix and suggest and not auto-fix (because of
current limitations).

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

14 years agoComments and assorted cleanups for the Objective C type AST.
John McCall [Mon, 17 May 2010 23:00:45 +0000 (23:00 +0000)]
Comments and assorted cleanups for the Objective C type AST.

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

14 years agoClean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointed
John McCall [Mon, 17 May 2010 21:00:27 +0000 (21:00 +0000)]
Clean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointed
out.  The remaining ones are okay.

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

14 years agoFix an ambiguous else warning from GCC by adding some much needed curlies.
Chandler Carruth [Mon, 17 May 2010 20:58:49 +0000 (20:58 +0000)]
Fix an ambiguous else warning from GCC by adding some much needed curlies.

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

14 years agorobustify the conflict marker stuff. Don't add 7 twice, which would
Chris Lattner [Mon, 17 May 2010 20:27:25 +0000 (20:27 +0000)]
robustify the conflict marker stuff.  Don't add 7 twice, which would
make it miss (invalid) things like:
<<<<<<<
>>>>>>>

and crash if

<<<<<<<

was at the end of the line.  When we find a >>>>>>> that is not at the
end of the line, make sure to reset Pos so we don't crash on something
like:
<<<<<<< >>>>>>>

This isn't worth making testcases for, since each would require a new file.

rdar://7987078 - signal 11 compiling "<<<<<<<<<<"

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

14 years agoFix missing '}'.
Ted Kremenek [Mon, 17 May 2010 20:12:45 +0000 (20:12 +0000)]
Fix missing '}'.

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

14 years agoCorrectly generate IR for ObjC messages sends to protocol-qualified types.
John McCall [Mon, 17 May 2010 20:12:43 +0000 (20:12 +0000)]
Correctly generate IR for ObjC messages sends to protocol-qualified types.
Fixes rdar://problem/7992749

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

14 years agoAdd libclang function 'clang_CXXMethod_isStatic' to query of a C++ method
Ted Kremenek [Mon, 17 May 2010 20:06:56 +0000 (20:06 +0000)]
Add libclang function 'clang_CXXMethod_isStatic' to query of a C++ method
is declared static.

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

14 years agoTest that mutability of class members that involve class definitions actually works
Douglas Gregor [Mon, 17 May 2010 19:45:25 +0000 (19:45 +0000)]
Test that mutability of class members that involve class definitions actually works

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

14 years agoTeach ASTContext::getUnqualifiedArrayType() how to look through
Douglas Gregor [Mon, 17 May 2010 18:45:21 +0000 (18:45 +0000)]
Teach ASTContext::getUnqualifiedArrayType() how to look through
typedefs. As a drive-by, teach hit how to build VLA types, since those
will eventually be supported in C++.

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

14 years agomutable is a storage class that can follow a class/struct/union definition. Fixes...
Douglas Gregor [Mon, 17 May 2010 18:19:56 +0000 (18:19 +0000)]
mutable is a storage class that can follow a class/struct/union definition. Fixes PR7153

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

14 years agoDon't attempt to poke into an invalid field's class type
Fariborz Jahanian [Mon, 17 May 2010 18:15:18 +0000 (18:15 +0000)]
Don't attempt to poke into an invalid field's class type
to mark its destructors as referenced which may cause
a crash. Fixes radar 7896920

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

14 years agoDiagnose a redefinition error when there are two instantiations of friend
Douglas Gregor [Mon, 17 May 2010 17:57:54 +0000 (17:57 +0000)]
Diagnose a redefinition error when there are two instantiations of friend
functions defined inside a class template. Fixes PR6952, the last
Boost.Units failure.

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

14 years agoDetermine when the instantiation of a friend function defined inside a
Douglas Gregor [Mon, 17 May 2010 17:34:56 +0000 (17:34 +0000)]
Determine when the instantiation of a friend function defined inside a
class template conflicts with an existing (non-template)
definition. This is another part of PR6952.

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

14 years agoIRgen: Remove dead function.
Daniel Dunbar [Mon, 17 May 2010 16:46:02 +0000 (16:46 +0000)]
IRgen: Remove dead function.

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

14 years agoC++/Darwin/i386 ABI: Fix some problems with empty record handling.
Daniel Dunbar [Mon, 17 May 2010 16:46:00 +0000 (16:46 +0000)]
C++/Darwin/i386 ABI: Fix some problems with empty record handling.
 - Check bases as part of isEmptyRecord().

 - C++ record fields are never empty in the Itanium ABI.

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

14 years agoC++98/03 [temp.friend]p4 requires that inline function definitions
Douglas Gregor [Mon, 17 May 2010 16:38:00 +0000 (16:38 +0000)]
C++98/03 [temp.friend]p4 requires that inline function definitions
within class templates be instantiated along with each class template
specialization, even if the functions are not used. Do so, as a baby
step toward PR6952.

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

14 years agoEnsure that destructors are called for NRVO'd objects when the
Douglas Gregor [Mon, 17 May 2010 15:52:46 +0000 (15:52 +0000)]
Ensure that destructors are called for NRVO'd objects when the
function does not return. Thanks to Eli for pointing out this corner
case.

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

14 years agoPick the correct personality function based on the language. This prevents link...
David Chisnall [Mon, 17 May 2010 13:49:20 +0000 (13:49 +0000)]
Pick the correct personality function based on the language.  This prevents link failures when C/ObjC code uses __attribute__((cleanup())) (previously this was inserting references to two libstc++ symbols; the personality function and the __terminate() function).

This is still probably wrong for Objective-C++ and adds a couple of lines in CGException that should probably be in the CGObjCRuntime subclass.  The personality function is now only looked up in one place in CGException though, so this should be easier to fix in the future.

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

14 years agoPR7117: Make sure we don't lose the calling convention for K&R-style
Eli Friedman [Mon, 17 May 2010 02:50:18 +0000 (02:50 +0000)]
PR7117: Make sure we don't lose the calling convention for K&R-style
definitions.

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

14 years agowhen code completing inside a C-style block comment, don't emit errors about
Chris Lattner [Sun, 16 May 2010 19:54:05 +0000 (19:54 +0000)]
when code completing inside a C-style block comment, don't emit errors about
a missing */ since we truncated the file.

This fixes rdar://7948776

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

14 years agoMoved clang-builtin include dir position to immediately precede C includes.
mike-m [Sun, 16 May 2010 19:03:52 +0000 (19:03 +0000)]
Moved clang-builtin include dir position to immediately precede C includes.
This aligns with how gcc compiler does things.

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

14 years agoCorrectly diagnose array 'new' with initialization arguments when the new type is...
Anders Carlsson [Sun, 16 May 2010 16:24:20 +0000 (16:24 +0000)]
Correctly diagnose array 'new' with initialization arguments when the new type is a typedef to an array type.

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

14 years agoWhen the type-id or new-type-id of a C++ "new" expression is a typedef
Douglas Gregor [Sun, 16 May 2010 16:01:03 +0000 (16:01 +0000)]
When the type-id or new-type-id of a C++ "new" expression is a typedef
of an array type, use the outermost array bound as the number of
elements to allocate. Fixes PR7147.

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

14 years agoDon't emit any fallthrough / missing-noreturn warnings if we can't
John McCall [Sun, 16 May 2010 09:34:11 +0000 (09:34 +0000)]
Don't emit any fallthrough / missing-noreturn warnings if we can't
compute a CFG for a function.

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

14 years agoWhen constant folding reference variables with an initializer to the
Chandler Carruth [Sun, 16 May 2010 09:32:51 +0000 (09:32 +0000)]
When constant folding reference variables with an initializer to the
initializer, don't fold paramters. Their initializers are just default
arguments which can be overridden. This fixes some spectacular regressions due
to more things making it into the constant folding.

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

14 years agoreally use valist.
Chris Lattner [Sun, 16 May 2010 05:00:34 +0000 (05:00 +0000)]
really use valist.

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

14 years agofix rdar://7985267 - Don't emit an error about a non-pod argument
Chris Lattner [Sun, 16 May 2010 04:01:30 +0000 (04:01 +0000)]
fix rdar://7985267 - Don't emit an error about a non-pod argument
passed to va_start, it doesn't actually pass it.

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

14 years agoEmit a type record for TYPE_OBJC_OBJECT in the PCH file. I'm not
John McCall [Sun, 16 May 2010 02:12:35 +0000 (02:12 +0000)]
Emit a type record for TYPE_OBJC_OBJECT in the PCH file.  I'm not
entirely sure what this does, to be honest.

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

14 years agoBe sure to initialize the "has base type as written" field of an
John McCall [Sun, 16 May 2010 02:12:01 +0000 (02:12 +0000)]
Be sure to initialize the "has base type as written" field of an
ObjCObjectTypeLoc.  This should clear up some valgrind errors we've
been seeing.

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

14 years agoAvoid doing two switches in TypeLoc's initialize() loop. The optimizer
John McCall [Sun, 16 May 2010 02:09:32 +0000 (02:09 +0000)]
Avoid doing two switches in TypeLoc's initialize() loop.  The optimizer
can probably do this for us, but it's actually somewhat nicer to write it
out here.

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

14 years agoWhen initializing thread-safe statics, put the call to
Douglas Gregor [Sun, 16 May 2010 01:24:12 +0000 (01:24 +0000)]
When initializing thread-safe statics, put the call to
__cxa_guard_abort along the exceptional edge into (in effect) a nested
"try" that rethrows after aborting. Fixes PR7144 and the remaining
Boost.ProgramOptions failures, along with the regressions that r103880
caused.

The crucial difference between this and r103880 is that we now follow
LLVM's little dance with the llvm.eh.exception and llvm.eh.selector
calls, then use _Unwind_Resume_or_Rethrow to rethrow.

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

14 years agoRevert r103880 (thread-safe static initialization w/ exceptions),
Douglas Gregor [Sun, 16 May 2010 00:44:00 +0000 (00:44 +0000)]
Revert r103880 (thread-safe static initialization w/ exceptions),
because it's causing strange linker errors. Unfixes PR7144.

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

14 years agoMinor twik to my last patch. (for radar 7986354).
Fariborz Jahanian [Sun, 16 May 2010 00:10:46 +0000 (00:10 +0000)]
Minor twik to my last patch. (for radar 7986354).

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

14 years agoFix API gen for objc_msgSend property of aggregate types
Fariborz Jahanian [Sat, 15 May 2010 23:05:52 +0000 (23:05 +0000)]
Fix API gen for objc_msgSend property of aggregate types
in Objective-c++ mode. Fixes radar 7986354.

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

14 years agoWhen initializing thread-safe statics, put the call to
Douglas Gregor [Sat, 15 May 2010 17:55:51 +0000 (17:55 +0000)]
When initializing thread-safe statics, put the call to
__cxa_guard_abort along the exceptional edge into (in effect) a nested
"try" that rethrows after aborting. Fixes PR7144 and the remaining
Boost.ProgramOptions failures.

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

14 years agoAttempt to satisfy Release-Asserts build
Douglas Gregor [Sat, 15 May 2010 17:28:53 +0000 (17:28 +0000)]
Attempt to satisfy Release-Asserts build

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

14 years agoModify this comment per Doug's suggestion: we don't need to mangle protocols.
John McCall [Sat, 15 May 2010 17:06:29 +0000 (17:06 +0000)]
Modify this comment per Doug's suggestion:  we don't need to mangle protocols.

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

14 years agosigh
Chris Lattner [Sat, 15 May 2010 16:56:34 +0000 (16:56 +0000)]
sigh

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

14 years agofix _mm_shuffle_pd too, thanks to Joel Falcou for pointing this out.
Chris Lattner [Sat, 15 May 2010 16:54:46 +0000 (16:54 +0000)]
fix _mm_shuffle_pd too, thanks to Joel Falcou for pointing this out.

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

14 years agoWhen applying the named return value optimization, we still need to
Douglas Gregor [Sat, 15 May 2010 16:39:56 +0000 (16:39 +0000)]
When applying the named return value optimization, we still need to
destroy the variable along the exceptional edge; it's only during
normal execution that we avoid destroying this variable.

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

14 years agoSubstantially alter the design of the Objective C type AST by introducing
John McCall [Sat, 15 May 2010 11:32:37 +0000 (11:32 +0000)]
Substantially alter the design of the Objective C type AST by introducing
ObjCObjectType, which is basically just a pair of
  one of {primitive-id, primitive-Class, user-defined @class}
with
  a list of protocols.
An ObjCObjectPointerType is therefore just a pointer which always points to
one of these types (possibly sugared).  ObjCInterfaceType is now just a kind
of ObjCObjectType which happens to not carry any protocols.

Alter a rather large number of use sites to use ObjCObjectType instead of
ObjCInterfaceType.  Store an ObjCInterfaceType as a pointer on the decl rather
than hashing them in a FoldingSet.  Remove some number of methods that are no
longer used, at least after this patch.

By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
pointers to Objective-C types, which is crucial for a certain kind of ObjC++
metaprogramming common in WebKit.

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

14 years agoImplement a simple form of the C++ named return value optimization for
Douglas Gregor [Sat, 15 May 2010 06:46:45 +0000 (06:46 +0000)]
Implement a simple form of the C++ named return value optimization for
return statements. We perform NRVO only when all of the return
statements in the function return the same variable. Fixes some link
failures in Boost.Interprocess (which is relying on NRVO), and
probably improves performance for some C++ applications.

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

14 years agoImplement semantic analysis and an AST representation for the named
Douglas Gregor [Sat, 15 May 2010 06:01:05 +0000 (06:01 +0000)]
Implement semantic analysis and an AST representation for the named
return value optimization. Sema marks return statements with their
NRVO candidates (which may or may not end up using the NRVO), then, at
the end of a function body, computes and marks those variables that
can be allocated into the return slot.

I've checked this locally with some debugging statements (not
committed), but there won't be any tests until CodeGen comes along.

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

14 years agoadd type casts to _mm_shuffle_ps so the front-end applies
Chris Lattner [Sat, 15 May 2010 05:53:53 +0000 (05:53 +0000)]
add type casts to _mm_shuffle_ps so the front-end applies
implicit conversions where needed.  This fixes an error reported
on cfe-dev, not really worth a testcase though.

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

14 years agoRecognize when the named return value optimization applies in a
Douglas Gregor [Sat, 15 May 2010 00:13:29 +0000 (00:13 +0000)]
Recognize when the named return value optimization applies in a
"return" statement and mark the corresponding CXXConstructExpr as
elidable. Teach CodeGen that eliding a temporary is different from
eliding an object construction.

This is just a baby step toward NRVO.

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

14 years agoC++/ABI/x86_64: Member pointers should be classified as INTEGER.
Daniel Dunbar [Sat, 15 May 2010 00:00:37 +0000 (00:00 +0000)]
C++/ABI/x86_64: Member pointers should be classified as INTEGER.

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

14 years agoC++/ABI/i386: Member function pointers should be passed by value.
Daniel Dunbar [Sat, 15 May 2010 00:00:30 +0000 (00:00 +0000)]
C++/ABI/i386: Member function pointers should be passed by value.

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

14 years agoChange install_name for libclang.dylib to '@rpath/libclang.dylib'. Fixes <rdar:...
Ted Kremenek [Fri, 14 May 2010 23:50:33 +0000 (23:50 +0000)]
Change install_name for libclang.dylib to '@rpath/libclang.dylib'.  Fixes <rdar://problem/7987039>.

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

14 years agoDriver: Make -fverbose-asm the default for platforms where the integrated
Daniel Dunbar [Fri, 14 May 2010 22:00:22 +0000 (22:00 +0000)]
Driver: Make -fverbose-asm the default for platforms where the integrated
assembler defaults to on.

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

14 years agoTweak test so that it does not require <typeinfo>
Douglas Gregor [Fri, 14 May 2010 21:50:50 +0000 (21:50 +0000)]
Tweak test so that it does not require <typeinfo>

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

14 years agoPatch to fix a crash on incomplete class declaration.
Fariborz Jahanian [Fri, 14 May 2010 21:35:02 +0000 (21:35 +0000)]
Patch to fix a crash on incomplete class declaration.
Radar 7923673.

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

14 years agoEmit an lvalue dynamic_cast even if the result is not used. Another
Douglas Gregor [Fri, 14 May 2010 21:31:02 +0000 (21:31 +0000)]
Emit an lvalue dynamic_cast even if the result is not used. Another
part (or possibly all) of PR7132.

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

14 years agoAdd CXType and an initial set of supporting functions to libclang. This exposes...
Ted Kremenek [Fri, 14 May 2010 21:29:26 +0000 (21:29 +0000)]
Add CXType and an initial set of supporting functions to libclang.  This exposes details of
Clang's representation of the C type system to clients.  It is nowhere near complete, and will
be expanded on demand.

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

14 years agoWhen a failed dynamic_cast<T&> (which is an lvalue) results in a
Douglas Gregor [Fri, 14 May 2010 21:14:41 +0000 (21:14 +0000)]
When a failed dynamic_cast<T&> (which is an lvalue) results in a
throw, it should use invoke when needed. The fixes the
Boost.Statechrt failures that motivated PR7132, but there are a few
side issues to tackle as well.

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

14 years agoRemove an unused function.
Anders Carlsson [Fri, 14 May 2010 19:48:27 +0000 (19:48 +0000)]
Remove an unused function.

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

14 years agoMove ContainsPointerToDataMember to CodeGenTypes. No functionality change.
Anders Carlsson [Fri, 14 May 2010 19:41:56 +0000 (19:41 +0000)]
Move ContainsPointerToDataMember to CodeGenTypes. No functionality change.

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

14 years agoImplement new default property synthesis rules. Essentially, no longer
Fariborz Jahanian [Fri, 14 May 2010 18:35:57 +0000 (18:35 +0000)]
Implement new default property synthesis rules. Essentially, no longer
user directive is needed to force a property implementation.
It is decided based on those propeties which are declared in
the class (or in its protocols) but not those which must be
default implemented by one of its super classes. Implements radar 7923851.

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

14 years agoAdd documention on ns_returns_not_retained and cf_returns_not_retained attributes.
Ted Kremenek [Fri, 14 May 2010 18:13:43 +0000 (18:13 +0000)]
Add documention on ns_returns_not_retained and cf_returns_not_retained attributes.

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

14 years agoImprove error recovery in C/ObjC when the first argument of a function
Chris Lattner [Fri, 14 May 2010 17:44:56 +0000 (17:44 +0000)]
Improve error recovery in C/ObjC when the first argument of a function
declarator is incorrect.  Not being a typename causes the parser to
dive down into the K&R identifier list handling stuff, which is almost
never the right thing to do.

Before:

r.c:3:17: error: expected ')'
void bar(intptr y);
                ^
r.c:3:9: note: to match this '('
void bar(intptr y);
        ^
r.c:3:10: error: a parameter list without types is only allowed in a function definition
void bar(intptr y);
         ^

After:

r.c:3:10: error: unknown type name 'intptr'; did you mean 'intptr_t'?
void bar(intptr y);
         ^~~~~~
         intptr_t
r.c:1:13: note: 'intptr_t' declared here
typedef int intptr_t;
            ^

This fixes rdar://7980651 - poor recovery for bad type in the first arg of a C function

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

14 years agofit in 80 cols, remove prototypes for handling #assert since apparently noone cares.
Chris Lattner [Fri, 14 May 2010 17:35:07 +0000 (17:35 +0000)]
fit in 80 cols, remove prototypes for handling #assert since apparently noone cares.

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

14 years agoRefactor ParseFunctionDeclaratorIdentifierList to have the first
Chris Lattner [Fri, 14 May 2010 17:23:36 +0000 (17:23 +0000)]
Refactor ParseFunctionDeclaratorIdentifierList to have the first
identifier in the identifier list consumed before it is called.
No functionality change.

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

14 years agoAdded Expr::EvaluateAsAnyLValue.
Abramo Bagnara [Fri, 14 May 2010 17:07:14 +0000 (17:07 +0000)]
Added Expr::EvaluateAsAnyLValue.

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

14 years agoFix thinko in yesterday's fix.
Devang Patel [Fri, 14 May 2010 16:55:25 +0000 (16:55 +0000)]
Fix thinko in yesterday's fix.
Providing linkage name for function static variable confuses gdb, so don't do that.

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

14 years agoRevert r103770, "Added basic source locations to Elaborated and DependentName
Daniel Dunbar [Fri, 14 May 2010 16:34:09 +0000 (16:34 +0000)]
Revert r103770, "Added basic source locations to Elaborated and DependentName
types.", it is breaking Clang bootstrap.

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

14 years agoMake sure that value-initialized pointers to data members are initialized correctly.
Anders Carlsson [Fri, 14 May 2010 15:05:19 +0000 (15:05 +0000)]
Make sure that value-initialized pointers to data members are initialized correctly.

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

14 years agoAdded basic source locations to Elaborated and DependentName types.
Abramo Bagnara [Fri, 14 May 2010 14:14:23 +0000 (14:14 +0000)]
Added basic source locations to Elaborated and DependentName types.

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

14 years agoNamespaces can only be defined at global or namespace scope. Fixes PR6596.
Douglas Gregor [Fri, 14 May 2010 05:08:22 +0000 (05:08 +0000)]
Namespaces can only be defined at global or namespace scope. Fixes PR6596.

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

14 years agoMake sure to search semantic scopes and appropriate template-parameter
Douglas Gregor [Fri, 14 May 2010 04:53:42 +0000 (04:53 +0000)]
Make sure to search semantic scopes and appropriate template-parameter
scopes during unqualified name lookup that has fallen out to namespace
scope. Fixes PR7133.

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

14 years agoA vtable is used if the key function is defined... even if that key
Douglas Gregor [Fri, 14 May 2010 04:08:48 +0000 (04:08 +0000)]
A vtable is used if the key function is defined... even if that key
function's definition is an out-of-class definition marked
"inline". Fixes an assertion in WebKit.

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

14 years agoXFAIL a test on Win32.
Daniel Dunbar [Fri, 14 May 2010 03:54:53 +0000 (03:54 +0000)]
XFAIL a test on Win32.

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

14 years agoC++/Darwin/x86: Teach IRgen it can pass reference types in registers.
Daniel Dunbar [Fri, 14 May 2010 03:40:53 +0000 (03:40 +0000)]
C++/Darwin/x86: Teach IRgen it can pass reference types in registers.

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

14 years agoDriver: Enable -integrated-as by default, at least for Darwin/x86 without -static.
Daniel Dunbar [Fri, 14 May 2010 02:03:00 +0000 (02:03 +0000)]
Driver: Enable -integrated-as by default, at least for Darwin/x86 without -static.
 - How else will we figure out what is broken, eh?

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

14 years agoForce -no-integrated-as in this test.
Daniel Dunbar [Fri, 14 May 2010 02:02:13 +0000 (02:02 +0000)]
Force -no-integrated-as in this test.

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

14 years agoFix context in class static variable's debugging information entry.
Devang Patel [Thu, 13 May 2010 23:52:37 +0000 (23:52 +0000)]
Fix context in class static variable's debugging information entry.
This fixes bunch of failures in gdb testsuite.

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

14 years agoDisable the available_externally optimization for inline virtual
Douglas Gregor [Thu, 13 May 2010 21:36:56 +0000 (21:36 +0000)]
Disable the available_externally optimization for inline virtual
methods for which the key function is guaranteed to be in another
translation unit. Unfortunately, this guarantee isn't the case when
dealing with shared libraries that fail to export these virtual method
definitions.

I'm reopening PR6747 so we can consider this again at a later point in
time.

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

14 years agoObjective-C++ Sema. Fix a bug in instantiation of receivers.
Fariborz Jahanian [Thu, 13 May 2010 17:19:25 +0000 (17:19 +0000)]
Objective-C++ Sema. Fix a bug in instantiation of receivers.
Completes radar 7963410.

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

14 years agoRework when and how vtables are emitted, by tracking where vtables are
Douglas Gregor [Thu, 13 May 2010 16:44:06 +0000 (16:44 +0000)]
Rework when and how vtables are emitted, by tracking where vtables are
"used" (e.g., we will refer to the vtable in the generated code) and
when they are defined (i.e., because we've seen the key function
definition). Previously, we were effectively tracking "potential
definitions" rather than uses, so we were a bit too eager about emitting
vtables for classes without key functions.

The new scheme:
  - For every use of a vtable, Sema calls MarkVTableUsed() to indicate
  the use. For example, this occurs when calling a virtual member
  function of the class, defining a constructor of that class type,
  dynamic_cast'ing from that type to a derived class, casting
  to/through a virtual base class, etc.
  - For every definition of a vtable, Sema calls MarkVTableUsed() to
  indicate the definition. This happens at the end of the translation
  unit for classes whose key function has been defined (so we can
  delay computation of the key function; see PR6564), and will also
  occur with explicit template instantiation definitions.
 - For every vtable defined/used, we mark all of the virtual member
 functions of that vtable as defined/used, unless we know that the key
 function is in another translation unit. This instantiates virtual
 member functions when needed.
  - At the end of the translation unit, Sema tells CodeGen (via the
  ASTConsumer) which vtables must be defined (CodeGen will define
  them) and which may be used (for which CodeGen will define the
  vtables lazily).

From a language perspective, both the old and the new schemes are
permissible: we're allowed to instantiate virtual member functions
whenever we want per the standard. However, all other C++ compilers
were more lazy than we were, and our eagerness was both a performance
issue (we instantiated too much) and a portability problem (we broke
Boost test cases, which now pass).

Notes:
  (1) There's a ton of churn in the tests, because the order in which
  vtables get emitted to IR has changed. I've tried to isolate some of
  the larger tests from these issues.
  (2) Some diagnostics related to
  implicitly-instantiated/implicitly-defined virtual member functions
  have moved to the point of first use/definition. It's better this
  way.
  (3) I could use a review of the places where we MarkVTableUsed, to
  see if I missed any place where the language effectively requires a
  vtable.

Fixes PR7114 and PR6564.

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

14 years agoDon't add a null successor to a CFGBlock when the contents of an @synchronized statem...
Ted Kremenek [Thu, 13 May 2010 16:38:08 +0000 (16:38 +0000)]
Don't add a null successor to a CFGBlock when the contents of an @synchronized statement is empty.
Fixes <rdar://problem/7979430>.

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

14 years agoFold assertion into condition, as it does not hold all the time.
Ted Kremenek [Thu, 13 May 2010 15:38:38 +0000 (15:38 +0000)]
Fold assertion into condition, as it does not hold all the time.

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

14 years agoTestcase for r103712.
Chandler Carruth [Thu, 13 May 2010 12:04:17 +0000 (12:04 +0000)]
Testcase for r103712.

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

14 years agoTeach the AKA calculation to look at sugar on the pointee type for pointers and
Chandler Carruth [Thu, 13 May 2010 11:37:24 +0000 (11:37 +0000)]
Teach the AKA calculation to look at sugar on the pointee type for pointers and
references. This is a WIP as we should handle function pointers, etc. Reshuffle
the code to do this to facilitate recursing in this manner, and to check for
the type already being printed first rather than last.

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

14 years agoRebuild builtin_id * as an ObjCObjectPointerType, where builtin_id is the
John McCall [Thu, 13 May 2010 08:39:13 +0000 (08:39 +0000)]
Rebuild builtin_id * as an ObjCObjectPointerType, where builtin_id is the
magic type that 'id' is a pointer to.

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

14 years agoRelax an assertion. Various cases could lead to non-symbol values.
Zhongxing Xu [Thu, 13 May 2010 08:26:32 +0000 (08:26 +0000)]
Relax an assertion. Various cases could lead to non-symbol values.

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

14 years agoWhen performing template argument deduction, match Objective C pointers
John McCall [Thu, 13 May 2010 07:48:05 +0000 (07:48 +0000)]
When performing template argument deduction, match Objective C pointers
against pointer patterns.

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

14 years agoDelete a dead function at sabre's request.
Chandler Carruth [Thu, 13 May 2010 07:47:58 +0000 (07:47 +0000)]
Delete a dead function at sabre's request.

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

14 years agoUpdate the types for warning option subgroup arrays to 'short', we have more
Chandler Carruth [Thu, 13 May 2010 07:43:05 +0000 (07:43 +0000)]
Update the types for warning option subgroup arrays to 'short', we have more
than 127 groups so this was already failing given -fsigned-char. A subsequent
to commit to TableGen will generate shorts for the arrays themselves.

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

14 years agoAdd test case for <rdar://problem/7880658>.
Ted Kremenek [Thu, 13 May 2010 06:58:45 +0000 (06:58 +0000)]
Add test case for <rdar://problem/7880658>.

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

14 years agoRemove stale comment.
Ted Kremenek [Thu, 13 May 2010 03:40:51 +0000 (03:40 +0000)]
Remove stale comment.

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

14 years agoadd a couple of key functions for classes without them.
Chris Lattner [Thu, 13 May 2010 01:02:19 +0000 (01:02 +0000)]
add a couple of key functions for classes without them.

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

14 years agoSpecially handle CaseStmts in CursorVisitor because they can be nested and walking...
Ted Kremenek [Thu, 13 May 2010 00:25:00 +0000 (00:25 +0000)]
Specially handle CaseStmts in CursorVisitor because they can be nested and walking them
can blow out the stack.

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

14 years agoIf given location is invalid then use current location.
Devang Patel [Wed, 12 May 2010 23:46:38 +0000 (23:46 +0000)]
If given location is invalid then use current location.
This fixes recent regressions reported by gdb testsuite.
Tighter verification of debug info generated by FE found these regressions.

Refactor code to extract line number and column number from SourceLocation.

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

14 years agoObjective-C++ Sema. Support for conversion of a C++
Fariborz Jahanian [Wed, 12 May 2010 23:29:11 +0000 (23:29 +0000)]
Objective-C++ Sema. Support for conversion of a C++
class object used as a receiver to an objective-c
pointer via a converwsion function. wip.

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

14 years ago"this patch properly addresses escaping < and > which might appear
Chris Lattner [Wed, 12 May 2010 23:27:11 +0000 (23:27 +0000)]
"this patch properly addresses escaping < and > which might appear
(e.g. for C++ operators) in the xml dump.

I also re-enabled the unit test for ast-print-xml (or so I think)
at least, make test didn't fail..."

patch by Sebastien Binet!

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

14 years agoimprove comments.
Chris Lattner [Wed, 12 May 2010 23:26:21 +0000 (23:26 +0000)]
improve comments.

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

14 years agoRevert "Move macro definitions for IBOutlet and IBAction into the source
Daniel Dunbar [Wed, 12 May 2010 21:54:41 +0000 (21:54 +0000)]
Revert "Move macro definitions for IBOutlet and IBAction into the source
code. ...", this was a lit bug which should be fixed in r103652.

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

14 years agoMove macro definitions for IBOutlet and IBAction into the source code. This hopefully
Ted Kremenek [Wed, 12 May 2010 21:44:56 +0000 (21:44 +0000)]
Move macro definitions for IBOutlet and IBAction into the source code.  This hopefully
unbreaks the test with lit+Windows.

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

14 years agoDriver/Darwin/i386: Don't allow compiling C++ with -fapple-kext, we don't support...
Daniel Dunbar [Wed, 12 May 2010 18:19:58 +0000 (18:19 +0000)]
Driver/Darwin/i386: Don't allow compiling C++ with -fapple-kext, we don't support the necessary ABI yet.

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

14 years agoSimplify.
Daniel Dunbar [Wed, 12 May 2010 18:19:55 +0000 (18:19 +0000)]
Simplify.

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

14 years agoObjective-C++ Sema - Allow static_cast of one objc pointer to
Fariborz Jahanian [Wed, 12 May 2010 18:16:59 +0000 (18:16 +0000)]
Objective-C++ Sema - Allow static_cast of one objc pointer to
another.

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