]> granicus.if.org Git - clang/log
clang
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

13 years agoDriver: When compiling i386 -fapple-kext code, we fallback to llvmgcc.
Chad Rosier [Mon, 1 Aug 2011 19:58:48 +0000 (19:58 +0000)]
Driver: When compiling i386 -fapple-kext code, we fallback to llvmgcc.
Unfortunately, llvmgcc doesn't always work when writing temporary output to
/dev/null.  Therefore, create a temp file that is later deleted.
rdar://9837692

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

13 years agoPass records with non-trivial destructors or constructors indirectly.
Akira Hatanaka [Mon, 1 Aug 2011 18:09:58 +0000 (18:09 +0000)]
Pass records with non-trivial destructors or constructors indirectly.

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

13 years agoFix linkage type for tentative definition of ivar offset variables (GNUstep runtime)
David Chisnall [Mon, 1 Aug 2011 17:36:53 +0000 (17:36 +0000)]
Fix linkage type for tentative definition of ivar offset variables (GNUstep runtime)

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

13 years agoMove the serialization of the MODULE_OFFSET_MAP out of the source-manager-writing...
Douglas Gregor [Mon, 1 Aug 2011 16:54:33 +0000 (16:54 +0000)]
Move the serialization of the MODULE_OFFSET_MAP out of the source-manager-writing code and into the general chained-PCH writing code

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

13 years agoRename the AST file's SOURCE_LOCATION_MAP to MODULE_OFFSET_MAP, to indicate the great...
Douglas Gregor [Mon, 1 Aug 2011 16:01:55 +0000 (16:01 +0000)]
Rename the AST file's SOURCE_LOCATION_MAP to MODULE_OFFSET_MAP, to indicate the greater role it will soon play in remapping.

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

13 years agoTest for // rdar://9846759
Fariborz Jahanian [Sun, 31 Jul 2011 20:27:31 +0000 (20:27 +0000)]
Test for // rdar://9846759

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

13 years agoRemove dead code flagged by GCC's -Wunused-but-set-variable.
Benjamin Kramer [Sun, 31 Jul 2011 01:06:41 +0000 (01:06 +0000)]
Remove dead code flagged by GCC's -Wunused-but-set-variable.

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

13 years agoNot sure why we bother updating FunctionDecl's EndRangeLoc in FunctionDecl::setParams.
Argyrios Kyrtzidis [Sat, 30 Jul 2011 17:23:28 +0000 (17:23 +0000)]
Not sure why we bother updating FunctionDecl's EndRangeLoc in FunctionDecl::setParams.
EndRangeLoc should always be set to at least the ending paren or brace.

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

13 years ago[libclang] Annotation of parameters that got default args from a previous declaration...
Argyrios Kyrtzidis [Sat, 30 Jul 2011 17:23:26 +0000 (17:23 +0000)]
[libclang] Annotation of parameters that got default args from a previous declarations was
broken because the end location of the parameter was the end location of the default arg,
resulting in a source range that could begin in one file and end in another.

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

13 years agoIntroduce a Fix-It for the "missing sentinel" warning, adding an
Douglas Gregor [Sat, 30 Jul 2011 08:57:03 +0000 (08:57 +0000)]
Introduce a Fix-It for the "missing sentinel" warning, adding an
appropriate sentinel at the end of the argument list. Also, put the
sentinel warnings under -Wsentinel. Fixes <rdar://problem/8764236>.

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

13 years agoAdd code completion to produce "else" blocks after an "if"
Douglas Gregor [Sat, 30 Jul 2011 08:36:53 +0000 (08:36 +0000)]
Add code completion to produce "else" blocks after an "if"
statement. Fixes <rdar://problem/9229438>.

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

13 years agoWhen producing code completion results for variadic macros, fold the
Douglas Gregor [Sat, 30 Jul 2011 08:17:44 +0000 (08:17 +0000)]
When producing code completion results for variadic macros, fold the
variadic bit (", ..." or ", args...") into the prior placeholder, like
we do with functions and methods. Fixes <rdar://problem/9740808>.

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

13 years agoAdd the various parameter-passing keywords for Distributed Objects
Douglas Gregor [Sat, 30 Jul 2011 07:55:26 +0000 (07:55 +0000)]
Add the various parameter-passing keywords for Distributed Objects
(such as in, inout, byref, and oneway) to code completion
results. Fixes <rdar://problem/8844158>.

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

13 years agoFix a thinko in my __is_empty/__is_pod commit.
Douglas Gregor [Sat, 30 Jul 2011 07:08:19 +0000 (07:08 +0000)]
Fix a thinko in my __is_empty/__is_pod commit.

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

13 years agoTurn off __has_feature(is_empty) and __has_feature(is_pod) if the
Douglas Gregor [Sat, 30 Jul 2011 07:01:49 +0000 (07:01 +0000)]
Turn off __has_feature(is_empty) and __has_feature(is_pod) if the
libstdc++ hack has reverted these type traits to keywords. Icky, but
fixes <rdar://problem/9836262>.

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

13 years agoWhen performing code completion after at @interface, allow both
Douglas Gregor [Sat, 30 Jul 2011 06:55:39 +0000 (06:55 +0000)]
When performing code completion after at @interface, allow both
already-defined and forward-declared results. Already-defined results
are fine because they could be the start of a category. Fixes
<rdar://problem/9811691>.

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

13 years agoWhen complaining about a non-POD second argument to va_arg, use a
Douglas Gregor [Sat, 30 Jul 2011 06:45:27 +0000 (06:45 +0000)]
When complaining about a non-POD second argument to va_arg, use a
special diagnostic for ARC ownership-qualified types. We wouldn't want
to expose Objective-C programmers to the term "POD", would we? Fixes
<rdar://problem/9772982>.

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

13 years agoUse the "Bar.h" -> <Foo/Bar.h> remapping for index header maps only as
Douglas Gregor [Sat, 30 Jul 2011 06:28:34 +0000 (06:28 +0000)]
Use the "Bar.h" -> <Foo/Bar.h> remapping for index header maps only as
a fallback, if normal header search fails. Another attempt at
<rdar://problem/9824020>.

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

13 years agoobjc rewriter - my last patch was not quite right.
Fariborz Jahanian [Sat, 30 Jul 2011 01:21:41 +0000 (01:21 +0000)]
objc rewriter - my last patch was not quite right.
Fixed again. // rdar://9846759

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

13 years agoobjc rewriter - set the flag passed to _Block_object_assign/_Block_object_dispose...
Fariborz Jahanian [Sat, 30 Jul 2011 01:07:55 +0000 (01:07 +0000)]
objc rewriter - set the flag passed to _Block_object_assign/_Block_object_dispose correctly
for copying a captured block object. // rdar://9846759

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

13 years agoTeach the ASTImporter to cope with cases where we have already
Douglas Gregor [Fri, 29 Jul 2011 23:31:30 +0000 (23:31 +0000)]
Teach the ASTImporter to cope with cases where we have already
imported a forward declaration, but later the full definition of the
same entity becomes available. When this happens, import the definition.

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

13 years agoAdd support for the 'Q' arm memory constraint.
Eric Christopher [Fri, 29 Jul 2011 21:20:35 +0000 (21:20 +0000)]
Add support for the 'Q' arm memory constraint.

Fixes rdar://9866494

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

13 years ago[analyzer] Remove recursive visitation in ExprEngine::VisitDeclStmt because it isn...
Ted Kremenek [Fri, 29 Jul 2011 21:18:41 +0000 (21:18 +0000)]
[analyzer] Remove recursive visitation in ExprEngine::VisitDeclStmt because it isn't needed anymore.

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

13 years ago[analyzer] Remove recursive visitation in ExprEngine::VisitCompoundLiteralExpr becaus...
Ted Kremenek [Fri, 29 Jul 2011 21:18:39 +0000 (21:18 +0000)]
[analyzer] Remove recursive visitation in ExprEngine::VisitCompoundLiteralExpr because it isn't needed anymore.

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

13 years ago[analyzer] Remove recursive visitation in ExprEngine::VisitCastExpr because it isn...
Ted Kremenek [Fri, 29 Jul 2011 21:18:37 +0000 (21:18 +0000)]
[analyzer] Remove recursive visitation in ExprEngine::VisitCastExpr because it isn't needed anymore.

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

13 years ago[analyzer] Remove recursive visitation in ExprEngine::VisitObjCForCollectionStmt...
Ted Kremenek [Fri, 29 Jul 2011 21:18:35 +0000 (21:18 +0000)]
[analyzer] Remove recursive visitation in ExprEngine::VisitObjCForCollectionStmt because it isn't needed anymore.

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

13 years ago[analyzer] Remove explicit argument processing from ExprEngine::VisitObjCMessage...
Ted Kremenek [Fri, 29 Jul 2011 21:18:31 +0000 (21:18 +0000)]
[analyzer] Remove explicit argument processing from ExprEngine::VisitObjCMessage() since it is no longer needed.

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

13 years ago[analyzer] Remove recursive visitation in ExprEngine::VisitLValObjCIvarRefExpr becaus...
Ted Kremenek [Fri, 29 Jul 2011 21:18:28 +0000 (21:18 +0000)]
[analyzer] Remove recursive visitation in ExprEngine::VisitLValObjCIvarRefExpr because it isn't needed anymore.

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

13 years ago[analyzer] tighten up ExprEngine::VisitObjCAtSynchronizationStmt().
Ted Kremenek [Fri, 29 Jul 2011 21:18:26 +0000 (21:18 +0000)]
[analyzer] tighten up ExprEngine::VisitObjCAtSynchronizationStmt().

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