]> granicus.if.org Git - clang/log
clang
12 years agoRemove switch/case statements and call GetFloatingPointTy() instead to get the
Akira Hatanaka [Tue, 10 Jan 2012 23:30:49 +0000 (23:30 +0000)]
Remove switch/case statements and call GetFloatingPointTy() instead to get the
floating point type.

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

12 years agoFlatten float complex arguments. N32/64 requires float complex arguments be
Akira Hatanaka [Tue, 10 Jan 2012 23:12:19 +0000 (23:12 +0000)]
Flatten float complex arguments. N32/64 requires float complex arguments be
passed in floating point registers.

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

12 years agoRemove space.
Akira Hatanaka [Tue, 10 Jan 2012 22:44:52 +0000 (22:44 +0000)]
Remove space.

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

12 years agoAdd field IsIEEE in FloatingLiteral to distinguish between different 128-bit
Akira Hatanaka [Tue, 10 Jan 2012 22:40:09 +0000 (22:40 +0000)]
Add field IsIEEE in FloatingLiteral to distinguish between different 128-bit
floating point formats.

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

12 years agoWhen something goes wrong in type-checking a namespace definition, make the namespace...
Douglas Gregor [Tue, 10 Jan 2012 22:14:10 +0000 (22:14 +0000)]
When something goes wrong in type-checking a namespace definition, make the namespace declaration invalid

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

12 years agoAdd support for the androideabi environment to our triple support, and
Chandler Carruth [Tue, 10 Jan 2012 19:47:42 +0000 (19:47 +0000)]
Add support for the androideabi environment to our triple support, and
for the arm-linux-androideabi triple in particular.

Also use this to do a better job of selecting soft FP settings.

Patch by Evgeniy Stepanov.

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

12 years agoobjc-arc: fixes a crash when trying to find out retaining cycle
Fariborz Jahanian [Tue, 10 Jan 2012 19:28:26 +0000 (19:28 +0000)]
objc-arc: fixes a crash when trying to find out retaining cycle
ownership of property sent to 'super'. // rdar://10640891

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

12 years agoRemove a set, but unused variable. Found with GCC's warning.
Chandler Carruth [Tue, 10 Jan 2012 18:26:14 +0000 (18:26 +0000)]
Remove a set, but unused variable. Found with GCC's warning.

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

12 years ago[analyzer] Testing infrastructure: Flush output after every print
Anna Zaks [Tue, 10 Jan 2012 18:10:25 +0000 (18:10 +0000)]
[analyzer] Testing infrastructure: Flush output after every print
statement.

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

12 years agoContrary to the other BSDs, NetBSD followed the ELF ABI for structure
Joerg Sonnenberger [Tue, 10 Jan 2012 16:53:17 +0000 (16:53 +0000)]
Contrary to the other BSDs, NetBSD followed the ELF ABI for structure
passing on i386 and does not use registers.

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

12 years agoMake PathDiagnosticLocation more resilient to null Stmt pointers.
Ted Kremenek [Tue, 10 Jan 2012 15:26:13 +0000 (15:26 +0000)]
Make PathDiagnosticLocation more resilient to null Stmt pointers.

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

12 years agoAdd definitions for AMD's bobcat (aka btver1)
Benjamin Kramer [Tue, 10 Jan 2012 11:50:18 +0000 (11:50 +0000)]
Add definitions for AMD's bobcat (aka btver1)

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

12 years agoEnable POPCNT and LZCNT with sse4a.
Benjamin Kramer [Tue, 10 Jan 2012 11:50:13 +0000 (11:50 +0000)]
Enable POPCNT and LZCNT with sse4a.

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

12 years agoFactor the repetitive cpu macro definition into a helper function.
Benjamin Kramer [Tue, 10 Jan 2012 11:50:09 +0000 (11:50 +0000)]
Factor the repetitive cpu macro definition into a helper function.

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

12 years agoThe `-fwritable-strings' flag doesn't make the backing store strings of all
Bill Wendling [Tue, 10 Jan 2012 08:46:39 +0000 (08:46 +0000)]
The `-fwritable-strings' flag doesn't make the backing store strings of all
CFStrings writable.

The strings (both Unicode and ASCII) should reside in a read-only section. E.g.,
__TEXT,__cstring instead of __DATA,__data. This is done by making the global
variable created for the strings constant despite the value of that flag.
<rdar://problem/10657500>

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

12 years agoImplement the missing pieces of Evaluate for _Complex types. With that complete...
Eli Friedman [Tue, 10 Jan 2012 04:58:17 +0000 (04:58 +0000)]
Implement the missing pieces of Evaluate for _Complex types.  With that complete, remove some code from CGExprConstant which is no longer necessary.  While I'm here, a couple minor tweaks to _Complex-in-C++. (Specifically, make _Complex types literal types, and don't warn for _Complex int.)

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

12 years agoPR11724: Implement evaluation for constexpr defaulted trivial union copy/move
Richard Smith [Tue, 10 Jan 2012 04:32:03 +0000 (04:32 +0000)]
PR11724: Implement evaluation for constexpr defaulted trivial union copy/move
constructors. These are a special case whose behavior cannot be modeled as a
user-written constructor.

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

12 years agoPer John's comment, it makes sense to ask isLambda on any CXXRecordDecl; make sure...
Eli Friedman [Tue, 10 Jan 2012 03:38:46 +0000 (03:38 +0000)]
Per John's comment, it makes sense to ask isLambda on any CXXRecordDecl; make sure that's safe.  Get rid of a check which is now unnecessary in Sema::getFunctionLevelDeclContext().

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

12 years ago[arcmt] XFAIL on mingw.
Argyrios Kyrtzidis [Tue, 10 Jan 2012 02:39:29 +0000 (02:39 +0000)]
[arcmt] XFAIL on mingw.

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

12 years agoUpdate C++11 scoped enumeration support to match the final proposal:
Richard Smith [Tue, 10 Jan 2012 01:33:14 +0000 (01:33 +0000)]
Update C++11 scoped enumeration support to match the final proposal:
 - reject definitions of enums within friend declarations
 - require 'enum', not 'enum class', for non-declaring references to scoped
   enumerations

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

12 years agoAdd -g to the cc1as flags only if we're dealing with an original
Eric Christopher [Tue, 10 Jan 2012 00:38:01 +0000 (00:38 +0000)]
Add -g to the cc1as flags only if we're dealing with an original
source file. Otherwise -g -save-temps will error out on the compile
of any .c file.

Fixes about 4000 of the errors in the clang-tests gdb test suite.

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

12 years agoRemove extraneous braces.
Eric Christopher [Tue, 10 Jan 2012 00:37:56 +0000 (00:37 +0000)]
Remove extraneous braces.

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

12 years agoobjc++: patch for IRgen for atomic properties of
Fariborz Jahanian [Tue, 10 Jan 2012 00:37:01 +0000 (00:37 +0000)]
objc++: patch for IRgen for atomic properties of
c++ objects with non-trivial assignment/copy functions.
Also, one additional sema check. // rdar://6137845

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

12 years agoDon't crash with -Wlarge-by-value-copy and a dependent type. PR11726.
Eli Friedman [Mon, 9 Jan 2012 23:46:59 +0000 (23:46 +0000)]
Don't crash with -Wlarge-by-value-copy and a dependent type.  PR11726.

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

12 years agoExtend the diagnostic for a ',' at the end of a declaration where a ';' was
Richard Smith [Mon, 9 Jan 2012 22:31:44 +0000 (22:31 +0000)]
Extend the diagnostic for a ',' at the end of a declaration where a ';' was
intended to cover C++ class definitions.

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

12 years agoFix "note" of a duplicate explicit instantiation definition following a specialization.
Nico Weber [Mon, 9 Jan 2012 19:52:25 +0000 (19:52 +0000)]
Fix "note" of a duplicate explicit instantiation definition following a specialization.

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

12 years agoInsert padding before unaligned long double arguments.
Akira Hatanaka [Mon, 9 Jan 2012 19:31:25 +0000 (19:31 +0000)]
Insert padding before unaligned long double arguments.

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

12 years agoMove the piece of code up that skips the padding argument. Without this change,
Akira Hatanaka [Mon, 9 Jan 2012 19:08:06 +0000 (19:08 +0000)]
Move the piece of code up that skips the padding argument. Without this change,
padding insertion will not work if the coerced type is not a structure.

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

12 years agoRestore some parts of this test which were accidental reverted in r147649.
Richard Smith [Mon, 9 Jan 2012 18:30:34 +0000 (18:30 +0000)]
Restore some parts of this test which were accidental reverted in r147649.
Thanks to David Blaikie for pointing this out.

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

12 years agoWhen deserializing an anonymous namespace from a module, do not attach
Douglas Gregor [Mon, 9 Jan 2012 18:07:24 +0000 (18:07 +0000)]
When deserializing an anonymous namespace from a module, do not attach
the anonymous namespace to its parent. Semantically, this means that
the anonymous namespaces defined in one module are distinct from the
anonymous namespaces defined in another module.

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

12 years agoImplement merging of namespace-scope declarations across modules, so
Douglas Gregor [Mon, 9 Jan 2012 17:38:47 +0000 (17:38 +0000)]
Implement merging of namespace-scope declarations across modules, so
that we can merge, for example, two occurrences of

  namespace N { void f(); }

in two disjoint modules.

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

12 years agoImplement redeclaration merging for namespaces defined in distinct
Douglas Gregor [Mon, 9 Jan 2012 17:30:44 +0000 (17:30 +0000)]
Implement redeclaration merging for namespaces defined in distinct
modules. Teach name lookup into namespaces to search in each of the
merged DeclContexts as well as the (now-primary) DeclContext. This
supports the common case where two different modules put something
into the same namespace.

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

12 years agoAlways allow redefinition of typedefs when modules are enabled. This
Douglas Gregor [Mon, 9 Jan 2012 15:36:04 +0000 (15:36 +0000)]
Always allow redefinition of typedefs when modules are enabled. This
is important because it's fairly common for headers (especially system
headers) to want to provide only those typedefs needed for that
particular header, based on some guard macro, e.g.,

#ifndef _SIZE_T
#define _SIZE_T
typedef long size_t;
#endif

which is repeated in a number of headers. The guard macro protects
against duplicate definitions. However, this means that only the first
occurrence of this pattern actually defines size_t, so the submodule
corresponding to this header has the only visible definition. If a
user then imports a different submodule from the same module, size_t
will be known but not visible, and therefore cannot be used.

By allowing redefinition of typedefs, each header that wants to define
size_t can do so independently, so it will be available in the
corresponding submodules.

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

12 years agoMade unknown builtin diagnostic remappable.
Abramo Bagnara [Mon, 9 Jan 2012 10:05:48 +0000 (10:05 +0000)]
Made unknown builtin diagnostic remappable.

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

12 years agoMerge AVX/AVX2 into the SSE level.
Craig Topper [Mon, 9 Jan 2012 09:19:09 +0000 (09:19 +0000)]
Merge AVX/AVX2 into the SSE level.

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

12 years agoobjc++: more atomic property api code for
Fariborz Jahanian [Sun, 8 Jan 2012 19:13:23 +0000 (19:13 +0000)]
objc++: more atomic property api code for
c++ object properties. wip.

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

12 years agoRemove unused variable.
Rafael Espindola [Sat, 7 Jan 2012 22:52:07 +0000 (22:52 +0000)]
Remove unused variable.

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

12 years agoRemove unused include of VectorExtras.h.
Benjamin Kramer [Sat, 7 Jan 2012 19:41:22 +0000 (19:41 +0000)]
Remove unused include of VectorExtras.h.

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

12 years agoPack UsingDecl more.
Benjamin Kramer [Sat, 7 Jan 2012 19:09:05 +0000 (19:09 +0000)]
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

12 years agoobjc++: More codegen stuff for atomic properties of c++ objects
Fariborz Jahanian [Sat, 7 Jan 2012 18:56:22 +0000 (18:56 +0000)]
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

12 years ago[analyzer] Fix use-after-free in HandleTranslationUnit.
Anna Zaks [Sat, 7 Jan 2012 16:49:46 +0000 (16:49 +0000)]
[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

12 years agoFixed TypeofExpr AST and code generation.
Abramo Bagnara [Sat, 7 Jan 2012 10:52:36 +0000 (10:52 +0000)]
Fixed TypeofExpr AST and code generation.

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

12 years agoSwitch NamespaceDecl from its own hand-rolled redeclaration chain over
Douglas Gregor [Sat, 7 Jan 2012 09:11:48 +0000 (09:11 +0000)]
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

12 years agoMore lambda work: semantic analysis of capturing 'this'. It's a bit complicated...
Eli Friedman [Sat, 7 Jan 2012 04:59:52 +0000 (04:59 +0000)]
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

12 years ago[analyzer] Add basic format string vulnerability checking.
Anna Zaks [Sat, 7 Jan 2012 02:33:10 +0000 (02:33 +0000)]
[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

12 years ago[arcmt] Disable tests in mingw, no idea why they are failing there.
Argyrios Kyrtzidis [Sat, 7 Jan 2012 02:24:23 +0000 (02:24 +0000)]
[arcmt] Disable tests in mingw, no idea why they are failing there.

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

12 years agoLambdas: semantic analysis of explicit captures.
Eli Friedman [Sat, 7 Jan 2012 01:08:17 +0000 (01:08 +0000)]
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

12 years ago[analyzer] Remove CallEnterNodeBuilder and simplify ExprEngine::processCallEnter().
Ted Kremenek [Sat, 7 Jan 2012 01:03:17 +0000 (01:03 +0000)]
[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

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