]> granicus.if.org Git - clang/log
clang
13 years agoTweak location of diagnostic for -Wunreachable-code
Ted Kremenek [Thu, 16 Dec 2010 08:22:16 +0000 (08:22 +0000)]
Tweak location of diagnostic for -Wunreachable-code
test due to recent changes to the CFG.  The
diagnostic is somewhat in the wrong place, but
the -Wunreachable-code diagnostic needs to be
revamped anyway since most of the diagnostics
in this test case are redundant.

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

13 years agoStart migration of static analyzer to using the
Ted Kremenek [Thu, 16 Dec 2010 07:46:53 +0000 (07:46 +0000)]
Start migration of static analyzer to using the
implicit lvalue-to-rvalue casts that John McCall
recently introduced.  This causes a whole bunch
of logic in the analyzer for handling lvalues
to vanish.  It does, however, raise a few issues
in the analyzer w.r.t to modeling various constructs
(e.g., field accesses to compound literals).

The .c/.m analysis test cases that fail are
due to a missing lvalue-to-rvalue cast that
will get introduced into the AST.  The .cpp
failures were more than I could investigate in
one go, and the patch was already getting huge.
I have XFAILED some of these tests, and they
should obviously be further investigated.

Some highlights of this patch include:

- CFG no longer requires an lvalue bit for
  CFGElements
- StackFrameContext doesn't need an 'asLValue'
  flag
- The "VisitLValue" path from GRExprEngine has
  been eliminated.

Besides the test case failures (XFAILed), there
are surely other bugs that are fallout from
this change.

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

13 years agoCMake: Add runtime dir.
Michael J. Spencer [Thu, 16 Dec 2010 03:28:42 +0000 (03:28 +0000)]
CMake: Add runtime dir.

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

13 years agoMemoryBuffer API update.
Michael J. Spencer [Thu, 16 Dec 2010 03:28:14 +0000 (03:28 +0000)]
MemoryBuffer API update.

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

13 years agoUpdate for LLVM API change.
Daniel Dunbar [Thu, 16 Dec 2010 03:06:05 +0000 (03:06 +0000)]
Update for LLVM API change.

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

13 years agoFix a regression I caused in r121930. It turns out that
Douglas Gregor [Thu, 16 Dec 2010 01:40:04 +0000 (01:40 +0000)]
Fix a regression I caused in r121930. It turns out that
DeclarationNameInfo instances don't always have a non-NULL
TypeSourceInfo?

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

13 years agoCheck for unexpanded parameter packs within variable initializers.
Douglas Gregor [Thu, 16 Dec 2010 01:31:22 +0000 (01:31 +0000)]
Check for unexpanded parameter packs within variable initializers.

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

13 years agoCheck for unexpanded parameter packs in friend declarations.
Douglas Gregor [Thu, 16 Dec 2010 01:14:37 +0000 (01:14 +0000)]
Check for unexpanded parameter packs in friend declarations.

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

13 years agoImprove diagnostics when property being looked up
Fariborz Jahanian [Thu, 16 Dec 2010 00:56:28 +0000 (00:56 +0000)]
Improve diagnostics when property being looked up
in a forward @class object. // rdar://8774513

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

13 years agoCheck for unexpanded parameter packs in using declarations. As a
Douglas Gregor [Thu, 16 Dec 2010 00:46:58 +0000 (00:46 +0000)]
Check for unexpanded parameter packs in using declarations. As a
drive-by, make sure to check for unexpanded parameter packs within the
name of a declaration.

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

13 years agoCheck for unexpanded parameter packs in enumeration types and enumerators.
Douglas Gregor [Thu, 16 Dec 2010 00:24:44 +0000 (00:24 +0000)]
Check for unexpanded parameter packs in enumeration types and enumerators.

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

13 years agoCheck for unexpanded parameter packs in static assertion expressions.
Douglas Gregor [Wed, 15 Dec 2010 23:55:21 +0000 (23:55 +0000)]
Check for unexpanded parameter packs in static assertion expressions.

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

13 years agoImplement builtins for Neon half-precision float conversions.
Bob Wilson [Wed, 15 Dec 2010 23:36:44 +0000 (23:36 +0000)]
Implement builtins for Neon half-precision float conversions.
Also tweak the VCVT_F32_F16 entry in arm_neon.td to be more consistent with
the other floating-point conversion builtins.  Radar 8068427.

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

13 years agoivars craeted for explicit @synthesize and those
Fariborz Jahanian [Wed, 15 Dec 2010 23:29:04 +0000 (23:29 +0000)]
ivars craeted for explicit @synthesize and those
created for auto-synthesis are @private.
Fixes: // rdar://8769582
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121913 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCheck for unexpanded parameter packs in various kinds of
Douglas Gregor [Wed, 15 Dec 2010 23:18:36 +0000 (23:18 +0000)]
Check for unexpanded parameter packs in various kinds of
declarations. This is a work in progress, as I go through the C++
declaration grammar to identify where unexpanded parameter packs can
occur.

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

13 years agoTeach the RecursiveASTVisitor to traverse the type-location
Douglas Gregor [Wed, 15 Dec 2010 22:07:31 +0000 (22:07 +0000)]
Teach the RecursiveASTVisitor to traverse the type-location
information for all of the explicit casts.

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

13 years agoTest that all of the relevant types properly compute the "contains
Douglas Gregor [Wed, 15 Dec 2010 21:57:59 +0000 (21:57 +0000)]
Test that all of the relevant types properly compute the "contains
unexpanded parameter pack" bit and that the recursive AST visitor can
then find those unexpanded parameter packs.

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

13 years agoIntroduce a RecursiveASTVisitor subclass that finds all unexpanded
Douglas Gregor [Wed, 15 Dec 2010 19:43:21 +0000 (19:43 +0000)]
Introduce a RecursiveASTVisitor subclass that finds all unexpanded
parameter packs within a statement, type, etc. Use this visitor to
provide improved diagnostics for the presence of unexpanded parameter
packs in a full expression, base type, declaration type, etc., by
highlighting the unexpanded parameter packs and providing their names,
e.g.,

test/CXX/temp/temp.decls/temp.variadic/p5.cpp:28:85: error: declaration type
      contains unexpanded parameter packs 'VeryInnerTypes',
      'OuterTypes', ...
  ...VeryInnerTypes, OuterTypes>, pair<InnerTypes, OuterTypes> > types;
     ~~~~~~~~~~~~~~  ~~~~~~~~~~        ~~~~~~~~~~  ~~~~~~~~~~    ^

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

13 years agoFix diagnostic pragmas.
Argyrios Kyrtzidis [Wed, 15 Dec 2010 18:44:22 +0000 (18:44 +0000)]
Fix diagnostic pragmas.

Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state.
Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect
a lot of places, like C++ inline methods, template instantiations, the lexer, etc.

Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location.

Fixes rdar://8365684.

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

13 years agoMove the work-in-progress implementation of variadic templates to its own file in...
Douglas Gregor [Wed, 15 Dec 2010 17:38:57 +0000 (17:38 +0000)]
Move the work-in-progress implementation of variadic templates to its own file in Sema. No functionality change.

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

13 years agoReorganize LookupMemberExpr for clarity and to make the obvious fast paths
John McCall [Wed, 15 Dec 2010 16:46:44 +0000 (16:46 +0000)]
Reorganize LookupMemberExpr for clarity and to make the obvious fast paths
come first.

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

13 years ago__attribute__((nonnull)) can apply to reference-to-pointer
Douglas Gregor [Wed, 15 Dec 2010 15:41:46 +0000 (15:41 +0000)]
__attribute__((nonnull)) can apply to reference-to-pointer
parameters. Fixes <rdar://problem/8769025>.

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

13 years agoSema: have BuildExpressionFromIntegralTemplateArgument produce well-formed IntegerLit...
Peter Collingbourne [Wed, 15 Dec 2010 15:06:14 +0000 (15:06 +0000)]
Sema: have BuildExpressionFromIntegralTemplateArgument produce well-formed IntegerLiterals

BuildExpressionFromIntegralTemplateArgument can produce malformed
IntegerLiterals with an EnumType if the template parameter type
is an EnumType.  This breaks the AST printer which expects all
IntegerLiterals to have a plain integer type.  Instead, give the
IntegerLiteral the enum's promotion type and wrap in an implicit cast
to the EnumType.

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

13 years agoSilence GCC warning about control reaching the end of the function and explicitly...
Chandler Carruth [Wed, 15 Dec 2010 07:29:18 +0000 (07:29 +0000)]
Silence GCC warning about control reaching the end of the function and explicitly mark that all cases are handled.

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

13 years agoFix gcc warning: 'clang::ASTStmtReader' is already a friend of 'clang::OverloadExpr'
Nico Weber [Wed, 15 Dec 2010 07:13:32 +0000 (07:13 +0000)]
Fix gcc warning: 'clang::ASTStmtReader' is already a friend of 'clang::OverloadExpr'

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

13 years agoSundry missing lvalue-to-rvalue conversions. Also leave a TODO for the vital
John McCall [Wed, 15 Dec 2010 04:42:30 +0000 (04:42 +0000)]
Sundry missing lvalue-to-rvalue conversions.  Also leave a TODO for the vital
future task of performing contextual conversion to size_t in a VLA size
expression. :)

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

13 years agoSet the "implicitly inline" bit on a method as soon as we see a definition
John McCall [Wed, 15 Dec 2010 04:00:32 +0000 (04:00 +0000)]
Set the "implicitly inline" bit on a method as soon as we see a definition
within the class.  Teach IR gen to look for function definitions in record
lexical contexts when deciding whether to emit a function whose address
was taken.  Fixes PR8789.

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

13 years agoVariadic templates: extend the Expr class with a bit that specifies
Douglas Gregor [Wed, 15 Dec 2010 01:34:56 +0000 (01:34 +0000)]
Variadic templates: extend the Expr class with a bit that specifies
whether the expression contains an unexpanded parameter pack, in the
same vein as the changes to the Type hierarchy. Compute this bit
within all of the Expr subclasses.

This change required a bunch of reshuffling of dependency
calculations, mainly to consolidate them inside the constructors and
to fuse multiple loops that iterate over arguments to determine type
dependence, value dependence, and (now) containment of unexpanded
parameter packs.

Again, testing is painfully sparse, because all of the diagnostics
will change and it is more important to test the to-be-written visitor
that collects unexpanded parameter packs.

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

13 years agoFunction types are compatible (in the C sense) if their regparms are identical.
John McCall [Wed, 15 Dec 2010 01:06:38 +0000 (01:06 +0000)]
Function types are compatible (in the C sense) if their regparms are identical.

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

13 years agoAdded missing IgnoreParens().
Abramo Bagnara [Tue, 14 Dec 2010 22:11:44 +0000 (22:11 +0000)]
Added missing IgnoreParens().

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

13 years agoRewrite ComplexExprEvaluator::VisitCastExpr to use cast kinds, and fix
John McCall [Tue, 14 Dec 2010 17:51:41 +0000 (17:51 +0000)]
Rewrite ComplexExprEvaluator::VisitCastExpr to use cast kinds, and fix
the basic casting logic to insert intermediate casts and preserve the
exact complex-cast design.  Fixes a crash in the test suite.

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

13 years agoMinor fix for clang-completion-mode, from Dve Abrahams
Douglas Gregor [Tue, 14 Dec 2010 16:52:29 +0000 (16:52 +0000)]
Minor fix for clang-completion-mode, from Dve Abrahams

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

13 years agoImprove some comments, shrink FunctionType::ExtInfo, and fix a bug found
John McCall [Tue, 14 Dec 2010 16:45:57 +0000 (16:45 +0000)]
Improve some comments, shrink FunctionType::ExtInfo, and fix a bug found
by valgrind where we were doing the wrong thing in the presence of invalid
exception specs.

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

13 years agoFix documentation typo, from nobled.
Douglas Gregor [Tue, 14 Dec 2010 16:21:49 +0000 (16:21 +0000)]
Fix documentation typo, from nobled.

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

13 years agoRestore r121752 without modification.
John McCall [Tue, 14 Dec 2010 08:05:40 +0000 (08:05 +0000)]
Restore r121752 without modification.

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

13 years agoPull out r121752 in case it's causing the selfhost breakage.
John McCall [Tue, 14 Dec 2010 07:30:51 +0000 (07:30 +0000)]
Pull out r121752 in case it's causing the selfhost breakage.

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

13 years agoFactor out most of the extra state in a FunctionProtoType into a separate
John McCall [Tue, 14 Dec 2010 06:51:39 +0000 (06:51 +0000)]
Factor out most of the extra state in a FunctionProtoType into a separate
class to be passed around.  The line between argument and return types and
everything else is kindof vague, but I think it's justifiable.

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

13 years agoGeneralize this test to work without instruction names.
Dan Gohman [Tue, 14 Dec 2010 01:33:14 +0000 (01:33 +0000)]
Generalize this test to work without instruction names.

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

13 years agoImplement CodeGen support for the may_alias attribute.
Dan Gohman [Mon, 13 Dec 2010 23:51:08 +0000 (23:51 +0000)]
Implement CodeGen support for the may_alias attribute.

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

13 years agoVariadic templates: extend Type, NestedNameSpecifier, TemplateName,
Douglas Gregor [Mon, 13 Dec 2010 22:49:22 +0000 (22:49 +0000)]
Variadic templates: extend Type, NestedNameSpecifier, TemplateName,
and TemplateArgument with an operation that determines whether there
are any unexpanded parameter packs within that construct. Use this
information to diagnose the appearance of the names of parameter packs
that have not been expanded (C++ [temp.variadic]p5). Since this
property is checked often (every declaration, ever expression
statement, etc.), we extend Type and Expr with a bit storing the
result of this computation, rather than walking the AST each time to
determine whether any unexpanded parameter packs occur.

This commit is deficient in several ways, which will be remedied with
future commits:
  - Expr has a bit to store the presence of an unexpanded parameter
  pack, but it is never set.
  - The error messages don't point out where the unexpanded parameter
  packs were named in the type/expression, but they should.
  - We don't check for unexpanded parameter packs in all of the places
  where we should.
  - Testing is sparse, pending the resolution of the above three
  issues.

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

13 years agoSkip ParenType on function instantiations.
Abramo Bagnara [Mon, 13 Dec 2010 22:27:55 +0000 (22:27 +0000)]
Skip ParenType on function instantiations.

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

13 years agoRemove a type that got reduced away from this test case but not actually deleted.
Chandler Carruth [Mon, 13 Dec 2010 08:01:53 +0000 (08:01 +0000)]
Remove a type that got reduced away from this test case but not actually deleted.

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

13 years agoFix PR8774 by restricting when hasInit returns true. Previously, it
Chandler Carruth [Mon, 13 Dec 2010 07:40:47 +0000 (07:40 +0000)]
Fix PR8774 by restricting when hasInit returns true. Previously, it
would return true if the initializer pointer union had *any* non-null
pointer in it, even if the pointer wasn't one that would actually be
returned via getInit(). This makes it more accurately model the logic of
'getInit() != NULL'.

This still isn't completely satisfying. From a principled stance,
I suspect we should make hasInit() and getInit() *always* return false
and NULL (resp.) for ParmVarDecl. We shouldn't at the API level treat
initializers and default arguments as the same thing.

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

13 years agoReduce the number of builtin operator overload candidates added in certain
Chandler Carruth [Mon, 13 Dec 2010 01:44:01 +0000 (01:44 +0000)]
Reduce the number of builtin operator overload candidates added in certain
cases. First, omit all builtin overloads when no non-record type is in the set
of candidate types. Second, avoid arithmetic type overloads for non-arithmetic
or enumeral types (counting vector types as arithmetic due to Clang
extensions). When heavily using constructs such as STL's '<<' based stream
logging, this can have a significant impact. One logging-heavy test case's
compile time dropped by 10% with this. Self-host shows 1-2% improvement in
compile time, but that's likely in the noise.

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

13 years agoBasic, Sema: add support for CUDA launch_bounds attribute
Peter Collingbourne [Sun, 12 Dec 2010 23:03:07 +0000 (23:03 +0000)]
Basic, Sema: add support for CUDA launch_bounds attribute

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

13 years agoSema: diagnose kernel functions with non-void return type
Peter Collingbourne [Sun, 12 Dec 2010 23:02:57 +0000 (23:02 +0000)]
Sema: diagnose kernel functions with non-void return type

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

13 years agoMove the functionality to mark all vtables of key functions as used within
Chandler Carruth [Sun, 12 Dec 2010 21:36:11 +0000 (21:36 +0000)]
Move the functionality to mark all vtables of key functions as used within
a translation unit to the ActOnEndOfTranslationUnit function instead of doing
it at the start of DefineUsedVTables. The latter is now called *recursively*
during template instantiation, which causes an absolutely insane number of
walks of every record decl in the translation unit.

After this patch, an extremely template instantiation heavy test case's compile
time drops by 10x, and we see between 15% and 20% improvement in average
compile times across a project. This is just recovering a regression, it
doesn't make anything faster than it was several weeks ago.

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

13 years agoChange MBlaze target to have the same description string as its LLVM equivalent.
Wesley Peck [Sun, 12 Dec 2010 20:56:47 +0000 (20:56 +0000)]
Change MBlaze target to have the same description string as its LLVM equivalent.

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

13 years agoFinish cleaning up the static utility code for adding builtin operator overload
Chandler Carruth [Sun, 12 Dec 2010 10:35:00 +0000 (10:35 +0000)]
Finish cleaning up the static utility code for adding builtin operator overload
candidates. They're now wrapped in nice APIs which hide the tables, etc. Also
removes some repetitive code from clients.

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

13 years agoClean up the helpers used to compute the usual arithmetic conversions' result
Chandler Carruth [Sun, 12 Dec 2010 09:59:53 +0000 (09:59 +0000)]
Clean up the helpers used to compute the usual arithmetic conversions' result
type. Localize all of the logic within a single function rather than spreading
it throughout the class.

Also fixes a buglet where we failed to check for a RHS arithmetic type wider
than the LHS and return its canonical type. I've yet to produce a test case
that breaks because of this, but it was spotted by inspection by folks on the
IRC channel and is obviously correct now.

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

13 years agoAdd a comment to a helper function.
Chandler Carruth [Sun, 12 Dec 2010 09:22:45 +0000 (09:22 +0000)]
Add a comment to a helper function.

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

13 years agoSink the logic to suppress builtin operator overloads in the presence of
Chandler Carruth [Sun, 12 Dec 2010 09:14:11 +0000 (09:14 +0000)]
Sink the logic to suppress builtin operator overloads in the presence of
user-defined operator overloads on the same enumeral types to the one place
where it is used.

In theory this removes wasted computation from several paths through this code,
but I'm not aware of a case where it actually matters. This is mostly for
cleanliness.

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

13 years agoReorder the cases in the switch to be more logically grouped (to my mind). If
Chandler Carruth [Sun, 12 Dec 2010 08:51:33 +0000 (08:51 +0000)]
Reorder the cases in the switch to be more logically grouped (to my mind). If
others have another ordering they would prefer, I'm all ears, but this one made
it much easier for me to find the group of operators I'm interested in.

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

13 years agoRemove the final goto from this switch making it explict which overload set is
Chandler Carruth [Sun, 12 Dec 2010 08:45:02 +0000 (08:45 +0000)]
Remove the final goto from this switch making it explict which overload set is
added for binary operator&.

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

13 years agoFold away completely identical code with simple fallthrough.
Chandler Carruth [Sun, 12 Dec 2010 08:41:34 +0000 (08:41 +0000)]
Fold away completely identical code with simple fallthrough.

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

13 years agoMove and copy function calls around to remove the indirection through gotos
Chandler Carruth [Sun, 12 Dec 2010 08:39:38 +0000 (08:39 +0000)]
Move and copy function calls around to remove the indirection through gotos
from the switch statement.

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

13 years agoSimplify the flow through the switch by explicitly listing the added overloads
Chandler Carruth [Sun, 12 Dec 2010 08:32:28 +0000 (08:32 +0000)]
Simplify the flow through the switch by explicitly listing the added overloads
for a few cases.

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

13 years agoFix 80-column violations and reflowing some code to facilitate those fixes.
Chandler Carruth [Sun, 12 Dec 2010 08:17:55 +0000 (08:17 +0000)]
Fix 80-column violations and reflowing some code to facilitate those fixes.

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

13 years agoBegin the refactoring of how builtin operators are added to the overload
Chandler Carruth [Sun, 12 Dec 2010 08:11:30 +0000 (08:11 +0000)]
Begin the refactoring of how builtin operators are added to the overload
candidate set. This breaks apart a huge switch + goto system into distinct
methods on a class. It also places the current mess of tables and other static
state used in the process within that class.

This is still a work in progress. I did a few simplifications that jumped out
at me as I went, but I plan to iterate on this a bit before it's truly clean.
However, this is easily the most invasive chunk. I benchmarked it on
all-std-headers.cpp and an internal testcase that has a major hotspot in
overload resolution and saw no real performance impact.

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

13 years agoEnhance my implementation of //rdar ://8747333 in r121597 to allow
Fariborz Jahanian [Sat, 11 Dec 2010 18:39:37 +0000 (18:39 +0000)]
Enhance my implementation of //rdar ://8747333 in r121597 to allow
for declaration of property setter/getter in forward
class extensions and also skip over
propeties which are @dynamic.

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

13 years agoImproved complex constants evaluation.
Abramo Bagnara [Sat, 11 Dec 2010 16:05:48 +0000 (16:05 +0000)]
Improved complex constants evaluation.

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

13 years agoAny property declared in a class extension might have user
Fariborz Jahanian [Fri, 10 Dec 2010 23:36:33 +0000 (23:36 +0000)]
Any property declared in a class extension might have user
declared setter or getter in current class extension or one
of the other class extensions. Mark them as synthesized as
property will be synthesized when property with same name is
seen in the @implementation. This prevents bogus warning
about unimplemented methods to be issued for these methods.
Fixes // rdar://8747333

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

13 years agoAdd missing switch case for the quad-register version of the Neon vmul builtin.
Bob Wilson [Fri, 10 Dec 2010 23:09:09 +0000 (23:09 +0000)]
Add missing switch case for the quad-register version of the Neon vmul builtin.

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

13 years agoFix clang crashes on Neon vld[234]_dup intrinsics with 64-bit element types.
Bob Wilson [Fri, 10 Dec 2010 22:54:58 +0000 (22:54 +0000)]
Fix clang crashes on Neon vld[234]_dup intrinsics with 64-bit element types.
The 64-bit element vectors need to be handled as a special case.

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

13 years agoIntroduce ObjCMessageExpr::getReceiverRange() to get the source range of the receiver.
Argyrios Kyrtzidis [Fri, 10 Dec 2010 20:08:30 +0000 (20:08 +0000)]
Introduce ObjCMessageExpr::getReceiverRange() to get the source range of the receiver.

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

13 years agoKeep the source location of the selector in ObjCMessageExpr.
Argyrios Kyrtzidis [Fri, 10 Dec 2010 20:08:27 +0000 (20:08 +0000)]
Keep the source location of the selector in ObjCMessageExpr.

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

13 years agoMake RecursiveASTVisitor traverse a ObjCMethodDecl.
Argyrios Kyrtzidis [Fri, 10 Dec 2010 20:08:22 +0000 (20:08 +0000)]
Make RecursiveASTVisitor traverse a ObjCMethodDecl.

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

13 years agoDo not assert on shifts of Neon polynomial types.
Bob Wilson [Fri, 10 Dec 2010 19:45:06 +0000 (19:45 +0000)]
Do not assert on shifts of Neon polynomial types.
Most Neon shift intrinsics do not have variants for polynomial types, but
vsri_n and vsli_n do support them, and we need to properly range-check the
shift immediates for them.

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

13 years agoSilence a few more uninitialized-value warnings
Douglas Gregor [Fri, 10 Dec 2010 19:28:19 +0000 (19:28 +0000)]
Silence a few more uninitialized-value warnings

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

13 years agoSilence a GCC unitialized-value warning
Douglas Gregor [Fri, 10 Dec 2010 19:27:07 +0000 (19:27 +0000)]
Silence a GCC unitialized-value warning

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

13 years agoReplace two QualType::getTypePtrOrNull() calls with
Douglas Gregor [Fri, 10 Dec 2010 17:19:40 +0000 (17:19 +0000)]
Replace two QualType::getTypePtrOrNull() calls with
QualType::getTypePtr(). It turns out that
cast_or_null/dyn_cast_or_null don't actually use simplify_type, so
they're guaranteed to operator on non-NULL QualType or CanQualType
objects.

Good for a 0.6% win on 403.gcc's combine.c with -emit-llvm.

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

13 years agoDo not substitute template types if template has dependent context
Peter Collingbourne [Fri, 10 Dec 2010 17:08:53 +0000 (17:08 +0000)]
Do not substitute template types if template has dependent context

We should not substitute template types if the template has a dependent
context because the template argument stack is not yet fully formed.
Instead, defer substitution until the template has a non-dependent
context (i.e. instantiation of an outer template).

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

13 years agoFix a compiler warning.
Fariborz Jahanian [Fri, 10 Dec 2010 17:05:33 +0000 (17:05 +0000)]
Fix a compiler warning.

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

13 years agoEliminate the branching in QualType::getTypePtr() by providing a
Douglas Gregor [Fri, 10 Dec 2010 17:03:06 +0000 (17:03 +0000)]
Eliminate the branching in QualType::getTypePtr() by providing a
common base for ExtQuals and Type that stores the underlying type
pointer. This results in a 2% performance win for -emit-llvm on a
typical C file, with 1% memory growth in the AST.

Note that there is an API change in this optimization:
QualType::getTypePtr() can no longer be invoked on a NULL
QualType. If the QualType might be NULL, use
QualType::getTypePtrOrNull(). I've audited all uses of getTypePtr() in
the code base and changed the appropriate uses over to
getTypePtrOrNull().

A future optimization opportunity would be to distinguish between
cast/dyn_cast and cast_or_null/dyn_cast_or_null; for the former, we
could use getTypePtr() rather than getTypePtrOrNull(), to take another
branch out of the cast/dyn_cast implementation.

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

13 years agoAdded ParenType type node.
Abramo Bagnara [Fri, 10 Dec 2010 16:29:40 +0000 (16:29 +0000)]
Added ParenType type node.

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

13 years agoSilence GCC warning about comparisons between enumerators of different types
Douglas Gregor [Fri, 10 Dec 2010 15:40:48 +0000 (15:40 +0000)]
Silence GCC warning about comparisons between enumerators of different types

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

13 years agoAnother dummy commit to check GIT mirroring
Anton Korobeynikov [Fri, 10 Dec 2010 12:03:06 +0000 (12:03 +0000)]
Another dummy commit to check GIT mirroring

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

13 years agoIt's kindof silly that ExtQuals has an ASTContext&, and we can use that
John McCall [Fri, 10 Dec 2010 11:01:00 +0000 (11:01 +0000)]
It's kindof silly that ExtQuals has an ASTContext&, and we can use that
space better.  Remove this reference.  To make that work, change some APIs
(most importantly, getDesugaredType()) to take an ASTContext& if they
need to return a QualType.  Simultaneously, diminish the need to return a
QualType by introducing some useful APIs on SplitQualType, which is
just a std::pair<const Type *, Qualifiers>.

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

13 years agoUpdate ExtQuals comment to reflect the expansion of the fast qualifiers
Douglas Gregor [Fri, 10 Dec 2010 10:08:30 +0000 (10:08 +0000)]
Update ExtQuals comment to reflect the expansion of the fast qualifiers

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

13 years agoOptimize memory usage of FunctionProtoType on MSVC.
John McCall [Fri, 10 Dec 2010 09:12:16 +0000 (09:12 +0000)]
Optimize memory usage of FunctionProtoType on MSVC.

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

13 years agoMove the "volatile" bit into QualType's "fast" qualifier set,
Douglas Gregor [Fri, 10 Dec 2010 08:57:38 +0000 (08:57 +0000)]
Move the "volatile" bit into QualType's "fast" qualifier set,
increasing the required type alignment from 8 to 16. This provides a
2.5% speedup for -fsyntax-only on a token-cached Cocoa.h, while only
increasing memory consumption in the ASTContext by 0.8%.

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

13 years agoUse TypeAlignment constant rather than fixed alignment of 8
Douglas Gregor [Fri, 10 Dec 2010 08:12:03 +0000 (08:12 +0000)]
Use TypeAlignment constant rather than fixed alignment of 8

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

13 years agoFixed version of 121435.
Rafael Espindola [Fri, 10 Dec 2010 07:40:14 +0000 (07:40 +0000)]
Fixed version of 121435.

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

13 years agoIn clang_getCursor(), don't override a preprocessing cursor within
Douglas Gregor [Fri, 10 Dec 2010 07:23:11 +0000 (07:23 +0000)]
In clang_getCursor(), don't override a preprocessing cursor within
another preprocessing cursor, since we want the outermost one.

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

13 years agoAdd missing switch case to handle builtin for Neon vqnegq.
Bob Wilson [Fri, 10 Dec 2010 06:26:19 +0000 (06:26 +0000)]
Add missing switch case to handle builtin for Neon vqnegq.

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

13 years agoLLVM's intrinsics for vpaddl and vpadal have 2 overloaded types.
Bob Wilson [Fri, 10 Dec 2010 05:51:07 +0000 (05:51 +0000)]
LLVM's intrinsics for vpaddl and vpadal have 2 overloaded types.
Clang was only specifying the overloaded result type.  PR8483.

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

13 years agoRevert my previous patch to make the valgrind bots happy.
Rafael Espindola [Fri, 10 Dec 2010 04:01:05 +0000 (04:01 +0000)]
Revert my previous patch to make the valgrind bots happy.

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

13 years agoTreat visibility on an enclosing namespace as a non-explicit source of
John McCall [Fri, 10 Dec 2010 02:59:44 +0000 (02:59 +0000)]
Treat visibility on an enclosing namespace as a non-explicit source of
visibility.  Fixes PR8713.

I've disabled a test which was testing that you can #pragma pop visibility
to get out of a namespace's visibility attribute.  We should probably just
diagnose that as an error unless it's instrumental to someone's system
headers.

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

13 years agoAdd dependency to "make clang-test check-all".
NAKAMURA Takumi [Fri, 10 Dec 2010 02:58:03 +0000 (02:58 +0000)]
Add dependency to "make clang-test check-all".

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

13 years agoAnd more gzip goodness for clang.
Eric Christopher [Fri, 10 Dec 2010 01:59:28 +0000 (01:59 +0000)]
And more gzip goodness for clang.

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

13 years agoBind the result of a property fetch to a temporary.
John McCall [Fri, 10 Dec 2010 01:49:45 +0000 (01:49 +0000)]
Bind the result of a property fetch to a temporary.

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

13 years agoExtend libclang debugging output for clang_getCursor() to show the definition we...
Douglas Gregor [Fri, 10 Dec 2010 01:45:00 +0000 (01:45 +0000)]
Extend libclang debugging output for clang_getCursor() to show the definition we found

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

13 years agoNeon compare absolute LLVM intrinsics are not overloaded. PR8484.
Bob Wilson [Fri, 10 Dec 2010 01:11:38 +0000 (01:11 +0000)]
Neon compare absolute LLVM intrinsics are not overloaded.  PR8484.

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

13 years agoAdded remaining objective-c library builtins (as in gcc) to
Fariborz Jahanian [Fri, 10 Dec 2010 00:39:16 +0000 (00:39 +0000)]
Added remaining objective-c library builtins (as in gcc) to
clang. // rdar://8735023

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

13 years agoFix another obscure corner layout case.
Argyrios Kyrtzidis [Fri, 10 Dec 2010 00:11:00 +0000 (00:11 +0000)]
Fix another obscure corner layout case.

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

13 years agoUpdate clang for the API changes in the cfi patch.
Rafael Espindola [Thu, 9 Dec 2010 23:48:34 +0000 (23:48 +0000)]
Update clang for the API changes in the cfi patch.

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

13 years agoAdd Neon vreinterpret intrinsics for half-float (f16) types.
Bob Wilson [Thu, 9 Dec 2010 23:37:49 +0000 (23:37 +0000)]
Add Neon vreinterpret intrinsics for half-float (f16) types.

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

13 years agoDon't crash when code-completing after "#include <". It would be far
Douglas Gregor [Thu, 9 Dec 2010 23:35:36 +0000 (23:35 +0000)]
Don't crash when code-completing after "#include <". It would be far
better to actually produce a decent set of completions by checking the
system include paths, but not today. Fixes PR8744.

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

13 years agoRefactored/cleanedup ActOnFunctionDeclarator
Fariborz Jahanian [Thu, 9 Dec 2010 23:11:32 +0000 (23:11 +0000)]
Refactored/cleanedup ActOnFunctionDeclarator
and ActOnVariableDeclarator
No functionality change. // rdar://8751949

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

13 years agoEliminate duplicate code completions for properties.
Douglas Gregor [Thu, 9 Dec 2010 23:01:55 +0000 (23:01 +0000)]
Eliminate duplicate code completions for properties.

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