]> granicus.if.org Git - clang/log
clang
12 years agoClean up, add some documentation, and make this test return to checking
Chandler Carruth [Tue, 21 Feb 2012 21:51:40 +0000 (21:51 +0000)]
Clean up, add some documentation, and make this test return to checking
the linker toolchainness a bit more thoroughly. It used to work this
way, but hit buildbot issues. Hopefully subsequent fixes have addressed
those problems, but I'll be watching the bots.

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

12 years agoDon't crash on attempts to synthesize an invalid property.
John McCall [Tue, 21 Feb 2012 21:48:05 +0000 (21:48 +0000)]
Don't crash on attempts to synthesize an invalid property.
rdar://problem/10904479

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

12 years agoRedirect the output to /dev/null. This prevents the output from cluttering
Richard Trieu [Tue, 21 Feb 2012 21:40:05 +0000 (21:40 +0000)]
Redirect the output to /dev/null.  This prevents the output from cluttering
up the build enviroment.

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

12 years agoOnly pop the expression evaluation context corresponding to a lambda
Douglas Gregor [Tue, 21 Feb 2012 20:05:31 +0000 (20:05 +0000)]
Only pop the expression evaluation context corresponding to a lambda
expression after we've finished the function body of the corresponding
function call operator. Otherwise, ActOnFinishFunctionBody() will see
the (unfinished) evaluation context of the lambda expression
itself. Fixes PR12031.

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

12 years agoDon't assume that a valid expression for the first part of a for-statement
Richard Smith [Tue, 21 Feb 2012 20:01:35 +0000 (20:01 +0000)]
Don't assume that a valid expression for the first part of a for-statement
is non-null when diagnosing a broken attempt to write a for-range-statement.

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

12 years agoWhen calling a non variadic format function(vprintf, vscanf, NSLogv, …), warn if...
Jean-Daniel Dupas [Tue, 21 Feb 2012 20:00:53 +0000 (20:00 +0000)]
When calling a non variadic format function(vprintf, vscanf, NSLogv, …), warn if the format string argument is a parameter that is not itself declared as a format string with compatible format.

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

12 years agoImprove our handling of lambda expressions that occur within default
Douglas Gregor [Tue, 21 Feb 2012 19:11:17 +0000 (19:11 +0000)]
Improve our handling of lambda expressions that occur within default
arguments. There are two aspects to this:

  - Make sure that when marking the declarations referenced in a
  default argument, we don't try to mark local variables, both because
  it's a waste of time and because the semantics are wrong: we're not
  in a place where we could capture these variables again even if it
  did make sense.
  - When a lambda expression occurs in a default argument of a
  function template, make sure that the corresponding closure type is
  considered dependent, so that it will get properly instantiated. The
  second bit is a bit of a hack; to fix it properly, we may have to
  rearchitect our handling of default arguments, parsing them only
  after creating the function definition. However, I'd like to
  separate that work from the lambdas work.

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

12 years agoAllow linux builds to take advantage of libunwind to get unwind.h if
Jeffrey Yasskin [Tue, 21 Feb 2012 16:20:12 +0000 (16:20 +0000)]
Allow linux builds to take advantage of libunwind to get unwind.h if
that's installed.

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

12 years agoAlso mark Type's dump() as 'used' to make it available in libclang.
Argyrios Kyrtzidis [Tue, 21 Feb 2012 06:12:38 +0000 (06:12 +0000)]
Also mark Type's dump() as 'used' to make it available in libclang.

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

12 years agoRemove comma from end of enum to silence build warning.
Craig Topper [Tue, 21 Feb 2012 05:39:57 +0000 (05:39 +0000)]
Remove comma from end of enum to silence build warning.

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

12 years agoMark a few 'dump' methods as 'used' to make sure they are included in libclang
Argyrios Kyrtzidis [Tue, 21 Feb 2012 05:04:44 +0000 (05:04 +0000)]
Mark a few 'dump' methods as 'used' to make sure they are included in libclang
and useable while debugging.

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

12 years agoImplement non-internal linkage for lambda closure types that need a
Douglas Gregor [Tue, 21 Feb 2012 04:17:39 +0000 (04:17 +0000)]
Implement non-internal linkage for lambda closure types that need a
stable mangling, since these lambdas can end up in multiple
translation units. Sema is responsible for deciding when this is the
case, because it's already responsible for choosing the mangling
number.

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

12 years agoRemove svn:eol-style on the test I just added.
Nico Weber [Tue, 21 Feb 2012 03:52:52 +0000 (03:52 +0000)]
Remove svn:eol-style on the test I just added.

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

12 years agoAdd a test case for r150976.
Nico Weber [Tue, 21 Feb 2012 03:52:05 +0000 (03:52 +0000)]
Add a test case for r150976.

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

12 years agoImplement name mangling for lambda expressions that occur within the
Douglas Gregor [Tue, 21 Feb 2012 02:22:07 +0000 (02:22 +0000)]
Implement name mangling for lambda expressions that occur within the
initializers of data members (both static and non-static).

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

12 years agoAdding a test case for the working-directory fix
Aaron Ballman [Tue, 21 Feb 2012 00:56:50 +0000 (00:56 +0000)]
Adding a test case for the working-directory fix

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

12 years agoHave ScanReachableSymbols reported reachable regions. Fixes a false positive with...
Ted Kremenek [Tue, 21 Feb 2012 00:46:29 +0000 (00:46 +0000)]
Have ScanReachableSymbols reported reachable regions.  Fixes a false positive with nested array literals.  <rdar://problem/10686586>

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

12 years agoImplement name mangling for lambda expressions that occur within the
Douglas Gregor [Tue, 21 Feb 2012 00:37:24 +0000 (00:37 +0000)]
Implement name mangling for lambda expressions that occur within the
default arguments of function parameters. This simple-sounding task is
complicated greatly by two issues:

  (1) Default arguments aren't actually a real context, so we need to
  maintain extra state within lambda expressions to track when a
  lambda was actually in a default argument.
  (2) At the time that we parse a default argument, the FunctionDecl
  doesn't exist yet, so lambda closure types end up in the enclosing
  context. It's not clear that we ever want to change that, so instead
  we introduce the notion of the "effective" context of a declaration
  for the purposes of name mangling.

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

12 years agoEmit the exact size for the invariant intrinsics.
Nick Lewycky [Tue, 21 Feb 2012 00:26:58 +0000 (00:26 +0000)]
Emit the exact size for the invariant intrinsics.

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

12 years ago[analyzer] + a couple more malloc tests.
Anna Zaks [Tue, 21 Feb 2012 00:00:48 +0000 (00:00 +0000)]
[analyzer] + a couple more malloc tests.

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

12 years ago[analyzer] Make KeyChainAPI checker inlining-aware.
Anna Zaks [Tue, 21 Feb 2012 00:00:44 +0000 (00:00 +0000)]
[analyzer] Make KeyChainAPI checker inlining-aware.

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

12 years agoMake RequireLiteralType work correctly with incomplete array types. PR12037.
Eli Friedman [Mon, 20 Feb 2012 23:58:14 +0000 (23:58 +0000)]
Make RequireLiteralType work correctly with incomplete array types.  PR12037.

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

12 years ago[PCH] Recover gracefully if the ASTReader detects that a file is different
Argyrios Kyrtzidis [Mon, 20 Feb 2012 23:58:07 +0000 (23:58 +0000)]
[PCH] Recover gracefully if the ASTReader detects that a file is different
from the one stored in the PCH/AST, while trying to load a SLocEntry.

We verify that all files of the PCH did not change before loading it but this is not enough because:

- The AST may have been 1) kept around, 2) to do queries on it.
- We may have 1) verified the PCH and 2) started parsing.

Between 1) and 2) files may change and we are going to have crashes because the rest of clang
cannot deal with the ASTReader failing to read a SLocEntry.

Handle this by recovering gracefully in such a case, by initializing the SLocEntry
with the info from the PCH/AST as well as reporting failure by the ASTReader.

rdar://10888929

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

12 years agoFix a constexpr FIXME: When implicitly instantiating the primary template for an
Richard Smith [Mon, 20 Feb 2012 23:28:05 +0000 (23:28 +0000)]
Fix a constexpr FIXME: When implicitly instantiating the primary template for an
explicit specialization of a function template, mark the instantiation as
constexpr if the specialization is, rather than requiring them to match.

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

12 years agoFormatting.
Eric Christopher [Mon, 20 Feb 2012 23:02:36 +0000 (23:02 +0000)]
Formatting.

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

12 years agoMake PreprocessorOptions::DetailedRecordIncludesNestedMacroExpansions false by default.
Argyrios Kyrtzidis [Mon, 20 Feb 2012 22:54:39 +0000 (22:54 +0000)]
Make PreprocessorOptions::DetailedRecordIncludesNestedMacroExpansions false by default.

Recording nested macro expansions is not useful, plus it fixes rdar://10893630

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

12 years agoobjc IRGen: force CSE of load of ivar offsets by setting
Fariborz Jahanian [Mon, 20 Feb 2012 22:42:22 +0000 (22:42 +0000)]
objc IRGen: force CSE of load of ivar offsets by setting
the 'invariant.load' metadata tag onto those loads.
// rdar://10840980

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

12 years ago[analyzer] Make Malloc aware of inter-procedural execution + basic
Anna Zaks [Mon, 20 Feb 2012 22:25:23 +0000 (22:25 +0000)]
[analyzer] Make Malloc aware of inter-procedural execution + basic
tests.

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

12 years ago[analyzer] Testing: These checkers are not experimental anymore.
Anna Zaks [Mon, 20 Feb 2012 21:10:40 +0000 (21:10 +0000)]
[analyzer] Testing: These checkers are not experimental anymore.

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

12 years ago[analyzer] Turn on by default the Malloc Checker and a couple of CString
Anna Zaks [Mon, 20 Feb 2012 21:10:37 +0000 (21:10 +0000)]
[analyzer] Turn on by default the Malloc Checker and a couple of CString
checks:

- unix.Malloc - Checks for memory leaks, double free, use-after-free.
- unix.cstring.NullArg - Checks for null pointers passed as arguments to
CString functions + evaluates CString functions.
- unix.cstring.BadSizeArg - Checks for common anti-patterns in
strncat size argument.

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

12 years agoMake sure that we set up the right declaration contexts when creating
Douglas Gregor [Mon, 20 Feb 2012 20:47:06 +0000 (20:47 +0000)]
Make sure that we set up the right declaration contexts when creating
and introducing the lambda closure type and its function call
operator. Previously, we assumed that the lambda closure type would
land directly in the current context, and not some parent context (as
occurs with linkage specifications). Thanks to Richard for the test case.

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

12 years agomodern objc translator. Finish off first cut of the
Fariborz Jahanian [Mon, 20 Feb 2012 20:09:20 +0000 (20:09 +0000)]
modern objc translator. Finish off first cut of the
modern meta-data translation by commenting out private ivar
declarations in user source. Also, added several tests.

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

12 years agoWhen we resolve the type of an 'auto' variable, clear out the linkage
Douglas Gregor [Mon, 20 Feb 2012 20:05:29 +0000 (20:05 +0000)]
When we resolve the type of an 'auto' variable, clear out the linkage
of that variable; it will need to be recomputed with the resolved
type.

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

12 years agoMake test case less sensitive to metadata numbering.
Chad Rosier [Mon, 20 Feb 2012 19:51:44 +0000 (19:51 +0000)]
Make test case less sensitive to metadata numbering.

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

12 years agoBasic support for name mangling of C++11 lambda expressions. Because
Douglas Gregor [Mon, 20 Feb 2012 19:44:39 +0000 (19:44 +0000)]
Basic support for name mangling of C++11 lambda expressions. Because
name mangling in the Itanium C++ ABI for lambda expressions is so
dependent on context, we encode the number used to encode each lambda
as part of the lambda closure type, and maintain this value within
Sema.

Note that there are a several pieces still missing:
  - We still get the linkage of lambda expressions wrong
  - We aren't properly numbering or mangling lambda expressions that
  occur in default function arguments or in data member initializers.
  - We aren't (de-)serializing the lambda numbering tables

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

12 years agoRemove the type retaining from the clang frontend. This is now
Eric Christopher [Mon, 20 Feb 2012 18:05:24 +0000 (18:05 +0000)]
Remove the type retaining from the clang frontend. This is now
handled by the caching and rauw. Also fix one cache that wasn't
being added to highlighted by this patch. Update all testcases
accordingly.

This should fix the deall failure.

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

12 years agoMake forward declarations for objective-c types use the new
Eric Christopher [Mon, 20 Feb 2012 18:05:04 +0000 (18:05 +0000)]
Make forward declarations for objective-c types use the new
temporary forward declaration nodes. Fixes a problem building
Chrome.

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

12 years ago[clang.py] Format and add documention for Type
Gregory Szorc [Mon, 20 Feb 2012 17:58:40 +0000 (17:58 +0000)]
[clang.py] Format and add documention for Type

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

12 years ago[clang.py] Add tests for Type.is_volatile_qualified and Type.is_restrict_qualified
Gregory Szorc [Mon, 20 Feb 2012 17:58:02 +0000 (17:58 +0000)]
[clang.py] Add tests for Type.is_volatile_qualified and Type.is_restrict_qualified

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

12 years ago[clang.py] Implement Type.argument_types()
Gregory Szorc [Mon, 20 Feb 2012 17:45:30 +0000 (17:45 +0000)]
[clang.py] Implement Type.argument_types()

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

12 years ago[clang.py] Implement Type.__eq__ and Type.__ne__
Gregory Szorc [Mon, 20 Feb 2012 17:44:49 +0000 (17:44 +0000)]
[clang.py] Implement Type.__eq__ and Type.__ne__

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

12 years agoDeserialize the direct-initialization range of a "new" expression
Douglas Gregor [Mon, 20 Feb 2012 16:12:14 +0000 (16:12 +0000)]
Deserialize the direct-initialization range of a "new" expression
properly. Previously, we deserialized it but failed to set the
corresponding member in CXXNewExpr. Fixes <rdar://problem/10893600>.

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

12 years agoFixing the working-directory option so that it stores the proper directory.
Aaron Ballman [Mon, 20 Feb 2012 14:13:25 +0000 (14:13 +0000)]
Fixing the working-directory option so that it stores the proper directory.

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

12 years agoBasic: import IntrusiveRefCntPtr<> into clang namespace
Dylan Noblesmith [Mon, 20 Feb 2012 14:00:23 +0000 (14:00 +0000)]
Basic: import IntrusiveRefCntPtr<> into clang namespace

The class name is long enough without the llvm:: added.
Also bring in RefCountedBase and RefCountedBaseVPTR.

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

12 years agoAdd 3dNOW intrinsic header to x86intrin.h, conditioned on __3dNOW__ to
Chandler Carruth [Mon, 20 Feb 2012 07:35:45 +0000 (07:35 +0000)]
Add 3dNOW intrinsic header to x86intrin.h, conditioned on __3dNOW__ to
match the behavior of GCC. Also add a test for these intrinsics, which
apparently have *zero* tests. =[ Not surprisingly, Clang crashed when
compiling these.

Fix the bug in CodeGen where we failed to bitcast the argument type to
x86mmx prior to calling the LLVM intrinsic. This fixes an assert on the
new 3dnow-builtins.c test.

This is one issue impacting the efforts to get Clang to emulate the
Microsoft intrinsics headers -- 3dnow intrinsics are implictitly made
available there.

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

12 years agoObjCMessageExpr: Don't leave SelLocsKind uninitialized when the send is implicit.
Benjamin Kramer [Mon, 20 Feb 2012 00:20:48 +0000 (00:20 +0000)]
ObjCMessageExpr: Don't leave SelLocsKind uninitialized when the send is implicit.

Fixes PR11929. Found by valgrind.

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

12 years agoSet the location of the template keyword when allocating a new TemplateIdAnnotation.
Benjamin Kramer [Sun, 19 Feb 2012 23:37:39 +0000 (23:37 +0000)]
Set the location of the template keyword when allocating a new TemplateIdAnnotation.

Found by valgrind.

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

12 years agoMake the regular expressions in this test more narrow to ensure we're
Chandler Carruth [Sun, 19 Feb 2012 23:09:50 +0000 (23:09 +0000)]
Make the regular expressions in this test more narrow to ensure we're
actually matching the write substrings, and stop looking for a leading
'/' to try and finish fixing darwin and other hosts.

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

12 years agoobjective-c modern translator: comment out private ivars
Fariborz Jahanian [Sun, 19 Feb 2012 19:00:05 +0000 (19:00 +0000)]
objective-c modern translator: comment out private ivars
declared in class extension and implementation.

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

12 years ago[clang.py] Implement Type.is_function_variadic
Gregory Szorc [Sun, 19 Feb 2012 18:28:33 +0000 (18:28 +0000)]
[clang.py] Implement Type.is_function_variadic

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

12 years agoEmit a warning when list-initializing a std::initializer_list member.
Sebastian Redl [Sun, 19 Feb 2012 16:31:05 +0000 (16:31 +0000)]
Emit a warning when list-initializing a std::initializer_list member.

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

12 years agoHarden test against for operator new(unsigned int).
Benjamin Kramer [Sun, 19 Feb 2012 16:20:58 +0000 (16:20 +0000)]
Harden test against for operator new(unsigned int).

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

12 years agoMake heap-allocation of std::initializer_list 'work'.
Sebastian Redl [Sun, 19 Feb 2012 16:03:09 +0000 (16:03 +0000)]
Make heap-allocation of std::initializer_list 'work'.

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

12 years agoMake std::initializer_list member initializers 'work'.
Sebastian Redl [Sun, 19 Feb 2012 15:41:54 +0000 (15:41 +0000)]
Make std::initializer_list member initializers 'work'.

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

12 years agoRefuse to compile global std::initializer_lists instead of doing completely the wrong...
Sebastian Redl [Sun, 19 Feb 2012 14:53:49 +0000 (14:53 +0000)]
Refuse to compile global std::initializer_lists instead of doing completely the wrong thing.

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

12 years agoGet recursive initializer lists to work and add a test. Codegen of std::initializer_l...
Sebastian Redl [Sun, 19 Feb 2012 12:28:02 +0000 (12:28 +0000)]
Get recursive initializer lists to work and add a test. Codegen of std::initializer_list is now complete. Onward to array new.

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

12 years agoAdd a testcase for using objects with list-constructors, and fix a Sema crash by...
Sebastian Redl [Sun, 19 Feb 2012 12:27:56 +0000 (12:27 +0000)]
Add a testcase for using objects with list-constructors, and fix a Sema crash by repeating an old hack.

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

12 years agoAdd a testcase to show that temporaries from the initializer list are destroyed corre...
Sebastian Redl [Sun, 19 Feb 2012 12:27:51 +0000 (12:27 +0000)]
Add a testcase to show that temporaries from the initializer list are destroyed correctly.

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

12 years agoAdd a testcase for start+end implementations of std::initializer_list.
Sebastian Redl [Sun, 19 Feb 2012 12:27:47 +0000 (12:27 +0000)]
Add a testcase for start+end implementations of std::initializer_list.

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

12 years agoFix a crash for nested initializer list initialization. Still does the wrong thing...
Sebastian Redl [Sun, 19 Feb 2012 12:27:43 +0000 (12:27 +0000)]
Fix a crash for nested initializer list initialization. Still does the wrong thing in CodeGen, in that it never destructs anything.

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

12 years agoRemove dead code.
Ahmed Charles [Sun, 19 Feb 2012 11:57:29 +0000 (11:57 +0000)]
Remove dead code.

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

12 years agoDon't check for /lib and /usr/lib.
Rafael Espindola [Sun, 19 Feb 2012 02:43:03 +0000 (02:43 +0000)]
Don't check for /lib and /usr/lib.

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

12 years agoOur handling of variables in FileCheck looks really broken on windws. Just
Rafael Espindola [Sun, 19 Feb 2012 02:33:09 +0000 (02:33 +0000)]
Our handling of variables in FileCheck looks really broken on windws. Just
give up on matching the path prefix for the libraries.

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

12 years agoAdd an extra CHECK line to make sure TOOLCHAIN2 matches just the path
Rafael Espindola [Sun, 19 Feb 2012 02:23:50 +0000 (02:23 +0000)]
Add an extra CHECK line to make sure TOOLCHAIN2 matches just the path
prefix.

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

12 years agoLooks like we use forward slashes for header search but back slashes for
Rafael Espindola [Sun, 19 Feb 2012 02:03:47 +0000 (02:03 +0000)]
Looks like we use forward slashes for header search but back slashes for
libraries on windows. Use two variables to make this test pass.

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

12 years agoTry to match the linker being named ld.exe. Second try at fixing the windows bots.
Rafael Espindola [Sun, 19 Feb 2012 01:52:23 +0000 (01:52 +0000)]
Try to match the linker being named ld.exe. Second try at fixing the windows bots.

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

12 years agoDon't assume a path starts with a /. Should fix the windows bot.
Rafael Espindola [Sun, 19 Feb 2012 01:47:01 +0000 (01:47 +0000)]
Don't assume a path starts with a /. Should fix the windows bot.

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

12 years agoImplement a -gcc-toolchain command line option that does the same as
Rafael Espindola [Sun, 19 Feb 2012 01:38:32 +0000 (01:38 +0000)]
Implement a -gcc-toolchain command line option that does the same as
configure's --with-gcc-toolchain. The configure option is now just a default
value for the command line one.

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

12 years agoTeach analyzer that blocks with no captures are globals. Fixes <rdar://problem/10348...
Ted Kremenek [Sat, 18 Feb 2012 22:41:01 +0000 (22:41 +0000)]
Teach analyzer that blocks with no captures are globals.  Fixes <rdar://problem/10348049>.

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

12 years agoImplement constant expression support for __real__ and __imag__ on lvalue
Richard Smith [Sat, 18 Feb 2012 22:04:06 +0000 (22:04 +0000)]
Implement constant expression support for __real__ and __imag__ on lvalue
complex numbers. Treat complex numbers as arrays of the corresponding component
type, in order to make std::complex behave properly if implemented in terms of
_Complex T.

Apparently libstdc++'s std::complex is implemented this way, and we were
rejecting a member like this:

  constexpr double real() { return __real__ val; }

because it was marked constexpr but unable to produce a constant expression.

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

12 years agoFix crash in analyzer diagnostic generation involving subexpressions of OpaqueValueEx...
Ted Kremenek [Sat, 18 Feb 2012 22:02:57 +0000 (22:02 +0000)]
Fix crash in analyzer diagnostic generation involving subexpressions of OpaqueValueExpr not appearing in the ParentMap.  Fixes <rdar://problem/10797980>.

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

12 years agoTeach analyzer about NSAutoreleasePool -allocWithZone:. Fixes <rdar://problem/10640253>.
Ted Kremenek [Sat, 18 Feb 2012 21:37:48 +0000 (21:37 +0000)]
Teach analyzer about NSAutoreleasePool -allocWithZone:.  Fixes <rdar://problem/10640253>.

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

12 years agoAdd analyzer test for using of C++ references with ObjC object pointers, reported...
Ted Kremenek [Sat, 18 Feb 2012 21:27:25 +0000 (21:27 +0000)]
Add analyzer test for using of C++ references with ObjC object pointers, reported in <rdar://problem/10569024>.

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

12 years agoFix wrong-code bug: __imag on a scalar lvalue should produce a zero rvalue,
Richard Smith [Sat, 18 Feb 2012 20:53:32 +0000 (20:53 +0000)]
Fix wrong-code bug: __imag on a scalar lvalue should produce a zero rvalue,
rather than an lvalue referring to the scalar.

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

12 years agoAdopt ExprEngine and checkers to ObjC property refactoring. Everything was working...
Ted Kremenek [Sat, 18 Feb 2012 20:53:30 +0000 (20:53 +0000)]
Adopt ExprEngine and checkers to ObjC property refactoring.  Everything was working, but now diagnostics are aware of message expressions implied by uses of properties.  Fixes <rdar://problem/9241180>.

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

12 years agoDefault to not using __cxa_atexit on Solaris.
David Chisnall [Sat, 18 Feb 2012 17:00:56 +0000 (17:00 +0000)]
Default to not using __cxa_atexit on Solaris.

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

12 years agoRemove a debugging line accidentally left in the last commit.
David Chisnall [Sat, 18 Feb 2012 16:20:35 +0000 (16:20 +0000)]
Remove a debugging line accidentally left in the last commit.

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

12 years agoImplement #pragma redefine_extname.
David Chisnall [Sat, 18 Feb 2012 16:12:34 +0000 (16:12 +0000)]
Implement #pragma redefine_extname.

This fixes PR5172 and allows clang to compile C++ programs on Solaris using the system headers.

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

12 years agoAdd -Wstrncat-size and -Wempty-body to release notes.
Dmitri Gribenko [Sat, 18 Feb 2012 14:13:26 +0000 (14:13 +0000)]
Add -Wstrncat-size and -Wempty-body to release notes.

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

12 years agoRemove unused but set variable.
Benjamin Kramer [Sat, 18 Feb 2012 11:35:28 +0000 (11:35 +0000)]
Remove unused but set variable.

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

12 years agoRewrite variable capture within lambda expressions and blocks,
Douglas Gregor [Sat, 18 Feb 2012 09:37:24 +0000 (09:37 +0000)]
Rewrite variable capture within lambda expressions and blocks,
eliminating a bunch of redundant code and properly modeling how the
captures of outside blocks/lambdas affect the types seen by inner
captures.

This new scheme makes two passes over the capturing scope stack. The
first pass goes up the stack (from innermost to outermost), assessing
whether the capture looks feasible and stopping when it either hits
the scope where the variable is declared or when it finds an existing
capture. The second pass then walks down the stack (from outermost to
innermost), capturing the variable at each step and updating the
captured type and the type that an expression referring to that
captured variable would see. It also checks type-specific
restrictions, such as the inability to capture an array within a
block. Note that only the first odr-use of each
variable needs to do the full walk; subsequent uses will find the
capture immediately, so multiple walks need not occur.

The same routine that builds the captures can also compute the type of
the captures without signaling errors and without actually performing
the capture. This functionality is used to determine the type of
declaration references as well as implementing the weird decltype((x))
rule within lambda expressions.

The capture code now explicitly takes sides in the debate over C++
core issue 1249, which concerns the type of captures within nested
lambdas. We opt to use the more permissive, more useful definition
implemented by GCC rather than the one implemented by EDG.

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

12 years agoUnify our computation of the type of a captured reference to a
Douglas Gregor [Sat, 18 Feb 2012 05:51:20 +0000 (05:51 +0000)]
Unify our computation of the type of a captured reference to a
variable; it was previously duplicated, and one of the copies failed
to account for outer non-mutable lambda captures.

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

12 years agoFix a problem in the GCC testsuite, exposed by r150557. Compound literals
Richard Smith [Sat, 18 Feb 2012 04:58:18 +0000 (04:58 +0000)]
Fix a problem in the GCC testsuite, exposed by r150557. Compound literals
are represented as prvalues in C++; don't be fooled into thinking they're
global lvalues.

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

12 years agoAdd a bunch of missing calls to DiagnoseSentinelCalls. <rdar://problem/10885993>.
Eli Friedman [Sat, 18 Feb 2012 04:48:30 +0000 (04:48 +0000)]
Add a bunch of missing calls to DiagnoseSentinelCalls.  <rdar://problem/10885993>.

This should probably be refactored... but it isn't completely obvious what refactoring is best.

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

12 years agoChange wording of warning about using __bridge casts in non-ARC.
Ted Kremenek [Sat, 18 Feb 2012 04:42:38 +0000 (04:42 +0000)]
Change wording of warning about using __bridge casts in non-ARC.

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

12 years agoDiagnose uses of deleted destructors and inaccessible defaulted destructors.
Richard Smith [Sat, 18 Feb 2012 04:13:32 +0000 (04:13 +0000)]
Diagnose uses of deleted destructors and inaccessible defaulted destructors.

We had two separate issues here: firstly, varions functions were assuming that
they did not need to perform semantic checks on trivial destructors (this is
not true in C++11, where a trivial destructor can nonetheless be private or
deleted), and a bunch of DiagnoseUseOfDecl calls were missing for uses of
destructors.

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

12 years agoInitial refactoring of 'ShouldDeleteSpecialMember', in preparation for providing
Richard Smith [Sat, 18 Feb 2012 02:02:13 +0000 (02:02 +0000)]
Initial refactoring of 'ShouldDeleteSpecialMember', in preparation for providing
decent diagnostics. Finish the work of combining all the 'ShouldDelete'
functions into one. In unifying the code, fix a minor bug where an anonymous
union with a deleted default constructor as a member of a union wasn't being
considered as making the outer union's default constructor deleted.

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

12 years agoFix comment.
Chad Rosier [Sat, 18 Feb 2012 01:20:35 +0000 (01:20 +0000)]
Fix comment.

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

12 years agoAdd in a caching mechanism so that forward declarations are replaced
Eric Christopher [Sat, 18 Feb 2012 00:50:17 +0000 (00:50 +0000)]
Add in a caching mechanism so that forward declarations are replaced
with full types if they exist.

rdar://10809898 and rdar://10209967 and rdar://10400981

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

12 years agoFormatting.
Eric Christopher [Sat, 18 Feb 2012 00:50:14 +0000 (00:50 +0000)]
Formatting.

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

12 years agoRemove UpdateCompletedType from the debug info emission. We now
Eric Christopher [Sat, 18 Feb 2012 00:50:08 +0000 (00:50 +0000)]
Remove UpdateCompletedType from the debug info emission. We now
emit less than complete types on purpose on occasion and so
our caches aren't useful for this kind of lazy emitting.

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

12 years agoRemove redundant check.
Chad Rosier [Sat, 18 Feb 2012 00:37:07 +0000 (00:37 +0000)]
Remove redundant check.

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

12 years agoHave conjured symbols depend on LocationContext, to add context sensitivity for funct...
Ted Kremenek [Fri, 17 Feb 2012 23:13:45 +0000 (23:13 +0000)]
Have conjured symbols depend on LocationContext, to add context sensitivity for functions called more than once.

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

12 years ago[analyzer] Malloc Checker more tests.
Anna Zaks [Fri, 17 Feb 2012 22:35:34 +0000 (22:35 +0000)]
[analyzer] Malloc Checker more tests.

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

12 years ago[analyzer] Fix another false positive in the Malloc Checker, by making
Anna Zaks [Fri, 17 Feb 2012 22:35:31 +0000 (22:35 +0000)]
[analyzer] Fix another false positive in the Malloc Checker, by making
it aware of CString APIs that return the input parameter.

Malloc Checker needs to know how the 'strcpy' function is
evaluated. Introduce the dependency on CStringChecker for that.
CStringChecker knows all about these APIs.

Addresses radar://10864450

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

12 years ago[analyzer] Generalize function name checking in CString checker.
Anna Zaks [Fri, 17 Feb 2012 22:35:26 +0000 (22:35 +0000)]
[analyzer] Generalize function name checking in CString checker.
(Ex: It was not treating __inline_strcpy as strcpy. Will add tests that
rely on this later on.)

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

12 years agomodern objc translator: postpone writing of class definitions
Fariborz Jahanian [Fri, 17 Feb 2012 22:20:12 +0000 (22:20 +0000)]
modern objc translator: postpone writing of class definitions
until the end when all their ivars are known then.

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

12 years agomodern objc writer: more work for category metadata rewrite
Fariborz Jahanian [Fri, 17 Feb 2012 20:33:00 +0000 (20:33 +0000)]
modern objc writer: more work for category metadata rewrite
and some cleanup.

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

12 years agoDon't emit optimization-specific intrinsic at -O0.
Richard Smith [Fri, 17 Feb 2012 20:12:52 +0000 (20:12 +0000)]
Don't emit optimization-specific intrinsic at -O0.

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

12 years agomodern objc translator: category metadata related
Fariborz Jahanian [Fri, 17 Feb 2012 18:40:41 +0000 (18:40 +0000)]
modern objc translator: category metadata related
patch.

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