]> granicus.if.org Git - clang/log
clang
12 years agoReplace the workaround from r153445 with a proper fix.
Kaelyn Uhrain [Tue, 3 Apr 2012 18:20:11 +0000 (18:20 +0000)]
Replace the workaround from r153445 with a proper fix.

Infinite recursion was happening when DiagnoseInvalidRedeclaration
called ActOnFunctionDeclarator to check if a typo correction works when
the correction was just to the nested-name-specifier because the wrong
DeclContext was being passed in. Unlike a number of functions
surrounding typo correction, the DeclContext passed in for a function is
the context of the function name after applying any nested name
specifiers, not the lexical DeclContext where the
function+nested-name-specifier appears.

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

12 years agomodern objective-c translator: rewriter linkage spec.
Fariborz Jahanian [Tue, 3 Apr 2012 17:35:38 +0000 (17:35 +0000)]
modern objective-c translator: rewriter linkage spec.
// rdar://11169733

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

12 years agoCorrect handling of _Pragma macro inside a macro argument.
Argyrios Kyrtzidis [Tue, 3 Apr 2012 16:47:40 +0000 (16:47 +0000)]
Correct handling of _Pragma macro inside a macro argument.

If we are pre-expanding a macro argument don't actually "activate"
the pragma at that point, activate the pragma whenever we encounter
it again in the token stream.
This ensures that we will activate it in the correct location
or that we will ignore it if it never enters the token stream, e.g:

     \#define EMPTY(x)
     \#define INACTIVE(x) EMPTY(x)
     INACTIVE(_Pragma("clang diagnostic ignored \"-Wconversion\""))

This also fixes the crash in rdar://11168596.

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

12 years agoRework ProgramPoint to bit-mangle the 'Kind' into both Data pointers and the Location...
Ted Kremenek [Tue, 3 Apr 2012 04:25:05 +0000 (04:25 +0000)]
Rework ProgramPoint to bit-mangle the 'Kind' into both Data pointers and the LocationContext.  After switching to PointerIntPair, it didn't look like a safe assumption to use the lower 3 bits of the LocationContext* field.  Thanks to Jordy Rose and Benjamin Kramer for their feedback.

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

12 years ago[analyzer] Record the basic blocks covered by the analyzes run.
Anna Zaks [Tue, 3 Apr 2012 02:05:47 +0000 (02:05 +0000)]
[analyzer] Record the basic blocks covered by the analyzes run.

Store this info inside the function summary generated for all analyzed
functions. This is useful for coverage stats and can be helpful for
analyzer state space search strategies.

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

12 years agoAdd more constraint registers for mips.
Eric Christopher [Tue, 3 Apr 2012 01:16:32 +0000 (01:16 +0000)]
Add more constraint registers for mips.

Patch by Jack Carter. Testcase cleanup by me.

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

12 years agoChange location information for synthesized properties to be at the
Eric Christopher [Tue, 3 Apr 2012 00:44:15 +0000 (00:44 +0000)]
Change location information for synthesized properties to be at the
property file/line rather than the @synthesize file/line. Avoids
some nasty confusing-ness with conflating the file from the scope
and the line from the original declaration. Use    the current scope
location as a separate parameter so that we can    match it up
better in the line table with the beginning of the scope.

Update a couple of testcases accordingly since I had to change
that we actually use the passed in location in EmitFunctionStart
and for the new metadata parameter and add a new testcase to
make sure we've got the right line numbers for synthesized
properties.

Part of rdar://11026482

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

12 years agoFix another false positive in RegionStore involving doing loads from symbolic offsets...
Ted Kremenek [Tue, 3 Apr 2012 00:03:34 +0000 (00:03 +0000)]
Fix another false positive in RegionStore involving doing loads from symbolic offsets.  We still don't
properly reason about such accesses, but we shouldn't emit bogus "uninitialized value" warnings
either.  Fixes <rdar://problem/11127008>.

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

12 years agoFix potential null dereference in the static analyzer when inlining a call that has...
Ted Kremenek [Mon, 2 Apr 2012 21:55:06 +0000 (21:55 +0000)]
Fix potential null dereference in the static analyzer when inlining a call that has already been inlined.  Unfortunately I have no test case.

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

12 years agoReduce static analyzer memory usage by about 4% by packing the ProgramPoing 'Kind...
Ted Kremenek [Mon, 2 Apr 2012 21:24:13 +0000 (21:24 +0000)]
Reduce static analyzer memory usage by about 4% by packing the ProgramPoing 'Kind' field into the spare bits of other fields.

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

12 years agoPR10217 diagnostic fix: don't say 'copy constructor' when we mean
Richard Smith [Mon, 2 Apr 2012 21:07:48 +0000 (21:07 +0000)]
PR10217 diagnostic fix: don't say 'copy constructor' when we mean
'copy assignment operator'.

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

12 years agoRemove windows line endings.
David Blaikie [Mon, 2 Apr 2012 20:59:49 +0000 (20:59 +0000)]
Remove windows line endings.

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

12 years agoFinish PR10217: Ensure we say that a special member was implicitly, not
Richard Smith [Mon, 2 Apr 2012 20:59:25 +0000 (20:59 +0000)]
Finish PR10217: Ensure we say that a special member was implicitly, not
explicitly, deleted in all relevant cases, and explain why.

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

12 years agoCorrect error recovery when missing 'class' in a template template parameter.
David Blaikie [Mon, 2 Apr 2012 19:15:28 +0000 (19:15 +0000)]
Correct error recovery when missing 'class' in a template template parameter.

The diagnostic message correctly informs the user that they have omitted the
'class' keyword, but neither suggests this insertion as a fixit, nor attempts
to recover as if they had provided the keyword.

This fixes the recovery, adds the fixit, and adds a separate diagnostic and
corresponding replacement fixit for cases where the user wrote 'struct' or
'typename' instead of 'class' (suggested by Richard Smith as a possible common
mistake).

I'm not sure the diagnostic message for either the original or new cases feel
very Clang-esque, so I'm open to suggestions there. The fixit hints make it
fairly easy to see what's required, though.

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

12 years agoSilence -Wunused-variable in -Asserts build
Matt Beaumont-Gay [Mon, 2 Apr 2012 19:05:35 +0000 (19:05 +0000)]
Silence -Wunused-variable in -Asserts build

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

12 years agoPR12438: Profile a reference to a type template parameter by depth and index,
Richard Smith [Mon, 2 Apr 2012 18:53:24 +0000 (18:53 +0000)]
PR12438: Profile a reference to a type template parameter by depth and index,
not by canonical decl. This only matters for sizeof...(Pack) expressions; in
all other cases, we'd profile it as a type instead.

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

12 years agoImplement DR1402: if a field or base class is not movable, the derived class's
Richard Smith [Mon, 2 Apr 2012 18:40:40 +0000 (18:40 +0000)]
Implement DR1402: if a field or base class is not movable, the derived class's
move constructor/move assignment operator are not declared, rather than being
defined as deleted, so move operations on the derived class fall back to
copying rather than moving.

If a move operation on the derived class is explicitly defaulted, the
unmovable subobject will be copied instead of being moved.

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

12 years agoUse -rewrite-legacy-objc as clang argument for translating
Fariborz Jahanian [Mon, 2 Apr 2012 15:59:19 +0000 (15:59 +0000)]
Use -rewrite-legacy-objc as clang argument for translating
objective-c's fragile abi, Use -rewrite-objc for translating
objective-c's modern abi.  // rdar://11143173

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

12 years agoFix build by passing in the needed variable after r153860.
Bill Wendling [Mon, 2 Apr 2012 06:17:37 +0000 (06:17 +0000)]
Fix build by passing in the needed variable after r153860.

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

12 years agoBasic semantic analysis support for inheriting constructor declarations in
Richard Smith [Mon, 2 Apr 2012 01:30:27 +0000 (01:30 +0000)]
Basic semantic analysis support for inheriting constructor declarations in
dependent contexts.

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

12 years agoIgnore unused --serialize-diagnostics option when using llvm-gcc.
Bob Wilson [Sun, 1 Apr 2012 23:03:29 +0000 (23:03 +0000)]
Ignore unused --serialize-diagnostics option when using llvm-gcc.

llvm-gcc doesn't handle --serialize-diagnostics so when compiling i386
kernel/kext code with -Werror, you get an error about that option being
unused.  Claim the argument to prevent this from breaking builds.
<rdar://problem/11161933>

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

12 years agoProperly handle explicit constructors in list-initialization. Fixes PR12120.
Sebastian Redl [Sun, 1 Apr 2012 19:54:59 +0000 (19:54 +0000)]
Properly handle explicit constructors in list-initialization. Fixes PR12120.

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

12 years agoAnalyzer: Store BugReports directly in a ilist instead of adding another layer of...
Benjamin Kramer [Sun, 1 Apr 2012 19:30:51 +0000 (19:30 +0000)]
Analyzer: Store BugReports directly in a ilist instead of adding another layer of inderection with std::list

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

12 years agoFixed MacroInfo definition range for function like macros with empty body.
Abramo Bagnara [Sat, 31 Mar 2012 20:17:27 +0000 (20:17 +0000)]
Fixed MacroInfo definition range for function like macros with empty body.

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

12 years agoRemove unused but set variable.
Benjamin Kramer [Sat, 31 Mar 2012 10:23:28 +0000 (10:23 +0000)]
Remove unused but set variable.

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

12 years ago[arcmt] When fixing the "unassigned init call" ARC error, make sure
Argyrios Kyrtzidis [Sat, 31 Mar 2012 01:34:06 +0000 (01:34 +0000)]
[arcmt] When fixing the "unassigned init call" ARC error, make sure
to do a nil check for the result of the call.

rdar://10950973

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

12 years ago[libclang] Fix use-after-free bug when handling attributes indexing info.
Argyrios Kyrtzidis [Sat, 31 Mar 2012 01:14:06 +0000 (01:14 +0000)]
[libclang] Fix use-after-free bug when handling attributes indexing info.

When indexing a property with a getter/setter with attributes, the allocated memory
for AttrListInfo could get released before its destructor is run.

Fixes rdar://11113442.

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

12 years agomodern objective-c translator: writing container
Fariborz Jahanian [Fri, 30 Mar 2012 23:35:47 +0000 (23:35 +0000)]
modern objective-c translator: writing container
literals. wip. // rdar://10803676

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

12 years ago[libclang] Introduce clang_Cursor_getObjCSelectorIndex() function.
Argyrios Kyrtzidis [Fri, 30 Mar 2012 22:15:48 +0000 (22:15 +0000)]
[libclang] Introduce clang_Cursor_getObjCSelectorIndex() function.

After getting a cursor with clang_getCursor for a particular source location,
allows querying the cursor in order to find out if the location points to a
selector identifier in an objc method or message expression, and which selector index it is.

rdar://11158946

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

12 years agoFix a pair of invalidation bugs when emitting protocol definitions
John McCall [Fri, 30 Mar 2012 21:29:05 +0000 (21:29 +0000)]
Fix a pair of invalidation bugs when emitting protocol definitions
in the fragile and non-fragile Mac ObjC runtimes.  No useful test
case.  Fixes rdar://problem/11072576.

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

12 years agoMake sure we unique static-local decls across multiple emissions of
John McCall [Fri, 30 Mar 2012 21:00:39 +0000 (21:00 +0000)]
Make sure we unique static-local decls across multiple emissions of
the function body, but do so in a way that doesn't make any assumptions
about the static local actually having a proper, unique mangling,
since apparently we don't do that correctly at all.

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

12 years ago[libclang] Introduce clang_Cursor_getSpellingNameRange().
Argyrios Kyrtzidis [Fri, 30 Mar 2012 20:58:35 +0000 (20:58 +0000)]
[libclang] Introduce clang_Cursor_getSpellingNameRange().

It retrieves a source range for a piece that forms the cursors spelling name.
Most of the times there is only one range for the complete spelling but for
objc methods and objc message expressions, there are multiple pieces for each
selector identifier.

Part of rdar://11113120

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

12 years agoPR10217: Provide diagnostics explaining why an implicitly-deleted special
Richard Smith [Fri, 30 Mar 2012 20:53:28 +0000 (20:53 +0000)]
PR10217: Provide diagnostics explaining why an implicitly-deleted special
member function is deleted.

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

12 years agoRevert r153723, and its follow-ups r153728 and r153733.
Chandler Carruth [Fri, 30 Mar 2012 19:44:53 +0000 (19:44 +0000)]
Revert r153723, and its follow-ups r153728 and r153733.

These patches cause us to miscompile and/or reject code with static
function-local variables in an extern-C context. Previously, we were
papering over this as long as the variables are within the same
translation unit, and had not seen any failures in the wild. We still
need a proper fix, which involves mangling static locals inside of an
extern-C block (as GCC already does), but this patch causes pretty
widespread regressions. Firefox, and many other applications no longer
build.

Lots of test cases have been posted to the list in response to this
commit, so there should be no problem reproducing the issues.

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

12 years ago[driver] Create a new L_Group for language options and add the -std= option to
Chad Rosier [Fri, 30 Mar 2012 17:33:35 +0000 (17:33 +0000)]
[driver] Create a new L_Group for language options and add the -std= option to
said group.  Also classify the group as a CompileOnly_Group so that this option
does not cause an unused argument warning when used with a link command.
rdar://11153013

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

12 years agomodern objective-c translator: writing numeric
Fariborz Jahanian [Fri, 30 Mar 2012 16:49:36 +0000 (16:49 +0000)]
modern objective-c translator: writing numeric
literals. // rdar://10803676

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

12 years agoIf we encounter a friend class template for which we cannot resolve
Douglas Gregor [Fri, 30 Mar 2012 16:20:47 +0000 (16:20 +0000)]
If we encounter a friend class template for which we cannot resolve
the nested-name-specifier (e.g., because it is dependent), do not
error even though we can't represent it in the AST at this point.

This is a horrible, horrible hack. The actual feature we still need to
implement (for C++98!) is covered by PR12292. However, we used to
silently accept this code, so when we recently started rejecting it we
caused some regressions (e.g., <rdar://problem/11147355>). This hack
brings us back to the passable-but-not-good state we had previously.

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

12 years agoDo the static-locals thing properly in the face of unions and
John McCall [Fri, 30 Mar 2012 07:09:50 +0000 (07:09 +0000)]
Do the static-locals thing properly in the face of unions and
other things which might mess with the variable's type.

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

12 years agoCorrectly check argument types for some vector macros in smmintrin.h. Put parentheses...
Craig Topper [Fri, 30 Mar 2012 07:01:17 +0000 (07:01 +0000)]
Correctly check argument types for some vector macros in smmintrin.h. Put parentheses around uses of vector macro arguments.

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

12 years ago[analyzer]Malloc,RetainRelease: Allow pointer to escape via NSMapInsert.
Anna Zaks [Fri, 30 Mar 2012 05:48:16 +0000 (05:48 +0000)]
[analyzer]Malloc,RetainRelease: Allow pointer to escape via NSMapInsert.

Fixes a false positive (radar://11152419). The current solution of
adding the info into 3 places is quite ugly. Pending a generic pointer
escapes callback.

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

12 years ago[analyzer] Do not inline functions which previously reached max block
Anna Zaks [Fri, 30 Mar 2012 05:48:10 +0000 (05:48 +0000)]
[analyzer] Do not inline functions which previously reached max block
count.

This is an optimization for "retry without inlining" option. Here, if we
failed to inline a function due to reaching the basic block max count,
we are going to store this information and not try to inline it
again in the translation unit. This can be viewed as a function summary.

On sqlite, with this optimization, we are 30% faster then before and
cover 10% more basic blocks (partially because the number of times we
reach timeout is decreased by 20%).

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

12 years agoHandle placeholder expressions in an ObjC for-collection loop.
John McCall [Fri, 30 Mar 2012 05:43:39 +0000 (05:43 +0000)]
Handle placeholder expressions in an ObjC for-collection loop.
The way we handle this implicitly removes the ability to use
property l-values in this position, but that's really okay.

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

12 years agoItaniumCXXABI.cpp: Don't use nullptr. Clang source tree should be pre-c++11-compatible.
NAKAMURA Takumi [Fri, 30 Mar 2012 05:43:21 +0000 (05:43 +0000)]
ItaniumCXXABI.cpp: Don't use nullptr. Clang source tree should be pre-c++11-compatible.

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

12 years agoRevert previous commit changing location information to see if this
Eric Christopher [Fri, 30 Mar 2012 05:42:12 +0000 (05:42 +0000)]
Revert previous commit changing location information to see if this
is causing the gdb test failures on the bots.

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

12 years agoAdd _mm_minpos_epu16 to smmintrin.h. Fixes PR12399.
Craig Topper [Fri, 30 Mar 2012 05:41:28 +0000 (05:41 +0000)]
Add _mm_minpos_epu16 to smmintrin.h. Fixes PR12399.

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

12 years agoForbid the block and lambda copy-capture of __autoreleasing variables
John McCall [Fri, 30 Mar 2012 05:23:48 +0000 (05:23 +0000)]
Forbid the block and lambda copy-capture of __autoreleasing variables
in ARC, under the usual reasoning limiting the use of __autoreleasing.

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

12 years agoFix shuffle vector calculation for mm_permute_ps. Fixes PR 12401.
Craig Topper [Fri, 30 Mar 2012 05:09:18 +0000 (05:09 +0000)]
Fix shuffle vector calculation for mm_permute_ps. Fixes PR 12401.

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

12 years agoWhen emitting a static local variable in C++, handle
John McCall [Fri, 30 Mar 2012 04:25:14 +0000 (04:25 +0000)]
When emitting a static local variable in C++, handle
the case that the variable already exists.  Partly this is just
protection against people making crazy declarations with custom
asm labels or extern "C" names that intentionally collide with
the manglings of such variables, but the main reason is that we
can actually emit a static local variable twice with the
requirement that it match up.  There may be other cases with
(e.g.) the various nested functions, but the main exemplar is
with constructor variants, where we can be forced into
double-emitting the function body under certain circumstances
like (currently) the presence of virtual bases.

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

12 years agoAdd a note about a missing optimization in the case of virtual
John McCall [Fri, 30 Mar 2012 04:25:03 +0000 (04:25 +0000)]
Add a note about a missing optimization in the case of virtual
inheritance.

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

12 years agoMissing piece of r153720: make sure the vtable pointer is handled correctly.
Eli Friedman [Fri, 30 Mar 2012 04:16:06 +0000 (04:16 +0000)]
Missing piece of r153720: make sure the vtable pointer is handled correctly.

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

12 years agoConstStructBuilder: fix offset math for base classes so it works correctly in general...
Eli Friedman [Fri, 30 Mar 2012 03:55:31 +0000 (03:55 +0000)]
ConstStructBuilder: fix offset math for base classes so it works correctly in general.  Found by inspection.

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

12 years agoMake sure we perform the relevant implied conversions correctly for ObjC methods...
Eli Friedman [Fri, 30 Mar 2012 01:13:43 +0000 (01:13 +0000)]
Make sure we perform the relevant implied conversions correctly for ObjC methods with related result types. PR12384.

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

12 years agoTestcase for the previous commit.
Eric Christopher [Fri, 30 Mar 2012 01:07:51 +0000 (01:07 +0000)]
Testcase for the previous commit.

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

12 years agoChange location information for synthesized properties to be at the
Eric Christopher [Fri, 30 Mar 2012 01:07:48 +0000 (01:07 +0000)]
Change location information for synthesized properties to be at the
property file/line rather than the @synthesize file/line. Avoids
some nasty confusing-ness with conflating the file from the scope
and the line from the original declaration.

Update a couple of testcases accordingly since I had to change
that we actually use the passed in location in EmitFunctionStart.

Fixes rdar://11026482

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

12 years agoThe UTF16 string referenced by a CFString should go into the __TEXT,__ustring
Bill Wendling [Fri, 30 Mar 2012 00:26:17 +0000 (00:26 +0000)]
The UTF16 string referenced by a CFString should go into the __TEXT,__ustring
section. A 'normal' string will go into the __TEXT,__const section, but this
isn't good for UTF16 strings. The __ustring section allows for coalescing, among
other niceties (such as allowing the linker to easily split up strings).

Instead of outputting the UTF16 string as a series of bytes, output it as a
series of shorts. The back-end will then nicely place the UTF16 string into the
correct section, because it's a mensch.
<rdar://problem/10655949>

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

12 years agoAdd info to ObjCPropertyRefExpr to indicate whether the dot syntax property
Argyrios Kyrtzidis [Fri, 30 Mar 2012 00:19:18 +0000 (00:19 +0000)]
Add info to ObjCPropertyRefExpr to indicate whether the dot syntax property
reference is going to message the setter, the getter, or both.

Having this info on the ObjCPropertyRefExpr node makes it easier for AST
clients (like libclang) to reason about the meaning of the property reference.

[AST/Sema]
-Use 2 bits (with a PointerIntPair) in ObjCPropertyRefExpr to record the above info
-Have ObjCPropertyOpBuilder set the info appropriately.

[libclang]
-When there is an implicit property reference (property syntax using methods)
have clang_getCursorReferenced return a cursor for the method. If the property
reference is going to result in messaging both the getter and the setter choose
to return a cursor for the setter because it is less obvious from source inspection
that the setter is getting called.

The general idea has the seal of approval by John.

rdar://11151621

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

12 years ago[libclang] A MemberRefExpr cursor for a property dot syntax should have as
Argyrios Kyrtzidis [Fri, 30 Mar 2012 00:19:13 +0000 (00:19 +0000)]
[libclang] A MemberRefExpr cursor for a property dot syntax should have as
its location the location of the property.

Part of rdar://11113120

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

12 years ago[libclang] Have c-index-test output more information about a cursor with -cursor-at:
Argyrios Kyrtzidis [Fri, 30 Mar 2012 00:19:05 +0000 (00:19 +0000)]
[libclang] Have c-index-test output more information about a cursor with -cursor-at:

-the location of the cursor
-its extent
-its spelling

Part of radar://11113120

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

12 years agoExtend -Wc++11-narrowing to cover converted constant expressions as well as braced...
Eli Friedman [Thu, 29 Mar 2012 23:39:39 +0000 (23:39 +0000)]
Extend -Wc++11-narrowing to cover converted constant expressions as well as braced-initializers.  <rdar://problem/11121178>.

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

12 years ago[analyzer] Add a malloc cpp test file.
Anna Zaks [Thu, 29 Mar 2012 23:26:54 +0000 (23:26 +0000)]
[analyzer] Add a malloc cpp test file.

Includes a test from a reported false positive fixed in some earlier
commit.

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

12 years agoFix whitespace.
Bill Wendling [Thu, 29 Mar 2012 22:12:09 +0000 (22:12 +0000)]
Fix whitespace.

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

12 years agoARM backend knows about cortex-m4. The front end should too.
Jim Grosbach [Thu, 29 Mar 2012 19:53:34 +0000 (19:53 +0000)]
ARM backend knows about cortex-m4. The front end should too.

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

12 years agomodern objc translator: avoid some duplicate declarations.
Fariborz Jahanian [Thu, 29 Mar 2012 19:04:10 +0000 (19:04 +0000)]
modern objc translator: avoid some duplicate declarations.

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

12 years agoRefactor special member function deletion. No functionality change.
Richard Smith [Thu, 29 Mar 2012 19:00:10 +0000 (19:00 +0000)]
Refactor special member function deletion. No functionality change.

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

12 years agoRelax the test slightly so that it should pass on other people's computers.
David Chisnall [Thu, 29 Mar 2012 18:41:08 +0000 (18:41 +0000)]
Relax the test slightly so that it should pass on other people's computers.

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

12 years agomodern objc translator: additional test.
Fariborz Jahanian [Thu, 29 Mar 2012 18:20:51 +0000 (18:20 +0000)]
modern objc translator: additional test.

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

12 years agoCall out to GCC-compatible runtime functions for atomic ops that we can't use
David Chisnall [Thu, 29 Mar 2012 18:01:11 +0000 (18:01 +0000)]
Call out to GCC-compatible runtime functions for atomic ops that we can't use
LLVM intrinsics for.

I have an implementation of these functions, which wants to go in a libgcc_s
equivalent in compiler-rt.  It's currently here:

http://people.freebsd.org/~theraven/atomic.c

It will be committed to compiler-rt as soon as I work out where would be a
sensible place to put it...

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

12 years agoPass parameters in the correct order when assembling an AtomicExpr.
David Chisnall [Thu, 29 Mar 2012 17:58:59 +0000 (17:58 +0000)]
Pass parameters in the correct order when assembling an AtomicExpr.

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

12 years agomodern objective-c translator: fix up assortment of
Fariborz Jahanian [Thu, 29 Mar 2012 17:51:09 +0000 (17:51 +0000)]
modern objective-c translator: fix up assortment of
visibility directives for a variety of exported
meta-data symbols. // rdar://11144048

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

12 years agoRevert r153613 as it's causing large compile-time regressions on the nightly testers.
Chad Rosier [Thu, 29 Mar 2012 17:37:10 +0000 (17:37 +0000)]
Revert r153613 as it's causing large compile-time regressions on the nightly testers.

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

12 years agoGo back to using just the selector name for the getter and setter
Eric Christopher [Thu, 29 Mar 2012 17:31:33 +0000 (17:31 +0000)]
Go back to using just the selector name for the getter and setter
in the property debug info. Any more isn't necessary after all.

rdar://11144023

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

12 years agoTidy.
Eric Christopher [Thu, 29 Mar 2012 17:31:31 +0000 (17:31 +0000)]
Tidy.

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

12 years agoMake ModuleMapParser own its TargetInfo, so it doesn't get leaked.
Benjamin Kramer [Thu, 29 Mar 2012 14:07:03 +0000 (14:07 +0000)]
Make ModuleMapParser own its TargetInfo, so it doesn't get leaked.

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

12 years ago Add support for objc property decls according to the page at:
Eric Christopher [Thu, 29 Mar 2012 08:43:37 +0000 (08:43 +0000)]
Add support for objc property decls according to the page at:

    http://llvm.org/docs/SourceLevelDebugging.html#objcproperty

    including type and DECL. Expand the getter and setter names
    into the fully qualified names.

    rdar://11144023

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

12 years agounwind.h fix for -fvisibility=hidden users. This fixes firefox build in a system
Rafael Espindola [Thu, 29 Mar 2012 03:37:17 +0000 (03:37 +0000)]
unwind.h fix for -fvisibility=hidden users. This fixes firefox build in a system
with libunwind installed.
Patch by Jeffrey Yasskin!

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

12 years agoDon't try to parse a malformed parameter list after a constructor or operator
Richard Smith [Thu, 29 Mar 2012 01:46:00 +0000 (01:46 +0000)]
Don't try to parse a malformed parameter list after a constructor or operator
name as a direct initializer.

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

12 years agoReject 'template<typename...Ts> void f(Ts ...(x));'. Add a special-case
Richard Smith [Thu, 29 Mar 2012 01:16:42 +0000 (01:16 +0000)]
Reject 'template<typename...Ts> void f(Ts ...(x));'. Add a special-case
diagnostic and a fix-it to explain to the user where the ellipsis is
supposed to go.

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

12 years ago[arcmt] Fix a bug where a property in a class extension, that did not exist
Argyrios Kyrtzidis [Thu, 29 Mar 2012 01:10:31 +0000 (01:10 +0000)]
[arcmt] Fix a bug where a property in a class extension, that did not exist
in the interface, got its attribute rewritten twice, resulting in
'weakweak' or 'strongstrong'.

rdar://11047179

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

12 years agoDefine __LITTLE_ENDIAN__ for le32, since "le" stands for little endian.
Jan Wen Voung [Thu, 29 Mar 2012 00:05:59 +0000 (00:05 +0000)]
Define __LITTLE_ENDIAN__ for le32, since "le" stands for little endian.
Add a test for this too.

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

12 years agoWhen we can't prove that the target of an aggregate copy is
John McCall [Wed, 28 Mar 2012 23:30:44 +0000 (23:30 +0000)]
When we can't prove that the target of an aggregate copy is
a complete object, the memcpy needs to use the data size of
the structure instead of its sizeof() value.  Fixes PR12204.

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

12 years agoFix typo in my last patch.
Fariborz Jahanian [Wed, 28 Mar 2012 21:13:53 +0000 (21:13 +0000)]
Fix typo in my last patch.

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

12 years ago[libclang] Fix CIndexer::isOptEnabled(); not sure what I was thinking there.
Argyrios Kyrtzidis [Wed, 28 Mar 2012 20:42:59 +0000 (20:42 +0000)]
[libclang] Fix CIndexer::isOptEnabled(); not sure what I was thinking there.

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

12 years ago[analyzer] Enable retry exhausted without inlining by default.
Anna Zaks [Wed, 28 Mar 2012 19:59:16 +0000 (19:59 +0000)]
[analyzer] Enable retry exhausted without inlining by default.

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

12 years agoFix the type of wchar_t on Solaris.
David Chisnall [Wed, 28 Mar 2012 18:04:14 +0000 (18:04 +0000)]
Fix the type of wchar_t on Solaris.

Patch by Dmitri Shubin!

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

12 years agoobjective-c: Improve diagnostics and
Fariborz Jahanian [Wed, 28 Mar 2012 17:56:49 +0000 (17:56 +0000)]
objective-c: Improve diagnostics and
provide 'fixit' hint when dictionary index
is not of proper type. // rdar://11062080

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

12 years ago[analyser] Stats checker: do not mark a node as exhausted if we will
Anna Zaks [Wed, 28 Mar 2012 17:05:50 +0000 (17:05 +0000)]
[analyser] Stats checker: do not mark a node as exhausted if we will
retry without inlining.

(+ other minor cleanups)

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

12 years ago[analyzer] Refactor: Use Decl when determining if the Block belongs to
Anna Zaks [Wed, 28 Mar 2012 17:05:46 +0000 (17:05 +0000)]
[analyzer] Refactor: Use Decl when determining if the Block belongs to
the root function.

(This is a bit cleaner then using the StackFrame.)

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

12 years agoCodeGen/CGDeclCXX.cpp: Twine-ize CreateGlobalInitOrDestructFunction().
NAKAMURA Takumi [Wed, 28 Mar 2012 16:24:29 +0000 (16:24 +0000)]
CodeGen/CGDeclCXX.cpp: Twine-ize CreateGlobalInitOrDestructFunction().

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

12 years agoUnify and fix our checking of C++ [dcl.meaning]p1's requirements
Douglas Gregor [Wed, 28 Mar 2012 16:01:27 +0000 (16:01 +0000)]
Unify and fix our checking of C++ [dcl.meaning]p1's requirements
concerning qualified declarator-ids. We now diagnose extraneous
qualification at namespace scope (which we had previously missed) and
diagnose these qualification errors for all kinds of declarations; it
was rather uneven before. Fixes <rdar://problem/11135644>.

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

12 years agoWhen we form a new function/class template specialization, we first
Douglas Gregor [Wed, 28 Mar 2012 14:34:23 +0000 (14:34 +0000)]
When we form a new function/class template specialization, we first
search for the specialization (in a folding set) and, if not found
form a *Decl that is then inserted into that folding set. In rare
cases, the folding set may be reallocated between the search and the
insertion, causing a crash. No test case, because triggering rehashing
consistently in a small test case is not feasible. Fixes
<rdar://problem/11115071>.

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

12 years agoFix suspicious comparison reported by PVS-Studio!
Ted Kremenek [Wed, 28 Mar 2012 05:24:50 +0000 (05:24 +0000)]
Fix suspicious comparison reported by PVS-Studio!

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

12 years ago[libclang] Rename setBackGroundPriority -> setThreadBackgroundPriority.
Argyrios Kyrtzidis [Wed, 28 Mar 2012 02:49:54 +0000 (02:49 +0000)]
[libclang] Rename setBackGroundPriority -> setThreadBackgroundPriority.

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

12 years ago[libclang] Fix gcc error.
Argyrios Kyrtzidis [Wed, 28 Mar 2012 02:49:50 +0000 (02:49 +0000)]
[libclang] Fix gcc error.

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

12 years ago[libclang] Introduce options to control the priority for the threads
Argyrios Kyrtzidis [Wed, 28 Mar 2012 02:18:05 +0000 (02:18 +0000)]
[libclang] Introduce options to control the priority for the threads
that libclang creates.

-Introduce CXGlobalOptFlags enum for the new options that can be
 set on the CXIndex object.

-CXGlobalOpt_ThreadBackgroundPriorityForIndexing affects:
  clang_indexSourceFile
  clang_indexTranslationUnit
  clang_parseTranslationUnit
  clang_saveTranslationUnit

-CXGlobalOpt_ThreadBackgroundPriorityForEditing affects:
  clang_reparseTranslationUnit
  clang_codeCompleteAt
  clang_annotateTokens

rdar://9075282

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

12 years ago[libclang] Put the CIndexer class in the clang namespace instead of having
Argyrios Kyrtzidis [Wed, 28 Mar 2012 02:18:02 +0000 (02:18 +0000)]
[libclang] Put the CIndexer class in the clang namespace instead of having
it at global namespace.

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

12 years ago[libclang] For clang_saveTranslationUnit, if the AST to save has invalid nodes
Argyrios Kyrtzidis [Wed, 28 Mar 2012 02:17:59 +0000 (02:17 +0000)]
[libclang] For clang_saveTranslationUnit, if the AST to save has invalid nodes
due to compiler errors, use a crash recovery thread to do the AST writing for
protection.

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

12 years agoMove the emission of strict enum range metadata behind a flag (the same
Chandler Carruth [Tue, 27 Mar 2012 23:58:37 +0000 (23:58 +0000)]
Move the emission of strict enum range metadata behind a flag (the same
flag as GCC uses: -fstrict-enums). There is a *lot* of code making
unwarranted assumptions about the underlying type of enums, and it
doesn't seem entirely reasonable to eagerly break all of it.

Much more importantly, the current state of affairs is *very* good at
optimizing based upon this information, which causes failures that are
very distant from the actual enum. Before we push for enabling this by
default, I think we need to implement -fcatch-undefined-behavior support
for instrumenting and trapping whenever we store or load a value outside
of the range. That way we can track down the misbehaving code very
quickly.

I discussed this with Rafael, and currently the only important cases he
is aware of are the bool range-based optimizations which are staying
hard enabled. We've not seen any issue with those either, and they are
much more important for performance.

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

12 years agoIntroduce a new libclang API to determine the parent context of a code
Douglas Gregor [Tue, 27 Mar 2012 23:34:16 +0000 (23:34 +0000)]
Introduce a new libclang API to determine the parent context of a code
completion item. For example, if the code completion itself represents
a declaration in a namespace (say, std::vector), then this API
retrieves the cursor kind and name of the namespace (std). Implements
<rdar://problem/11121951>.

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

12 years agoIf we see '(...' where we're expecting an abstract-declarator, that doesn't
Richard Smith [Tue, 27 Mar 2012 23:05:05 +0000 (23:05 +0000)]
If we see '(...' where we're expecting an abstract-declarator, that doesn't
necessarily mean we've found a function declarator. If the next token is not
a ')', this is actually a parenthesized pack expansion.

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

12 years ago[libclang] Introduce indexing option CXIndexOpt_SuppressWarnings, which
Argyrios Kyrtzidis [Tue, 27 Mar 2012 21:38:03 +0000 (21:38 +0000)]
[libclang] Introduce indexing option CXIndexOpt_SuppressWarnings, which
disables all compiler warnings.

rdar://11059556

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