]> granicus.if.org Git - clang/log
clang
14 years agoConvert assertion in memset checking to a runtime check (because real code may provid...
Ted Kremenek [Thu, 28 Apr 2011 01:38:02 +0000 (01:38 +0000)]
Convert assertion in memset checking to a runtime check (because real code may provide a deviant definition of memset).

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

14 years agoRemoved test that depended on ast-test
John Wiegley [Thu, 28 Apr 2011 01:09:13 +0000 (01:09 +0000)]
Removed test that depended on ast-test

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

14 years agoParsing/AST support for Structured Exception Handling
John Wiegley [Thu, 28 Apr 2011 01:08:34 +0000 (01:08 +0000)]
Parsing/AST support for Structured Exception Handling

Patch authored by Sohail Somani.

Provide parsing and AST support for Windows structured exception handling.

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

14 years agoMore cleanup of template argument deduction and its handling of
Douglas Gregor [Thu, 28 Apr 2011 00:56:09 +0000 (00:56 +0000)]
More cleanup of template argument deduction and its handling of
non-CVR qualifiers. We can now properly match address-space--qualified
references during template argument deduction.

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

14 years agoFix modified-header-crash.c for read-only source trees
Matt Beaumont-Gay [Thu, 28 Apr 2011 00:23:49 +0000 (00:23 +0000)]
Fix modified-header-crash.c for read-only source trees

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

14 years agoImplementation of Embarcadero array type traits
John Wiegley [Thu, 28 Apr 2011 00:16:57 +0000 (00:16 +0000)]
Implementation of Embarcadero array type traits

Patch authored by John Wiegley.

These are array type traits used for parsing code that employs certain
features of the Embarcadero C++ compiler: __array_rank(T) and
__array_extent(T, Dim).

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

14 years agoUpdate regex in scan-build for parsing statistics.
Ted Kremenek [Wed, 27 Apr 2011 23:43:27 +0000 (23:43 +0000)]
Update regex in scan-build for parsing statistics.

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

14 years agoClean up the handling of non-CVR qualifiers in template argument
Douglas Gregor [Wed, 27 Apr 2011 23:34:22 +0000 (23:34 +0000)]
Clean up the handling of non-CVR qualifiers in template argument
deduction. The good news is that address spaces are a lot less broken
in this regard than I'd expected.

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

14 years agot/clang/type-traits
John Wiegley [Wed, 27 Apr 2011 23:09:49 +0000 (23:09 +0000)]
t/clang/type-traits

Patch authored by John Wiegley.

These type traits are used for parsing code that employs certain features of
the Embarcadero C++ compiler.  Several of these constructs are also desired by
libc++, according to its project pages (such as __is_standard_layout).

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

14 years agoRemove unused method CFGBlock::hasBinaryBranchTerminator().
Ted Kremenek [Wed, 27 Apr 2011 22:16:58 +0000 (22:16 +0000)]
Remove unused method CFGBlock::hasBinaryBranchTerminator().

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

14 years agoDon't print fixits for format specifiers in cases where the fixit does not actually...
Eli Friedman [Wed, 27 Apr 2011 22:06:20 +0000 (22:06 +0000)]
Don't print fixits for format specifiers in cases where the fixit does not actually fix the warning. PR8781.

I'm not sure what the preferred way to write a test for whether a fixit is emitted.

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

14 years agoUpdate scan-build to '-analyzer-checker debug.Stats' instead of the old '-analyzer...
Ted Kremenek [Wed, 27 Apr 2011 18:53:08 +0000 (18:53 +0000)]
Update scan-build to '-analyzer-checker debug.Stats' instead of the old '-analyzer-stats' -cc1 argument.

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

14 years agoHeh, funny thing, 'void' isn't a POD type. Nice of us to suggest it to
Chandler Carruth [Wed, 27 Apr 2011 18:48:59 +0000 (18:48 +0000)]
Heh, funny thing, 'void' isn't a POD type. Nice of us to suggest it to
silence this warning. ;]

Fixed that obvious bug and added a bit more testing as well.

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

14 years agoRe-enable byval for ARM in clang. rdar://problem/7662569
Stuart Hastings [Wed, 27 Apr 2011 17:24:02 +0000 (17:24 +0000)]
Re-enable byval for ARM in clang.  rdar://problem/7662569

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

14 years agoSome refactoring of my ms_struct patch.
Fariborz Jahanian [Wed, 27 Apr 2011 17:14:21 +0000 (17:14 +0000)]
Some refactoring of my ms_struct patch.
// rdar://8823265 related.

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

14 years agoWhen printing a base-specifier, print the ellipsis ("...") if it is a
Douglas Gregor [Wed, 27 Apr 2011 17:07:55 +0000 (17:07 +0000)]
When printing a base-specifier, print the ellipsis ("...") if it is a
pack expansion. Fixes PR9452.

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

14 years agoASTImporter support for NestedNameSpecifier, from Olaf Krzikalla
Douglas Gregor [Wed, 27 Apr 2011 16:48:40 +0000 (16:48 +0000)]
ASTImporter support for NestedNameSpecifier, from Olaf Krzikalla

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

14 years agoThis is the next step in building the standalone tools infrastructure:
Manuel Klimek [Wed, 27 Apr 2011 16:39:14 +0000 (16:39 +0000)]
This is the next step in building the standalone tools infrastructure:
This patch simplifies writing of standalone Clang tools. As an
example, we add clang-check, a tool that runs a syntax only frontend
action over a .cc file. When you integrate this into your favorite
editor, you get much faster feedback on your compilation errors, thus
reducing your feedback cycle especially when writing new code.

The tool depends on integration of an outstanding patch to CMake to
work which allows you to always have a current compile command
database in your cmake output directory when you set
CMAKE_EXPORT_COMPILE_COMMANDS.

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

14 years agoMore accurately model realloc() when the size argument is 0. realloc() with a size...
Lenny Maiorani [Wed, 27 Apr 2011 14:49:29 +0000 (14:49 +0000)]
More accurately model realloc() when the size argument is 0. realloc() with a size of 0 is equivalent to free(). The memory region should be marked as free and not used again.

Unit tests f2_realloc_0(), f6_realloc(), and f7_realloc() contributed by Marshall Clow <mclow.lists@gmail.com>. Thanks!

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

14 years agoAdd a warning (-Wnon-pod-memset) for calls to memset() with
Chandler Carruth [Wed, 27 Apr 2011 07:05:31 +0000 (07:05 +0000)]
Add a warning (-Wnon-pod-memset) for calls to memset() with
a destination pointer that points to a non-POD type. This can flag such
horrible bugs as overwriting vptrs when a previously POD structure is
suddenly given a virtual method, or creating objects that crash on
practically any use by zero-ing out a member when its changed from
a const char* to a std::string, etc.

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

14 years agoDiagnose attempts to implicitly instantiate a template before it is
John McCall [Wed, 27 Apr 2011 06:46:31 +0000 (06:46 +0000)]
Diagnose attempts to implicitly instantiate a template before it is
fully defined.  Somehow this escaped notice for a very long time.

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

14 years agoIntroduce a new parser annotation token for primary expressions. When
Douglas Gregor [Wed, 27 Apr 2011 06:18:01 +0000 (06:18 +0000)]
Introduce a new parser annotation token for primary expressions. When
ClassifyName() builds a primary expression, generate one of these
annotation tokens rather than jumping into the parser.

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

14 years agoRemove this assert, I don't think it's being helpful and people have
Eric Christopher [Wed, 27 Apr 2011 05:48:06 +0000 (05:48 +0000)]
Remove this assert, I don't think it's being helpful and people have
been running into it.

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

14 years agoClean out some cruft I introduced when adding Sema::ClassifyName()
Douglas Gregor [Wed, 27 Apr 2011 05:44:51 +0000 (05:44 +0000)]
Clean out some cruft I introduced when adding Sema::ClassifyName()

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

14 years agoSimplify the parser's handling of Sema::ClassifyName() for types, by
Douglas Gregor [Wed, 27 Apr 2011 05:41:15 +0000 (05:41 +0000)]
Simplify the parser's handling of Sema::ClassifyName() for types, by
creating a type-annotation token rather than jumping into the
declaration parsing.

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

14 years agoAllow 'Environment::getSVal()' to allow an optional way for checkers to do a direct...
Ted Kremenek [Wed, 27 Apr 2011 05:34:09 +0000 (05:34 +0000)]
Allow 'Environment::getSVal()' to allow an optional way for checkers to do a direct lookup to values bound to expressions, without
resulting to lazy logic.  This is critical for the OSAtomicChecker that does a simulated load on any arbitrary expression.

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

14 years agoAdd the test that I intended to submit with r130055, but forgot to add.
Chandler Carruth [Wed, 27 Apr 2011 05:25:42 +0000 (05:25 +0000)]
Add the test that I intended to submit with r130055, but forgot to add.
Apologies.

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

14 years agoAdd support for Microsoft __interface keyword. An __interface class is basically...
Francois Pichet [Wed, 27 Apr 2011 05:07:51 +0000 (05:07 +0000)]
Add support for Microsoft __interface keyword. An __interface class is basically a normal class containing just pure virtual functions. No urgency to enforce that restriction in clang for now, so make __interface an "class" alias.

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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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