]> granicus.if.org Git - clang/log
clang
13 years agoIn Microsoft mode, allow pure specifier (=0) on inline functions declared at class...
Francois Pichet [Wed, 11 May 2011 02:14:46 +0000 (02:14 +0000)]
In Microsoft mode, allow pure specifier (=0) on inline functions declared at class scope.
This removes 2 errors when parsing MFC code with clang

Example:
class A {
    virtual void f() = 0 { }
}

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

13 years agoUse a heralded conversion to bool in inline-asm constraints.
John McCall [Tue, 10 May 2011 23:39:47 +0000 (23:39 +0000)]
Use a heralded conversion to bool in inline-asm constraints.

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

13 years agoFix crash in -Wuninitialized when using switch statments whose condition is a logical...
Ted Kremenek [Tue, 10 May 2011 22:10:35 +0000 (22:10 +0000)]
Fix crash in -Wuninitialized when using switch statments whose condition is a logical operation.

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

13 years agoTweak the diagnostics for the C++0x extensions to friend types to note
Douglas Gregor [Tue, 10 May 2011 21:23:31 +0000 (21:23 +0000)]
Tweak the diagnostics for the C++0x extensions to friend types to note
that they are C++0x extensions, and put them in the appropriate
group. We already support most of the semantics. Addresses
<rdar://problem/9407525>.

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

13 years agoChange magic string "abc" to better magic string "qux".
Matt Beaumont-Gay [Tue, 10 May 2011 20:28:29 +0000 (20:28 +0000)]
Change magic string "abc" to better magic string "qux".

Wait, what?

So, we run Clang (and LLVM) tests in an environment where the md5sum of the
input files becomes a component of the path. When testing the preprocessor,
the path becomes part of the output (in line directives). In this test, we
were grepping for the absence of "abc" in the output. When the stars aligned
properly, the md5sum component of the path contained "abc" and the test
failed. Oops.

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

13 years agoRe-do R131114 without breaking code.
Sean Hunt [Tue, 10 May 2011 19:08:14 +0000 (19:08 +0000)]
Re-do R131114 without breaking code.

I've edited one diagnostic which would print "copy constructor" for copy
constructors and "constructor" for any other constructor. If anyone is
extremely enamored with this, it can be reinstated with a simple boolean
flag rather than calling getSpecialMember, which is inappropriate.

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

13 years agoSupport pack pragma and ms_struct attributes. // rdar://8823265
Fariborz Jahanian [Tue, 10 May 2011 19:00:50 +0000 (19:00 +0000)]
Support pack pragma and ms_struct attributes. // rdar://8823265

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

13 years agoElide __label__ declarations from the CFG. This resolves a crash in CFGRecStmtDeclVi...
Ted Kremenek [Tue, 10 May 2011 18:42:15 +0000 (18:42 +0000)]
Elide __label__ declarations from the CFG.  This resolves a crash in CFGRecStmtDeclVisitor (crash in static analyzer).

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

13 years agoReimplement Sema::MatchTemplateParametersToScopeSpecifier() based on
Douglas Gregor [Tue, 10 May 2011 18:27:06 +0000 (18:27 +0000)]
Reimplement Sema::MatchTemplateParametersToScopeSpecifier() based on
the semantic context referenced by the nested-name-specifier rather
than the syntactic form of the nested-name-specifier. The previous
incarnation was based on my complete misunderstanding of C++
[temp.expl.spec]. The latest C++0x working draft clarifies the
requirements here, and this rewrite is intended to follow that.

Along the way, improve source location information in the
diagnostics. For example, if we report that a specific type needs or
doesn't need a 'template<>' header, we dig out that type in the
nested-name-specifier and highlight its range.

Fixes: PR5907, PR9421, PR8277, PR8708, PR9482, PR9668, PR9877, and
<rdar://problem/9135379>.

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

13 years agoDon't strlen() every file before parsing it.
Eli Friedman [Tue, 10 May 2011 17:11:21 +0000 (17:11 +0000)]
Don't strlen() every file before parsing it.

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

13 years agoAdd test for PR9884.
Rafael Espindola [Tue, 10 May 2011 14:19:13 +0000 (14:19 +0000)]
Add test for PR9884.

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

13 years agoRevert 131114. This fixes PR9884.
Rafael Espindola [Tue, 10 May 2011 14:12:22 +0000 (14:12 +0000)]
Revert 131114. This fixes PR9884.

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

13 years agoFixes compilation with Visual Studio by replacing the non-standard vector::data(...
Manuel Klimek [Tue, 10 May 2011 00:58:12 +0000 (00:58 +0000)]
Fixes compilation with Visual Studio by replacing the non-standard vector::data() access.

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

13 years agoFurther implement defaulting constructors.
Sean Hunt [Tue, 10 May 2011 00:49:42 +0000 (00:49 +0000)]
Further implement defaulting constructors.

Focus is on default constructors for the time being. Currently the
exception specification and prototype are processed correctly. Codegen
might work but in all likelihood doesn't.

Note that due to an error, out-of-line defaulting of member functions is
currently impossible. It will continue to that until I muster up the
courage to admit that I secretly pray to epimetheus and that I need to
rework the way default gets from Parse -> Sema.

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

13 years agoThe last of the trivial constructor changes, make CXXSpecialMember
Sean Hunt [Tue, 10 May 2011 00:41:46 +0000 (00:41 +0000)]
The last of the trivial constructor changes, make CXXSpecialMember
reflect our new, more accurate AST.

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

13 years agoAdd a __uuidof test where the uuid attribute is on the second declaration.
Francois Pichet [Tue, 10 May 2011 00:08:32 +0000 (00:08 +0000)]
Add a __uuidof test where the uuid attribute is on the second declaration.
Also some -fdelayed-template-parsing test refactoring.

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

13 years agoIgnore const/volatile/restrict qualifiers on anonymous structs and
Douglas Gregor [Mon, 9 May 2011 23:05:33 +0000 (23:05 +0000)]
Ignore const/volatile/restrict qualifiers on anonymous structs and
unions. Fixes PR8326.

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

13 years agoAdd a FIXME.
Francois Pichet [Mon, 9 May 2011 22:32:46 +0000 (22:32 +0000)]
Add a FIXME.

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

13 years ago'long long' requires special treatment in ms_struct
Fariborz Jahanian [Mon, 9 May 2011 22:03:17 +0000 (22:03 +0000)]
'long long' requires special treatment in ms_struct
structs (impacts 32-bit only though).

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

13 years agoExtend the tag-ambiguity hack I committed in r130810 for tag
Douglas Gregor [Mon, 9 May 2011 21:46:33 +0000 (21:46 +0000)]
Extend the tag-ambiguity hack I committed in r130810 for tag
definitions to also include tag declarations. Fixes PR8151.

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

13 years agoClean up trivial default constructors now.
Sean Hunt [Mon, 9 May 2011 21:45:35 +0000 (21:45 +0000)]
Clean up trivial default constructors now.

hasTrivialDefaultConstructor() really really means it now.

Also implement a fun standards bug regarding aggregates. Doug, if you'd
like, I can un-implement that bug if you think it is truly a defect.

The bug is that non-special-member constructors are never considered
user-provided, so the following is an aggregate:

struct foo {
  foo(int);
};

It's kind of bad, but the solution isn't obvious - should

struct foo {
  foo (int) = delete;
};

be an aggregate or not?

Lastly, add a missing initialization to FunctionDecl.

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

13 years agoWhen determining whether we need to instantiate a function type,
Douglas Gregor [Mon, 9 May 2011 20:45:16 +0000 (20:45 +0000)]
When determining whether we need to instantiate a function type,
also consider whether any of the parameter types (as written, prior to
decay) are dependent. Fixes PR9880 and <rdar://problem/9408413>.

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

13 years agoRename "hasTrivialConstructor" to "hasTrivialDefaultConstructor" and
Sean Hunt [Mon, 9 May 2011 18:22:59 +0000 (18:22 +0000)]
Rename "hasTrivialConstructor" to "hasTrivialDefaultConstructor" and
modify the semantics slightly to accomodate default constructors (I
hope).

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

13 years agoDriver/Darwin: Put dsymutil -o arguments first, so that dysmutil doesn't barf
Daniel Dunbar [Mon, 9 May 2011 17:23:16 +0000 (17:23 +0000)]
Driver/Darwin: Put dsymutil -o arguments first, so that dysmutil doesn't barf
when POSIXLY_COMPLIANT is set.
 - Patch by Dave Vasilevsky!

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

13 years ago__builtin_va_list is void* on ARM, not char*.
John McCall [Mon, 9 May 2011 02:19:37 +0000 (02:19 +0000)]
__builtin_va_list is void* on ARM, not char*.
rdar://problem/9391966

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

13 years agoFix test.
Francois Pichet [Sun, 8 May 2011 23:15:10 +0000 (23:15 +0000)]
Fix test.

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

13 years agoAllow implicit conversion from function pointer to void* in Microsoft mode.
Francois Pichet [Sun, 8 May 2011 22:52:41 +0000 (22:52 +0000)]
Allow implicit conversion from function pointer to void* in Microsoft mode.
Necessary to parse MFC code.

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

13 years agoMove code to emit the callee of an CXXOperatorCallExpr out into a separate function...
Anders Carlsson [Sun, 8 May 2011 20:32:23 +0000 (20:32 +0000)]
Move code to emit the callee of an CXXOperatorCallExpr out into a separate function in CGClass.cpp

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

13 years agoRestore an accidentally-deleted word.
Sean Hunt [Sun, 8 May 2011 20:15:27 +0000 (20:15 +0000)]
Restore an accidentally-deleted word.

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

13 years agoDon't emit complete constructors for abstract classes. Also, don't emit
Anders Carlsson [Sun, 8 May 2011 17:25:05 +0000 (17:25 +0000)]
Don't emit complete constructors for abstract classes. Also, don't emit
complete destructors for abstract classes unless the destructor is virtual
and thus needs to be in the vtable.

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

13 years agoLook at all the record redeclaration when looking for a uuid attribute.
Francois Pichet [Sun, 8 May 2011 10:02:20 +0000 (10:02 +0000)]
Look at all the record redeclaration when looking for a uuid attribute.

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

13 years agoRelax the conversion rules for Objective-C GC qualifiers a
Douglas Gregor [Sun, 8 May 2011 06:09:53 +0000 (06:09 +0000)]
Relax the conversion rules for Objective-C GC qualifiers a
bit by allowing __weak and __strong to be added/dropped as part of
implicit conversions (qualification conversions in C++). A little
history: GCC lets one add/remove/change GC qualifiers just about
anywhere, implicitly. Clang did roughly the same before, but we
recently normalized the semantics of qualifiers across the board to
get a semantics that we could reason about (yay). Unfortunately, this
tightened the screws a bit too much for GC qualifiers, where it's
common to add/remove these qualifiers at will.

Overall, we're still in better shape than we were before: we don't
permit directly changing the GC qualifier (e.g., __weak -> __strong),
so type safety is improved. More importantly, we're internally
consistent in our handling of qualifiers, and the logic that allows
adding/removing GC qualifiers (but not adding/removing address
spaces!) only touches two obvious places.

Fixes <rdar://problem/9402499>.

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

13 years agoIn C++, allow us to emit a global as 'constant' even if it has class
Douglas Gregor [Sat, 7 May 2011 22:06:45 +0000 (22:06 +0000)]
In C++, allow us to emit a global as 'constant' even if it has class
type, so long as it is known to have a constant initializer and the
class type is a POD class. Fixes <rdar://problem/9306265>.

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

13 years agoRevert r130717, which caused a regression (<rdar://problem/9402621>).
Douglas Gregor [Sat, 7 May 2011 20:12:26 +0000 (20:12 +0000)]
Revert r130717, which caused a regression (<rdar://problem/9402621>).

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

13 years agoDon't fail at parsing __declspec(property(get=get_func_name)). Just skip everything...
Francois Pichet [Sat, 7 May 2011 19:04:49 +0000 (19:04 +0000)]
Don't fail at parsing __declspec(property(get=get_func_name)). Just skip everything inside property() for now while we wait for the BoostPro people to provide a complete patch.

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

13 years agoPR9866: Fix the implementation of _mm_loadl_pd and _mm_loadh_pd to not make
Eli Friedman [Sat, 7 May 2011 18:59:31 +0000 (18:59 +0000)]
PR9866: Fix the implementation of _mm_loadl_pd and _mm_loadh_pd to not make
bad assumptions about the alignment of the double* argument.

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

13 years agoTemporary preprocessor hack to get around the Microsoft __identifier(x) extension.
Francois Pichet [Sat, 7 May 2011 17:47:38 +0000 (17:47 +0000)]
Temporary preprocessor hack to get around the Microsoft __identifier(x) extension.
http://msdn.microsoft.com/en-us/library/hzc8ytsz(v=VS.100).aspx

Microsoft doc claims this is a C++/CLI feature but it is really always enabled.
This removes 2 error when parsing MFC code with clang.

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

13 years agoAdd support for _if_exists and __if_not_exists at namespace/global scope.
Francois Pichet [Sat, 7 May 2011 17:30:27 +0000 (17:30 +0000)]
Add support for _if_exists and __if_not_exists at namespace/global scope.

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

13 years agoPatch for PR 7409 - only error on definition of invalid typedefs. Suppress errors...
Richard Trieu [Sat, 7 May 2011 01:36:37 +0000 (01:36 +0000)]
Patch for PR 7409 - only error on definition of invalid typedefs.  Suppress errors for additional uses of this invalid typedef.

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

13 years agoImplement a minor optimization by not introducing declarations into
Douglas Gregor [Fri, 6 May 2011 23:32:38 +0000 (23:32 +0000)]
Implement a minor optimization by not introducing declarations into
DeclContext's lookup table when they aren't in any identifier namespace.

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

13 years agoWhen checking for a prior declaration of the name of a namespace, skip
Douglas Gregor [Fri, 6 May 2011 23:28:47 +0000 (23:28 +0000)]
When checking for a prior declaration of the name of a namespace, skip
any names that aren't in the appropriate identifier namespaces. Fixes
an embarrassing bug where we give a redefinition error due to an
Objective-C category (<rdar://problem/9388207>).

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

13 years agoIn ms_struct structs, Establish a new alignment for a
Fariborz Jahanian [Fri, 6 May 2011 22:42:22 +0000 (22:42 +0000)]
In ms_struct structs, Establish a new alignment for a
non-bitfield following a bitfield if size of their types differ.

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

13 years agoEstablish a new alignment for an ms_struct bitfield following
Fariborz Jahanian [Fri, 6 May 2011 21:56:12 +0000 (21:56 +0000)]
Establish a new alignment for an ms_struct bitfield following
a non-bitfield if size of their types differ.

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

13 years agoKeep track of the file ID corresponding to the original file used to
Douglas Gregor [Fri, 6 May 2011 21:43:30 +0000 (21:43 +0000)]
Keep track of the file ID corresponding to the original file used to
build a precompiled header. Use this information to eliminate the call
to SourceManager::getLocation() while loading a precompiled preamble,
since SourceManager::getLocation() itself causes unwanted
deserialization.

Fixed <rdar://problem/9399352>.

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

13 years agoFix false positive warning about uninitialized variable.
Cameron Esfahani [Fri, 6 May 2011 21:28:42 +0000 (21:28 +0000)]
Fix false positive warning about uninitialized variable.

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

13 years agoPer Richard's suggestion, rename DefLoc to DefaultLoc where it appears.
Sean Hunt [Fri, 6 May 2011 21:24:28 +0000 (21:24 +0000)]
Per Richard's suggestion, rename DefLoc to DefaultLoc where it appears.

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

13 years agoFix diagnostics to start with a lower case letter
Sean Hunt [Fri, 6 May 2011 21:15:01 +0000 (21:15 +0000)]
Fix diagnostics to start with a lower case letter

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

13 years agoAdd support for Microsoft __if_exists and __if_not_exists construct inside function...
Francois Pichet [Fri, 6 May 2011 20:48:22 +0000 (20:48 +0000)]
Add support for Microsoft __if_exists and __if_not_exists construct inside function definition.
Allow to include or exclude code depending on if a symbol exists or not. Just like a #ifdef but for C/C++ symbols.

More doc: http://msdn.microsoft.com/en-us/library/x7wy9xh3(v=VS.100).aspx

Support at class and namespace scopes will be added later.

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

13 years agoModify some deleted function methods to better reflect reality:
Sean Hunt [Fri, 6 May 2011 20:44:56 +0000 (20:44 +0000)]
Modify some deleted function methods to better reflect reality:

 - New isDefined() function checks for deletedness
 - isThisDeclarationADefinition checks for deletedness
 - New doesThisDeclarationHaveABody() does what
   isThisDeclarationADefinition() used to do
 - The IsDeleted bit is not propagated across redeclarations
 - isDeleted() now checks the canoncial declaration
 - New isDeletedAsWritten() does what it says on the tin.
 - isUserProvided() now correct (thanks Richard!)

This fixes the bug that we weren't catching

void foo() = delete;
void foo() {}

as being a redefinition.

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

13 years agoDon't emit nsw flags for vector operations; there's basically no benefit, and a lot...
Eli Friedman [Fri, 6 May 2011 18:04:18 +0000 (18:04 +0000)]
Don't emit nsw flags for vector operations; there's basically no benefit, and a lot of downside (like PR9850, which is about clang's xmmintrin.h making an unexpected transformation on an expression involving _mm_add_epi32).

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

13 years agoFix a couple of comments.
Eli Friedman [Fri, 6 May 2011 17:34:05 +0000 (17:34 +0000)]
Fix a couple of comments.

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

13 years agoAdd an implementation of thunks for varargs methods. The implementation is a bit...
Eli Friedman [Fri, 6 May 2011 17:27:27 +0000 (17:27 +0000)]
Add an implementation of thunks for varargs methods.  The implementation is a bit messy, but it is correct as long as the method in question doesn't use indirect gotos.  A couple of possible alternative implementations are outlined in FIXME's in this patch. rdar://problem/8077308 .

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

13 years agoIntroduce a new libclang parsing flag,
Douglas Gregor [Fri, 6 May 2011 16:33:08 +0000 (16:33 +0000)]
Introduce a new libclang parsing flag,
CXTranslationUnit_NestedMacroInstantiations, which indicates whether
we want to see "nested" macro instantiations (e.g., those that occur
inside other macro instantiations) within the detailed preprocessing
record. Many clients (e.g., those that only care about visible tokens)
don't care about this information, and in code that uses preprocessor
metaprogramming, this information can have a very high cost.

Addresses <rdar://problem/9389320>.

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

13 years agoReset the emitted initializers.
Axel Naumann [Fri, 6 May 2011 15:24:04 +0000 (15:24 +0000)]
Reset the emitted initializers.
This enables incremental codegen, where the initializer array can be removed from the module, such that only new initializers will be emitted and run.

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

13 years agoMove logic for passing down -mrelax-all / -relax-all into a common
Joerg Sonnenberger [Fri, 6 May 2011 14:35:16 +0000 (14:35 +0000)]
Move logic for passing down -mrelax-all / -relax-all into a common
function. Extend the logic to check if the input was compiled.
Use -relax-all as default only if -O0 is used for compilation.
Fixes bug 9290.

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

13 years agoWarn when trying to call a pure virtual member function in a class from the class...
Anders Carlsson [Fri, 6 May 2011 14:25:31 +0000 (14:25 +0000)]
Warn when trying to call a pure virtual member function in a class from the class constructor/destructor. Fixes PR7966.

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

13 years agoRename ContainsCompileAction to ContainsCompileOrAssembleAction to
Joerg Sonnenberger [Fri, 6 May 2011 14:05:11 +0000 (14:05 +0000)]
Rename ContainsCompileAction to ContainsCompileOrAssembleAction to
properly reflect its behavior.

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

13 years agoDo defaulted constructors properly.
Sean Hunt [Fri, 6 May 2011 01:42:00 +0000 (01:42 +0000)]
Do defaulted constructors properly.

Explictly defaultedness is correctly reflected on the AST, but there are
no changes to how that affects the definition of functions or much else
really.

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

13 years agoRevert r130912 in order to approach defaulted functions from the other
Sean Hunt [Fri, 6 May 2011 00:11:07 +0000 (00:11 +0000)]
Revert r130912 in order to approach defaulted functions from the other
direction and not introduce things in the wrong place three different
times.

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

13 years agoSlight tweak to alias template error handling: don't guess that a template-id in...
Richard Smith [Thu, 5 May 2011 22:36:10 +0000 (22:36 +0000)]
Slight tweak to alias template error handling: don't guess that a template-id in an alias declaration was meant to be a specialization. Use a generic, but more accurate, diagnostic.

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

13 years agoUpdate www: we now mangle references to function parameters properly. Also, this...
Richard Smith [Thu, 5 May 2011 22:07:51 +0000 (22:07 +0000)]
Update www: we now mangle references to function parameters properly. Also, this is really more a decltype issue rather than a late-specified return type issue.

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

13 years agotype of last arg of objc_assign_ivar is ptrdiff_t.
Fariborz Jahanian [Thu, 5 May 2011 22:00:38 +0000 (22:00 +0000)]
type of last arg of objc_assign_ivar is  ptrdiff_t.
// rdar://9362887

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

13 years agoImplement support for C++0x alias templates.
Richard Smith [Thu, 5 May 2011 21:57:07 +0000 (21:57 +0000)]
Implement support for C++0x alias templates.

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

13 years ago__alignof attribute on the field must consider
Fariborz Jahanian [Thu, 5 May 2011 21:19:14 +0000 (21:19 +0000)]
__alignof attribute on the field must consider
packed attribute on the field. //rdar://9217290

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

13 years agoWhen the environment variable LIBCLANG_RESOURCE_USAGE is set, teach
Douglas Gregor [Thu, 5 May 2011 20:27:22 +0000 (20:27 +0000)]
When the environment variable LIBCLANG_RESOURCE_USAGE is set, teach
libclang to emit information about resource usage after parsing, code
completion, etc.

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

13 years agoPR9849: Fix _mm_setr_pi32 and friends to actually work correctly. They broke with...
Eli Friedman [Thu, 5 May 2011 20:21:54 +0000 (20:21 +0000)]
PR9849: Fix _mm_setr_pi32 and friends to actually work correctly.  They broke with the MMX rewrite a while back.

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

13 years agotests: Force a triple in this test (so uint128 is present).
Daniel Dunbar [Thu, 5 May 2011 18:54:06 +0000 (18:54 +0000)]
tests: Force a triple in this test (so uint128 is present).

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

13 years agoWhen instantiating a block expression, the instantiated
Fariborz Jahanian [Thu, 5 May 2011 17:18:12 +0000 (17:18 +0000)]
When instantiating a block expression, the instantiated
blockScopeInfo's CapturesCXXThis field need get set as
well. // rdar://9362021. John M. please review.

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

13 years agoDo not drop uint128 on the floor.
Devang Patel [Thu, 5 May 2011 17:06:30 +0000 (17:06 +0000)]
Do not drop uint128 on the floor.

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

13 years agoScoped enumerations should not be treated as integer types (in the C
Douglas Gregor [Thu, 5 May 2011 16:13:52 +0000 (16:13 +0000)]
Scoped enumerations should not be treated as integer types (in the C
sense). Fixes <rdar://problem/9366066> by eliminating an inconsistency
between C++ overloading (which handled scoped enumerations correctly)
and C binary operator type-checking (which didn't).

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

13 years agoWhen providing code completions for an Objective-C property access,
Douglas Gregor [Thu, 5 May 2011 15:50:42 +0000 (15:50 +0000)]
When providing code completions for an Objective-C property access,
also include methods with zero-argument selectors. Implements
<rdar://problem/9048332>.

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

13 years agoIntroduce a Diagnostic::Report function that accepts and emits a StoredDiagnostic.
Argyrios Kyrtzidis [Thu, 5 May 2011 07:54:59 +0000 (07:54 +0000)]
Introduce a Diagnostic::Report function that accepts and emits a StoredDiagnostic.

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

13 years agoPlace "incompatible pointer types assigning..." warning under a flag, allowing it...
Ted Kremenek [Thu, 5 May 2011 04:37:05 +0000 (04:37 +0000)]
Place "incompatible pointer types assigning..." warning under a flag, allowing it to be surgically mapped to an error.

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

13 years agoAdd Checker callback for running a checker at the end of processing an entire Transla...
Ted Kremenek [Thu, 5 May 2011 03:41:17 +0000 (03:41 +0000)]
Add Checker callback for running a checker at the end of processing an entire TranslationUnit.  Patch by Lei Zhang.

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

13 years agoImplement some framework for defaulted constructors.
Sean Hunt [Thu, 5 May 2011 03:36:28 +0000 (03:36 +0000)]
Implement some framework for defaulted constructors.

There's some unused stuff for now.

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

13 years agoFrontend: Fix a crash in CC_LOG_DIAGNOSTICS handling.
Daniel Dunbar [Thu, 5 May 2011 02:12:02 +0000 (02:12 +0000)]
Frontend: Fix a crash in CC_LOG_DIAGNOSTICS handling.

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

13 years agoLook through block pointers and ObjC object pointers
Matt Beaumont-Gay [Thu, 5 May 2011 00:59:35 +0000 (00:59 +0000)]
Look through block pointers and ObjC object pointers

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

13 years agoWith invalid overloaded operators, we can get into funny cases where
Douglas Gregor [Thu, 5 May 2011 00:13:13 +0000 (00:13 +0000)]
With invalid overloaded operators, we can get into funny cases where
the overloading of member and non-member functions results in arity
mismatches that don't fit well into our overload-printing scheme. This
only happens for invalid code (which breaks the arity invariants for
these cases), so just suppress the diagnostic rather than inventing
anything new. Fixes <rdar://problem/9222009>.

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

13 years agoPreserve the full name of the file, so that '-c -o foo.pic.o' produces
Nick Lewycky [Thu, 5 May 2011 00:08:20 +0000 (00:08 +0000)]
Preserve the full name of the file, so that '-c -o foo.pic.o' produces
foo.pic.gcno instead of foo.gcno.

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

13 years agoChange cycle detection to be based off of a warning flag.
Sean Hunt [Thu, 5 May 2011 00:05:47 +0000 (00:05 +0000)]
Change cycle detection to be based off of a warning flag.

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

13 years agoWhen adding KVC code completions, keep track of all of the selectors
Douglas Gregor [Wed, 4 May 2011 23:50:46 +0000 (23:50 +0000)]
When adding KVC code completions, keep track of all of the selectors
that we've previously seen, both in declared methods and from previous
KVC completions, to eliminate duplicates. Fixes <rdar://problem/9162207>.

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

13 years agothere i fixed it
Sean Hunt [Wed, 4 May 2011 23:29:54 +0000 (23:29 +0000)]
there i fixed it

Increase robustness of the delegating constructor cycle detection
mechanism. No more infinite loops on invalid or logic errors leading to
false results. Ensure that this is maintained correctly accross
serialization.

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

13 years agoASTUnit::LoadFromASTFile(): recover the resources from an ASTReader if it crashes...
Ted Kremenek [Wed, 4 May 2011 23:27:12 +0000 (23:27 +0000)]
ASTUnit::LoadFromASTFile(): recover the resources from an ASTReader if it crashes during PCH validation.

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

13 years agoClean up Sema::BuildCXXNestedNameSpecifier()'s creation of TypeLoc
Douglas Gregor [Wed, 4 May 2011 23:05:40 +0000 (23:05 +0000)]
Clean up Sema::BuildCXXNestedNameSpecifier()'s creation of TypeLoc
information. Rather than looking at the declaration kind to figure out
what TypeLoc to build, look at the type; it makes so much more
sense. Fixes <rdar://problem/9086649>.

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

13 years agoImplement Sema::isExprCallable.
Matt Beaumont-Gay [Wed, 4 May 2011 22:10:40 +0000 (22:10 +0000)]
Implement Sema::isExprCallable.

We can use this to produce nice diagnostics (and try to fixit-and-recover) in
various cases where we might see "MyFunction" instead of "MyFunction()". The
changes in SemaExpr are an example of how to use isExprCallable.

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

13 years agoWhen converting an integral template argument value to a non-type
Douglas Gregor [Wed, 4 May 2011 21:55:00 +0000 (21:55 +0000)]
When converting an integral template argument value to a non-type
template parameter of type 'bool', force the value to be zero or
one. Fixes <rdar://problem/9169404>.

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

13 years agoPack ivar offsets together.
Bill Wendling [Wed, 4 May 2011 21:37:25 +0000 (21:37 +0000)]
Pack ivar offsets together.

Ivar offsets for synthesized ivars are wrong, which could end up with a large
number of dirty pages because of ivar fixups at runtime. When we pack all of the
synthesized ivars into the same section, it limits the number of dirty pages
created. Place them in the "__DATA,__objc_ivar" section.
<rdar://problem/9374905>

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

13 years agoRecord where the GCOV data files should be placed.
Nick Lewycky [Wed, 4 May 2011 20:46:58 +0000 (20:46 +0000)]
Record where the GCOV data files should be placed.

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

13 years agoSimplification noticed by Chris.
Bill Wendling [Wed, 4 May 2011 20:28:12 +0000 (20:28 +0000)]
Simplification noticed by Chris.

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

13 years agotests: Tweak test to at least use a standard arch, to ensure we try to invoke
Daniel Dunbar [Wed, 4 May 2011 19:52:08 +0000 (19:52 +0000)]
tests: Tweak test to at least use a standard arch, to ensure we try to invoke
Clang.

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

13 years agoAnd a test case for my last patch.
Fariborz Jahanian [Wed, 4 May 2011 18:58:27 +0000 (18:58 +0000)]
And a test case for my last patch.

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

13 years agoMore ms_struct bitfield stuff:
Fariborz Jahanian [Wed, 4 May 2011 18:51:37 +0000 (18:51 +0000)]
More ms_struct bitfield stuff:
Adjacent bit fields are packed into the same 1-, 2-, or
4-byte allocation unit if the integral types are the same
size. // rdar://8823265.

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

13 years agoChange test/PCH/cxx-static_assert.cpp so that it doesn't need a separate header.
Argyrios Kyrtzidis [Wed, 4 May 2011 14:58:28 +0000 (14:58 +0000)]
Change test/PCH/cxx-static_assert.cpp so that it doesn't need a separate header.

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

13 years agoFrom Vassil Vassilev:
Axel Naumann [Wed, 4 May 2011 12:59:24 +0000 (12:59 +0000)]
From Vassil Vassilev:
Like in r126648, provide (empty) default implementation for pure virtual getMemoryBufferSizes(). Not all use cases have meaningful implementations.

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

13 years agoAdd C++ include paths for libstdc++ with Ubuntu 11.04 and Debian's libstdc++6-4.5...
Axel Naumann [Wed, 4 May 2011 09:25:56 +0000 (09:25 +0000)]
Add C++ include paths for libstdc++ with Ubuntu 11.04 and Debian's libstdc++6-4.5, as collected from http://packages.ubuntu.com/search?mode=exactfilename&suite=natty&section=all&arch=any&searchon=contents&keywords=c%2B%2Blocale.h and http://packages.debian.org/wheezy/armel/libstdc++6-4.5-dev/filelist
Fixes compilation with clang++ on Ubuntu 11.04.

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

13 years agoImplement a better version of delegating constructor cycle detection.
Sean Hunt [Wed, 4 May 2011 05:57:24 +0000 (05:57 +0000)]
Implement a better version of delegating constructor cycle detection.

This is more efficient as it's all done at once at the end of the TU.
This could still get expensive, so a flag is provided to disable it. As
an added bonus, the diagnostics will now print out a cycle.

The PCH test is XFAILed because we currently can't deal with a note
emitted in the header and I, being tired, see no other way to verify the
serialization of delegating constructors. We should probably address
this problem /somehow/ but no good solution comes to mind.

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

13 years agoNo, fix this use after free properly.
Nick Lewycky [Wed, 4 May 2011 03:44:01 +0000 (03:44 +0000)]
No, fix this use after free properly.

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

13 years agoConvert the non-temporal store builtins to LLVM-native IR.
Bill Wendling [Wed, 4 May 2011 02:40:38 +0000 (02:40 +0000)]
Convert the non-temporal store builtins to LLVM-native IR.

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

13 years agoFix use after free through StringRef.
Nick Lewycky [Wed, 4 May 2011 02:06:19 +0000 (02:06 +0000)]
Fix use after free through StringRef.

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

13 years agoType prefixes of unresolved-names should only be mangled as unresolved-types
John McCall [Wed, 4 May 2011 01:45:19 +0000 (01:45 +0000)]
Type prefixes of unresolved-names should only be mangled as unresolved-types
if they match that production, i.e. if they're template type parameters
or decltypes (or, as an obvious case not yet described in the ABI document,
if they're template template parameters applied to template arguments).

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