Граф коммитов

23095 Коммитов

Автор SHA1 Сообщение Дата
Rafael Espindola 2215eef02c Remove unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147744 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 22:52:07 +00:00
Benjamin Kramer 9bc6fb6317 Pack UsingDecl more.
88 -> 80 bytes on x86_64.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147736 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 19:09:05 +00:00
Fariborz Jahanian b6e5fe3cae objc++: More codegen stuff for atomic properties of c++ objects
with non-trivial copies. // rdar://6137845



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147735 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 18:56:22 +00:00
Anna Zaks c5bdc556f6 [analyzer] Fix use-after-free in HandleTranslationUnit.
A patch by Dmitri Gribenko!

The attached patch fixes a use-after-free in AnalysisConsumer::HandleTranslationUnit.  The problem is that
BugReporter's destructor runs after AnalysisManager has been already
deleted.  The fix introduces a scope to force correct destruction
order.

A crash happens only when reports have been added in AnalysisConsumer::HandleTranslationUnit's BugReporter. We don't have such checkers in clang so no test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147732 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 16:49:46 +00:00
Abramo Bagnara 06284c1dc5 Fixed TypeofExpr AST and code generation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147730 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 10:52:36 +00:00
Douglas Gregor f5c9f9fd6f Switch NamespaceDecl from its own hand-rolled redeclaration chain over
to Redeclarable<NamespaceDecl>, so that we benefit from the improveed
redeclaration deserialization and merging logic provided by
Redeclarable<T>. Otherwise, no functionality change.

As a drive-by fix, collapse the "inline" bit into the low bit of the
original namespace/anonymous namespace, saving 8 bytes per
NamespaceDecl on x86_64.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147729 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 09:11:48 +00:00
Eli Friedman 72899c34e3 More lambda work: semantic analysis of capturing 'this'. It's a bit complicated, but we have to be careful about when exactly captures are marked given PotentiallyPotentiallyEvaluated contexts. (Actually, it's not 100% correct yet, but it's close enough for the moment.)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147723 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 04:59:52 +00:00
Anna Zaks 9f03b62036 [analyzer] Add basic format string vulnerability checking.
We already have a more conservative check in the compiler (if the
format string is not a literal, we warn). Still adding it here for
completeness and since this check is stronger - only triggered if the
format string is tainted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147714 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 02:33:10 +00:00
Eli Friedman e81d7e9810 Lambdas: semantic analysis of explicit captures.
This patch (and some of my other commits related to lambdas) is heavily based off of John Freeman's work-in-progress patches.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147706 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 01:08:17 +00:00
Ted Kremenek 3070e13dca [analyzer] Remove CallEnterNodeBuilder and simplify ExprEngine::processCallEnter().
This removes analysis of other translation units, but that was an experimental feature anyway that we will revisit later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147705 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 01:03:17 +00:00
Akira Hatanaka f0cc2087b1 Add field PaddingType to ABIArgInfo which specifies the type of padding that
is inserted before the real argument. Padding is needed to ensure the backend
reads from or writes to the correct argument slots when the original alignment
of a byval structure is unavailable due to flattening.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147699 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 00:25:33 +00:00
Ted Kremenek 242384ddb0 Correctly enqueue successors in ExprEngine::processCallExit().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147698 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 00:10:49 +00:00
Ted Kremenek 894212e951 [analyzer] Remove CallExitNodeBuilder, and have ExprEngine::processCallExit() do the work manually. This is a nice simplification.
Along the way, fix Exprengine::processCallExit() to also perform the postStmt callback for checkers for CallExprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147697 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 00:00:59 +00:00
Matt Beaumont-Gay d87a0cd2b3 Suppress -Wunused-value within macros from system headers.
Along the way, move a helper function from SemaChecking.cpp to a more
accessible home in SourceManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147692 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 22:43:58 +00:00
Fariborz Jahanian cd93b96bc5 objc++: more code gen stuff for atomic property api,
currently turned off. // rdar://6137845
Also, fixes a test case which should be nonatomic under
new API.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147691 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 22:33:54 +00:00
Ted Kremenek 5eca482fe8 [analyzer] Make the entries in 'Environment' context-sensitive by making entries map from
(Stmt*,LocationContext*) pairs to SVals instead of Stmt* to SVals.

This is needed to support basic IPA via inlining.  Without this, we cannot tell
if a Stmt* binding is part of the current analysis scope (StackFrameContext) or
part of a parent context.

This change introduces an uglification of the use of getSVal(), and thus takes
two steps forward and one step back.  There are also potential performance implications
of enlarging the Environment.  Both can be addressed going forward by refactoring the
APIs and optimizing the internal representation of Environment.  This patch
mainly introduces the functionality upon when we want to build upon (and clean up).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147688 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 22:09:28 +00:00
Douglas Gregor 0782ef2bd0 During name lookup, use redecl_iterator to walk over the redeclaration
chain to determine whether any declaration of the given entity is
visible, eliminating the redundant (and less efficient)
getPreviousDeclaration() implementation.

This tweak uncovered an omission in the handling of
RedeclarableTemplateDecl, where we weren't making sure to search for
additional redeclarations of a template in other module files. Things
would be cleaner if RedeclarableTemplateDecl actually used Redeclarable.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147687 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 22:05:37 +00:00
Eli Friedman d97927d69b Revert r147664; it's breaking clang regression tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147681 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 20:42:20 +00:00
Chad Rosier 0774ba7bb2 Fix uninitialized variable warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147678 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 20:05:14 +00:00
Eli Friedman 52a27f5be9 Revert r147655; it's breaking the compiler_rt build on OSX.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147677 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 20:03:09 +00:00
DeLesley Hutchins b4fa418a72 Thread safety analysis: added support for trylock attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147672 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 19:16:50 +00:00
DeLesley Hutchins b37d2b5c08 Added LocalVariableMap
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147670 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 18:36:09 +00:00
Joerg Sonnenberger 42378be9a0 __FLT_EVAL_METHOD__ should be 1 on NetBSD/i386, since it defaults to
"double" rounding.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147669 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 18:32:26 +00:00
Fariborz Jahanian e3173021fa objc++: some declarations related to atomic
properties of c++ object types with non-trivial
assignment copy. Not used yet. // rdar://6137845


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147666 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 18:07:23 +00:00
Jakub Staszak 2d5f0952a9 Silence GCC warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147664 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 17:44:30 +00:00
Douglas Gregor 303aae98a5 When inferring a submodule ID during module creation, look up the
include stack to find the first file that is known to be part of the
module. This copes with situations where the module map doesn't
completely specify all of the headers that are involved in the module,
which can come up when there are very strange #include_next chains
(e.g., with weird compiler/stdlib headers like stdarg.h or float.h).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147662 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 17:19:32 +00:00
Douglas Gregor 46cd2186bd Stash Decl's TopLevelDeclInObjCContainer and ModulePrivate bits
into the two unused lower bits of the NextDeclInContext link, dropping
the number of bits in Decl down to 32, and saving 8 bytes per
declaration on x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147660 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 16:59:53 +00:00
Richard Smith b4e85ed519 C++11 generalized constant expressions: implement checking and diagnostics for
pointer-arithmetic-related undefined behavior and unspecified results. We
continue to fold such values, but now notice they aren't constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147659 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 16:39:00 +00:00
Douglas Gregor f143ffc4a9 Introduce a "Hidden" bit into Decl, to track whether that declaration
is hidden from name lookup. The previous hack of tweaking the
ModulePrivate bit when loading a declaration from a hidden submodule
was brittle.

Note that we now have 34 bits in Decl. I'll fix that next.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147658 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 16:22:39 +00:00
Douglas Gregor 9b8b20f7a4 Teach DeclContext deserialization to pay attention to endianness, from
David Fang and Takumi Nakamura. Fixes many PCH failures on PowerPC.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147657 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 16:09:53 +00:00
David Chisnall 843cc5aaed If we are compiling with -fno-builtin then don't do constant folding of
builtins.

This fixes PR11711.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147655 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 12:20:19 +00:00
John McCall 092beef87b Fix the mangling of class template arguments in a particular
dependent case.  Thanks to Jason Merrill for pointing this out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147653 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 05:06:35 +00:00
Rafael Espindola 1a5d35539a Improvements to the uninitialized variable warning: Check if the constructor
call is elidable or if the constructor is trivial instead of checking if it
is user declared.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147652 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 04:54:01 +00:00
Eli Friedman 906a7e1c0f More lambda work. Fixes a minor bug Richard pointed out, makes lookup for lambda parameters work correctly, recording more information into the AST.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147650 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 03:05:34 +00:00
Richard Smith 2f0e88a87c David Blaikie and Chandler would like us to diagnose
int f();

in function scopes under -Wvexing-parse, so now we do.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147649 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 02:30:50 +00:00
Richard Smith 1d7bcf4b35 Tweak to r147599 for PR10828: Move the check from the parser into sema, and use
the Semantic Powers to only warn on class types (or dependent types), where the
constructor or destructor could do something interesting.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147642 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 01:31:20 +00:00
Eli Friedman a0b2ba1d0e Minor refactoring of sentinel warning on blocks. Add a test for this warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147641 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 01:23:10 +00:00
Fariborz Jahanian 84e49865cb objc++: sythesize a helper function to be used
for copying atomic properties of c++ objects
with non-trivial copy assignment in setters/getters.
Not yet used. // rdar://6137845


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147636 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 00:29:35 +00:00
Argyrios Kyrtzidis ce52bb3dec Fix a memory leak of PragmaNamespaces, rdar://10611796.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147635 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 00:22:09 +00:00
Eli Friedman 5930a4c522 Address Richard's review comments on r147561 (Evaluate support for address-of-label differences).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147631 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 23:59:40 +00:00
Douglas Gregor 5d1f496f86 Always allocate an extra 8 bytes for a deserialized declaration, since
some code in Clang expects 8-byte alignment of declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147626 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 23:49:36 +00:00
Ted Kremenek 71207fc047 After further discussion, rename attribute 'objc_disable_automatic_synthesis' to 'objc_requires_property_definitions'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147622 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 22:47:47 +00:00
Eli Friedman 6aeaa60217 Tweak the fix to PR8977: an empty expression-list represents value initialization, not default initialization. Fixes PR11712.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147620 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 22:34:08 +00:00
Douglas Gregor 1c7946a9fb Don't seed the ASTWriter's declaration -> ID mapping with the IDs of
each deserialized declaration, since that information is already
available in each declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147619 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 22:33:30 +00:00
Douglas Gregor b6b60c1521 When we deserialize a declaration from a module file, allocate extra
storage for the global declaration ID. Declarations that are parsed
(rather than deserialized) are unaffected, so the number of
declarations that pay this cost tends to be relatively small (since
relatively few declarations are ever deserialized).

This replaces a largish DenseMap within the AST reader. It's not
strictly a win in terms of memory use---not every declaration was
added to that DenseMap in the first place---but it's cleaner to have
this information available for every deserialized declaration, so that
future clients can rely on it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147617 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 22:27:05 +00:00
Douglas Gregor 1e68ecc4fc When creating declarations that are deserialized from an module file,
go through a central allocation routine
Decl::AllocateDeserializedDecl(). No actual functionality change (yet).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147614 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 21:55:30 +00:00
Argyrios Kyrtzidis b8c879a536 When loading an AST file, set SourceManager::MainFileID to the main file of the AST file,
as suggested by Tom Honermann.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147612 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 21:36:25 +00:00
Richard Smith cb7709c060 PR10828: Produce a warning when a no-arguments function is declared in block
scope, when no other indication is provided that the user intended to declare a
function rather than a variable.

Remove some false positives from the existing 'parentheses disambiguated as a
function' warning by suppressing it when the declaration is marked as 'typedef'
or 'extern'.

Add a new warning group -Wvexing-parse containing both of these warnings.

The new warning is enabled by default; despite a number of false positives (and
one bug) in clang's test-suite, I have only found genuine bugs with it when
running it over a significant quantity of real C++ code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147599 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 04:12:21 +00:00
Eli Friedman ec9ea72007 More lambda work. Tweak the Sema interface slightly. Start adding the pieces to build the lambda class and its call operator. Create an actual scope for the lambda body.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147595 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 03:35:19 +00:00
Douglas Gregor 447af24a00 When we're performing name lookup for a tag, we still allow ourselves
to see hidden declarations because every tag lookup is effectively a
redeclaration lookup. For example, image that

  struct foo;

is declared in a submodule that is known but hasn't been imported. If
someone later writes

  struct foo *foo_p;

then "struct foo" is either a reference or a redeclaration. To keep
the redeclaration chains sound, we treat it like a redeclaration for
name-lookup purposes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147588 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 01:11:47 +00:00