]> granicus.if.org Git - clang/log
clang
13 years agoFix HTML.
Benjamin Kramer [Sat, 6 Aug 2011 03:04:45 +0000 (03:04 +0000)]
Fix HTML.

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

13 years agoOnly look at decls after the current one when checking if it's the last field in...
Benjamin Kramer [Sat, 6 Aug 2011 03:04:42 +0000 (03:04 +0000)]
Only look at decls after the current one when checking if it's the last field in a record.

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

13 years ago[analyzer] add more buffer overflow tests to show we handle sizeof(VLA) in obstruse...
Ted Kremenek [Sat, 6 Aug 2011 00:34:48 +0000 (00:34 +0000)]
[analyzer] add more buffer overflow tests to show we handle sizeof(VLA) in obstruse ways...

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

13 years ago[analyzer] Simplify logic for ExprEngine::VisitUnaryExprOrTypeTraitExpr to avoid...
Ted Kremenek [Sat, 6 Aug 2011 00:30:00 +0000 (00:30 +0000)]
[analyzer] Simplify logic for ExprEngine::VisitUnaryExprOrTypeTraitExpr to avoid recursion to subexpression.

This exposed bugs in the live variables analysis, and a latent analyzer bug in the SymbolReaper.

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

13 years ago[analyzer] Change SymbolReaper to store region roots implied by the Environment,...
Ted Kremenek [Sat, 6 Aug 2011 00:29:57 +0000 (00:29 +0000)]
[analyzer] Change SymbolReaper to store region roots implied by the Environment, allowing it be queried when
determining if symbols derived from regions are still live.

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

13 years agoKeychainAPI checker: Track SymbolMetadata instead of MemRegion in checker state so...
Anna Zaks [Fri, 5 Aug 2011 23:52:45 +0000 (23:52 +0000)]
KeychainAPI checker: Track SymbolMetadata instead of MemRegion in checker state so that we could clear the state on evalDeadSymbols; also track the return value.

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

13 years agoStatic Analyzer: Add a convinience API. Add comment.
Anna Zaks [Fri, 5 Aug 2011 23:47:13 +0000 (23:47 +0000)]
Static Analyzer: Add a convinience API. Add comment.

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

13 years agoRevert 136984 and 136927.
Ted Kremenek [Fri, 5 Aug 2011 23:31:22 +0000 (23:31 +0000)]
Revert 136984 and 136927.

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

13 years agoPerform array bounds checking in more situations and properly handle special
Kaelyn Uhrain [Fri, 5 Aug 2011 23:18:04 +0000 (23:18 +0000)]
Perform array bounds checking in more situations and properly handle special
case situations with the unary operators & and *. Also extend the array bounds
checking to work with pointer arithmetic; the pointer arithemtic checking can
be turned on using -Warray-bounds-pointer-arithmetic.

The changes to where CheckArrayAccess gets called is based on some trial &
error and a bunch of digging through source code and gdb backtraces in order
to have the check performed under as many situations as possible (such as for
variable initializers, arguments to function calls, and within conditional in
addition to the simpler cases of the operands to binary and unary operator)
while not being called--and triggering warnings--more than once for a given
ArraySubscriptExpr.

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

13 years agoAdd workaround for built va list (and other builtins) so that running ReadAST multipl...
Jonathan D. Turner [Fri, 5 Aug 2011 23:07:10 +0000 (23:07 +0000)]
Add workaround for built va list (and other builtins) so that running ReadAST multiple times does not immediately throw an error.

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

13 years agoAdd support for using anonymous bitfields (e.g., int : 0) to enforce alignment.
Chad Rosier [Fri, 5 Aug 2011 22:38:04 +0000 (22:38 +0000)]
Add support for using anonymous bitfields (e.g., int : 0) to enforce alignment.
This fixes cases where the anonymous bitfield is followed by a bitfield member.
E.g.,
struct t4
{
 char foo;
 long : 0;
 char bar : 1;
};

rdar://9859156

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

13 years agoWire up -import-module to run ReadAST for each module loaded.
Jonathan D. Turner [Fri, 5 Aug 2011 22:17:03 +0000 (22:17 +0000)]
Wire up -import-module to run ReadAST for each module loaded.

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

13 years agoMake test/SemaObjC/qualified-protocol-method-conflicts.m always fail and mark it...
Ted Kremenek [Fri, 5 Aug 2011 21:53:47 +0000 (21:53 +0000)]
Make test/SemaObjC/qualified-protocol-method-conflicts.m always fail and mark it XFAIL.  This is a stop gap until the output of the test is deterministic.

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

13 years agoLet attribute((cdecl)) and company override -mrtd default calling convention.
Roman Divacky [Fri, 5 Aug 2011 16:37:22 +0000 (16:37 +0000)]
Let attribute((cdecl)) and company override -mrtd default calling convention.

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

13 years agoFlesh out the -Warray-bounds detection of C89 tail-padded one-element
Chandler Carruth [Fri, 5 Aug 2011 09:10:50 +0000 (09:10 +0000)]
Flesh out the -Warray-bounds detection of C89 tail-padded one-element
arrays. This now suppresses the warning only in the case of
a one-element array as the last field in a struct where the array size
is a literal '1' rather than any macro expansion or template parameter.

This doesn't distinguish between the language standard in use to allow
code which dates from C89 era to compile without the warning even in C99
and C++ builds. We could add a separate warning (under a different flag)
with fixit hints to switch to a flexible array, but its not clear that
this would be desirable. Much of the code using this idiom is striving
for maximum portability.

Tests were also fleshed out a bit, and the diagnostic itself tweaked to
be more pretty w.r.t. single elment arrays. This is more ugly than
I would like due to APInt's not being supported by the diagnostic
rendering engine.

A pseudo-patch for this was proposed by Nicola Gigante, but I reworked
it both for several correctness issues and for code style.

Sorry this was so long in coming.

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

13 years agoFinally getting around to re-working this to more accurately white-list
Chandler Carruth [Fri, 5 Aug 2011 08:07:29 +0000 (08:07 +0000)]
Finally getting around to re-working this to more accurately white-list
1-element character arrays which are serving as flexible arrays. This is
the initial step, which is to restrict the 1-element array whitelist to
arrays that are member declarations. I'll refine it from here based on
the proposed patch.

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

13 years agoFixed FieldDecl source range.
Abramo Bagnara [Fri, 5 Aug 2011 08:02:55 +0000 (08:02 +0000)]
Fixed FieldDecl source range.

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

13 years agoChange the this -W flag to 'return-stack-address'.
Chandler Carruth [Fri, 5 Aug 2011 02:11:36 +0000 (02:11 +0000)]
Change the this -W flag to 'return-stack-address'.

  ~or~

Paint the bikeshed green.

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

13 years agoOutput to /dev/null, not "0"
Matt Beaumont-Gay [Fri, 5 Aug 2011 01:05:35 +0000 (01:05 +0000)]
Output to /dev/null, not "0"

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

13 years agoKeychainAPI checker: Generate an error on double allocation. Pull out getAsPointeeMem...
Anna Zaks [Fri, 5 Aug 2011 00:37:00 +0000 (00:37 +0000)]
KeychainAPI checker: Generate an error on double allocation. Pull out getAsPointeeMemoryRegion so that it could be reused.

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

13 years agoExtend memset/memcpy/memmove checking to include memcmp
Matt Beaumont-Gay [Fri, 5 Aug 2011 00:22:34 +0000 (00:22 +0000)]
Extend memset/memcpy/memmove checking to include memcmp

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

13 years agoThe continue label in an ARC for-in loop should not involve
John McCall [Fri, 5 Aug 2011 00:14:38 +0000 (00:14 +0000)]
The continue label in an ARC for-in loop should not involve
releasing the collection.

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

13 years agoHave the typo correction in DiagnoseEmptyLookup properly handle template
Kaelyn Uhrain [Fri, 5 Aug 2011 00:09:52 +0000 (00:09 +0000)]
Have the typo correction in DiagnoseEmptyLookup properly handle template
functions when performing function overload resolution.

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

13 years agoobjc rewriter: Fixes a rewriting of implicit casting of an integral
Fariborz Jahanian [Thu, 4 Aug 2011 23:58:03 +0000 (23:58 +0000)]
objc rewriter: Fixes a rewriting of implicit casting of an integral
argument to bool. // rdar://9899834

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

13 years agoMore whitespace and naming fixup. No functionality change.
Chad Rosier [Thu, 4 Aug 2011 23:34:15 +0000 (23:34 +0000)]
More whitespace and naming fixup.  No functionality change.

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

13 years agoFix a small bug where DiagnoseEmptyLookup would no longer print any messages
Kaelyn Uhrain [Thu, 4 Aug 2011 23:30:54 +0000 (23:30 +0000)]
Fix a small bug where DiagnoseEmptyLookup would no longer print any messages
when performing typo correction involving any overloaded template functions.

The added test cases, while currently demontrating sub-optimal behavior, will
not trigger any messages without the 1-line change to SemaExpr.cpp.

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

13 years agoSpecialize diag::warn_unused_call for the "warn_unused_result" attribute, so
Matt Beaumont-Gay [Thu, 4 Aug 2011 23:11:04 +0000 (23:11 +0000)]
Specialize diag::warn_unused_call for the "warn_unused_result" attribute, so
it can be controlled with a distinct flag.

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

13 years agoFix assertion failure in -Wuninitialized involving no-op casts. Fixes PR 10577.
Ted Kremenek [Thu, 4 Aug 2011 22:40:57 +0000 (22:40 +0000)]
Fix assertion failure in -Wuninitialized involving no-op casts.  Fixes PR 10577.

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

13 years agoKeychainAPI checker: forgot to commit the test with r136930. This should fix the...
Anna Zaks [Thu, 4 Aug 2011 22:40:38 +0000 (22:40 +0000)]
KeychainAPI checker: forgot to commit the test with r136930. This should fix the bot.

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

13 years agoPut a few warnings into a DiagGroup. Feel free to improve the flag name!
Matt Beaumont-Gay [Thu, 4 Aug 2011 22:35:03 +0000 (22:35 +0000)]
Put a few warnings into a DiagGroup. Feel free to improve the flag name!

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

13 years agoKeychainAPI checker: Track additional pair of SecKeychain APIs. Also, keep exploring...
Anna Zaks [Thu, 4 Aug 2011 21:53:01 +0000 (21:53 +0000)]
KeychainAPI checker: Track additional pair of SecKeychain APIs. Also, keep exploring the transition on which a call to allocator function failed (to be able to find errors in examples like ErrorCodesFromDifferentAPISDoNotInterfere).

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

13 years agoWhitespace.
Chad Rosier [Thu, 4 Aug 2011 21:50:29 +0000 (21:50 +0000)]
Whitespace.

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

13 years agoobjective-c: diagnose protocol inconsistencies in following
Fariborz Jahanian [Thu, 4 Aug 2011 21:28:44 +0000 (21:28 +0000)]
objective-c: diagnose protocol inconsistencies in following
situation. When a class explicitly or implicitly (through inheritance)
"conformsTo" two protocols which conflict (have methods which conflict).
This is 2nd part of // rdar://6191214.

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

13 years agoFormatting.
Chad Rosier [Thu, 4 Aug 2011 21:26:30 +0000 (21:26 +0000)]
Formatting.

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

13 years agoAdd a new libclang API to return a CXCompletionString for an arbitrary
Douglas Gregor [Thu, 4 Aug 2011 20:04:59 +0000 (20:04 +0000)]
Add a new libclang API to return a CXCompletionString for an arbitrary
cursor, from Connor Wakamo! Addresses <rdar://problem/9087798>.

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

13 years agoFix style and remove obviously redundant code.
Chad Rosier [Thu, 4 Aug 2011 19:25:14 +0000 (19:25 +0000)]
Fix style and remove obviously redundant code.

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

13 years agoClean up the debug dump for a Module, so the local->global maps are
Douglas Gregor [Thu, 4 Aug 2011 19:00:50 +0000 (19:00 +0000)]
Clean up the debug dump for a Module, so the local->global maps are
clearly called out, and add the missing local -> global selector map
output.

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

13 years agoIntroduce local -> global mapping for preprocessed entity IDs. This is
Douglas Gregor [Thu, 4 Aug 2011 18:56:47 +0000 (18:56 +0000)]
Introduce local -> global mapping for preprocessed entity IDs. This is
the last of the ID/offset/index mappings that I know
of. Unfortunately, the "gap" method of testing doesn't work here due
to the way the preprocessing record performs iteration. We'll do more
testing once multi-AST loading is possible.

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

13 years agoRemove the unset, unused return value of
Douglas Gregor [Thu, 4 Aug 2011 18:09:14 +0000 (18:09 +0000)]
Remove the unset, unused return value of
ASTReader::ReadMacroRecord(). No functionality change.

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

13 years agoAdditional comments and whitespace.
Chad Rosier [Thu, 4 Aug 2011 17:52:43 +0000 (17:52 +0000)]
Additional comments and whitespace.

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

13 years agoMatch type names and give more info for out-of-line function definition errors.
Kaelyn Uhrain [Thu, 4 Aug 2011 17:40:00 +0000 (17:40 +0000)]
Match type names and give more info for out-of-line function definition errors.

Having a function declaration and definition with different types for a
parameter where the types have same (textual) name can occur when an unqualified
type name resolves to types in different namespaces in each location.

The error messages have been extended by adding notes that point to the first
parameter of the function definition that doesn't match the declaration, instead
of a generic "member declaration nearly matches". The generic message is still
used in cases where the mismatch is not in the paramenter list, such as
mismatched cv qualifiers on the member function itself.

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

13 years agoKeychainAPI checker: Refactor to make it easier to add more allocator/deallocator...
Anna Zaks [Thu, 4 Aug 2011 17:28:06 +0000 (17:28 +0000)]
KeychainAPI checker: Refactor to make it easier to add more allocator/deallocator API pairs. Add the allocator function ID to the checker state. Better comments.

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

13 years agoIn the AST reader and writer, slide the preprocessed entity IDs by +1
Douglas Gregor [Thu, 4 Aug 2011 17:06:18 +0000 (17:06 +0000)]
In the AST reader and writer, slide the preprocessed entity IDs by +1
so that we use ID zero as a sentinel for "no result". This matches the
convention set by all of the other global IDs.

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

13 years agoAdd some missing record names to the AST output. No functionality change, but llvm...
Douglas Gregor [Thu, 4 Aug 2011 16:39:39 +0000 (16:39 +0000)]
Add some missing record names to the AST output. No functionality change, but llvm-bcanalyzer will be a little more informative now for AST files

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

13 years agoImplement the local -> global remapping for macro definition IDs in
Douglas Gregor [Thu, 4 Aug 2011 16:36:56 +0000 (16:36 +0000)]
Implement the local -> global remapping for macro definition IDs in
the detailed preprocessing record. Tested with the standard "gaps" method.

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

13 years agoThe AST reader was forgetting to parse ObjCInferRelatedReturnType
Douglas Gregor [Thu, 4 Aug 2011 15:46:00 +0000 (15:46 +0000)]
The AST reader was forgetting to parse ObjCInferRelatedReturnType

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

13 years agoParsing of C++0x lambda expressions, from John Freeman with help from
Douglas Gregor [Thu, 4 Aug 2011 15:30:47 +0000 (15:30 +0000)]
Parsing of C++0x lambda expressions, from John Freeman with help from
David Blaikie!

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

13 years agoThis test still hangs on win32, despite XFAIL it. Remove XFAIL.
Ted Kremenek [Thu, 4 Aug 2011 03:24:35 +0000 (03:24 +0000)]
This test still hangs on win32, despite XFAIL it.  Remove XFAIL.

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

13 years agoTake -Wvector-conversions out of -Wmost; it needs a lot of
John McCall [Thu, 4 Aug 2011 01:26:15 +0000 (01:26 +0000)]
Take -Wvector-conversions out of -Wmost;  it needs a lot of
QoI work.  rdar://problem/9887979.  If some open-source
wants to get an idea for what QoI work I have in mind,
ping me.

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

13 years agoAdd documentation for useBitFieldTypeAlignment.
Chad Rosier [Thu, 4 Aug 2011 01:22:40 +0000 (01:22 +0000)]
Add documentation for useBitFieldTypeAlignment.

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

13 years agoAdd partial support for using anonymous bitfields (e.g., int : 0) to enforce
Chad Rosier [Thu, 4 Aug 2011 01:21:14 +0000 (01:21 +0000)]
Add partial support for using anonymous bitfields (e.g., int : 0) to enforce
alignment.  This fixes cases where the anonymous bitfield is followed by a
non-bitfield member.  E.g.,

struct t4
{
  int foo : 1;
  long : 0;
  char bar;
};

Part of rdar://9859156

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

13 years agoEmit wide string literals with the appropriate alignment.
John McCall [Thu, 4 Aug 2011 01:03:22 +0000 (01:03 +0000)]
Emit wide string literals with the appropriate alignment.
Patch by Craig Topper and Sundeep!

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

13 years agoKeychainAPI checker: refactor to use early exit.
Anna Zaks [Thu, 4 Aug 2011 00:31:38 +0000 (00:31 +0000)]
KeychainAPI checker: refactor to use early exit.

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

13 years agoKeychainAPI checker: Add basic diagnostics. Track MemoryRegion istead of SymbolicRef...
Anna Zaks [Thu, 4 Aug 2011 00:26:57 +0000 (00:26 +0000)]
KeychainAPI checker: Add basic diagnostics. Track MemoryRegion istead of SymbolicRef since the address might not be a symbolic value in some cases, for example in fooOnlyFree() test.

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

13 years agoXFAIL arc.m codegen test on win32 because it is currently hanging. Need to investigate.
Ted Kremenek [Thu, 4 Aug 2011 00:25:52 +0000 (00:25 +0000)]
XFAIL arc.m codegen test on win32 because it is currently hanging.  Need to investigate.

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

13 years ago[analyzer] Remove 'all-experimental' checker group.
Ted Kremenek [Thu, 4 Aug 2011 00:25:50 +0000 (00:25 +0000)]
[analyzer] Remove 'all-experimental' checker group.

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

13 years agoFor APCS the alignment of bitfield types is *not* respected when laying out
Chad Rosier [Thu, 4 Aug 2011 00:19:13 +0000 (00:19 +0000)]
For APCS the alignment of bitfield types is *not* respected when laying out
structures.  Alignment can be enforced with the use of anonymous bitfields
(e.g., int :0), but this is not currently supported.  Add this test case to
document the current state, which will hopefully be fixed shortly.

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

13 years agoDon't introduce a local -> global mapping for CXXBaseSpecifiers. The
Douglas Gregor [Thu, 4 Aug 2011 00:01:48 +0000 (00:01 +0000)]
Don't introduce a local -> global mapping for CXXBaseSpecifiers. The
IDs will never cross module boundaries, since they're tied to the
CXXDefinitionData, so just use a local mapping throughout. Eliminate
the global -> local tables and supporting data.

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

13 years agoDelete one of the old tests that was ported over to Clang. The test is
Chandler Carruth [Wed, 3 Aug 2011 23:53:42 +0000 (23:53 +0000)]
Delete one of the old tests that was ported over to Clang. The test is
designed to be executed, and its output inspected for correct values,
but we aren't executing it. We're just compiling it, and dumping it to
/dev/null. It also isn't freestanding. If there is a desire to have this
test actually stick around, complain and I'll revert this and try to add
the file checks necessary to make this actually test things.

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

13 years agoRefactoring of my last patch.
Fariborz Jahanian [Wed, 3 Aug 2011 23:44:01 +0000 (23:44 +0000)]
Refactoring of my last patch.

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

13 years agoIntroduce local -> global selector ID mapping into the AST
Douglas Gregor [Wed, 3 Aug 2011 23:28:44 +0000 (23:28 +0000)]
Introduce local -> global selector ID mapping into the AST
reader. Tested with the usual "gaps" method.

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

13 years ago[analyzer] rename all experimental checker packages to have 'experimental' be the...
Ted Kremenek [Wed, 3 Aug 2011 23:14:55 +0000 (23:14 +0000)]
[analyzer] rename all experimental checker packages to have 'experimental' be the common root package.

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

13 years agoUse the general conditional-cleanup framework instead of rolling our
John McCall [Wed, 3 Aug 2011 22:24:24 +0000 (22:24 +0000)]
Use the general conditional-cleanup framework instead of rolling our
own, incorrectly, for releasing objects at the end of a full-expression.

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

13 years agoIntroduce a local-to-global remapping for identifiers in the AST
Douglas Gregor [Wed, 3 Aug 2011 21:49:18 +0000 (21:49 +0000)]
Introduce a local-to-global remapping for identifiers in the AST
reader, and fix up the one (!) place where we were improperly mapping
a local ID to a global ID. Tested via the usual "gaps" trick.

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

13 years agoImprove overloaded function handling in the typo correction code.
Kaelyn Uhrain [Wed, 3 Aug 2011 20:36:05 +0000 (20:36 +0000)]
Improve overloaded function handling in the typo correction code.

Change TypoCorrection to store a set of NamedDecls instead of a single
NamedDecl. Also add initial support for performing function overload
resolution to Sema::DiagnoseEmptyLookup.

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

13 years ago[analyzer] Introduce MallocOverflowSecurityChecker, a simple flow-sensitive checker...
Ted Kremenek [Wed, 3 Aug 2011 20:17:43 +0000 (20:17 +0000)]
[analyzer] Introduce MallocOverflowSecurityChecker, a simple flow-sensitive checker that may be useful for security auditing.  This checker is currently too noisy to be on by default.

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

13 years agoobjective-c: Methods declared in methods must type match
Fariborz Jahanian [Wed, 3 Aug 2011 18:21:12 +0000 (18:21 +0000)]
objective-c: Methods declared in methods must type match
those declated in its protocols. First half or // rdar://6191214

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

13 years agoFix a few typos
Jonathan D. Turner [Wed, 3 Aug 2011 17:36:09 +0000 (17:36 +0000)]
Fix a few typos

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

13 years agoComment the weird behavior of __has_feature(is_empty) and __has_feature(is_pod)
Douglas Gregor [Wed, 3 Aug 2011 17:01:05 +0000 (17:01 +0000)]
Comment the weird behavior of __has_feature(is_empty) and __has_feature(is_pod)

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

13 years agoMake the type of the IntegerLiteral for bitfield paddings an actual
Douglas Gregor [Wed, 3 Aug 2011 16:26:46 +0000 (16:26 +0000)]
Make the type of the IntegerLiteral for bitfield paddings an actual
integer, and initialise its TypeSourceInfo. The initialisation fixes a
crash when using pre-compiled preambles with C++ code-completion. From
Erik Verbruggen! Fixes PR10511.

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

13 years agoRemove stray comma
Douglas Gregor [Wed, 3 Aug 2011 16:22:53 +0000 (16:22 +0000)]
Remove stray comma

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

13 years agoIntroduce a constant for the number of predefined declarations in an
Douglas Gregor [Wed, 3 Aug 2011 16:05:40 +0000 (16:05 +0000)]
Introduce a constant for the number of predefined declarations in an
AST file, along with an enumeration naming those predefined
declarations. No functionality change, but this will make it easier to
introduce new predefined declarations, when/if we need them.

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

13 years agogive an example of a 'lowered vtable reference'
Chris Lattner [Wed, 3 Aug 2011 15:54:40 +0000 (15:54 +0000)]
give an example of a 'lowered vtable reference'

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

13 years agoIntroduce the local -> global declaration ID mapping into the AST
Douglas Gregor [Wed, 3 Aug 2011 15:48:04 +0000 (15:48 +0000)]
Introduce the local -> global declaration ID mapping into the AST
reader, to allow AST files to be loaded with their declarations
remapped to different ID numbers. Fix a number of places where we were
either failing to map local declaration IDs into global declaration
IDs or where interpreting the local declaration IDs within the wrong
module.

I've tested this via the usual "random gaps" method. It works well
except for the preamble tests, because our handling of the precompiled
preamble requires declaration and preprocessed entity to be stable
when parsing code and then loading that back into memory. This
property will hold in general, but my randomized testing naturally
breaks this property to get more coverage. In the future, I expect
that the precompiled preamble logic won't need this property.

I am very unhappy with the current handling of the translation unit,
which is a rather egregious hack. We're going to have to do something
very different here for loading multiple AST files, because we don't
want to have to cope with merging two translation units. Likely, we'll
just handle translation units entirely via "update" records, and
predefine a single, fixed declaration ID for the translation
unit. That will come later.

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

13 years agoIn ARC, don't try to reclaim the result of a call to performSelector
John McCall [Wed, 3 Aug 2011 07:02:44 +0000 (07:02 +0000)]
In ARC, don't try to reclaim the result of a call to performSelector
unless done in a context where the value is used retained.

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

13 years agoHandle "homogeneous aggregates" as required by the ARM AAPCS-VFP ABI.
Bob Wilson [Wed, 3 Aug 2011 05:58:22 +0000 (05:58 +0000)]
Handle "homogeneous aggregates" as required by the ARM AAPCS-VFP ABI.

A homogeneous aggregate is an aggregate data structure where after flattening
any nesting there are 1 to 4 elements of the same base type that is either a
float, double, or Neon vector.  All Neon vectors of the same size, either 64
or 128 bits, are treated as equivalent for this purpose.  When using the
AAPCS-VFP ABI, check for homogeneous aggregates and pass them as arguments by
expanding them into a sequence of their base types.  This requires extending
the existing support for expanded arguments to handle not only structs, but
also constant arrays and complex types.

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

13 years agoStatic Analyzer diagnostics visualization: when the last location on a path is end...
Anna Zaks [Wed, 3 Aug 2011 01:57:49 +0000 (01:57 +0000)]
Static Analyzer diagnostics visualization: when the last location on a path is end of the function, the arrow should point to the closing brace, not the statement before it. Patch by Ted Kremenek.

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

13 years agoWhen rewriting a call to a K&R function to lead to a well-prototyped
John McCall [Wed, 3 Aug 2011 00:43:55 +0000 (00:43 +0000)]
When rewriting a call to a K&R function to lead to a well-prototyped
function, be sure to drop parameter attributes when dropping their
associated arguments.  Patch by Aaron Landwehr!

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

13 years agoA couple fixes for preprocessor expressions:
Eli Friedman [Wed, 3 Aug 2011 00:04:13 +0000 (00:04 +0000)]
A couple fixes for preprocessor expressions:

1. Be more tolerant of comments in -CC (comment-preserving) mode.  We were missing a few cases.

2. Make sure to expand the second FOO in "#if defined FOO FOO".  (See also
r97253, which addressed the case of "#if defined(FOO FOO".)

Fixes PR10286.

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

13 years agoImplements alignment for long long and double types in va_arg on ARM AAPCS.
Rafael Espindola [Tue, 2 Aug 2011 22:33:37 +0000 (22:33 +0000)]
Implements alignment for long long and double types in va_arg on ARM AAPCS.
Patch by Jim (Ningjie) Chen.

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

13 years agoUpdate for LLVM change in PassManagerBuilder.
Rafael Espindola [Tue, 2 Aug 2011 21:51:02 +0000 (21:51 +0000)]
Update for LLVM change in PassManagerBuilder.

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

13 years agodisable array bounds overflow warning for cases where an array
Chris Lattner [Tue, 2 Aug 2011 21:44:23 +0000 (21:44 +0000)]
disable array bounds overflow warning for cases where an array
has a single element.  This disables the warning in cases where
there is a clear bug, but this is really rare (who uses arrays
with one element?) and it also silences a large class of false
positive issues with C89 code that is using tail padding in structs.

A better version of this patch would detect when an array is in
a tail position in a struct, but at least patch fixes the huge
false positives that are hitting postgres and other code.

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

13 years agoFix cmake for r136702 (at least for the most part). Chandler has been kind
Chad Rosier [Tue, 2 Aug 2011 20:44:34 +0000 (20:44 +0000)]
Fix cmake for r136702 (at least for the most part).  Chandler has been kind
enough to offer to investigate the underlying issue.  Thanks to Doug for his
assistance as well.

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

13 years agoobjective-c rewrite: Fixes rewriting of objective-c collection
Fariborz Jahanian [Tue, 2 Aug 2011 20:28:46 +0000 (20:28 +0000)]
objective-c rewrite: Fixes rewriting of objective-c collection
statement inside a block. // rdar://9878420

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

13 years agoTemporarily revert parts of r136702 to make cmake builds happy.
Chad Rosier [Tue, 2 Aug 2011 18:33:29 +0000 (18:33 +0000)]
Temporarily revert parts of r136702 to make cmake builds happy.
Someone with more cmake experience want to throw me a bone? :)

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

13 years agoChange the hashing function for DeclContext lookup within an AST file
Douglas Gregor [Tue, 2 Aug 2011 18:32:54 +0000 (18:32 +0000)]
Change the hashing function for DeclContext lookup within an AST file
by eliminating the type ID from constructor, destructor, and
conversion function names. There are several reasons for this change:
  - A given type (say, int*) isn't guaranteed to have a single, unique
  type ID within a chain of PCH files. Hence, we could end up hashing
  based on the wrong type ID, causing name lookup to fail.

  - The mapping from types back to type IDs required one DenseMap
  entry for every type that was ever deserialized, which was an
  unacceptable cost to support just the name lookup of constructors,
  destructors, and conversion functions. Plus, this mapping could
  never actually work with chained or multiple PCH, based on the first
  bullet.

Once we have eliminated the type from the hash function, these
problems go away, as does my horrible "reverse type remap" hack, which
was doomed from the start (see bullet #1 above) and far too
complicated.

However, note that removing the type from the hash function means that
all constructors, destructors, and conversion functions have the same
hash key, so I've updated the caller to double-check that the
declarations found have the appropriate name.

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

13 years ago[analyzer] Drastically simplify ExprEngine::VisitInitListExpr() by assuming all initi...
Ted Kremenek [Tue, 2 Aug 2011 18:27:05 +0000 (18:27 +0000)]
[analyzer] Drastically simplify ExprEngine::VisitInitListExpr() by assuming all initializer expressions have already been evaluated.

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

13 years agoPR10566: Make sure codegen for deleting an pointer to an incomplete type actually...
Eli Friedman [Tue, 2 Aug 2011 18:05:30 +0000 (18:05 +0000)]
PR10566: Make sure codegen for deleting an pointer to an incomplete type actually works.

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

13 years agoWhen the compiler crashes, the compiler driver now produces diagnostic
Chad Rosier [Tue, 2 Aug 2011 17:58:04 +0000 (17:58 +0000)]
When the compiler crashes, the compiler driver now produces diagnostic
information including the fully preprocessed source file(s) and command line
arguments.  The developer is asked to attach this diagnostic information to a
bug report.
rdar://9575623

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

13 years agoFollowing up the earlier refactoring/cleanup work by fixing up how we manage the...
Jonathan D. Turner [Tue, 2 Aug 2011 17:40:32 +0000 (17:40 +0000)]
Following up the earlier refactoring/cleanup work by fixing up how we manage the virtual files the ASTReader has to handle.  Specifically, this occurs when the reader is reading AST files that were created in memory and not written to disk.  For example, when a user creates a chained PCH using command line flags.  These virtual files are stored in MemoryBuffers in ChainIncludeSource.cpp, and then read back in by the ASTReader.  This patch moves the management of these buffers into the ModuleManager, so that it becomes the authority on where these buffers are located.

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

13 years agoKeychainAPI checker: only check the paths on which the allocator function returned...
Anna Zaks [Tue, 2 Aug 2011 17:11:03 +0000 (17:11 +0000)]
KeychainAPI checker: only check the paths on which the allocator function returned noErr. (+ minor cleanup)

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

13 years agoImplement a proper local -> global type ID remapping scheme in the AST
Douglas Gregor [Tue, 2 Aug 2011 16:26:37 +0000 (16:26 +0000)]
Implement a proper local -> global type ID remapping scheme in the AST
reader. This scheme permits an AST file to be loaded with its type IDs
shifted anywhere in the type ID space.

At present, the type indices are still allocated in the same boring
way they always have been, just by adding up the number of types in
each PCH file within the chain. However, I've done testing with this
patch by randomly sliding the base indices at load time, to ensure
that remapping is occurring as expected. I may eventually formalize
this in some testing flag, but loading multiple (non-chained) AST
files at once will eventually exercise the same code.

There is one known problem with this patch, which involves name lookup
of operator names (e.g., "x.operator int*()") in cases where multiple
PCH files in the chain. The hash function itself depends on having a
stable type ID, which doesn't happen with chained PCH and *certainly*
doesn't happen when sliding type IDs around. We'll need another
approach. I'll tackle that next.

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

13 years agoAdd a debugging dump for Module (also emitted as part of the AST
Douglas Gregor [Tue, 2 Aug 2011 11:12:41 +0000 (11:12 +0000)]
Add a debugging dump for Module (also emitted as part of the AST
reader statistics), to show the local-to-global mappings. The only
such mapping we have (at least, for now) is for source location
offsets.

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

13 years agoGeneralize the module offset map to include mapping information for
Douglas Gregor [Tue, 2 Aug 2011 10:56:51 +0000 (10:56 +0000)]
Generalize the module offset map to include mapping information for
all of the kinds of IDs that can be offset. No effectively
functionality change; this is preparation for adding remapping for
IDs.

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

13 years agoMake helper functions static.
Benjamin Kramer [Tue, 2 Aug 2011 04:50:49 +0000 (04:50 +0000)]
Make helper functions static.

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

13 years agoFix formatting of SemaExpr.cpp, mainly fixing lines greater than 80 characters.
Richard Trieu [Tue, 2 Aug 2011 04:35:43 +0000 (04:35 +0000)]
Fix formatting of SemaExpr.cpp, mainly fixing lines greater than 80 characters.
No functional change.

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

13 years agoRevert "Re-enable byval for ARM in clang. rdar://problem/7662569"
Bob Wilson [Mon, 1 Aug 2011 23:39:04 +0000 (23:39 +0000)]
Revert "Re-enable byval for ARM in clang.  rdar://problem/7662569"

This reverts commit 67d097e1232b7d66f58989c16a45b8a11721f76e.
We found a miscompile with ARM byval, which is still being investigated.
In the meantime, this works around the problem by disabling ARM byval.

Conflicts:
lib/CodeGen/TargetInfo.cpp

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

13 years agoAdd a skeleton for the Keychain Services API Checker. Register it as OSX experimental...
Anna Zaks [Mon, 1 Aug 2011 22:40:01 +0000 (22:40 +0000)]
Add a skeleton for the Keychain Services API Checker. Register it as OSX experimental for now. Note, the checker still does not handle tracking of escaped values, taking into account the return value of the allocator functions, nor the actual bug reporting..

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

13 years agoobjective-c: reverse patch for // rdar://9818354
Fariborz Jahanian [Mon, 1 Aug 2011 22:39:49 +0000 (22:39 +0000)]
objective-c: reverse patch for // rdar://9818354

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

13 years agoImplement MipsABIInfo::EmitVAArg. This fix enables clang to complete compilation
Akira Hatanaka [Mon, 1 Aug 2011 20:48:01 +0000 (20:48 +0000)]
Implement MipsABIInfo::EmitVAArg. This fix enables clang to complete compilation
without bailing out when va_arg is an aggregate expression. However,
alignment checking needs to be added in isSafeToEliminateVarargsCast in
InstCombineCalls.cpp in order to produce correct mips code (see link below).

http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-July/042047.html

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