]> granicus.if.org Git - clang/log
clang
13 years agoSet the native EOL property on this now that I've fixed it. Fixing some other
Chandler Carruth [Mon, 25 Apr 2011 06:55:34 +0000 (06:55 +0000)]
Set the native EOL property on this now that I've fixed it. Fixing some other
instances of this momentarily.

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

13 years agot/clang/expr-traits
John Wiegley [Mon, 25 Apr 2011 06:54:41 +0000 (06:54 +0000)]
t/clang/expr-traits

Patch authored by David Abrahams.

These two expression traits (__is_lvalue_expr, __is_rvalue_expr) are used for
parsing code that employs certain features of the Embarcadero C++ compiler.

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

13 years agoRemove hard coded dos line endings, let subversion translate them on
Chandler Carruth [Mon, 25 Apr 2011 06:34:35 +0000 (06:34 +0000)]
Remove hard coded dos line endings, let subversion translate them on
update.

Despite the diff, nothing but line endings changed here.

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

13 years agoLet clang detect gcc triple on Ubuntu Natty. Patch by Thomas Jablin.
Nico Weber [Mon, 25 Apr 2011 03:17:35 +0000 (03:17 +0000)]
Let clang detect gcc triple on Ubuntu Natty. Patch by Thomas Jablin.

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

13 years agoMissing bit of r130117.
Eli Friedman [Sun, 24 Apr 2011 22:31:41 +0000 (22:31 +0000)]
Missing bit of r130117.

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

13 years agoPR4304: Add warning for designators in strict c89 mode.
Eli Friedman [Sun, 24 Apr 2011 22:14:22 +0000 (22:14 +0000)]
PR4304: Add warning for designators in strict c89 mode.

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

13 years agoUse template magic to make dumping of vectors slightly less fragile.
Benjamin Kramer [Sun, 24 Apr 2011 17:44:50 +0000 (17:44 +0000)]
Use template magic to make dumping of vectors slightly less fragile.

No intended functionality change.

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

13 years agoConvert size and alignment variables to CharUnits in EmitAggregateCopy(). No
Ken Dyck [Sun, 24 Apr 2011 17:37:26 +0000 (17:37 +0000)]
Convert size and alignment variables to CharUnits in EmitAggregateCopy(). No
change in functionality intended.

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

13 years agoConvert type size and alignment to CharUnits in CheckAggExprForMemSetUse().
Ken Dyck [Sun, 24 Apr 2011 17:25:32 +0000 (17:25 +0000)]
Convert type size and alignment to CharUnits in CheckAggExprForMemSetUse().
No change in functionality intended.

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

13 years agoConvert the return type of GetNumNonZeroBytesInInit() to CharUnits. No
Ken Dyck [Sun, 24 Apr 2011 17:17:56 +0000 (17:17 +0000)]
Convert the return type of GetNumNonZeroBytesInInit() to CharUnits. No
change in functionality intended.

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

13 years agoEliminate some literal 8s by converting size variables in EmitGCMove() and
Ken Dyck [Sun, 24 Apr 2011 17:08:00 +0000 (17:08 +0000)]
Eliminate some literal 8s by converting size variables in EmitGCMove() and
EmitFinalDestCopy() to CharUnits. No change in functionality intended.

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

13 years agoReplace calls to ASTContext::getTypeInfo() with calls to
Ken Dyck [Sun, 24 Apr 2011 17:02:38 +0000 (17:02 +0000)]
Replace calls to ASTContext::getTypeInfo() with calls to
ASTContext::getTypeSize() when only the size part is used. No change in
functionality intended.

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

13 years agoSimplify AppendTailPadding() by converting its parameter to CharUnits. No
Ken Dyck [Sun, 24 Apr 2011 16:53:44 +0000 (16:53 +0000)]
Simplify AppendTailPadding() by converting its parameter to CharUnits. No
change in functionality intended.

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

13 years agoEliminate literal 8s from LayoutUnionField by converting NumBytesToAppend to
Ken Dyck [Sun, 24 Apr 2011 16:47:33 +0000 (16:47 +0000)]
Eliminate literal 8s from LayoutUnionField by converting NumBytesToAppend to
CharUnits. No change in functionality intended.

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

13 years agoEliminate literal 8s from LayoutBitField(), converting variables to
Ken Dyck [Sun, 24 Apr 2011 16:40:29 +0000 (16:40 +0000)]
Eliminate literal 8s from LayoutBitField(), converting variables to
CharUnits or replacing the 8s with char align. No change in functionality
intended.

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

13 years agoSet the correct anonymous namespace (must be last reopening), and behave correctly...
Sebastian Redl [Sun, 24 Apr 2011 16:28:21 +0000 (16:28 +0000)]
Set the correct anonymous namespace (must be last reopening), and behave correctly in the presence of the ever-annoying linkage specifications.

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

13 years agoFix adding an anonymous namespace in a chained PCH to a namespace from a previous...
Sebastian Redl [Sun, 24 Apr 2011 16:28:13 +0000 (16:28 +0000)]
Fix adding an anonymous namespace in a chained PCH to a namespace from a previous PCH.
Fix anonymous namespaces in PCH.

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

13 years agoSynthesizing the definition of an implicit member is an AST modification, so notify...
Sebastian Redl [Sun, 24 Apr 2011 16:28:06 +0000 (16:28 +0000)]
Synthesizing the definition of an implicit member is an AST modification, so notify any mutation listeners of it. This fixes a crasher in chained PCH, where an implicit destructor in a PCH gets a definition in a chained PCH, which is then lost. However, any further use of the destructor would cause its definition to be regenerated in the final file, hiding the bug.

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

13 years agoOn reading DeclContexts from PCH, check for visible updates even if the context was...
Sebastian Redl [Sun, 24 Apr 2011 16:27:54 +0000 (16:27 +0000)]
On reading DeclContexts from PCH, check for visible updates even if the context was empty in the original version. Also, if there are any, tell the context that it has external visible decls. This fixes the problem that a namespace that was empty in the initial PCH (could also happen if the initial PCH didn't include any std header but caused implicit creation of namespace std, e.g. due to implicit declaration of a virtual destructor) never found any declaration declared in *any* chained PCH. Very ugly when the chained PCH includes all that std stuff, as the errors were effectively the same as not including std headers.

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

13 years agoMake the invalid declarator recovery when parsing members work the same as when parsi...
Sebastian Redl [Sun, 24 Apr 2011 16:27:48 +0000 (16:27 +0000)]
Make the invalid declarator recovery when parsing members work the same as when parsing global decls. It's still rather broken (skipping much too far when the declarator belongs to a function definition), but at least not so broken as to mismatch braces. Tested by the removal of the fixme in the template test case.

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

13 years agoGive MultiplexConsumer.h a header guard.
Sebastian Redl [Sun, 24 Apr 2011 16:27:41 +0000 (16:27 +0000)]
Give MultiplexConsumer.h a header guard.

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

13 years agoFix PathDiagnosticClients.h header guard. (Case error)
Sebastian Redl [Sun, 24 Apr 2011 16:27:36 +0000 (16:27 +0000)]
Fix PathDiagnosticClients.h header guard. (Case error)

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

13 years agoStore the full list of pending instantiations in a chained PCH. Previously we attempt...
Sebastian Redl [Sun, 24 Apr 2011 16:27:30 +0000 (16:27 +0000)]
Store the full list of pending instantiations in a chained PCH. Previously we attempted to store only new pending instantiations, but our filter was incorrect, dropping implicit instantiations of class template members. It's just not worth coming up with a complex filter that is correct, when the only cost is PCH files that are a few hundred bytes (at most) larger.

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

13 years agoDowngrade unnecessary "typename" from error to warning in Microsoft mode.
Francois Pichet [Sun, 24 Apr 2011 11:24:13 +0000 (11:24 +0000)]
Downgrade unnecessary "typename" from error to warning in Microsoft mode.
This fixes 1 error when parsing MSVC 2008 headers with clang.

Must "return true;" even if it is a warning because the rest of the code path assumes that SS is set to something. The parser will get back on its feet and continue parsing the rest of the declaration correctly so it is not a problem.

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

13 years agoConvert AccessInfo::AccessAlignment to CharUnits. No change in functionality
Ken Dyck [Sun, 24 Apr 2011 10:13:17 +0000 (10:13 +0000)]
Convert AccessInfo::AccessAlignment to CharUnits. No change in functionality
intended.

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

13 years agoPR9214: Convert the DIBuilder API to use ArrayRef.
Jay Foad [Sun, 24 Apr 2011 10:11:03 +0000 (10:11 +0000)]
PR9214: Convert the DIBuilder API to use ArrayRef.

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

13 years agoConvert CGBitFieldInfo::FieldByteOffset to CharUnits. No change in
Ken Dyck [Sun, 24 Apr 2011 10:04:59 +0000 (10:04 +0000)]
Convert CGBitFieldInfo::FieldByteOffset to CharUnits. No change in
functionality intended.

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

13 years agoGCC seems to create address-of expression manglings when passing *any*
John McCall [Sun, 24 Apr 2011 08:43:07 +0000 (08:43 +0000)]
GCC seems to create address-of expression manglings when passing *any*
function as a template argument where a pointer to function is wanted.
Just extend the existing hack.

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

13 years agoUpdate the mangler for some of the "new" unresolved-name manglings.
John McCall [Sun, 24 Apr 2011 08:23:24 +0000 (08:23 +0000)]
Update the mangler for some of the "new" unresolved-name manglings.
I've sent off an email requesting clarification on a few things that
I wasn't sure how to handle.

This also necessitated making prefixes and unresolved-prefixes get
mangled separately.

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

13 years agoImplement a new identifier-classification scheme where Sema
Douglas Gregor [Sun, 24 Apr 2011 05:37:28 +0000 (05:37 +0000)]
Implement a new identifier-classification scheme where Sema
performs name lookup for an identifier and resolves it to a
type/expression/template/etc. in the same step. This scheme is
intended to improve both performance (by reducing the number of
redundant name lookups for a given identifier token) and error
recovery (by giving Sema a chance to correct type names before the
parser has decided that the identifier isn't a type name). For
example, this allows us to properly typo-correct type names at the
beginning of a statement:

t.c:6:3: error: use of undeclared identifier 'integer'; did you mean
'Integer'?
  integer *i = 0;
  ^~~~~~~
  Integer
t.c:1:13: note: 'Integer' declared here
typedef int Integer;
            ^

Previously, we wouldn't give a Fix-It because the typo correction
occurred after the parser had checked whether "integer" was a type
name (via Sema::getTypeName(), which isn't allowed to typo-correct)
and therefore decided to parse "integer * i = 0" as an expression. By
typo-correcting earlier, we typo-correct to the type name Integer and
parse this as a declaration.

Moreover, in this context, we can also typo-correct identifiers to
keywords, e.g.,

t.c:7:3: error: use of undeclared identifier 'vid'; did you mean
'void'?
  vid *p = i;
  ^~~
  void

and recover appropriately.

Note that this is very much a work-in-progress. The new
Sema::ClassifyName is only used for expression-or-declaration
disambiguation in C at the statement level. The next steps will be to
make this work for the same disambiguation in C++ (where
functional-style casts make some trouble), then push it
further into the parser to eliminate more redundant name lookups.

Fixes <rdar://problem/7963833> for C and starts us down the path of
<rdar://problem/8172000>.

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

13 years agoThe ABI settled on mangling float literals with lowercase hex dumps.
John McCall [Sun, 24 Apr 2011 03:07:16 +0000 (03:07 +0000)]
The ABI settled on mangling float literals with lowercase hex dumps.
APInt::toString doesn't do those, but it's easy to postprocess that output,
and that's probably better than adding another knob to that method.

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

13 years agoPut -Wunneeded-internal-declaration under UnusedFunction group so it will be disabled...
Argyrios Kyrtzidis [Sun, 24 Apr 2011 02:56:06 +0000 (02:56 +0000)]
Put -Wunneeded-internal-declaration under UnusedFunction group so it will be disabled with -Wno-unused-function.

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

13 years agoImplement most of the remaining logic in __is_literal type trait. This
Chandler Carruth [Sun, 24 Apr 2011 02:49:34 +0000 (02:49 +0000)]
Implement most of the remaining logic in __is_literal type trait. This
should now support all of the C++98 types, and all of the C++0x types
Clang supports.

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

13 years agoAdd support for '__is_literal_type' spelling of the existing
Chandler Carruth [Sun, 24 Apr 2011 02:49:28 +0000 (02:49 +0000)]
Add support for '__is_literal_type' spelling of the existing
'__is_literal' type trait for GCC compatibility. At least one relased
version if libstdc++ uses this name for the trait despite it not being
documented anywhere.

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

13 years agoBegin tracking trivialness of move constructors and move assignment
Chandler Carruth [Sat, 23 Apr 2011 23:10:33 +0000 (23:10 +0000)]
Begin tracking trivialness of move constructors and move assignment
operators in C++ record declarations.

This patch starts off by updating a bunch of the standard citations to
refer to the draft 0x standard so that the semantics intended for move
varianst is clear. Where necessary these are duplicated so they'll be
available in doxygen.

It adds bit fields to keep track of the state for the move constructs,
and updates all the code necessary to track this state (I think) as
members are declared for a class. It also wires the state into the
various trait-like accessors in the AST's API, and tests that the type
trait expressions now behave correctly in the presence of move
constructors and move assignment operators.

This isn't complete yet due to these glaring FIXMEs:
1) No synthesis of implicit move constructors or assignment operators.
2) I don't think we correctly enforce the new logic for both copy and
   move trivial checks: that the *selected* copy/move
   constructor/operator is trivial. Currently this requires *all* of them
   to be trivial.
3) Some of the trait logic needs to be folded into the fine-grained
   trivial bits to more closely match the wording of the standard. For
   example, many of the places we currently set a bit to track POD-ness
   could be removed by querying other more fine grained traits on
   demand.

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

13 years agoFlesh out these tests just a tad more. This provides targeted
Chandler Carruth [Sat, 23 Apr 2011 21:02:37 +0000 (21:02 +0000)]
Flesh out these tests just a tad more. This provides targeted
'DerivesHasFoo' types for various non-POD constructs in the base class.
Only __is_pod and __is_trivial are wired up to these, not sure how much
more of this type of exhaustive testing is really interesting.

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

13 years agoTest POD and trivial type traits given a class derived from a generic
Chandler Carruth [Sat, 23 Apr 2011 20:51:42 +0000 (20:51 +0000)]
Test POD and trivial type traits given a class derived from a generic
non-POD type.

It might be nicer to have a Derives* variant for each of HasCons,
HasCopy, etc. Then we could test each of those and also test the __has_*
traits. WIP.

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

13 years agoUse a more precise name for some of the types here, and re-group several
Chandler Carruth [Sat, 23 Apr 2011 20:51:39 +0000 (20:51 +0000)]
Use a more precise name for some of the types here, and re-group several
of the tests using those types to have a (hopefully) more logical
ordering now that doing so doesn't cause unreadable deltas of counters
changing.

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

13 years agoMechanical change moving all of the test statements away from a pattern
Chandler Carruth [Sat, 23 Apr 2011 20:51:37 +0000 (20:51 +0000)]
Mechanical change moving all of the test statements away from a pattern
that requires needless noise in every patch (due to numbers changing) or
poorly grouped test cases in order to have strictly increasing numbers.
This will make my subsequent patches much less ugly. =D

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

13 years agoTeach the AST reader and writer to preserve the __DEPRECATED bit in
Chandler Carruth [Sat, 23 Apr 2011 20:05:38 +0000 (20:05 +0000)]
Teach the AST reader and writer to preserve the __DEPRECATED bit in
language options, and warn when reading an AST with a different value
for the bit.

There doesn't appear to be a good way to test this (commenting out
similar other language options doesn't break anything) but if folks have
suggestions on tests I'm happy to add them.

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

13 years agoRemove unused STL header includes.
Jay Foad [Sat, 23 Apr 2011 19:53:52 +0000 (19:53 +0000)]
Remove unused STL header includes.

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

13 years agoMove all of the logic for __DEPRECATED to the driver based on comments
Chandler Carruth [Sat, 23 Apr 2011 19:48:40 +0000 (19:48 +0000)]
Move all of the logic for __DEPRECATED to the driver based on comments
from dgregor.

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

13 years ago"note" location of forward class used as receiver of
Fariborz Jahanian [Sat, 23 Apr 2011 17:27:19 +0000 (17:27 +0000)]
"note" location of forward class used as receiver of
a 'deprecated' selector in the diagnostics for the
selector. // rdar://9309223

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

13 years agoRemove unnecessary const away cast in LateTemplateParserCallback.
Francois Pichet [Sat, 23 Apr 2011 11:52:20 +0000 (11:52 +0000)]
Remove unnecessary const away cast in LateTemplateParserCallback.

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

13 years agoImplement basic __is_trivial type-trait support, enough to close PR9472.
Chandler Carruth [Sat, 23 Apr 2011 10:47:28 +0000 (10:47 +0000)]
Implement basic __is_trivial type-trait support, enough to close PR9472.
This introduces a few APIs on the AST to bundle up the standard-based
logic so that programmatic clients have access to exactly the same
behavior.

There is only one serious FIXME here: checking for non-trivial move
constructors and move assignment operators. Those bits need to be added
to the declaration and accessors provided.

This implementation should be enough for the uses of __is_trivial in
libstdc++ 4.6's C++98 library implementation.

Ideas for more thorough test cases or any edge cases missing would be
appreciated. =D

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

13 years agoSort the type traits in a few places where they weren't previously
Chandler Carruth [Sat, 23 Apr 2011 10:47:20 +0000 (10:47 +0000)]
Sort the type traits in a few places where they weren't previously
sorted in order to prepare for adding some new ones.

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

13 years agoFix Clang's __DEPRECATED define to be controled by -Wdeprecated. This
Chandler Carruth [Sat, 23 Apr 2011 09:27:53 +0000 (09:27 +0000)]
Fix Clang's __DEPRECATED define to be controled by -Wdeprecated. This
matches GCC behavior which libstdc++ uses to limit #warning-based
messages about deprecation.

The machinery involves threading this through a new '-fdeprecated-macro'
flag for CC1. The flag defaults to "on", similarly to -Wdeprecated. We
turn the flag off in the driver when the warning is turned off (modulo
matching some GCC bugs). We record this as a language option, and key
the preprocessor on the option when introducing the define.

A separate flag rather than a '-D' flag allows us to properly represent
the difference between C and C++ builds (only C++ receives the define),
and it allows the specific behavior of following -Wdeprecated without
potentially impacting the set of user-provided macro flags.

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

13 years agoLike the coding standards say, do not use "using namespace std".
Jay Foad [Sat, 23 Apr 2011 09:06:00 +0000 (09:06 +0000)]
Like the coding standards say, do not use "using namespace std".

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

13 years agoGCC overloads -Wwrite-strings just to make it extra confusing. While it
Chandler Carruth [Sat, 23 Apr 2011 06:54:44 +0000 (06:54 +0000)]
GCC overloads -Wwrite-strings just to make it extra confusing. While it
changes language semantics in C and ObjC (which Clang has supported for
a while), in C++ it's the name used for Clang's
-Wdeprecated-writable-strings.

Clang's name is at least less overloaded if still confusing (the string
isn't writable, we just allow converting to a non-const pointer without
warning), so I've left it in place and made the GCC name an alias for
compatibility.

With this I've implemented all the aspects of GCC's -Wwrite-strings I've
encountered which didn't work with Clang.

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

13 years agoThere were some frustrating problems with the implementation of
Chandler Carruth [Sat, 23 Apr 2011 06:30:43 +0000 (06:30 +0000)]
There were some frustrating problems with the implementation of
-Wwrite-strings. First and foremost, once the positive form of the flag
was passed, it could never be disabled by passing -Wno-write-strings.
Also, the diagnostic engine couldn't in turn use -Wwrite-strings to
control diagnostics (as GCC does) because it was essentially hijacked to
drive the language semantics.

Fix this by giving CC1 a clean '-fconst-strings' flag to enable
const-qualified strings in C and ObjC compilations. Corresponding
'-fno-const-strings' is also added. Then the driver is taught to
introduce '-fconst-strings' in the CC1 command when '-Wwrite-strings'
dominates.

This entire flag is basically GCC-bug-compatibility driven, so we also
match GCC's bug where '-w' doesn't actually disable -Wwrite-strings. I'm
open to changing this though as it seems insane.

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

13 years agoDiagnose C++ abstract parameters for Objective-C methods.
John McCall [Sat, 23 Apr 2011 02:46:06 +0000 (02:46 +0000)]
Diagnose C++ abstract parameters for Objective-C methods.

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

13 years agoExhaust the cases.
Argyrios Kyrtzidis [Sat, 23 Apr 2011 01:10:24 +0000 (01:10 +0000)]
Exhaust the cases.

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

13 years agoFix an assertion when code-completing, rdar://9288730 & http://llvm.org/PR9728.
Argyrios Kyrtzidis [Sat, 23 Apr 2011 01:04:12 +0000 (01:04 +0000)]
Fix an assertion when code-completing, rdar://9288730 & http://llvm.org/PR9728.

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

13 years agoTie debug information for method declaration with debug information for method defini...
Devang Patel [Sat, 23 Apr 2011 00:08:01 +0000 (00:08 +0000)]
Tie debug information for method declaration with debug information for method definition.

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

13 years agoDon't allow reinterpret_cast to reference of vector element and property expression...
Argyrios Kyrtzidis [Fri, 22 Apr 2011 23:57:57 +0000 (23:57 +0000)]
Don't allow reinterpret_cast to reference of vector element and property expression. Thanks goes to Eli Friedman!

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

13 years agoTeach libclang to be more careful around BlockDecls, and don't assume
Douglas Gregor [Fri, 22 Apr 2011 23:49:24 +0000 (23:49 +0000)]
Teach libclang to be more careful around BlockDecls, and don't assume
that a TypeSourceInfo is always available, like we do everywhere else
in libclang. Fixes <rdar://problem/9311140>.

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

13 years agodon't warn about empty macro arguments in c++'0x mode, since it sucked in
Chris Lattner [Fri, 22 Apr 2011 23:25:09 +0000 (23:25 +0000)]
don't warn about empty macro arguments in c++'0x mode, since it sucked in
the c99 preprocessor.  Patch by Jonathan Sauer!

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

13 years agoCorrectly emit a diagnostic for multiple templated function definitions in -flate...
Francois Pichet [Fri, 22 Apr 2011 23:20:44 +0000 (23:20 +0000)]
Correctly emit a diagnostic for multiple templated function definitions in -flate-template-parsing mode.

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

13 years agoreinterpret_cast to reference of a bit-field is not allowed.
Argyrios Kyrtzidis [Fri, 22 Apr 2011 22:31:13 +0000 (22:31 +0000)]
reinterpret_cast to reference of a bit-field is not allowed.

Fixes rdar://9202628 & http://llvm.org/PR9564.

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

13 years agoAt the end of the translation unit, defining a vtable can introduce
Douglas Gregor [Fri, 22 Apr 2011 22:25:37 +0000 (22:25 +0000)]
At the end of the translation unit, defining a vtable can introduce
new templates that need to be instantiated and vice-versa. Iterate
until we've instantiated all required templates and defined all
required vtables. Fixed PR9325 / <rdar://problem/9055177>.

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

13 years agoAdd -fdelayed-template-parsing option. Using this option all templated function defin...
Francois Pichet [Fri, 22 Apr 2011 22:18:13 +0000 (22:18 +0000)]
Add -fdelayed-template-parsing option. Using this option all templated function definitions are parsed at the end of the translation unit only if it is required by an actual instantiation. As such all the symbols of the TU are available during name lookup.

Using this flag is necessary for compatibility with Microsoft template code.
This also provides some parsing speed improvement.

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

13 years agoFixes an instance method meta-data generation bug in
Fariborz Jahanian [Fri, 22 Apr 2011 22:02:28 +0000 (22:02 +0000)]
Fixes an instance method meta-data generation bug in
ObjC NeXt runtime where method pointer registered in
metadata belongs to an unrelated method. Ast part of this fix,
I turned at @end missing warning (for class
implementations) into an error as we can never
be sure that meta-data being generated is correct.
// rdar://9072317

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

13 years agoWorkaround buildbot failure by hacking up this test to emit llvm IR.
Bob Wilson [Fri, 22 Apr 2011 20:42:46 +0000 (20:42 +0000)]
Workaround buildbot failure by hacking up this test to emit llvm IR.
This is not a real fix.  It needs some checks to make sure the IR is correct.

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

13 years agoDo not return true from MergeFunctionDecl for a warn_static_non_static warning in...
Francois Pichet [Fri, 22 Apr 2011 19:50:06 +0000 (19:50 +0000)]
Do not return true from MergeFunctionDecl for a warn_static_non_static warning in Microsoft mode.

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

13 years agoFor -Wlogical-op-parentheses, point at '&&', not '||'. Fixes rdar://9125333.
Argyrios Kyrtzidis [Fri, 22 Apr 2011 19:16:27 +0000 (19:16 +0000)]
For -Wlogical-op-parentheses, point at '&&', not '||'. Fixes rdar://9125333.

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

13 years agoI concur with DPG here. This does indeed apply in 0x mode. Added test
Chandler Carruth [Fri, 22 Apr 2011 19:01:39 +0000 (19:01 +0000)]
I concur with DPG here. This does indeed apply in 0x mode. Added test
cases that demonstrates exactly why this does indeed apply in 0x mode.

If isPOD is currently broken in 0x mode, we should fix that directly
rather than papering over it here.

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

13 years agoDon't enter a qualified scope for an invalid decl.
Argyrios Kyrtzidis [Fri, 22 Apr 2011 18:52:25 +0000 (18:52 +0000)]
Don't enter a qualified scope for an invalid decl.

Fixes assertion later on. rdar://9122937 & http://llvm.org/PR9459

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

13 years agoAdd static analyzer support for C++'0X nullptr. Patch by Jim Goodnow II.
Ted Kremenek [Fri, 22 Apr 2011 18:01:30 +0000 (18:01 +0000)]
Add static analyzer support for C++'0X nullptr.  Patch by Jim Goodnow II.

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

13 years agoReplace a couple of literal 8s with ASTContext::getCharWidth(). No change in
Ken Dyck [Fri, 22 Apr 2011 17:59:22 +0000 (17:59 +0000)]
Replace a couple of literal 8s with ASTContext::getCharWidth(). No change in
functionality intended.

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

13 years agoEliminate some literal 8s from EmitNullInitialization() by converting
Ken Dyck [Fri, 22 Apr 2011 17:51:05 +0000 (17:51 +0000)]
Eliminate some literal 8s from EmitNullInitialization() by converting
variables to CharUnits. No change in functionality intended.

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

13 years agoIn IsUserDefinedConversion try to recover from RequireCompleteType returning true.
Argyrios Kyrtzidis [Fri, 22 Apr 2011 17:45:37 +0000 (17:45 +0000)]
In IsUserDefinedConversion try to recover from RequireCompleteType returning true.

Fixes an assertion later on, rdar://9122862 & http://llvm.org/PR9460.

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

13 years agoEliminate some literal 8s from EmitDeclare by converting to CharUnits. No
Ken Dyck [Fri, 22 Apr 2011 17:41:34 +0000 (17:41 +0000)]
Eliminate some literal 8s from EmitDeclare by converting to CharUnits. No
change in functionality intended.

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

13 years agoUse CharUnits to eliminate some literal 8s in
Ken Dyck [Fri, 22 Apr 2011 17:34:18 +0000 (17:34 +0000)]
Use CharUnits to eliminate some literal 8s in
EmitTypeForVarWithBlocksAttr(). No change in functionality intended.

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

13 years agoReplace some literal 8s with char width and char align. No change in
Ken Dyck [Fri, 22 Apr 2011 17:23:43 +0000 (17:23 +0000)]
Replace some literal 8s with char width and char align. No change in
functionality intended.

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

13 years agoPTX: Add default PTX calling conventions
Justin Holewinski [Fri, 22 Apr 2011 11:10:38 +0000 (11:10 +0000)]
PTX: Add default PTX calling conventions

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

13 years agoFor consistency, change suffix from war_ to warn_ for some Microsoft warnings I intro...
Francois Pichet [Fri, 22 Apr 2011 08:25:24 +0000 (08:25 +0000)]
For consistency, change suffix from war_ to warn_ for some Microsoft warnings I introduced lately.

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

13 years agoDowngrade error "static declaration of 'foo' follows non-static declaration" to a...
Francois Pichet [Fri, 22 Apr 2011 08:14:00 +0000 (08:14 +0000)]
Downgrade error "static declaration of 'foo' follows non-static declaration" to a warning in Microsoft mode.

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

13 years agoFor
Argyrios Kyrtzidis [Fri, 22 Apr 2011 05:29:30 +0000 (05:29 +0000)]
For

 double data[20000000] = { [19999999] = 1 };

Don't serialize the filler multiple times.

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

13 years ago_declspec is an alias for __declspec.
Francois Pichet [Fri, 22 Apr 2011 05:21:17 +0000 (05:21 +0000)]
_declspec is an alias for __declspec.

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

13 years agoAdd a testcase for svn r129964 (Neon load/store intrinsic alignments).
Bob Wilson [Fri, 22 Apr 2011 04:06:49 +0000 (04:06 +0000)]
Add a testcase for svn r129964 (Neon load/store intrinsic alignments).

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

13 years agoFix crashing rdar://9122854 & http://llvm.org/PR9461.
Argyrios Kyrtzidis [Fri, 22 Apr 2011 01:18:40 +0000 (01:18 +0000)]
Fix crashing rdar://9122854 & http://llvm.org/PR9461.

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

13 years agoWire up the -ftest-coverage and -fprofile-arcs flags to .gcno file emission (at
Nick Lewycky [Thu, 21 Apr 2011 23:44:07 +0000 (23:44 +0000)]
Wire up the -ftest-coverage and -fprofile-arcs flags to .gcno file emission (at
compile time) and .gcda emission (at runtime). --coverage enables both.

This does not yet add the profile_rt library to the link step if -fprofile-arcs
is enabled when linking.

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

13 years agoFix indentation. No functional change.
Nick Lewycky [Thu, 21 Apr 2011 23:37:32 +0000 (23:37 +0000)]
Fix indentation. No functional change.

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

13 years agoDon't hide #warnings in a system header, same as gcc. Fixes rdar://8495837.
Argyrios Kyrtzidis [Thu, 21 Apr 2011 23:08:23 +0000 (23:08 +0000)]
Don't hide #warnings in a system header, same as gcc. Fixes rdar://8495837.

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

13 years agoMove the check whether a diagnostic must be ignored because it is in a system header
Argyrios Kyrtzidis [Thu, 21 Apr 2011 23:08:18 +0000 (23:08 +0000)]
Move the check whether a diagnostic must be ignored because it is in a system header
inside DiagnosticIDs::getDiagnosticLevel.

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

13 years agoFix gcc warning. Add parens to this assert, incidentally reassociating it, but the...
Richard Smith [Thu, 21 Apr 2011 22:48:40 +0000 (22:48 +0000)]
Fix gcc warning. Add parens to this assert, incidentally reassociating it, but the condition is the same either way.

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

13 years agoAdd a fixit suggest for missing case keywords inside a switch scope. For instance...
Richard Trieu [Thu, 21 Apr 2011 21:44:26 +0000 (21:44 +0000)]
Add a fixit suggest for missing case keywords inside a switch scope.  For instance, in the following code, 'case ' will be suggested before the '1:'

switch (x) {
  1: return 0;
  default: return 1;
}

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

13 years agoAlphabetize this one flag, just to pull it out of my patch.
Nick Lewycky [Thu, 21 Apr 2011 21:32:34 +0000 (21:32 +0000)]
Alphabetize this one flag, just to pull it out of my patch.

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

13 years agoDriver/Darwin: Allow OS X deployment targets like 10.4.11, even though they
Daniel Dunbar [Thu, 21 Apr 2011 21:27:33 +0000 (21:27 +0000)]
Driver/Darwin: Allow OS X deployment targets like 10.4.11, even though they
can't be represented in the environment define.

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

13 years agoUse the ArrayFiller to fill out "holes" in the array initializer due to designated...
Argyrios Kyrtzidis [Thu, 21 Apr 2011 20:03:38 +0000 (20:03 +0000)]
Use the ArrayFiller to fill out "holes" in the array initializer due to designated initializers,
avoiding to create separate Exprs for each one.

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

13 years agoPR9214: Convert Metadata API to use ArrayRef.
Jay Foad [Thu, 21 Apr 2011 19:59:12 +0000 (19:59 +0000)]
PR9214: Convert Metadata API to use ArrayRef.

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

13 years agoAdds a function to run FrontendActions over in-memory code. This is
Manuel Klimek [Thu, 21 Apr 2011 18:37:41 +0000 (18:37 +0000)]
Adds a function to run FrontendActions over in-memory code. This is
the first step towards a standalone Clang tool infrastructure.
The plan is to make it easy to build command line tools that run over
the AST of source files in a project outside of the build system.

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

13 years agoDriver: Tweak -Xarch diags a bit more, we can't actually differentiate between
Daniel Dunbar [Thu, 21 Apr 2011 17:41:34 +0000 (17:41 +0000)]
Driver: Tweak -Xarch diags a bit more, we can't actually differentiate between
unknown and "required more arguments", but only the latter should be feasible in
practice.

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

13 years agoDriver: Improve -Xarch argument diagnostics a bit.
Daniel Dunbar [Thu, 21 Apr 2011 17:32:21 +0000 (17:32 +0000)]
Driver: Improve -Xarch argument diagnostics a bit.

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

13 years agoFixit suggestion for adding missing tag name should have a space after the tag name...
Argyrios Kyrtzidis [Thu, 21 Apr 2011 17:29:47 +0000 (17:29 +0000)]
Fixit suggestion for adding missing tag name should have a space after the tag name. Fixes rdar://9295072

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

13 years agoHave #pragma message not turn into error by -Werror, by default. Fixes rdar://9308989.
Argyrios Kyrtzidis [Thu, 21 Apr 2011 17:11:44 +0000 (17:11 +0000)]
Have #pragma message not turn into error by -Werror, by default. Fixes rdar://9308989.

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

13 years agoPR9772: Fix the definition of WINT_MIN and WINT_MAX on Linux -ffreestanding.
Eli Friedman [Thu, 21 Apr 2011 05:45:45 +0000 (05:45 +0000)]
PR9772: Fix the definition of WINT_MIN and WINT_MAX on Linux -ffreestanding.

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

13 years agoThe 0.98 revision of the x86-64 ABI clarified a lot of things, some
John McCall [Thu, 21 Apr 2011 01:20:55 +0000 (01:20 +0000)]
The 0.98 revision of the x86-64 ABI clarified a lot of things, some
of which break strict compatibility with previous compilers.  Implement
one of them and then immediately opt out on Darwin.

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

13 years agoFor
Argyrios Kyrtzidis [Thu, 21 Apr 2011 00:27:41 +0000 (00:27 +0000)]
For

double data[20000000] = {0};

we would blow out the memory by creating 20M Exprs to fill out the initializer.

To fix this, if the initializer list initializes an array with more elements than
there are initializers in the list, have InitListExpr store a single 'ArrayFiller' expression
that specifies an expression to be used for value initialization of the rest of the elements.

Fixes rdar://9275920.

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

13 years agoDon't add type names for enums; they're never used in LLVM IR.
Anders Carlsson [Wed, 20 Apr 2011 23:51:43 +0000 (23:51 +0000)]
Don't add type names for enums; they're never used in LLVM IR.

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