]> granicus.if.org Git - clang/log
clang
12 years agoAdd field PaddingType to ABIArgInfo which specifies the type of padding that
Akira Hatanaka [Sat, 7 Jan 2012 00:25:33 +0000 (00:25 +0000)]
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

12 years agoCorrectly enqueue successors in ExprEngine::processCallExit().
Ted Kremenek [Sat, 7 Jan 2012 00:10:49 +0000 (00:10 +0000)]
Correctly enqueue successors in ExprEngine::processCallExit().

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

12 years ago[analyzer] Remove CallExitNodeBuilder, and have ExprEngine::processCallExit() do...
Ted Kremenek [Sat, 7 Jan 2012 00:00:59 +0000 (00:00 +0000)]
[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

12 years agoSuppress -Wunused-value within macros from system headers.
Matt Beaumont-Gay [Fri, 6 Jan 2012 22:43:58 +0000 (22:43 +0000)]
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

12 years agoobjc++: more code gen stuff for atomic property api,
Fariborz Jahanian [Fri, 6 Jan 2012 22:33:54 +0000 (22:33 +0000)]
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

12 years ago[analyzer] Make the entries in 'Environment' context-sensitive by making entries...
Ted Kremenek [Fri, 6 Jan 2012 22:09:28 +0000 (22:09 +0000)]
[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

12 years agoDuring name lookup, use redecl_iterator to walk over the redeclaration
Douglas Gregor [Fri, 6 Jan 2012 22:05:37 +0000 (22:05 +0000)]
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

12 years agoRevert r147664; it's breaking clang regression tests.
Eli Friedman [Fri, 6 Jan 2012 20:42:20 +0000 (20:42 +0000)]
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

12 years agoFix uninitialized variable warning.
Chad Rosier [Fri, 6 Jan 2012 20:05:14 +0000 (20:05 +0000)]
Fix uninitialized variable warning.

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

12 years agoRevert r147655; it's breaking the compiler_rt build on OSX.
Eli Friedman [Fri, 6 Jan 2012 20:03:09 +0000 (20:03 +0000)]
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

12 years agoThread safety analysis: added support for trylock attribute.
DeLesley Hutchins [Fri, 6 Jan 2012 19:16:50 +0000 (19:16 +0000)]
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

12 years agoAdded LocalVariableMap
DeLesley Hutchins [Fri, 6 Jan 2012 18:36:09 +0000 (18:36 +0000)]
Added LocalVariableMap

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

12 years ago__FLT_EVAL_METHOD__ should be 1 on NetBSD/i386, since it defaults to
Joerg Sonnenberger [Fri, 6 Jan 2012 18:32:26 +0000 (18:32 +0000)]
__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

12 years agoobjc++: some declarations related to atomic
Fariborz Jahanian [Fri, 6 Jan 2012 18:07:23 +0000 (18:07 +0000)]
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

12 years agoSilence GCC warnings.
Jakub Staszak [Fri, 6 Jan 2012 17:44:30 +0000 (17:44 +0000)]
Silence GCC warnings.

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

12 years ago[asan] mention -fno-omit-frame-pointer in the docs
Kostya Serebryany [Fri, 6 Jan 2012 17:35:27 +0000 (17:35 +0000)]
[asan] mention -fno-omit-frame-pointer in the docs

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

12 years agoWhen inferring a submodule ID during module creation, look up the
Douglas Gregor [Fri, 6 Jan 2012 17:19:32 +0000 (17:19 +0000)]
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

12 years ago[analyzer] Correct the c++-analyzer symlink
Anna Zaks [Fri, 6 Jan 2012 17:11:23 +0000 (17:11 +0000)]
[analyzer] Correct the c++-analyzer symlink

As Matt pointed out, this should be just a link to 'ccc-analyzer'.

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

12 years agoStash Decl's TopLevelDeclInObjCContainer and ModulePrivate bits
Douglas Gregor [Fri, 6 Jan 2012 16:59:53 +0000 (16:59 +0000)]
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

12 years agoC++11 generalized constant expressions: implement checking and diagnostics for
Richard Smith [Fri, 6 Jan 2012 16:39:00 +0000 (16:39 +0000)]
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

12 years agoIntroduce a "Hidden" bit into Decl, to track whether that declaration
Douglas Gregor [Fri, 6 Jan 2012 16:22:39 +0000 (16:22 +0000)]
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

12 years agoTeach DeclContext deserialization to pay attention to endianness, from
Douglas Gregor [Fri, 6 Jan 2012 16:09:53 +0000 (16:09 +0000)]
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

12 years agoIf we are compiling with -fno-builtin then don't do constant folding of
David Chisnall [Fri, 6 Jan 2012 12:20:19 +0000 (12:20 +0000)]
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

12 years agoFix the mangling of class template arguments in a particular
John McCall [Fri, 6 Jan 2012 05:06:35 +0000 (05:06 +0000)]
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

12 years agoImprovements to the uninitialized variable warning: Check if the constructor
Rafael Espindola [Fri, 6 Jan 2012 04:54:01 +0000 (04:54 +0000)]
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

12 years agoMore lambda work. Fixes a minor bug Richard pointed out, makes lookup for lambda...
Eli Friedman [Fri, 6 Jan 2012 03:05:34 +0000 (03:05 +0000)]
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

12 years agoDavid Blaikie and Chandler would like us to diagnose
Richard Smith [Fri, 6 Jan 2012 02:30:50 +0000 (02:30 +0000)]
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

12 years ago[analyzer] c++-analyzer should be a symlink.
Anna Zaks [Fri, 6 Jan 2012 02:19:07 +0000 (02:19 +0000)]
[analyzer] c++-analyzer should be a symlink.

This fixes a regression from r147643.

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

12 years ago[analyzer] Update the docs to reflect that gcc is not the only default
Anna Zaks [Fri, 6 Jan 2012 01:54:08 +0000 (01:54 +0000)]
[analyzer] Update the docs to reflect that gcc is not the only default
compiler option.

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

12 years ago[analyzer] scan-build: If we are on MacOS, use clang as the default
Anna Zaks [Fri, 6 Jan 2012 01:54:05 +0000 (01:54 +0000)]
[analyzer] scan-build: If we are on MacOS, use clang as the default
compiler.

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

12 years ago[analyzer] Skip --serialize-diagnostic when running scan-build.
Anna Zaks [Fri, 6 Jan 2012 01:54:02 +0000 (01:54 +0000)]
[analyzer] Skip --serialize-diagnostic when running scan-build.

Otherwise, the analyzer will try to analyze the serialized diagnostic
file as if it were a source file.

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

12 years agoTweak to r147599 for PR10828: Move the check from the parser into sema, and use
Richard Smith [Fri, 6 Jan 2012 01:31:20 +0000 (01:31 +0000)]
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

12 years agoMinor refactoring of sentinel warning on blocks. Add a test for this warning.
Eli Friedman [Fri, 6 Jan 2012 01:23:10 +0000 (01:23 +0000)]
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

12 years agoobjc++: sythesize a helper function to be used
Fariborz Jahanian [Fri, 6 Jan 2012 00:29:35 +0000 (00:29 +0000)]
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

12 years agoFix a memory leak of PragmaNamespaces, rdar://10611796.
Argyrios Kyrtzidis [Fri, 6 Jan 2012 00:22:09 +0000 (00:22 +0000)]
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

12 years agoAddress Richard's review comments on r147561 (Evaluate support for address-of-label...
Eli Friedman [Thu, 5 Jan 2012 23:59:40 +0000 (23:59 +0000)]
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

12 years agoAlways allocate an extra 8 bytes for a deserialized declaration, since
Douglas Gregor [Thu, 5 Jan 2012 23:49:36 +0000 (23:49 +0000)]
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

12 years agoAfter further discussion, rename attribute 'objc_disable_automatic_synthesis' to...
Ted Kremenek [Thu, 5 Jan 2012 22:47:47 +0000 (22:47 +0000)]
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

12 years agoTweak the fix to PR8977: an empty expression-list represents value initialization...
Eli Friedman [Thu, 5 Jan 2012 22:34:08 +0000 (22:34 +0000)]
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

12 years agoDon't seed the ASTWriter's declaration -> ID mapping with the IDs of
Douglas Gregor [Thu, 5 Jan 2012 22:33:30 +0000 (22:33 +0000)]
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

12 years agoWhen we deserialize a declaration from a module file, allocate extra
Douglas Gregor [Thu, 5 Jan 2012 22:27:05 +0000 (22:27 +0000)]
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

12 years agoWhen creating declarations that are deserialized from an module file,
Douglas Gregor [Thu, 5 Jan 2012 21:55:30 +0000 (21:55 +0000)]
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

12 years agoWhen loading an AST file, set SourceManager::MainFileID to the main file of the AST...
Argyrios Kyrtzidis [Thu, 5 Jan 2012 21:36:25 +0000 (21:36 +0000)]
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

12 years agoPR10828: Produce a warning when a no-arguments function is declared in block
Richard Smith [Thu, 5 Jan 2012 04:12:21 +0000 (04:12 +0000)]
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

12 years agoMore lambda work. Tweak the Sema interface slightly. Start adding the pieces to...
Eli Friedman [Thu, 5 Jan 2012 03:35:19 +0000 (03:35 +0000)]
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

12 years ago[driver] Add support for passing -lazy_framework/-lazy_library to the linker.
Chad Rosier [Thu, 5 Jan 2012 01:56:11 +0000 (01:56 +0000)]
[driver] Add support for passing -lazy_framework/-lazy_library to the linker.
rdar://10630328

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

12 years agoChange casting slightly to avoid warnings about casting away const.
Eli Friedman [Thu, 5 Jan 2012 01:16:29 +0000 (01:16 +0000)]
Change casting slightly to avoid warnings about casting away const.

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

12 years agoWhen we're performing name lookup for a tag, we still allow ourselves
Douglas Gregor [Thu, 5 Jan 2012 01:11:47 +0000 (01:11 +0000)]
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

12 years agoMinor cleanup; no functional change.
Eli Friedman [Thu, 5 Jan 2012 00:49:17 +0000 (00:49 +0000)]
Minor cleanup; no functional change.

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

12 years agoSanity checks in SourceManager::getFileEntryForID() and SourceManager::getFileEntryFo...
Argyrios Kyrtzidis [Thu, 5 Jan 2012 00:19:03 +0000 (00:19 +0000)]
Sanity checks in SourceManager::getFileEntryForID() and SourceManager::getFileEntryForSLocEntry()
to make sure we do not crash. rdar://10594186

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

12 years agoThe value of a const weak variable is not an integer constant.
John McCall [Thu, 5 Jan 2012 00:13:19 +0000 (00:13 +0000)]
The value of a const weak variable is not an integer constant.

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

12 years agoIf we already have a definition for a top-level module that we deserialized from...
Douglas Gregor [Thu, 5 Jan 2012 00:12:00 +0000 (00:12 +0000)]
If we already have a definition for a top-level module that we deserialized from a module file, don't bother parsing a new definition

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

12 years agoFixes a code gen bug for setter code for a property of
Fariborz Jahanian [Thu, 5 Jan 2012 00:10:16 +0000 (00:10 +0000)]
Fixes a code gen bug for setter code for a property of
c++ object reference type with trivial copy constructor.
This causes an assert crash and bad code gen. when assert
is off. // rdar://6137845

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

12 years agoWhen generating includes for all of the headers we found in an
Douglas Gregor [Thu, 5 Jan 2012 00:04:05 +0000 (00:04 +0000)]
When generating includes for all of the headers we found in an
umbrella directory, skip includes for any headers that are part of an
unavailable module.

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

12 years ago[analyzer] Add another tests to taint tester.
Anna Zaks [Wed, 4 Jan 2012 23:54:04 +0000 (23:54 +0000)]
[analyzer] Add another tests to taint tester.

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

12 years ago[analyzer] Be less pessimistic about invalidation of global variables
Anna Zaks [Wed, 4 Jan 2012 23:54:01 +0000 (23:54 +0000)]
[analyzer] Be less pessimistic about invalidation of global variables
as a result of a call.

Problem:
Global variables, which come in from system libraries should not be
invalidated by all calls. Also, non-system globals should not be
invalidated by system calls.

Solution:
The following solution to invalidation of globals seems flexible enough
for taint (does not invalidate stdin) and should not lead to too
many false positives. We split globals into 3 classes:

* immutable - values are preserved by calls (unless the specific
global is passed in as a parameter):
     A :  Most system globals and const scalars

* invalidated by functions defined in system headers:
     B: errno

* invalidated by all other functions (note, these functions may in
turn contain system calls):
     B: errno
     C: all other globals (which are not in A nor B)

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

12 years ago[analyzer] Correct the error message in the testing infrastructure.
Anna Zaks [Wed, 4 Jan 2012 23:53:50 +0000 (23:53 +0000)]
[analyzer] Correct the error message in the testing infrastructure.

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

12 years agoRename attribute 'objc_suppress_autosynthesis' to 'objc_disable_automatic_synthesis'.
Ted Kremenek [Wed, 4 Jan 2012 23:51:09 +0000 (23:51 +0000)]
Rename attribute 'objc_suppress_autosynthesis' to 'objc_disable_automatic_synthesis'.

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

12 years agoFix 80 col violations.
Ted Kremenek [Wed, 4 Jan 2012 23:48:37 +0000 (23:48 +0000)]
Fix 80 col violations.

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

12 years agoFix test on Release builds.
Eli Friedman [Wed, 4 Jan 2012 23:41:09 +0000 (23:41 +0000)]
Fix test on Release builds.

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

12 years agoStore the submodules of a module in source order, as they are stored
Douglas Gregor [Wed, 4 Jan 2012 23:32:19 +0000 (23:32 +0000)]
Store the submodules of a module in source order, as they are stored
in the module map. This provides a bit more predictability for the
user, as well as eliminating the need to sort the submodules when
serializing them.

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

12 years agoTest case for my previous patch.
Fariborz Jahanian [Wed, 4 Jan 2012 23:16:48 +0000 (23:16 +0000)]
Test case for my previous patch.

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

12 years agoobjc: When issuing warning for missing synthesis for
Fariborz Jahanian [Wed, 4 Jan 2012 23:16:13 +0000 (23:16 +0000)]
objc: When issuing warning for missing synthesis for
properties in classes declared with objc_suppress_autosynthesis
attribute, pinpoint location of the said class in a note.

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

12 years agoAdd an APValue representation for the difference between two address-of-label express...
Eli Friedman [Wed, 4 Jan 2012 23:13:47 +0000 (23:13 +0000)]
Add an APValue representation for the difference between two address-of-label expressions.  Add support to Evaluate and CGExprConstant for generating/handling them.  Remove the special-case for such differences in Expr::isConstantInitializer.

With that done, remove a bunch of buggy code from CGExprConstant for handling scalar expressions which is no longer necessary.

Fixes PR11705.

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

12 years agofix test on -Asserts builds.
Chris Lattner [Wed, 4 Jan 2012 22:51:21 +0000 (22:51 +0000)]
fix test on -Asserts builds.

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

12 years agoimplement rdar://10639962 by keeping track of increased alignment
Chris Lattner [Wed, 4 Jan 2012 22:35:55 +0000 (22:35 +0000)]
implement rdar://10639962 by keeping track of increased alignment
information even in subscripting operations.

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

12 years agoAdd missing #endif in documentation.
Ted Kremenek [Wed, 4 Jan 2012 22:35:02 +0000 (22:35 +0000)]
Add missing #endif in documentation.

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

12 years agoSupport __has_attribute for objc_suppress_autosynthesis
Fariborz Jahanian [Wed, 4 Jan 2012 22:29:28 +0000 (22:29 +0000)]
Support __has_attribute for objc_suppress_autosynthesis
which is automatic with proper spelling :).

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

12 years agoDriver/Darwin: Remove a hack that avoided passing -demangle to iOS linkers.
Daniel Dunbar [Wed, 4 Jan 2012 21:45:27 +0000 (21:45 +0000)]
Driver/Darwin: Remove a hack that avoided passing -demangle to iOS linkers.

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

12 years agoAdd __has_feature(modules) to indicate when modules are available (in
Douglas Gregor [Wed, 4 Jan 2012 21:16:09 +0000 (21:16 +0000)]
Add __has_feature(modules) to indicate when modules are available (in
any language variant), and restrict __has_feature(objc_modules) to
mean that we also have the Objective-C @import syntax. I anticipate
__has_feature(cxx_modules) and/or __has_feature(c_modules) for when we
nail down the module syntax for C/C++.

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

12 years agoFix test so it doesn't depend on the host's calling convention lowering code.
Eli Friedman [Wed, 4 Jan 2012 20:43:57 +0000 (20:43 +0000)]
Fix test so it doesn't depend on the host's calling convention lowering code.

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

12 years agoImplement declaration merging for variables in disjoint modules.
Douglas Gregor [Wed, 4 Jan 2012 17:21:36 +0000 (17:21 +0000)]
Implement declaration merging for variables in disjoint modules.

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

12 years agoImplement declaration merging for non-template functions from
Douglas Gregor [Wed, 4 Jan 2012 17:13:46 +0000 (17:13 +0000)]
Implement declaration merging for non-template functions from
different modules. This implementation is a first approximation of
what we want, using only the function type to determine
equivalence. Later, we'll want to deal with some of the more subtle
issues, including:

  - C allows a prototyped declaration and a non-prototyped declaration
    to be merged, which we should support
  - We may want to ignore the return type when merging, then
    complain if the return types differ. Or, we may want to leave it
    as it us, so that we only complain if overload resolution
    eventually fails.
  - C++ non-static member functions need to consider cv-qualifiers
    and ref-qualifiers.
  - Function templates need to consider the template parameters and
    return type.
  - Function template specializations will have special rules.
  - We can now (accidentally!) end up overloading in C, even without
    the "overloadable" attribute, and will need to detect this at some
    point.

The actual detection of "is this an overload?" is implemented by
Sema::IsOverload(), which will need to be moved into the AST library
for re-use here. That will be a future refactor.

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

12 years agoImplement declaration merging for typedefs loaded from disjoint
Douglas Gregor [Wed, 4 Jan 2012 16:44:10 +0000 (16:44 +0000)]
Implement declaration merging for typedefs loaded from disjoint
modules, so long as the typedefs refer to the same underlying
type. This ensures that the typedefs end up in the same redeclaration
chain.

To test this, fix name lookup for C/Objective-C to properly deal with
multiple declarations with the same name in the same scope.

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

12 years agoPenryn doesn't support sse4.2, don't enable it in the first place.
Benjamin Kramer [Wed, 4 Jan 2012 14:36:57 +0000 (14:36 +0000)]
Penryn doesn't support sse4.2, don't enable it in the first place.

While the code took care of disabling the sse42 flag it didn't know
about popcnt. This broke -march=native on penryn.

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

12 years agoRestore r147493 and remove the part of the test that was checking the wrong thing.
David Chisnall [Wed, 4 Jan 2012 12:02:13 +0000 (12:02 +0000)]
Restore r147493 and remove the part of the test that was checking the wrong thing.

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

12 years agoExtend ConditionBRVisitor to handle condition variable assignments.
Ted Kremenek [Wed, 4 Jan 2012 08:18:09 +0000 (08:18 +0000)]
Extend ConditionBRVisitor to handle condition variable assignments.

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

12 years agoDon't treat 'import' as a contextual keyword when we're in a caching lexer, or when...
Douglas Gregor [Wed, 4 Jan 2012 06:20:15 +0000 (06:20 +0000)]
Don't treat 'import' as a contextual keyword when we're in a caching lexer, or when modules are disabled.

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

12 years agoProcess attributes in explicit function template instantiations. Fixes part of
Rafael Espindola [Wed, 4 Jan 2012 05:40:59 +0000 (05:40 +0000)]
Process attributes in explicit function template instantiations. Fixes part of
PR11690.

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

12 years agoAdd an explicit LambdaExprContext to Declarator, to parallel BlockLiteralContext...
Eli Friedman [Wed, 4 Jan 2012 04:41:38 +0000 (04:41 +0000)]
Add an explicit LambdaExprContext to Declarator, to parallel BlockLiteralContext.  Use it to ensure semantic analysis of types isn't confused by the lack of a type specifier.

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

12 years agoHave functions return structures smaller than 128-bit in registers if ABI
Akira Hatanaka [Wed, 4 Jan 2012 03:34:42 +0000 (03:34 +0000)]
Have functions return structures smaller than 128-bit in registers if ABI
is either N32 or N64.

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

12 years agoFix messed-up indentation in r147515.
Eli Friedman [Wed, 4 Jan 2012 02:46:53 +0000 (02:46 +0000)]
Fix messed-up indentation in r147515.

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

12 years agoStub out the Sema interface for lambda expressions, and change the parser to use...
Eli Friedman [Wed, 4 Jan 2012 02:40:39 +0000 (02:40 +0000)]
Stub out the Sema interface for lambda expressions, and change the parser to use it.  Unconditionally error on lambda expressions because they don't work in any meaningful way yet.

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

12 years agoRevert r147493. It broke test/CodeGenObjC/constant-strings.m.
Rafael Espindola [Wed, 4 Jan 2012 01:32:19 +0000 (01:32 +0000)]
Revert r147493. It broke test/CodeGenObjC/constant-strings.m.

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

12 years agoTeach the static analyzer to not treat XPC types as CF types.
Ted Kremenek [Wed, 4 Jan 2012 00:35:48 +0000 (00:35 +0000)]
Teach the static analyzer to not treat XPC types as CF types.

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

12 years agoMinor code formatting cleanups.
Ted Kremenek [Wed, 4 Jan 2012 00:35:45 +0000 (00:35 +0000)]
Minor code formatting cleanups.

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

12 years agoIn non-gc, non-arc mode, property of 'Class' type
Fariborz Jahanian [Wed, 4 Jan 2012 00:31:53 +0000 (00:31 +0000)]
In non-gc, non-arc mode, property of 'Class' type
variety is treated as a 'void *'. No need to issue
warning reserved for objc object properties.
// rdar://10565506

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

12 years agoGet rid of an unnecessary check; the AST for init-lists is the same independent of...
Eli Friedman [Tue, 3 Jan 2012 23:54:05 +0000 (23:54 +0000)]
Get rid of an unnecessary check; the AST for init-lists is the same independent of whether we're in C++11 mode.

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

12 years agoEnhance UnixAPIChecker to also warn about zero-sized allocations to calloc() and...
Ted Kremenek [Tue, 3 Jan 2012 23:43:13 +0000 (23:43 +0000)]
Enhance UnixAPIChecker to also warn about zero-sized allocations to calloc() and realloc().  Patch by Cyril Roelandt!

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

12 years agoMinor tweak to name lookup for C/Objective-C: after the first name, still consider...
Douglas Gregor [Tue, 3 Jan 2012 23:34:23 +0000 (23:34 +0000)]
Minor tweak to name lookup for C/Objective-C: after the first name, still consider whether this is a redeclaration lookup when determining whether to look for the visible declaration

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

12 years agoTest "merging" of typedef types across distinct modules. At present,
Douglas Gregor [Tue, 3 Jan 2012 23:26:26 +0000 (23:26 +0000)]
Test "merging" of typedef types across distinct modules. At present,
the AST reader doesn't actually perform a merge, because name lookup
knows how to merge identical typedefs together.

As part of this, teach C/Objective-C name lookup to return multiple
results in all cases, rather than first digging through the attributes
to see if the value is overloadable. This way, we'll catch ambiguous
lookups in C/Objective-C.

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

12 years agoSupport constant evaluation for OpenCL nested vector literals. Patch by Anton Lokhmotov.
Eli Friedman [Tue, 3 Jan 2012 23:24:20 +0000 (23:24 +0000)]
Support constant evaluation for OpenCL nested vector literals.  Patch by Anton Lokhmotov.

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

12 years agoAdd initial version of checker to check if virtual member functions are called transi...
Ted Kremenek [Tue, 3 Jan 2012 23:18:57 +0000 (23:18 +0000)]
Add initial version of checker to check if virtual member functions are called transitively
from C++ constructors or destructors.  Checker by Lei Zhang with a few tweaks by Ted Kremenek.

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

12 years agoInitialise constant Objective-C string isa pointers with a weak reference to the...
David Chisnall [Tue, 3 Jan 2012 23:18:17 +0000 (23:18 +0000)]
Initialise constant Objective-C string isa pointers with a weak reference to the class, so that they are usable in +load methods if the string class has been compiled with clang - if it's been compiled with GCC, the ABI makes this impossible.  (GNU runtimes)

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

12 years agoobjc: diagnose misplacement of objc_suppress_autosynthesis
Fariborz Jahanian [Tue, 3 Jan 2012 22:52:32 +0000 (22:52 +0000)]
objc: diagnose misplacement of objc_suppress_autosynthesis
attribute.

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

12 years agoFixed by Chandler in r147434.
Chad Rosier [Tue, 3 Jan 2012 22:51:32 +0000 (22:51 +0000)]
Fixed by Chandler in r147434.

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

12 years agoImplement cross-module declaration merging for tag declarations, so
Douglas Gregor [Tue, 3 Jan 2012 22:46:00 +0000 (22:46 +0000)]
Implement cross-module declaration merging for tag declarations, so
that if two modules A and B both contain a declaration of a tag such
as

  struct X;

and those two modules are unrelated, the two declarations of X will be
merged into a single redeclaration chain.

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

12 years agoForce set-xcode-analyzer to use the system version of Python installed on OS X.
Ted Kremenek [Tue, 3 Jan 2012 22:05:57 +0000 (22:05 +0000)]
Force set-xcode-analyzer to use the system version of Python installed on OS X.

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

12 years agoAdd __has_feature(objc_modules)
Douglas Gregor [Tue, 3 Jan 2012 21:12:26 +0000 (21:12 +0000)]
Add __has_feature(objc_modules)

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

12 years agoAdd a test for the driver-level -fmodules/-fno-modules flags.
Douglas Gregor [Tue, 3 Jan 2012 21:04:31 +0000 (21:04 +0000)]
Add a test for the driver-level -fmodules/-fno-modules flags.

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