]> granicus.if.org Git - clang/log
clang
13 years agoRename the last '[hH]asStandardLayout' entites to '[iI]sStandardLayout'
Chandler Carruth [Sat, 30 Apr 2011 10:07:30 +0000 (10:07 +0000)]
Rename the last '[hH]asStandardLayout' entites to '[iI]sStandardLayout'
based on Doug's preferences when we discussed this in IRC. This brings
the wording more in line with the standard.

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

13 years agoHoist all of the type-specific trait logic for __is_standard_layout into
Chandler Carruth [Sat, 30 Apr 2011 09:17:49 +0000 (09:17 +0000)]
Hoist all of the type-specific trait logic for __is_standard_layout into
a Type method isStandardLayoutType, to keep our user API matching the
type trait builtins as closely as possible. Also, implement it in terms
of other Type APIs rather than in terms of other type traits. This
models the implementation on that of isLiteralType and isTrivialType.
There remain some common problems with these traits still, so this is
a bit of a WIP. However, we can now fix all of these traits at the same
time and in a consistent manner.

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

13 years agoCompletely re-implement the core logic behind the __is_standard_layout
Chandler Carruth [Sat, 30 Apr 2011 09:17:45 +0000 (09:17 +0000)]
Completely re-implement the core logic behind the __is_standard_layout
type trait. The previous implementation suffered from several problems:

1) It implemented all of the logic in RecordType by walking over every
   base and field in a CXXRecordDecl and validating the constraints of
   the standard. This made for very straightforward code, but is
   extremely inefficient. It also is conceptually wrong, the logic tied
   to the C++ definition of standard-layout classes should be in
   CXXRecordDecl, not RecordType.
2) To address the performance problems with #1, a cache bit was added to
   CXXRecordDecl, and at the completion of every C++ class, the
   RecordType was queried to determine if it was a standard layout
   class, and that state was cached. Two things went very very wrong
   with this. First, the caching version of the query *was never
   called*. Even within the recursive steps of the walk over all fields
   and bases the caching variant was not called, making each query
   a full *recursive* walk. Second, despite the cache not being used, it
   was computed for every class declared, even when the trait was never
   used in the program. This probably significantly regressed compile
   time performance for edge-case files.
3) An ASTContext was required merely to query the type trait because
   querying it performed the actual computations.
4) The caching bit wasn't managed correctly (uninitialized).

The new implementation follows the system for all the other traits on
C++ classes by encoding all the state needed in the definition data and
building up the trait incrementally as each base and member are added to
the definition of the class.

The idiosyncracies of the specification of standard-layout classes
requires more state than I would like; currently 5 bits. I could
eliminate one of the bits easily at the expense of both clarity and
resilience of the code. I might be able to eliminate one of the other
bits by computing its state in terms of other state bits in the
definition. I've already done that in one place where there was a fairly
simple way to achieve it.

It's possible some of the bits could be moved out of the definition data
and into some other structure which isn't serialized if the serialized
bloat is a problem. That would preclude serialization of a partial class
declaration, but that's likely already precluded.

Comments on any of these issues welcome.

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

13 years agoInitialize HasStandardLayout.
Benjamin Kramer [Sat, 30 Apr 2011 08:55:35 +0000 (08:55 +0000)]
Initialize HasStandardLayout.

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

13 years agoMove the SelfInit checker to the 'cocoa.experimental' package.
Ted Kremenek [Sat, 30 Apr 2011 06:46:45 +0000 (06:46 +0000)]
Move the SelfInit checker to the 'cocoa.experimental' package.

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

13 years agoDriver/Darwin: Don't link -lgcc_s.1 when compiling as iOS for the simulator,
Daniel Dunbar [Sat, 30 Apr 2011 04:25:16 +0000 (04:25 +0000)]
Driver/Darwin: Don't link -lgcc_s.1 when compiling as iOS for the simulator,
that library has never been in the SDK. Fortunately, it shouldn't be necessary,
since that library was also removed in 10.6.

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

13 years agoDriver/Darwin: When using -mios-simulator-version-min, explicitly pass this on
Daniel Dunbar [Sat, 30 Apr 2011 04:22:58 +0000 (04:22 +0000)]
Driver/Darwin: When using -mios-simulator-version-min, explicitly pass this on
to the linker.
 - Only do this explicitly with the argument for now, the linker will need to
   explicitly add support for this.

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

13 years agoDriver/Darwin: Reject invalid arch combinations with
Daniel Dunbar [Sat, 30 Apr 2011 04:20:40 +0000 (04:20 +0000)]
Driver/Darwin: Reject invalid arch combinations with
-mios-simulator-version-min.

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

13 years agoDriver/Darwin: Change Darwin toolchain to explicitly track is-ios-sim bit, and
Daniel Dunbar [Sat, 30 Apr 2011 04:18:16 +0000 (04:18 +0000)]
Driver/Darwin: Change Darwin toolchain to explicitly track is-ios-sim bit, and
update -mios-simulator-version-min to set it.

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

13 years agoDriver/Darwin: Sketch initial support for a -mios-simulator-version-min= flag
Daniel Dunbar [Sat, 30 Apr 2011 04:15:58 +0000 (04:15 +0000)]
Driver/Darwin: Sketch initial support for a -mios-simulator-version-min= flag
and associated deployment target environment variable.

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

13 years agoUpdate API.
Rafael Espindola [Sat, 30 Apr 2011 03:46:18 +0000 (03:46 +0000)]
Update API.

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

13 years agoFix gcc 'warning: multi-line comment'.
Nico Weber [Sat, 30 Apr 2011 03:13:21 +0000 (03:13 +0000)]
Fix gcc 'warning: multi-line comment'.

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

13 years agoAdd lib/Tooling to the Makefile build.
Nico Weber [Sat, 30 Apr 2011 03:09:18 +0000 (03:09 +0000)]
Add lib/Tooling to the Makefile build.

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

13 years agoAdd a Makefile to examples/Tooling for people who do not use cmake.
Nico Weber [Sat, 30 Apr 2011 03:03:12 +0000 (03:03 +0000)]
Add a Makefile to examples/Tooling for people who do not use cmake.

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

13 years agoFix Makefile build of examples/clang-interpreter.
Nico Weber [Sat, 30 Apr 2011 02:52:27 +0000 (02:52 +0000)]
Fix Makefile build of examples/clang-interpreter.

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

13 years agoAdd a couple of assertions to make sure the bitfields can fit the value assigned...
Argyrios Kyrtzidis [Sat, 30 Apr 2011 02:28:27 +0000 (02:28 +0000)]
Add a couple of assertions to make sure the bitfields can fit the value assigned to them. No functionality change.

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

13 years agoDocumentation for -Oz; Updated synopsis and item.
Chad Rosier [Sat, 30 Apr 2011 02:04:10 +0000 (02:04 +0000)]
Documentation for -Oz; Updated synopsis and item.

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

13 years agoAdd documentation for -Oz flag.
Chad Rosier [Sat, 30 Apr 2011 01:40:58 +0000 (01:40 +0000)]
Add documentation for -Oz flag.

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

13 years agoRemoved redundant case statements
Chad Rosier [Sat, 30 Apr 2011 00:03:48 +0000 (00:03 +0000)]
Removed redundant case statements

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

13 years agoTie constructor defintion with its declaration using AT_specification.
Devang Patel [Fri, 29 Apr 2011 23:42:32 +0000 (23:42 +0000)]
Tie constructor defintion with its declaration using AT_specification.

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

13 years agoAdjust test/Analysis/retain-release.m to also test the retain/release checker in...
Ted Kremenek [Fri, 29 Apr 2011 23:15:53 +0000 (23:15 +0000)]
Adjust test/Analysis/retain-release.m to also test the retain/release checker in Objective-C++ mode.

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

13 years agoAdd -Oz option and use it to set the inline threshold to 25.
Bob Wilson [Fri, 29 Apr 2011 22:49:50 +0000 (22:49 +0000)]
Add -Oz option and use it to set the inline threshold to 25.
Radar 9333566.  Patch by Chad Rosier!

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

13 years agoremoves a meaningless comment.
Fariborz Jahanian [Fri, 29 Apr 2011 22:11:28 +0000 (22:11 +0000)]
removes a meaningless comment.

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

13 years agoblock variables on lhs need be ir-gen'ed after the
Fariborz Jahanian [Fri, 29 Apr 2011 21:53:21 +0000 (21:53 +0000)]
block variables on lhs need be ir-gen'ed after the
rhs when its 'forwarding' pointer may be modified
in rhs evaluation as result of call to Block_copy.
// rdar://9309454

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

13 years agoGuard in USRGenerator::GenLoc() against null Decl* from invalid code.
Ted Kremenek [Fri, 29 Apr 2011 21:35:23 +0000 (21:35 +0000)]
Guard in USRGenerator::GenLoc() against null Decl* from invalid code.

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

13 years agoDisable -Wnon-pod-memset for now while I try to reduce the false
Chandler Carruth [Fri, 29 Apr 2011 20:58:14 +0000 (20:58 +0000)]
Disable -Wnon-pod-memset for now while I try to reduce the false
positives still further.

The plan is to:

1) Create a more targeted warning for memset of memory pointing at
   a type with virtual methods or bases where a vptr would be
   overwritten.
2) Consider turning the above warning back on by default.
3) Evaluate whether any false positives in the existing warning can be
   detected and white listed in the warning implementation.
4) If #3 lowers the noise floor enough, enable the full warning in -Wall
   or -Wextra.

Comments or suggestions welcome. Even more welcome are specific test
cases which trigger the warning and shouldn't.

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

13 years agoChange -Wparentheses to not imply -Widiomatic-parentheses. Users rarely want to...
Ted Kremenek [Fri, 29 Apr 2011 20:30:39 +0000 (20:30 +0000)]
Change -Wparentheses to not imply -Widiomatic-parentheses.  Users rarely want to see these warnings, and often explicitly pass -Wparentheses.

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

13 years agoSerialize/deserialize the HasStandardLayout bit when writing/reading PCHs.
Anders Carlsson [Fri, 29 Apr 2011 18:37:25 +0000 (18:37 +0000)]
Serialize/deserialize the HasStandardLayout bit when writing/reading PCHs.

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

13 years agoDriver/cc1as: Forward -mllvm arguments when compiling assembly files.
Daniel Dunbar [Fri, 29 Apr 2011 17:53:18 +0000 (17:53 +0000)]
Driver/cc1as: Forward -mllvm arguments when compiling assembly files.

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

13 years agoRemove comments about __int8 and friends from the mangler. Turns out we don't
Charles Davis [Fri, 29 Apr 2011 15:50:52 +0000 (15:50 +0000)]
Remove comments about __int8 and friends from the mangler. Turns out we don't
actually have to implement them, since in modern versions of MSVC they're
aliases to the standard C types.

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

13 years agoWhite-list yet more type trait names, since they're used as
Douglas Gregor [Fri, 29 Apr 2011 15:31:39 +0000 (15:31 +0000)]
White-list yet more type trait names, since they're used as
identifiers in libc++.

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

13 years agoDon't crash if the AST doesn't have a sensible ObjC id type.
David Chisnall [Fri, 29 Apr 2011 14:10:35 +0000 (14:10 +0000)]
Don't crash if the AST doesn't have a sensible ObjC id type.

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

13 years agoRelax the non-POD memset warning to use the less restrictive C++11
Chandler Carruth [Fri, 29 Apr 2011 09:46:08 +0000 (09:46 +0000)]
Relax the non-POD memset warning to use the less restrictive C++11
definition of POD. Specifically, this allows certain non-aggregate
types due to their data members being private.

The representation of C++11 POD testing is pretty gross. Any suggestions
for improvements there are welcome. Especially the name
'isCXX11PODType()' seems truly unfortunate.

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

13 years agor130381 follow up: accept __uuidof expression for template argument reference.
Francois Pichet [Fri, 29 Apr 2011 09:08:14 +0000 (09:08 +0000)]
r130381 follow up: accept __uuidof expression for template argument reference.

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

13 years agoAdd a decl update when a static data member of a class template is instantiated in...
Sebastian Redl [Fri, 29 Apr 2011 08:19:30 +0000 (08:19 +0000)]
Add a decl update when a static data member of a class template is instantiated in a different PCH than its containing class. Otherwise we get double definition errors. Fixes a Boost.MPL problem that affects Boost.Accumulators and probably a lot more of Boost.

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

13 years agoUse std::vector for ASTReader's ASTBuffers, instead of std::deque.
Sebastian Redl [Fri, 29 Apr 2011 08:19:19 +0000 (08:19 +0000)]
Use std::vector for ASTReader's ASTBuffers, instead of std::deque.

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

13 years agoUse -emit-llvm-only as suggested by Argyrios.
Sebastian Redl [Fri, 29 Apr 2011 08:19:03 +0000 (08:19 +0000)]
Use -emit-llvm-only as suggested by Argyrios.

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

13 years agoDon't assume that the AST methods will only be invoked on C++ types.
Chandler Carruth [Fri, 29 Apr 2011 07:47:42 +0000 (07:47 +0000)]
Don't assume that the AST methods will only be invoked on C++ types.
Teaches isLiteralType and isTrivialType to behave plausibly and most
importantly not crash on normal RecordDecls.

Sadly I have no real way to test this. I stumbled onto it by
mis-implementing a warning.

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

13 years agoOops
Douglas Gregor [Fri, 29 Apr 2011 01:50:40 +0000 (01:50 +0000)]
Oops

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

13 years agolibstdc++ 4.2 also uses __is_same as a struct name, which conflicts with our new...
Douglas Gregor [Fri, 29 Apr 2011 01:38:03 +0000 (01:38 +0000)]
libstdc++ 4.2 also uses __is_same as a struct name, which conflicts with our new type trait __is_same

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

13 years agoUse DirectoryLookup::getName() rather than getDir()->getName() in a context where...
Douglas Gregor [Fri, 29 Apr 2011 00:45:09 +0000 (00:45 +0000)]
Use DirectoryLookup::getName() rather than getDir()->getName() in a context where we don't know whether we have a normal directory

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

13 years agoEnhance clang_getCXTUResourceUsage() to report the sizes of the memory buffers used...
Ted Kremenek [Thu, 28 Apr 2011 23:46:20 +0000 (23:46 +0000)]
Enhance clang_getCXTUResourceUsage() to report the sizes of the memory buffers used by PCH.

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

13 years agoFixes debug info generation problem for ms_struct structs.
Fariborz Jahanian [Thu, 28 Apr 2011 23:43:23 +0000 (23:43 +0000)]
Fixes debug info generation problem for ms_struct structs.
// rdar://8823265

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

13 years agoCut down unnecessary zero'ing when value-initializing arrays of C++ objects.
Argyrios Kyrtzidis [Thu, 28 Apr 2011 22:57:55 +0000 (22:57 +0000)]
Cut down unnecessary zero'ing when value-initializing arrays of C++ objects.

-C++ objects with user-declared constructor don't need zero'ing.
-We can zero-initialize arrays of C++ objects in "bulk" now, in which case don't zero-initialize each object again.

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

13 years agoms_struct patch for initialization and field access irgen.
Fariborz Jahanian [Thu, 28 Apr 2011 22:49:46 +0000 (22:49 +0000)]
ms_struct patch for initialization and field access irgen.
// rdar://8823265 - wip.

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

13 years agoRaise ARM byval minimum size from 32 to 64, addressing a performance
Stuart Hastings [Thu, 28 Apr 2011 21:35:59 +0000 (21:35 +0000)]
Raise ARM byval minimum size from 32 to 64, addressing a performance
regression in mason.  rdar://problem/7662569

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

13 years agoDriver/Darwin/ld: Set the deployment target following the version information in
Daniel Dunbar [Thu, 28 Apr 2011 21:23:41 +0000 (21:23 +0000)]
Driver/Darwin/ld: Set the deployment target following the version information in
the tool chain, instead of based on the translated arguments.

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

13 years agotests: Tweak test to not write to the same temporary twice, in the hopes of avoiding...
Daniel Dunbar [Thu, 28 Apr 2011 21:23:38 +0000 (21:23 +0000)]
tests: Tweak test to not write to the same temporary twice, in the hopes of avoiding sporadic win32 failures about renaming a temporary.

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

13 years agoEnhance clang_getCXTUResourceUsage() to report how much memory is used by SourceManag...
Ted Kremenek [Thu, 28 Apr 2011 20:36:42 +0000 (20:36 +0000)]
Enhance clang_getCXTUResourceUsage() to report how much memory is used by SourceManager's memory buffers.

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

13 years agoGet the base element type even in multidimensional arrays.
Argyrios Kyrtzidis [Thu, 28 Apr 2011 20:07:15 +0000 (20:07 +0000)]
Get the base element type even in multidimensional arrays.

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

13 years agoUse StringRef::substr() and unbounded StringRef::compare() instead of bounded version...
Lenny Maiorani [Thu, 28 Apr 2011 19:31:12 +0000 (19:31 +0000)]
Use StringRef::substr() and unbounded StringRef::compare() instead of bounded version of StringRef::compare() because bounded version of StringRef::compare() is going to be removed.

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

13 years agoMake the top-level driver ignore -fobjc-default-synthesize-properties while this...
Ted Kremenek [Thu, 28 Apr 2011 19:26:03 +0000 (19:26 +0000)]
Make the top-level driver ignore -fobjc-default-synthesize-properties while this feature undergoes more review and development.  This is still available as a -cc1 option for testing.

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

13 years agoReplace unitary array with scalar. rdar://problem/7662569
Stuart Hastings [Thu, 28 Apr 2011 19:24:47 +0000 (19:24 +0000)]
Replace unitary array with scalar.  rdar://problem/7662569

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

13 years agoEliminates an assert in the strncpy/strncat checker caused by not validating a cast...
Lenny Maiorani [Thu, 28 Apr 2011 18:59:43 +0000 (18:59 +0000)]
Eliminates an assert in the strncpy/strncat checker caused by not validating a cast was successful. If the value of an argument was unknown, the cast would result in a NULL pointer which was later being dereferenced.

This fixes Bugzilla #9806.

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

13 years agoWhen value-initializing the elements of an array not not included in the initializer...
Argyrios Kyrtzidis [Thu, 28 Apr 2011 18:53:58 +0000 (18:53 +0000)]
When value-initializing the elements of an array not not included in the initializer make sure
that a non-trivial C++ constructor gets called.

Fixes rdar://9347552 & http://llvm.org/PR9801

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

13 years agoDon't waste memory if the initializer expression is empty.
Argyrios Kyrtzidis [Thu, 28 Apr 2011 18:53:55 +0000 (18:53 +0000)]
Don't waste memory if the initializer expression is empty.

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

13 years agoReplace SmallVector with an array, as suggested by Frits van Bommel. rdar://problem...
Stuart Hastings [Thu, 28 Apr 2011 18:16:06 +0000 (18:16 +0000)]
Replace SmallVector with an array, as suggested by Frits van Bommel.  rdar://problem/7662569

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

13 years agoWhen determining whether two types are reference-compatible, check
Douglas Gregor [Thu, 28 Apr 2011 17:56:11 +0000 (17:56 +0000)]
When determining whether two types are reference-compatible, check
non-CVR qualifiers as well as CVR qualifiers. For example, don't allow
a reference to an integer in address space 1 to bind to an integer in
address space 2.

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

13 years agoFixes ArrayTypeTraitExpr (-Wnon-virtual-dtor).
Manuel Klimek [Thu, 28 Apr 2011 17:03:03 +0000 (17:03 +0000)]
Fixes ArrayTypeTraitExpr (-Wnon-virtual-dtor).

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

13 years agoOnly call the MacroExpands callback when we're actually going to
Douglas Gregor [Thu, 28 Apr 2011 16:36:13 +0000 (16:36 +0000)]
Only call the MacroExpands callback when we're actually going to
expand the macro, based on a patch by Ori Avtalion. Fixes PR9799.

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

13 years agolibstdc++ 4.4 uses __is_signed as an identifier, while Clang treats it
Douglas Gregor [Thu, 28 Apr 2011 15:48:45 +0000 (15:48 +0000)]
libstdc++ 4.4 uses __is_signed as an identifier, while Clang treats it
as a keyword for the __is_signed type trait. Cope with this conflict
via some hackish recovery: if we see a declaration of the form

 static const bool __is_signed

then we stop treating __is_signed as a keyword and instead treat it as
an identifier. It's ugly, but it's better than making the __is_signed
type trait conditional on some language flag. Fixes PR9804.

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

13 years agoImplements strcasecmp() checker in Static Analyzer.
Lenny Maiorani [Thu, 28 Apr 2011 15:09:11 +0000 (15:09 +0000)]
Implements strcasecmp() checker in Static Analyzer.

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

13 years agoSilence more -Wnon-pod-memset given its current implementation. I may be
Chandler Carruth [Thu, 28 Apr 2011 08:19:45 +0000 (08:19 +0000)]
Silence more -Wnon-pod-memset given its current implementation. I may be
able to revert these based on a patch I'm working on, but no reason for
people to be spammed with warnings in the interim.

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

13 years agoAdd comment to CFGBlock suggested by Jiri Slaby.
Ted Kremenek [Thu, 28 Apr 2011 06:19:35 +0000 (06:19 +0000)]
Add comment to CFGBlock suggested by Jiri Slaby.

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

13 years agoUpdate r130381 to check for UO_AddrOf.
Francois Pichet [Thu, 28 Apr 2011 05:12:34 +0000 (05:12 +0000)]
Update r130381 to check for UO_AddrOf.

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

13 years agoEnhance clang_getCXTUResourceUsage() to report the amount of memory used by ASTContex...
Ted Kremenek [Thu, 28 Apr 2011 04:53:38 +0000 (04:53 +0000)]
Enhance clang_getCXTUResourceUsage() to report the amount of memory used by ASTContext's side tables.

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

13 years agoSupport &__uuidof(type) as a non type template argument.
Francois Pichet [Thu, 28 Apr 2011 04:39:50 +0000 (04:39 +0000)]
Support &__uuidof(type) as a non type template argument.
This idiom is used everywhere in MFC/COM code and as such this patch removes hundreds of errors when parsing MFC code with clang.

Example:
template <class T, const GUID* g = &__uuidof(T)>
class ComTemplate  { };

typedef ComTemplate<struct_with_uuid, &__uuidof(struct_with_uuid)> COM_TYPE;

Of course this is just parsing support. Trying to use this in CodeGen will generate:
error: cannot yet mangle expression type CXXUuidofExpr

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

13 years agoEnhance clang_getCXTUResourceUsage() to report the amount of memory used by SourceMan...
Ted Kremenek [Thu, 28 Apr 2011 04:10:31 +0000 (04:10 +0000)]
Enhance clang_getCXTUResourceUsage() to report the amount of memory used by SourceManager's content cache allocator.

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

13 years agoSEH was crashing under -fms-extensions.
Francois Pichet [Thu, 28 Apr 2011 03:14:31 +0000 (03:14 +0000)]
SEH was crashing under -fms-extensions.

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

13 years agoImplement the mangling for non-ADL call expressions that we just
John McCall [Thu, 28 Apr 2011 02:52:03 +0000 (02:52 +0000)]
Implement the mangling for non-ADL call expressions that we just
worked out.

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

13 years agoWhen block-capturing a variable with a non-trivial destructor,
John McCall [Thu, 28 Apr 2011 02:15:35 +0000 (02:15 +0000)]
When block-capturing a variable with a non-trivial destructor,
make sure to mark the destructor.  This normally isn't required,
because the destructor should have been marked as part of the
declaration of the local, but it's necessary when the variable
is a parameter because it's the call sites that are responsible
for those destructors.

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

13 years agoA few corrections to type traits that missed the last checkin
John Wiegley [Thu, 28 Apr 2011 02:06:46 +0000 (02:06 +0000)]
A few corrections to type traits that missed the last checkin

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

13 years agoBecause of r130359 this test no longer fail on Windows.
Francois Pichet [Thu, 28 Apr 2011 02:01:57 +0000 (02:01 +0000)]
Because of r130359 this test no longer fail on Windows.

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

13 years agoUpgrade Microsoft's __int8, __int16, __int32 and __int64 types from builtin defines...
Francois Pichet [Thu, 28 Apr 2011 01:59:37 +0000 (01:59 +0000)]
Upgrade Microsoft's __int8, __int16, __int32 and __int64 types from builtin defines to real types.

Otherwise statements like:
  __int64 var = __int64(0);

would be expanded to:
  long long var = long long(0);

and fail to compile.

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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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