]> granicus.if.org Git - clang/log
clang
14 years agoMisc. fixes to bring Objetive-C++'s handling of
Fariborz Jahanian [Tue, 18 May 2010 23:04:17 +0000 (23:04 +0000)]
Misc. fixes to bring Objetive-C++'s handling of
gc attributes to be inline with Objective-C
(for radar 7925141).

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

14 years agoProtect isIntegerConstantExpr from seeing type- or value-dependent
Douglas Gregor [Tue, 18 May 2010 23:01:22 +0000 (23:01 +0000)]
Protect isIntegerConstantExpr from seeing type- or value-dependent
expressions in attributes, pragmas.

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

14 years agoImplement C++ support for vector and extended vector types. This
Douglas Gregor [Tue, 18 May 2010 22:42:18 +0000 (22:42 +0000)]
Implement C++ support for vector and extended vector types. This
involves extending implicit conversion sequences to model vector
conversions and vector splats, along with teaching the C++ conditional
operator-checking code about vector types.

Fixes <rdar://problem/7983501>.

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

14 years agoAdd function 'clang_isTagDeclDefinition()' to allow clients of libclang to distinguis...
Ted Kremenek [Tue, 18 May 2010 22:32:15 +0000 (22:32 +0000)]
Add function 'clang_isTagDeclDefinition()' to allow clients of libclang to distinguish between
forward declarations and definitions of structs/classes/enums.

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

14 years agoTeach CursorVisitor about duplicate ObjCPropertyDecls that can arise because of a...
Ted Kremenek [Tue, 18 May 2010 21:09:07 +0000 (21:09 +0000)]
Teach CursorVisitor about duplicate ObjCPropertyDecls that can arise because of a current
design limitation in how we handle Objective-C class extensions.  This was causing the CursorVisitor
to essentially visit an @property twice (once in the @interface, the other in the class extension).
Fixes <rdar://problem/7410145>.

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

14 years agoThese test now run in objective-c++ mode we well.
Fariborz Jahanian [Tue, 18 May 2010 18:24:06 +0000 (18:24 +0000)]
These test now run in objective-c++ mode we well.

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

14 years agoAdd missing test case, provided by Steven Watanabe.
Douglas Gregor [Tue, 18 May 2010 17:43:51 +0000 (17:43 +0000)]
Add missing test case, provided by Steven Watanabe.

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

14 years agoFix typo test case
Douglas Gregor [Tue, 18 May 2010 16:57:36 +0000 (16:57 +0000)]
Fix typo test case

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

14 years agoAdd support for Microsoft's __thiscall, from Steven Watanabe!
Douglas Gregor [Tue, 18 May 2010 16:57:00 +0000 (16:57 +0000)]
Add support for Microsoft's __thiscall, from Steven Watanabe!

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

14 years agoCorrectly initialize bases with member pointers. This should fix PR6441 but that...
Anders Carlsson [Tue, 18 May 2010 16:51:41 +0000 (16:51 +0000)]
Correctly initialize bases with member pointers. This should fix PR6441 but that test case is a bit weird and I'd like to investigate further before closing that bug.

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

14 years agoGive a slight edge to the context-sensitive keyword 'super' over
Douglas Gregor [Tue, 18 May 2010 16:30:22 +0000 (16:30 +0000)]
Give a slight edge to the context-sensitive keyword 'super' over
non-function-local declarations with names similar to what the user
typed. For example, this allows us to correct 'supper' to 'super' in
an Objective-C message send, even though the C function 'isupper' has
the same edit distance.

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

14 years agoTweak typo-correction logic a bit regarding "super", so that we
Douglas Gregor [Tue, 18 May 2010 16:14:23 +0000 (16:14 +0000)]
Tweak typo-correction logic a bit regarding "super", so that we
consider "super" as a candidate whenever we're parsing an expression
within an Objective-C method in an interface that has a superclass. At
some point, we'd like to give "super" a little edge over non-local
names; that will come later.

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

14 years agoPermit Objective C object pointers to be const_casted.
John McCall [Tue, 18 May 2010 09:35:29 +0000 (09:35 +0000)]
Permit Objective C object pointers to be const_casted.

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

14 years agoSwitch over the tablegen to use much prettier range technology
Sean Hunt [Tue, 18 May 2010 06:22:21 +0000 (06:22 +0000)]
Switch over the tablegen to use much prettier range technology
Also rename ABSTRACT to ABSTRACT_STMT, in keeping with the other .def
files

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

14 years ago"The attached patch allows clang to find the headers
Douglas Gregor [Tue, 18 May 2010 05:47:04 +0000 (05:47 +0000)]
"The attached patch allows clang to find the headers
for Visual Studio 2010.  It also adds a registry search
for the Express edition,", from Steven Watanabe!

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

14 years agoI hate this commit.
Douglas Gregor [Tue, 18 May 2010 05:45:02 +0000 (05:45 +0000)]
I hate this commit.

Revert much of the implementation of C++98/03 [temp.friend]p5 in
r103943 and its follow-ons r103948 and r103952. While our
implementation was technically correct, other compilers don't seem to
implement this paragraph (which forces the instantiation of friend
functions defined in a class template when a class template
specialization is instantiated), and doing so broke a bunch of Boost
libraries.

Since this behavior has changed in C++0x (which instantiates the
friend function definitions when they are used), we're going to skip
the nowhere-implemented C++98/03 semantics and go straight to the
C++0x semantics.

This commit is a band-aid to get Boost up and running again. It
doesn't really fix PR6952 (which this commit un-fixes), but it does
deal with the way Boost.Units abuses this particular paragraph.

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

14 years agoKeep track of the LLVM field numbers for non-virtual bases.
Anders Carlsson [Tue, 18 May 2010 05:22:06 +0000 (05:22 +0000)]
Keep track of the LLVM field numbers for non-virtual bases.

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

14 years agoStart laying out bases as individual fields. We still use ugly i8 arrays but this...
Anders Carlsson [Tue, 18 May 2010 05:12:20 +0000 (05:12 +0000)]
Start laying out bases as individual fields. We still use ugly i8 arrays but this is a step in the right direction.

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

14 years agoAdd CodeGenTypes::ContainsPointerToDataMember overload that takes a CXXRecordDecl.
Anders Carlsson [Tue, 18 May 2010 03:47:15 +0000 (03:47 +0000)]
Add CodeGenTypes::ContainsPointerToDataMember overload that takes a CXXRecordDecl.

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

14 years agoIf a switch condition is constant, don't warn about missing enum cases.
John McCall [Tue, 18 May 2010 03:19:21 +0000 (03:19 +0000)]
If a switch condition is constant, don't warn about missing enum cases.
If a switch condition is constant, warn if there's no case for it.

Constant switch conditions do come up in reasonable template code.

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

14 years agoAdd option '-analyzer-max-loop', which specifies the maximum
Zhongxing Xu [Tue, 18 May 2010 00:28:37 +0000 (00:28 +0000)]
Add option '-analyzer-max-loop', which specifies the maximum
number of times the analyzer will go through a loop.

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

14 years agoTeach the ObjC mangler to ignore member pointers just like gcc does.
John McCall [Mon, 17 May 2010 23:56:34 +0000 (23:56 +0000)]
Teach the ObjC mangler to ignore member pointers just like gcc does.

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

14 years agoAdd a hack to silence warnings about failing to return from functions after
Chandler Carruth [Mon, 17 May 2010 23:51:52 +0000 (23:51 +0000)]
Add a hack to silence warnings about failing to return from functions after
a temporary with a noreturn destructor has been created. Fixes PR6884 for now.

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

14 years agoInstantiate attributes on typedefs. This is a quick fix for PR7148,
Douglas Gregor [Mon, 17 May 2010 23:46:49 +0000 (23:46 +0000)]
Instantiate attributes on typedefs. This is a quick fix for PR7148,
when we really need a proper audit of our handling of attributes in
templates.

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

14 years agoAdd a 'Base' type to RecursiveASTVisitor to make recursing easier and document
Nick Lewycky [Mon, 17 May 2010 23:15:38 +0000 (23:15 +0000)]
Add a 'Base' type to RecursiveASTVisitor to make recursing easier and document
how you're supposed to use it.

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

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