]> granicus.if.org Git - clang/log
clang
12 years agoLet CompilerInvocation initialization indicate failure
Dylan Noblesmith [Fri, 23 Dec 2011 03:05:38 +0000 (03:05 +0000)]
Let CompilerInvocation initialization indicate failure

This fixes the FIXMEs in ParseAnalyzeArgs. (Also a
precursor to moving the analyzer into an AST plugin.)

For consistency, do the same with AssemblerInvocation.

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

12 years agoPass context and access to Parser::ParseExplicitInstantiation() for
Argyrios Kyrtzidis [Fri, 23 Dec 2011 02:16:45 +0000 (02:16 +0000)]
Pass context and access to Parser::ParseExplicitInstantiation() for
good parser error recovery and for not crashing.

We still have a accepts-invalid-code bug.

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

12 years agoobjective-c: Use class definition AST in several situations when
Fariborz Jahanian [Fri, 23 Dec 2011 00:31:02 +0000 (00:31 +0000)]
objective-c: Use class definition AST in several situations when
building related objc ASTs which require a class definition AST.
These were uncovered when testing objc rewriter.

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

12 years agoRemove spurious, but now legal, typename
Douglas Gregor [Fri, 23 Dec 2011 00:27:08 +0000 (00:27 +0000)]
Remove spurious, but now legal, typename

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

12 years agoWhen building a module with an umbrella header, warn about any headers
Douglas Gregor [Fri, 23 Dec 2011 00:23:59 +0000 (00:23 +0000)]
When building a module with an umbrella header, warn about any headers
found within that umbrella directory that were not actually included
by the umbrella header. They should either be referenced in the module
map or included by the umbrella header.

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

12 years agoColorize and condense CFG pretty-printing.
Ted Kremenek [Thu, 22 Dec 2011 23:33:52 +0000 (23:33 +0000)]
Colorize and condense CFG pretty-printing.

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

12 years agoAdd -Wdangling-else.
Nico Weber [Thu, 22 Dec 2011 23:26:17 +0000 (23:26 +0000)]
Add -Wdangling-else.

This works like described in  http://drdobbs.com/blogs/cpp/231602010
Fixes http://llvm.org/PR11609

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

12 years agoremove unneeded config.h includes
Dylan Noblesmith [Thu, 22 Dec 2011 22:49:47 +0000 (22:49 +0000)]
remove unneeded config.h includes

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

12 years agoMake a note for an optimization that I'd like to implement, when the ASTs for local...
Douglas Gregor [Thu, 22 Dec 2011 22:05:07 +0000 (22:05 +0000)]
Make a note for an optimization that I'd like to implement, when the ASTs for local externs are sound

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

12 years agoSerialize the AST reader's mapping from canonical declarations to the
Douglas Gregor [Thu, 22 Dec 2011 21:40:42 +0000 (21:40 +0000)]
Serialize the AST reader's mapping from canonical declarations to the
set of (previously-canonical) declaration IDs to the module file, so
that future AST reader instances that load the module know which
declarations are merged. This is important in the fairly tricky case
where a declaration of an entity, e.g.,

  @class X;

occurs before the import of a module that also declares that
entity. We merge the declarations, and record the fact that the
declaration of X loaded from the module was merged into the (now
canonical) declaration of X that we parsed.

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

12 years agoAdd missing triple to darwin clang driver test.
Kevin Enderby [Thu, 22 Dec 2011 21:32:51 +0000 (21:32 +0000)]
Add missing triple to darwin clang driver test.

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

12 years agoFix build under -Wswitch by adding support for FK_ListConstructorOverloadFailed
Nick Lewycky [Thu, 22 Dec 2011 20:21:32 +0000 (20:21 +0000)]
Fix build under -Wswitch by adding support for FK_ListConstructorOverloadFailed
to initialization sequence dumping.

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

12 years agoIf we end up merging an Objective-C class with an existing Objective-C
Douglas Gregor [Thu, 22 Dec 2011 19:44:59 +0000 (19:44 +0000)]
If we end up merging an Objective-C class with an existing Objective-C
class that comes from a different module file, make sure that we load
all of the pending declarations for the original declaration.

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

12 years agoLast part of support for generating dwarf for assembly source files. This gets
Kevin Enderby [Thu, 22 Dec 2011 19:31:58 +0000 (19:31 +0000)]
Last part of support for generating dwarf for assembly source files.  This gets
the clang driver to enable this when assembling a .s file.  rdar://9275556

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

12 years agoOverloading for initializer list construction.
Sebastian Redl [Thu, 22 Dec 2011 18:58:38 +0000 (18:58 +0000)]
Overloading for initializer list construction.

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

12 years agoFix a parser bug that prevented it from correctly parsing explicit construct expresso...
Sebastian Redl [Thu, 22 Dec 2011 18:58:29 +0000 (18:58 +0000)]
Fix a parser bug that prevented it from correctly parsing explicit construct expressoins of the form T{args}.

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

12 years agoList-initialization via constructor part 1. Still needs: pretty-printing, overloading...
Sebastian Redl [Thu, 22 Dec 2011 14:44:04 +0000 (14:44 +0000)]
List-initialization via constructor part 1. Still needs: pretty-printing, overloading, initializer_list.

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

12 years agoAdd AVX2 intrinsics for max, min, sign extend, and zero extend.
Craig Topper [Thu, 22 Dec 2011 09:18:58 +0000 (09:18 +0000)]
Add AVX2 intrinsics for max, min, sign extend, and zero extend.

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

12 years agoDelete stray semicolon.
Eli Friedman [Thu, 22 Dec 2011 06:36:54 +0000 (06:36 +0000)]
Delete stray semicolon.

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

12 years agoFix typos in analyzer diagnostics pointed out by Matt Beaumont-Gay and Robert Purves.
Ted Kremenek [Thu, 22 Dec 2011 06:35:52 +0000 (06:35 +0000)]
Fix typos in analyzer diagnostics pointed out by Matt Beaumont-Gay and Robert Purves.

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

12 years agoIn Lexer::getCharAndSizeSlow[NoWarn] if we come up against
Argyrios Kyrtzidis [Thu, 22 Dec 2011 04:38:07 +0000 (04:38 +0000)]
In Lexer::getCharAndSizeSlow[NoWarn] if we come up against

\<newline><newline>

don't consume the second newline.

Thanks to David Blaikie for pointing out the crash!

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

12 years agoAdd support for bitcasts to vector type in Evaluate.
Eli Friedman [Thu, 22 Dec 2011 03:51:45 +0000 (03:51 +0000)]
Add support for bitcasts to vector type in Evaluate.

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

12 years agoPR11614: Mark defaulted special constructors as constexpr if their implicit
Richard Smith [Thu, 22 Dec 2011 02:22:31 +0000 (02:22 +0000)]
PR11614: Mark defaulted special constructors as constexpr if their implicit
definition would satisfy the constexpr requirements.

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

12 years agoWhen deserializing an Objective-C class, check whether we have another
Douglas Gregor [Thu, 22 Dec 2011 01:48:48 +0000 (01:48 +0000)]
When deserializing an Objective-C class, check whether we have another
declaration of that same class that either came from some other module
or occurred in the translation unit loading the module. In this case,
we need to merge the two redeclaration chains immediately so that all
such declarations have the same canonical declaration in the resulting
AST (even though they don't in the module files we've imported).

Focusing on Objective-C classes until I'm happy with the design, then
I'll both (1) extend this notion to other kinds of declarations, and
(2) optimize away this extra checking when we're not dealing with
modules. For now, doing this checking for PCH files/preambles gives us
better testing coverage.

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

12 years agoEnhance AnalysisDeclContext::getReferencedBlockVars() to understand PseudoObjExprs...
Ted Kremenek [Thu, 22 Dec 2011 01:30:46 +0000 (01:30 +0000)]
Enhance AnalysisDeclContext::getReferencedBlockVars() to understand PseudoObjExprs.  It turns out
that the information collected by this method is a super set of the captured variables in BlockDecl.

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

12 years agoPR11637: implement special-case constant evaluation for char arrays initialized
Richard Smith [Thu, 22 Dec 2011 01:07:19 +0000 (01:07 +0000)]
PR11637: implement special-case constant evaluation for char arrays initialized
by string literals.

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

12 years agoFix regression in LiveVariables when reasoning about variables captured by blocks.
Ted Kremenek [Thu, 22 Dec 2011 00:46:32 +0000 (00:46 +0000)]
Fix regression in LiveVariables when reasoning about variables captured by blocks.

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

12 years agoFix a silly mistake in this test that somehow slipped into my last commit.
Eli Friedman [Thu, 22 Dec 2011 00:06:39 +0000 (00:06 +0000)]
Fix a silly mistake in this test that somehow slipped into my last commit.

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

12 years agoFix a failure (which led to a crash) in constant emission code with vector compound...
Eli Friedman [Thu, 22 Dec 2011 00:04:00 +0000 (00:04 +0000)]
Fix a failure (which led to a crash) in constant emission code with vector compound literals.

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

12 years agoIn Lexer::getCharAndSizeSlow[NoWarn] make sure we don't go over the end of the buffer
Argyrios Kyrtzidis [Wed, 21 Dec 2011 20:19:55 +0000 (20:19 +0000)]
In Lexer::getCharAndSizeSlow[NoWarn] make sure we don't go over the end of the buffer
when the end of the buffer is immediately after an escaped newline.

Fixes http://llvm.org/PR10153.

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

12 years agoobjc, objc rewriter. Fixes couple of bugs one
Fariborz Jahanian [Wed, 21 Dec 2011 19:48:07 +0000 (19:48 +0000)]
objc, objc rewriter. Fixes couple of bugs one
because of recent refactoring and one in the
rewriter.

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

12 years agoImprove CFG pretty-printing for CXXConstructExprs.
Ted Kremenek [Wed, 21 Dec 2011 19:39:59 +0000 (19:39 +0000)]
Improve CFG pretty-printing for CXXConstructExprs.

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

12 years agoCast enumerators from different anonymous enums to unsigned, to appease gcc
Matt Beaumont-Gay [Wed, 21 Dec 2011 19:36:37 +0000 (19:36 +0000)]
Cast enumerators from different anonymous enums to unsigned, to appease gcc

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

12 years agoImprove CFG pretty-printing of CastExprs.
Ted Kremenek [Wed, 21 Dec 2011 19:32:38 +0000 (19:32 +0000)]
Improve CFG pretty-printing of CastExprs.

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

12 years ago[libclang] In visitPreprocessedEntitiesInRange we are interested in a file region
Argyrios Kyrtzidis [Wed, 21 Dec 2011 16:56:38 +0000 (16:56 +0000)]
[libclang] In visitPreprocessedEntitiesInRange we are interested in a file region
so translate the range to file locations.

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

12 years agoFix bugs in SourceManager::computeMacroArgsCache() and add a unit test for it.
Argyrios Kyrtzidis [Wed, 21 Dec 2011 16:56:35 +0000 (16:56 +0000)]
Fix bugs in SourceManager::computeMacroArgsCache() and add a unit test for it.

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

12 years agoFor SourceManager::isBeforeInTranslationUnit(), have it consider macro arg expanded
Argyrios Kyrtzidis [Wed, 21 Dec 2011 16:56:29 +0000 (16:56 +0000)]
For SourceManager::isBeforeInTranslationUnit(), have it consider macro arg expanded
token locations as coming before the closing ')' of a function macro expansion.

Include a unit test for SourceManager.

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

12 years agoImplement a trivial, obvious optimization for deserialization of
Douglas Gregor [Wed, 21 Dec 2011 15:12:03 +0000 (15:12 +0000)]
Implement a trivial, obvious optimization for deserialization of
redeclaration chains: only ever have the reader search for
redeclarations of the first (canonical) declaration, since we only
ever record redeclaration ranges for the that declaration. Searching
for redeclarations of non-canonical declarations will never find
anything, so it's a complete waste of time.

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

12 years agoAdd a few more AVX2 intrinsics and fix the type strings on a couple SSE intrinsics.
Craig Topper [Wed, 21 Dec 2011 08:35:05 +0000 (08:35 +0000)]
Add a few more AVX2 intrinsics and fix the type strings on a couple SSE intrinsics.

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

12 years agoAdd AVX2 horizontal add/sub intrinsics.
Craig Topper [Wed, 21 Dec 2011 08:17:40 +0000 (08:17 +0000)]
Add AVX2 horizontal add/sub intrinsics.

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

12 years agoconstexpr: diagnostic improvements for invalid lvalue-to-rvalue conversions in
Richard Smith [Wed, 21 Dec 2011 05:04:46 +0000 (05:04 +0000)]
constexpr: diagnostic improvements for invalid lvalue-to-rvalue conversions in
constant expressions.

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

12 years agoBump suitable alignment on darwin ppc 32/64 and x86-32 to 16 bytes. I don't
Nick Lewycky [Wed, 21 Dec 2011 04:25:47 +0000 (04:25 +0000)]
Bump suitable alignment on darwin ppc 32/64 and x86-32 to 16 bytes. I don't
actually know about the other OSes on X86-32 besides Linux...

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

12 years agoC++11 half of r147023: In C++11, additionally eagerly instantiate:
Richard Smith [Wed, 21 Dec 2011 02:55:12 +0000 (02:55 +0000)]
C++11 half of r147023: In C++11, additionally eagerly instantiate:
 - constexpr function template instantiations
 - variables of reference type
 - constexpr variables

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

12 years agoAttempt to fix test on 32-bit hosts.
Eli Friedman [Wed, 21 Dec 2011 01:57:31 +0000 (01:57 +0000)]
Attempt to fix test on 32-bit hosts.

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

12 years agoFix a case where Expr::isConstantInitializer would return true for an expression...
Eli Friedman [Wed, 21 Dec 2011 00:43:02 +0000 (00:43 +0000)]
Fix a case where Expr::isConstantInitializer would return true for an expression we can't support.  In a slightly amusing twist, the case in question was already in the clang regression tests marked as a valid construct.  <rdar://problem/10020074>

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

12 years agoC++ constant expression handling: eagerly instantiate static const integral data
Richard Smith [Wed, 21 Dec 2011 00:25:33 +0000 (00:25 +0000)]
C++ constant expression handling: eagerly instantiate static const integral data
members of class templates so that their values can be used in ICEs. This
required reverting r105465, to get such instantiated members to be included in
serialized ASTs.

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

12 years agoobjc QOI: Don't't warn about mismatch between attributes
Fariborz Jahanian [Wed, 21 Dec 2011 00:09:11 +0000 (00:09 +0000)]
objc QOI: Don't't warn about mismatch between attributes
on method declaration and definition if former is in
a system header. // rdar://10580333

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

12 years agoPR11297: Provide a better diagnostic for code which contains a
Richard Smith [Tue, 20 Dec 2011 22:56:20 +0000 (22:56 +0000)]
PR11297: Provide a better diagnostic for code which contains a
reasonable-looking but ill-formed for-range statement of the form:

  for (expression : expression)

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

12 years ago[analyzer] Do not invalidate arguments when the parameter's
Anna Zaks [Tue, 20 Dec 2011 22:35:30 +0000 (22:35 +0000)]
[analyzer] Do not invalidate arguments when the parameter's
type is a pointer to const. (radar://10595327)

The regions corresponding to the pointer and reference arguments to
a function get invalidated by the calls since a function call can
possibly modify the pointed to data. With this change, we are not going
to invalidate the data if the argument is a pointer to const. This
change makes the analyzer more optimistic in reporting errors.
(Support for C, C++ and Obj C)

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

12 years agoobjc/c++: Issue diagnostic when free-standing ivar is accessed
Fariborz Jahanian [Tue, 20 Dec 2011 22:21:08 +0000 (22:21 +0000)]
objc/c++: Issue diagnostic when free-standing ivar is accessed
in class method instead of crash. // rdar://10593227

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

12 years agoWhen we make a previously-deserialized module definition visible,
Douglas Gregor [Tue, 20 Dec 2011 22:06:13 +0000 (22:06 +0000)]
When we make a previously-deserialized module definition visible,
notify the AST deserialization listener so that the AST writer knows
that it can write the macro definition.

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

12 years agoFix inversion of static analyzer path diagnostics for path conditions.
Ted Kremenek [Tue, 20 Dec 2011 22:00:25 +0000 (22:00 +0000)]
Fix inversion of static analyzer path diagnostics for path conditions.

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

12 years agoFix a crash on invalid, http://llvm.org/pr11599
Nico Weber [Tue, 20 Dec 2011 20:32:49 +0000 (20:32 +0000)]
Fix a crash on invalid, http://llvm.org/pr11599

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

12 years agoLet the KNR promotion warning be disabled.
Roman Divacky [Tue, 20 Dec 2011 18:35:44 +0000 (18:35 +0000)]
Let the KNR promotion warning be disabled.

Patch by Dimitry Andric!

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

12 years agoWhen performing name lookup for a redeclaration, ignore module
Douglas Gregor [Tue, 20 Dec 2011 18:11:52 +0000 (18:11 +0000)]
When performing name lookup for a redeclaration, ignore module
visibility restrictions. This ensures that all declarations of the
same entity end up in the same redeclaration chain, even if some of
those declarations aren't visible. While this may seem unfortunate to
some---why can't two C modules have different functions named
'f'?---it's an acknowedgment that a module does not introduce a new
"namespace" of names.

As part of this, stop merging the 'module-private' bit from previous
declarations to later declarations, because we want each declaration
in a module to stand on its own because this can effect, for example,
submodule visibility.

Note that this notion of names that are invisible to normal name
lookup but are available for redeclaration lookups is how we should
implement friend declarations and extern declarations within local
function scopes. I'm not tackling that problem now.

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

12 years agoWhen performing layout for an Objective-C class, make sure to dig out
Douglas Gregor [Tue, 20 Dec 2011 15:50:13 +0000 (15:50 +0000)]
When performing layout for an Objective-C class, make sure to dig out
the definition of that class. Fixes PR11613 / <rdar://problem/10604077>.

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

12 years agoAdd AVX2 intrinsics for pavg, pblend, and pcmp instructions. Also remove unneeded...
Craig Topper [Tue, 20 Dec 2011 09:55:26 +0000 (09:55 +0000)]
Add AVX2 intrinsics for pavg, pblend, and pcmp instructions. Also remove unneeded builtins for SSE pcmp. Change SSE pcmpeqq and pcmpgtq to not use builtins and just use vector == and >.

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

12 years agoUpdate the CMake build for r146959's new files.
Chandler Carruth [Tue, 20 Dec 2011 08:42:15 +0000 (08:42 +0000)]
Update the CMake build for r146959's new files.

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

12 years agoRelax type checking for a few Neon intrinsics. <rdar://problem/10538555>
Bob Wilson [Tue, 20 Dec 2011 06:16:48 +0000 (06:16 +0000)]
Relax type checking for a few Neon intrinsics.  <rdar://problem/10538555>

Not long ago, I tightened up the type checking for pointer arguments of
Neon intrinsics to match the specifications provided by ARM.  One consequence
was that it became impossible to access the unaligned versions of a few
Neon load/store operations.  Since there are just a few of these intrinsics
where it makes a difference, I think it's better to relax the type checking
than to either introduce new non-standard unaligned intrinsics or to disallow
intrinsics for the unaligned operations.

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

12 years agoFix off-by-one error in an assert condition. No functionality change, but better
Richard Smith [Tue, 20 Dec 2011 04:39:57 +0000 (04:39 +0000)]
Fix off-by-one error in an assert condition. No functionality change, but better
error detection.

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

12 years agoRevert r146766, and add a testcase for which it introduced a wrong-code bug.
Richard Smith [Tue, 20 Dec 2011 04:00:21 +0000 (04:00 +0000)]
Revert r146766, and add a testcase for which it introduced a wrong-code bug.

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

12 years agoUnweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch
David Blaikie [Tue, 20 Dec 2011 02:48:34 +0000 (02:48 +0000)]
Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch

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

12 years agoUnlike in C++03, a constant-expression is not an unevaluated operand in C++11.
Richard Smith [Tue, 20 Dec 2011 02:08:33 +0000 (02:08 +0000)]
Unlike in C++03, a constant-expression is not an unevaluated operand in C++11.
Split out a new ExpressionEvaluationContext flag for this case, and don't treat
it as unevaluated in C++11. This fixes some crash-on-invalids where we would
allow references to class members in potentially-evaluated constant expressions
in static member functions, and also fixes half of PR10177.

The fix to PR10177 exposed a case where template instantiation failed to provide
a source location for a diagnostic, so TreeTransform has been tweaked to supply
source locations when transforming a type. The source location is still not very
good, but MarkDeclarationsReferencedInType would need to operate on a TypeLoc to
improve it further.

Also fix MarkDeclarationReferenced in C++98 mode to trigger instantiation for
static data members of class templates which are used in constant expressions.
This fixes a link-time problem, but we still incorrectly treat the member as
non-constant. The rest of the fix for that issue is blocked on PCH support for
early-instantiated static data members, which will be added in a subsequent
patch.

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

12 years agoFix tentative parsing so it knows how to handle an ambiguous for-range-declaration...
Eli Friedman [Tue, 20 Dec 2011 01:50:37 +0000 (01:50 +0000)]
Fix tentative parsing so it knows how to handle an ambiguous for-range-declaration.  PR11601.

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

12 years agoRemove some extraneous carriage returns from these files. One of the
Chandler Carruth [Tue, 20 Dec 2011 01:45:15 +0000 (01:45 +0000)]
Remove some extraneous carriage returns from these files. One of the
Windows subversion clients isn't setup to default to eol:native again...

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

12 years agoRefine error diagnostic for using bridged casts when not using ARC.
Ted Kremenek [Tue, 20 Dec 2011 01:03:40 +0000 (01:03 +0000)]
Refine error diagnostic for using bridged casts when not using ARC.

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

12 years agoDetect when mapping a #include/#import over to a submodule ends up
Douglas Gregor [Tue, 20 Dec 2011 00:28:52 +0000 (00:28 +0000)]
Detect when mapping a #include/#import over to a submodule ends up
hitting a submodule that was never actually created, e.g., because
that header wasn't parsed. In such cases, complain (because the
module's umbrella headers don't cover everything) and fall back to
including the header.

Later, we'll add a warning at module-build time to catch all such
cases. However, this fallback is important to eliminate assertions in
the ASTWriter when this happens.

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

12 years agoMark the calls to the _setjmp function as returns twice. <rdar://problem/10492556>
Bill Wendling [Mon, 19 Dec 2011 23:53:28 +0000 (23:53 +0000)]
Mark the calls to the _setjmp function as returns twice. <rdar://problem/10492556>

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

12 years agoSwitch a few callers of MakeAddrLValue places over to MakeNaturalAlignAddrLValue.
Eli Friedman [Mon, 19 Dec 2011 23:03:09 +0000 (23:03 +0000)]
Switch a few callers of MakeAddrLValue places over to MakeNaturalAlignAddrLValue.

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

12 years agoobjc-arc: bridge casts in non-arc mode are now
Fariborz Jahanian [Mon, 19 Dec 2011 22:52:53 +0000 (22:52 +0000)]
objc-arc: bridge casts in non-arc mode are now
error. // rdar://10597832

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

12 years agoEvaluation support for ExprWithCleanups. We won't evaluate any expression which
Richard Smith [Mon, 19 Dec 2011 22:12:41 +0000 (22:12 +0000)]
Evaluation support for ExprWithCleanups. We won't evaluate any expression which
actually requires non-trivial cleanups, so no cleanups need to be performed.

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

12 years agoImprove r146813 (for PR11595) to give an appropriate diagnostic.
Richard Smith [Mon, 19 Dec 2011 22:01:37 +0000 (22:01 +0000)]
Improve r146813 (for PR11595) to give an appropriate diagnostic.

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

12 years agoloads also handled of course.
Chris Lattner [Mon, 19 Dec 2011 21:17:33 +0000 (21:17 +0000)]
loads also handled of course.

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

12 years agoFix PR5279 - don't sliently drop alignment information on stores of types that have...
Chris Lattner [Mon, 19 Dec 2011 21:16:08 +0000 (21:16 +0000)]
Fix PR5279 - don't sliently drop alignment information on stores of types that have alignment less than the natural alignment of the type when it comes from a typedef.

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

12 years agofilecheckize.
Chris Lattner [Mon, 19 Dec 2011 21:11:59 +0000 (21:11 +0000)]
filecheckize.

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

12 years agorename test.
Chris Lattner [Mon, 19 Dec 2011 21:10:59 +0000 (21:10 +0000)]
rename test.

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

12 years agoEliminate the first->last redeclaration map from the AST file
Douglas Gregor [Mon, 19 Dec 2011 21:09:25 +0000 (21:09 +0000)]
Eliminate the first->last redeclaration map from the AST file
format. It's no longer being used, now that we have a new
implementation of redeclaration chains.

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

12 years agoobjc-arc: bridge casts in non-objc-arc mode are ignord.
Fariborz Jahanian [Mon, 19 Dec 2011 21:06:15 +0000 (21:06 +0000)]
objc-arc: bridge casts in non-objc-arc mode are ignord.
But, warn too. // rdar://10597832

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

12 years agoRemove ASTReader's PendingForwardRefs, which is now handled by the
Douglas Gregor [Mon, 19 Dec 2011 20:51:16 +0000 (20:51 +0000)]
Remove ASTReader's PendingForwardRefs, which is now handled by the
(more general) fix-up of definition data pointers.

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

12 years agoAttempt to fix test in Release builds.
Eli Friedman [Mon, 19 Dec 2011 20:09:01 +0000 (20:09 +0000)]
Attempt to fix test in Release builds.

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

12 years agoFix typo 'typdefs', from Nikola Smiljanic
Douglas Gregor [Mon, 19 Dec 2011 19:50:23 +0000 (19:50 +0000)]
Fix typo 'typdefs', from Nikola Smiljanic

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

12 years agoOnce we have fully deserialized a redeclaration chain for something
Douglas Gregor [Mon, 19 Dec 2011 19:00:47 +0000 (19:00 +0000)]
Once we have fully deserialized a redeclaration chain for something
with a definition pointer (e.g., C++ and Objective-C classes), zip
through the redeclaration chain to make sure that all of the
declarations point to the definition data.

As part of this, realized again why the first redeclaration of an
entity in a file is important, and brought back that idea.

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

12 years agoRe-implement (de-)serialization of redeclaration chains for
Douglas Gregor [Mon, 19 Dec 2011 18:19:24 +0000 (18:19 +0000)]
Re-implement (de-)serialization of redeclaration chains for
redeclaration templates (RedeclarableTemplateDecl), similarly to the
way (de-)serialization is implemented for Redeclarable<T>. In the
process, found a simpler formulation for handling redeclaration
chains and implemented that in both places.

The new test establishes that we're building the redeclaration chains
properly. However, the FIXME indicates where we're tickling a
different bug that has to do with us not setting the DefinitionData
pointer properly in redeclarations that we detected after the
definition itself was deserialized. The (separable) fix for that bug
is forthcoming.

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

12 years agoAdd a triple to the test.
Rafael Espindola [Mon, 19 Dec 2011 16:30:30 +0000 (16:30 +0000)]
Add a triple to the test.

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

12 years agoThe submodule offset map can introduce "empty" remapping entries for
Douglas Gregor [Mon, 19 Dec 2011 16:14:14 +0000 (16:14 +0000)]
The submodule offset map can introduce "empty" remapping entries for
imported modules that don't introduce any new entities of a particular
kind. Allow these entries to be replaced with entries for another
loaded module.

In the included test case, selectors exhibit this behavior.

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

12 years agoOptimize serialized representation of redeclarable declarations for
Douglas Gregor [Mon, 19 Dec 2011 15:27:36 +0000 (15:27 +0000)]
Optimize serialized representation of redeclarable declarations for
which there are no redeclarations. This reduced by size of the PCH
file for Cocoa.h by ~650k: ~536k of that was in the new
LOCAL_REDECLARATIONS table, which went from a ridiculous 540k down to
an acceptable 3.5k, while the rest was due to the more compact
abbreviated representation of redeclarable declaration kinds (which no
longer need to store the 'first' declaration ID).

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

12 years agoMake sure this test works in C++, too
Douglas Gregor [Mon, 19 Dec 2011 14:42:41 +0000 (14:42 +0000)]
Make sure this test works in C++, too

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

12 years agoExtend the fix for PR9614 to handle inline asm in the outer decl and
Rafael Espindola [Mon, 19 Dec 2011 14:41:01 +0000 (14:41 +0000)]
Extend the fix for PR9614 to handle inline asm in the outer decl and
the inner decl being a builtin. This is needed to support the glibc headers
in fedora 16 (2.14).

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

12 years agoCombine common (de-)serialization logic for typedefs and type aliases
Douglas Gregor [Mon, 19 Dec 2011 14:40:25 +0000 (14:40 +0000)]
Combine common (de-)serialization logic for typedefs and type aliases
into operations on TypedefNameDecl. No functionality change.

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

12 years agoAdd AVX2 intrinsics for and, andn, or, and xor.
Craig Topper [Mon, 19 Dec 2011 09:03:48 +0000 (09:03 +0000)]
Add AVX2 intrinsics for and, andn, or, and xor.

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

12 years agoSourceManager: use getBufferSize()
Dylan Noblesmith [Mon, 19 Dec 2011 08:51:05 +0000 (08:51 +0000)]
SourceManager: use getBufferSize()

Forming an out of bounds pointer to check if it's out
of bounds was undefined behavior.

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

12 years agofix a broken link
Chris Lattner [Mon, 19 Dec 2011 07:49:23 +0000 (07:49 +0000)]
fix a broken link

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

12 years agoMore AVX2 intrinsic support including saturating add/sub and palignr.
Craig Topper [Mon, 19 Dec 2011 07:03:25 +0000 (07:03 +0000)]
More AVX2 intrinsic support including saturating add/sub and palignr.

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

12 years agoconstexpr handling improvements. Produce detailed diagnostics when a 'constexpr'
Richard Smith [Mon, 19 Dec 2011 06:19:21 +0000 (06:19 +0000)]
constexpr handling improvements. Produce detailed diagnostics when a 'constexpr'
variable is initialized by a non-constant expression, and pass in the variable
being declared so that earlier-initialized fields' values can be used.

Rearrange VarDecl init evaluation to make this possible, and in so doing fix a
long-standing issue in our C++ constant expression handling, where we would
mishandle cases like:

  extern const int a;
  const int n = a;
  const int a = 5;
  int arr[n];

Here, n is not initialized by a constant expression, so can't be used in an ICE,
even though the initialization expression would be an ICE if it appeared later
in the TU. This requires computing whether the initializer is an ICE eagerly,
and saving that information in PCH files.

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

12 years agoBegin adding AVX2 intrinsics. Necessitated increasing the number of bits used to...
Craig Topper [Mon, 19 Dec 2011 05:04:33 +0000 (05:04 +0000)]
Begin adding AVX2 intrinsics. Necessitated increasing the number of bits used to store builtinID when serializing identifier table.

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

12 years agotest/Analysis: fix error message
Dylan Noblesmith [Sun, 18 Dec 2011 18:07:42 +0000 (18:07 +0000)]
test/Analysis: fix error message

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

12 years agoSilence gcc warnings.
Benjamin Kramer [Sun, 18 Dec 2011 12:18:02 +0000 (12:18 +0000)]
Silence gcc warnings.

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

12 years agoexamples: flesh out PFN readme
Dylan Noblesmith [Sun, 18 Dec 2011 11:30:53 +0000 (11:30 +0000)]
examples: flesh out PFN readme

Show how to actually use the arguments it has.

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

12 years agoPR11604: don't allow floating-literal-to-integer casts in ICEs if the (truncated)
Richard Smith [Sun, 18 Dec 2011 02:33:09 +0000 (02:33 +0000)]
PR11604: don't allow floating-literal-to-integer casts in ICEs if the (truncated)
floating literal value does not fit into the destination type. Such casts have
undefined behavior at translation time; treating them as non-ICE matches the
behavior of modern gcc versions.

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

12 years agoCompletely re-implement (de-)serialization of declaration
Douglas Gregor [Sat, 17 Dec 2011 23:38:30 +0000 (23:38 +0000)]
Completely re-implement (de-)serialization of declaration
chains. The previous implementation relied heavily on the declaration
chain being stored as a (circular) linked list on disk, as it is in
memory. However, when deserializing from multiple modules, the
different chains could get mixed up, leading to broken declaration chains.

The new solution keeps track of the first and last declarations in the
chain for each module file. When we load a declaration, we search all
of the module files for redeclarations of that declaration, then
splice together all of the lists into a coherent whole (along with any
redeclarations that were actually parsed).

As a drive-by fix, (de-)serialize the redeclaration chains of
TypedefNameDecls, which had somehow gotten missed previously. Add a
test of this serialization.

This new scheme creates a redeclaration table that is fairly large in
the PCH file (on the order of 400k for Cocoa.h's 12MB PCH file). The
table is mmap'd in and searched via a binary search, but it's still
quite large. A future tweak will eliminate entries for declarations
that have no redeclarations anywhere, and should
drastically reduce the size of this table.

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