]> granicus.if.org Git - clang/log
clang
13 years agoIf a null statement was preceded by an empty macro keep its instantiation source...
Argyrios Kyrtzidis [Wed, 27 Apr 2011 05:04:02 +0000 (05:04 +0000)]
If a null statement was preceded by an empty macro keep its instantiation source location
in NullStmt.

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

13 years agoExtend Sema::ClassifyName() to support C++, ironing out a few issues
Douglas Gregor [Wed, 27 Apr 2011 04:48:22 +0000 (04:48 +0000)]
Extend Sema::ClassifyName() to support C++, ironing out a few issues
in the classification of template names and using declarations. We now
properly typo-correct the leading identifiers in statements to types,
templates, values, etc. As an added bonus, this reduces the number of
lookups required for disambiguation.

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

13 years agoWhen compiling with -fno-threadsafe-statics, guard variables for globals with interna...
Anders Carlsson [Wed, 27 Apr 2011 04:37:08 +0000 (04:37 +0000)]
When compiling with -fno-threadsafe-statics, guard variables for globals with internal linkage don't have to be i64, i8 works just fine!

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

13 years agoFix test
Douglas Gregor [Wed, 27 Apr 2011 04:02:56 +0000 (04:02 +0000)]
Fix test

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

13 years agoImprove diagnostics for typo correction via Sema::ClassifyName(), by
Douglas Gregor [Wed, 27 Apr 2011 03:47:06 +0000 (03:47 +0000)]
Improve diagnostics for typo correction via Sema::ClassifyName(), by
looking at the context and the correction and using a custom
diagnostic. Also, enable some Fix-It tests that were somewhat lamely
disabled.

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

13 years agoAdd triple in the hope of unbreaking the bubuildbot
Douglas Gregor [Wed, 27 Apr 2011 03:24:57 +0000 (03:24 +0000)]
Add triple in the hope of unbreaking the bubuildbot

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

13 years agoFixOverloadedFunctionReference needs to rebuild member accesses of
John McCall [Wed, 27 Apr 2011 00:36:17 +0000 (00:36 +0000)]
FixOverloadedFunctionReference needs to rebuild member accesses of
instance methods to have bound-member type.

Fixing that broke __unknown_anytype, which I've in turn fixed.

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

13 years agoWhen comparing Objective-C pointers during overload resolution to
Douglas Gregor [Wed, 27 Apr 2011 00:01:52 +0000 (00:01 +0000)]
When comparing Objective-C pointers during overload resolution to
determine which is a better conversion to "void*", be sure to perform
the comparison using the safe-for-id
ASTContext::canAssignObjCInterfaces() rather than the asserts-with-id
ASTContext::canAssignObjCInterfaces().

Fixes <rdar://problem/9327203>.

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

13 years agoWith ms_struct attribut, Zero-length bitfields following
Fariborz Jahanian [Tue, 26 Apr 2011 23:52:16 +0000 (23:52 +0000)]
With ms_struct attribut, Zero-length bitfields following
non-bitfield members are ignore. // rdar://8823265 wip

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

13 years agoWhen computing Objective-C pointer conversions in C++, retain
Douglas Gregor [Tue, 26 Apr 2011 23:16:46 +0000 (23:16 +0000)]
When computing Objective-C pointer conversions in C++, retain
the qualifiers (e.g., GC qualifiers) on the type we're converting
from, rather than just blindly adopting the qualifiers of the type
we're converting to or dropping qualifiers altogether.

As an added bonus, properly diagnose GC qualifier mismatches to
eliminate a crash in the overload resolution failure diagnostics.

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

13 years agoTo be able to replay compilations we need to accurately remodel how
Manuel Klimek [Tue, 26 Apr 2011 21:50:03 +0000 (21:50 +0000)]
To be able to replay compilations we need to accurately remodel how
includes get resolved, especially when they are found relatively to
another include file. We also try to get it working for framework
includes, but that part of the code is untested, as I don't have a code
base that uses it.

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

13 years agoWe need pointer size in bits here.
Devang Patel [Tue, 26 Apr 2011 21:16:49 +0000 (21:16 +0000)]
We need pointer size in bits here.

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

13 years agoGcc pads the size of an array using the alignment of its elements.
Argyrios Kyrtzidis [Tue, 26 Apr 2011 21:05:39 +0000 (21:05 +0000)]
Gcc pads the size of an array using the alignment of its elements.

The size of the array may not be aligned according to alignment of its elements if an alignment attribute is
specified in a typedef. Fixes rdar://8665729 & http://llvm.org/PR5637.

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

13 years agoMake yet another placeholder type, this one marking that an expression is a bound
John McCall [Tue, 26 Apr 2011 20:42:42 +0000 (20:42 +0000)]
Make yet another placeholder type, this one marking that an expression is a bound
member function, i.e. something of the form 'x.f' where 'f' is a non-static
member function.  Diagnose this in the general case.  Some of the new diagnostics
are probably worse than the old ones, but we now get this right much more
universally, and there's certainly room for improvement in the diagnostics.

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

13 years agoIRgen/Darwin: Fix refacto introduced in Triple changes.
Daniel Dunbar [Tue, 26 Apr 2011 19:43:00 +0000 (19:43 +0000)]
IRgen/Darwin: Fix refacto introduced in Triple changes.

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

13 years agoAdd ms_struct attribute on record typee
Fariborz Jahanian [Tue, 26 Apr 2011 17:54:40 +0000 (17:54 +0000)]
Add ms_struct attribute on record typee
(and ignore it for now) - wip.

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

13 years agoEmit a -Wnull-dereference warning for "*null" not just "*null = something". Addresses...
Argyrios Kyrtzidis [Tue, 26 Apr 2011 17:41:22 +0000 (17:41 +0000)]
Emit a -Wnull-dereference warning for "*null" not just "*null = something". Addresses rdar://9269271.

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

13 years agoDisable a test that fails on windows; for some reason we don't detect that the header...
Argyrios Kyrtzidis [Tue, 26 Apr 2011 16:49:25 +0000 (16:49 +0000)]
Disable a test that fails on windows; for some reason we don't detect that the header has different timestamp.

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

13 years agoinclude/clang/AST/StmtIterator.h: std::pair should be provided by <utility>. libcxx...
NAKAMURA Takumi [Tue, 26 Apr 2011 03:17:13 +0000 (03:17 +0000)]
include/clang/AST/StmtIterator.h: std::pair should be provided by <utility>. libcxx needs it.

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

13 years agoTemporarily revert r130176, it appears to have broken a few tests.
Eric Christopher [Tue, 26 Apr 2011 01:02:04 +0000 (01:02 +0000)]
Temporarily revert r130176, it appears to have broken a few tests.

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

13 years agoEmit intrinsic at current insert point, not at the end of current block.
Devang Patel [Mon, 25 Apr 2011 23:52:27 +0000 (23:52 +0000)]
Emit intrinsic at current insert point, not at the end of current block.

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

13 years agoTurn on byval parameters in Clang for ARM APCS. rdar://problem/7662569
Stuart Hastings [Mon, 25 Apr 2011 23:48:12 +0000 (23:48 +0000)]
Turn on byval parameters in Clang for ARM APCS.  rdar://problem/7662569

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

13 years agoSimplify. There is no need to have a method to just call another method.
Devang Patel [Mon, 25 Apr 2011 23:43:36 +0000 (23:43 +0000)]
Simplify. There is no need to have a method to just call another method.

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

13 years agoGeneralize case for built-in expressions having
Fariborz Jahanian [Mon, 25 Apr 2011 23:10:07 +0000 (23:10 +0000)]
Generalize case for built-in expressions having
side-effect to generate their ir. Not just for
__builtin_expect. // rdar://9330105

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

13 years agoFor the warnings related to -Wparentheses, display first the note about how to silenc...
Argyrios Kyrtzidis [Mon, 25 Apr 2011 23:01:29 +0000 (23:01 +0000)]
For the warnings related to -Wparentheses, display first the note about how to silence the warning and
any other suggestion after that. Related to rdar://9300260.

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

13 years agoRe-enable disable free optimization where the FrontendAction is not freed when -disab...
Ted Kremenek [Mon, 25 Apr 2011 22:57:55 +0000 (22:57 +0000)]
Re-enable disable free optimization where the FrontendAction is not freed when -disable-free is passed.  This accidentally was commited in r128011.

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

13 years agoWhen generating printf fixits, preserve the original formating for unsigned integers...
Ted Kremenek [Mon, 25 Apr 2011 22:32:59 +0000 (22:32 +0000)]
When generating printf fixits, preserve the original formating for unsigned integers (e.g., 'x', 'o').

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

13 years agoIr-gen the side-effect(s) when __builtin_expect is
Fariborz Jahanian [Mon, 25 Apr 2011 22:30:02 +0000 (22:30 +0000)]
Ir-gen the side-effect(s) when __builtin_expect is
constant-folded. // rdar://9330105

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

13 years agoFix a crash when ASTReader emits diagnostic when another one is in flight. Fixes...
Argyrios Kyrtzidis [Mon, 25 Apr 2011 22:23:56 +0000 (22:23 +0000)]
Fix a crash when ASTReader emits diagnostic when another one is in flight. Fixes rdar//9334563.

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

13 years agoImplements the strncmp() checker just like the strcmp() checker, but with bounds...
Lenny Maiorani [Mon, 25 Apr 2011 22:21:00 +0000 (22:21 +0000)]
Implements the strncmp() checker just like the strcmp() checker, but with bounds. Requires LLVM svn r129582.

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

13 years ago'extern' variables in functions don't shadow externs in global scope. Fixes rdar...
Argyrios Kyrtzidis [Mon, 25 Apr 2011 21:39:50 +0000 (21:39 +0000)]
'extern' variables in functions don't shadow externs in global scope. Fixes rdar://8883302, this time for C++ as well.

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

13 years agoAdd libstdc++ search paths for GCC 4.6.0 on Arch Linux. Patch by Jakub Wieczorek.
Nico Weber [Mon, 25 Apr 2011 20:59:30 +0000 (20:59 +0000)]
Add libstdc++ search paths for GCC 4.6.0 on Arch Linux. Patch by Jakub Wieczorek.

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

13 years agoDriver: When compilation fails, don't try to remove output files we don't have
Daniel Dunbar [Mon, 25 Apr 2011 20:43:05 +0000 (20:43 +0000)]
Driver: When compilation fails, don't try to remove output files we don't have
write access to.

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

13 years agodon't use compound literals in MM macros, since they will be instantiated
Chris Lattner [Mon, 25 Apr 2011 20:42:40 +0000 (20:42 +0000)]
don't use compound literals in MM macros, since they will be instantiated
into user code which may warn about them with -pedantic.  Patch by Jonathan Sauer!

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

13 years agofix PR9474, a crash with -fshort-enum and C++ templates: when instantiating
Chris Lattner [Mon, 25 Apr 2011 20:37:58 +0000 (20:37 +0000)]
fix PR9474, a crash with -fshort-enum and C++ templates: when instantiating
the enum decl, we need to use an integer type the same size as the enumerator,
which may not be the promoted type with packed enums.

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

13 years agoRecognize gcc's ms_struct pragma (and ignore for now).
Fariborz Jahanian [Mon, 25 Apr 2011 18:49:15 +0000 (18:49 +0000)]
Recognize gcc's ms_struct pragma (and ignore for now).
This is wip.

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

13 years agoMinor tweak to avoid having to dig through canonical types multiple times when checki...
Douglas Gregor [Mon, 25 Apr 2011 18:40:17 +0000 (18:40 +0000)]
Minor tweak to avoid having to dig through canonical types multiple times when checking a qualification conversion

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

13 years agoAdd Windows SEH keywords.
Francois Pichet [Mon, 25 Apr 2011 17:23:15 +0000 (17:23 +0000)]
Add Windows SEH keywords.

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

13 years agoWhen Sema::ClassifyName() finds an invalid ivar reference, return an
Douglas Gregor [Mon, 25 Apr 2011 15:05:41 +0000 (15:05 +0000)]
When Sema::ClassifyName() finds an invalid ivar reference, return an
invalid expression rather than the far-more-generic "error". Fixes a
mild regression in error recovery uncovered by the GCC testsuite.

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

13 years agoRemove some more hard CR-LF lines. These were particularly weird as they were
Chandler Carruth [Mon, 25 Apr 2011 07:09:43 +0000 (07:09 +0000)]
Remove some more hard CR-LF lines. These were particularly weird as they were
only a few lines of the file. Also set their properties to have explicitly
native eol sytle.

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

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