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

3851 Коммитов

Автор SHA1 Сообщение Дата
Daniel Dunbar 8fbc6d23d6 [AST] Define a few more key getLocStart() implementations.
- This cuts the # of getSourceRange calls by 60% on
   OGF/NSBezierPath-OAExtensions.m.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152412 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 15:39:24 +00:00
Daniel Dunbar 90e25a8b2c [AST] Reimplement Stmt::getLoc{Start,End} to dispatch to subclass overloads.
- getSourceRange() can be very expensive, we should try to avoid it if at all possible.

In conjunction with the previous commit I measured a ~2% speedup on 403.gcc/combine.c and a 3% speedup on OmniGroupFrameworks/NSBezierPath-OAExtensions.m.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152411 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 15:39:19 +00:00
Daniel Dunbar 396ec676b7 [AST] Add {DeclRefExpr,MemberExpr,ImplicitCastExpr}::{getLocStart,getLocEnd} methods.
- There are probably a lot more of these worth adding, but these are a start at hitting some of the exprs for which getSourceRange().getBegin() is a poor substitute for getLocStart().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152410 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 15:39:15 +00:00
Richard Smith ef9f29804f Fix statement printing for raw and template user-defined literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152401 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 10:10:02 +00:00
Richard Smith 3a5032b89d Literal operator suffixes and regular names live in separate namespaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152395 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 08:37:16 +00:00
Richard Smith 36f5cfe4df Support for raw and template forms of numeric user-defined literals,
and lots of tidying up.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152392 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 08:00:36 +00:00
Daniel Dunbar bc5419a2ed [AST] Memoize ASTContext::getTypeInfo().
- On -emit-llvm-only of 403.gcc/combine.c, for example, we make 160k calls to
   getTypeInfo but only ever deal with 680 some distinct types.

I saw these speedups (user time):
  403.gcc/combine.c -- 3.1%
  OmniGroupFrameworks/NSBezierPath-OAExtensions.m -- 3.6%
  JavaScriptCore/Interpreter.cpp -- 1.4%
which seems pretty sweet.

I ran some histograms on those compiles and we end up doing a ton of
getTypeInfo() on 'char' and 'int'. I tried splitting out a fast path for builtin
types, but this wasn't a win. Still kinda seems like we could be doing better
here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152377 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 04:12:54 +00:00
Daniel Dunbar 42f42c8c58 [AST] NestedNameSpecifier's ctor/dtor are trivial and should be inlined.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152365 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 01:51:59 +00:00
Daniel Dunbar cd485926f1 [AST] Type::isVoidType() is trivial and should be inlined.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152364 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 01:51:56 +00:00
Daniel Dunbar 3d13c5a1e7 [AST] Reduce Decl::getASTContext() calls.
- This function is not at all free; pass it around along some hot paths instead
   of recomputing it deep inside various VarDecl methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152363 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 01:51:51 +00:00
Benjamin Kramer 56757e9eaf Untangle getUnderlyingDeclImpl, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152339 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 21:00:45 +00:00
Daniel Dunbar 7a8c758868 [AST] APValue: Split the fast path of MakeUninit to be inline.
- This change seems to be a tiny loss on 403.gcc/combine.c (.2%), but I think
   it is the right thing to do.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152330 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 20:28:55 +00:00
Daniel Dunbar 6daffa5d60 [AST] Change NamedDecl::getUnderlyingDecl() to inline the fast (and incredibly common) path.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152321 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 18:20:41 +00:00
Richard Smith 916883004c Ensure we don't print 123ULL_foo when printing a user-defined integer literal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152303 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 09:02:38 +00:00
Daniel Dunbar 76e035a529 [AST] Change Type::isIntegerType to be inlined(). It is very popular.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152289 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 02:52:18 +00:00
Douglas Gregor 5bc37f6e0c Loosen the precondition of isCXXInstanceMember() to simply return
"false" for declarations that aren't members of classes. Fixes PR12106.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152284 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 02:08:05 +00:00
Richard Smith 9fcce65e7e AST representation for user-defined literals, plus just enough of semantic
analysis to make the AST representation testable. They are represented by a
new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic
properties, including full CodeGen support, are achieved for free by this
representation.

UserDefinedLiterals can never be dependent, so no custom instantiation
behavior is required. They are mangled as if they were direct calls to the
underlying literal operator. This matches g++'s apparent behavior (but not its
actual mangling, which is broken for literal-operator-ids).

User-defined *string* literals are now fully-operational, but the semantic
analysis is quite hacky and needs more work. No other forms of user-defined
literal are created yet, but the AST support for them is present.

This patch committed after midnight because we had already hit the quota for
new kinds of literal yesterday.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152211 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 08:35:16 +00:00
Eli Friedman 9e9c454b12 Make sure we consistently canonicalize types when canonicalizing TemplateTemplateParmDecls. PR12179.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152189 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 01:09:33 +00:00
Richard Smith 485ea8e8ea The constant folder's diagnosic mechanism is irrelevant for C; don't bother
producing a C-only diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152181 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 00:30:44 +00:00
Daniel Dunbar 047da195ae [AST] VarDecl::hasDefinition() - Early exit if we find a strong definition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152166 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 23:52:46 +00:00
Daniel Dunbar 60d302a707 [AST] FunctionDecl::getBuiltinID() - Eliminate spurious calls to getASTContext
-- which is very much not free -- in the common case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152165 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 23:52:37 +00:00
Ted Kremenek ebcb57a8d2 Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,
NSNumber, and boolean literals.  This includes both Sema and Codegen support.
Included is also support for new Objective-C container subscripting.

My apologies for the large patch.  It was very difficult to break apart.
The patch introduces changes to the driver as well to cause clang to link
in additional runtime support when needed to support the new language features.

Docs are forthcoming to document the implementation and behavior of these features.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152137 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 20:05:56 +00:00
Daniel Dunbar f9aa3635fc AST: Move several Type::is...Type() functions to be inline.
- These functions are both (a) very commonly called and (b) excellent
   candidates for CSE in the callers in which they are commonly used.
 - That isHalfType() is hot makes me sad, but it is trivially when inlined (and
   a huge waste of time when not!!!).
 - The extra IsEnumDeclComplete() function is a hack to break the cycle between
   Type.h and Decl.h, I'm not sure of how to do this more cleanly, but am open
   to ideas.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152126 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 18:20:20 +00:00
Argyrios Kyrtzidis c1b0f7fa9b Use TinyPtrVector instead of UsuallyTinyPtrVector.
The latter is just a worse version of the former.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152096 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 03:00:11 +00:00
Daniel Dunbar 02892a65b1 AST/stats: Don't effectively use an out-of-line function to return a static
bool. Ugh.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152062 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 21:42:49 +00:00
Peter Collingbourne 12fc4b0624 Properly handle non-canonical underlying types in
ASTContext::getUnaryTransformType.  This can happen if, for example,
an enumeration's underlying type is a typedef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152031 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 16:02:06 +00:00
James Molloy b3c312ce4d Fix a bug in the mangler where in 'namespace std { extern "C" {X;} }', X would not be seen to be in ::std::.
Migrate two other places where the same logic is used to use the helper function that already exists.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152022 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 09:59:43 +00:00
Richard Smith 1aa0be8635 constexpr: Remove APValue/CCValue distinction. It is no longer useful given the
resolution of core issue 1454.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151991 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-03 22:46:17 +00:00
Eli Friedman 16412ef25a Avoid an unnecessary recursive loop between type canonicalization and NNS canonicalization which would (rarely) lead to memory corruption. While I'm here, simplify. Fixes PR12166. Not committing a testcase because it's impossible to reduce it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151967 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-03 04:09:56 +00:00
Argyrios Kyrtzidis 5a61e0c422 [Sema] Fix crash-on-invalid-code issue:
@class I;
@implementation I(cat) // crashes here
@end

rdar://10968158

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151931 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 19:14:29 +00:00
Richard Smith 16581335fc Ensure that we instantiate static reference data members of class templates
early, since their values can be used in constant expressions in C++11. For
odr-use checking, the opposite change is required, since references are
odr-used whether or not they satisfy the requirements for appearing in a
constant expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151881 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 04:14:40 +00:00
Ted Kremenek 32ad2ee261 Change @import to @__experimental_modules_import. We are not ready to commit to a particular syntax for modules,
and don't have time to push it forward in the near future.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151841 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 22:07:04 +00:00
Argyrios Kyrtzidis b2c60b04a5 Move llvm/ADT/SaveAndRestore.h -> llvm/Support/SaveAndRestore.h.
Needs llvm update.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151829 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 19:45:56 +00:00
Peter Collingbourne dca1761c9b StmtProfiler: Add a null check for child statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151812 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 16:34:31 +00:00
Fariborz Jahanian 77bfb8b43e objective-c: provide fixit hint when atomic property does not
have matching user defined setter/getter and a warning is issued. 
In this case, a fixit note is displayed. // rdar://10267155


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151766 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 22:18:55 +00:00
Eli Friedman fd819783aa Fix a couple -Wuninitialized warnings from gcc. Reported by David Greene.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151754 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 20:59:56 +00:00
James Molloy 16f1f717af Reapply r151638 and r151641.
The bug that was caught by Apple's internal buildbots was valid and also showed another bug in my implementation.

These are now fixed, with regression tests added to catch them both (not Darwin-specific).

Original log:
====================

Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h

Original log:
---------------------
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.

This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
 return 0;
}

This finally fixes PR5464 and PR5477.
---------------------

I also reverted r151641 which was enhancement on top of r151638.

====================




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151712 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 10:24:19 +00:00
Argyrios Kyrtzidis 32a9a7543f Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h
Original log:
---------------------
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.

This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
 return 0;
}

This finally fixes PR5464 and PR5477.
---------------------

I also reverted r151641 which was enhancement on top of r151638.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151667 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-28 23:39:14 +00:00
James Molloy fbcf0405b7 Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.
This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
  return 0;
}

This finally fixes PR5464 and PR5477.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151638 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-28 18:12:11 +00:00
Argyrios Kyrtzidis c1b66e6003 When evaluating integer expressions include a check for sub-expressions
depth and error if we exceed a max value, to make sure we avoid a stack overflow.

This is a hacky temporary fix. rdar://10913206.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151585 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-27 23:18:37 +00:00
Argyrios Kyrtzidis d411a4b230 Revert testing code I committed by mistake in r151464.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151548 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-27 20:21:34 +00:00
Benjamin Kramer d162cf1024 Reorder members to save padding.
There's more potential here, but these Exprs aren't used that often so I don't feel like doing heroic bit packing right now.

-8 bytes on every class changed (x86_64).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151501 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-26 20:37:14 +00:00
Argyrios Kyrtzidis 2fa975c940 Revert r151460 as it is not enough to address the issue.
Original log:
When evaluating integer expressions handle logical operators outside
VisitBinaryOperator() to reduce stack pressure for source with huge number
of logical operators.

Fixes rdar://10913206.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151464 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-25 23:21:37 +00:00
Sebastian Redl faf4ef62b6 Richard Smith pointed out that there already is a proposal for init list mangling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151462 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-25 22:59:28 +00:00
Argyrios Kyrtzidis 8ed20910d8 When evaluating integer expressions handle logical operators outside
VisitBinaryOperator() to reduce stack pressure for source with huge number
of logical operators.

Fixes rdar://10913206.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151460 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-25 21:38:16 +00:00
Sebastian Redl b76ffc5667 Better mangling for new-expressions. Also, although we can't mangle arbitrary initializer lists yet (we will need this), turn the crash into a controlled error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151455 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-25 20:51:07 +00:00
Ahmed Charles 13a140caba ArrayRef'ize various functions in the AST/Parser/Sema.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151447 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-25 11:00:22 +00:00
Richard Smith dfefb840e3 Teach CXXRecordDecl::hasIrrelevantDestructor to check the base classes and
data members for deleted or user-provided destructors.

Now it's computed in advance, serialize it, and in passing fix all the other
record DefinitionData flags whose serialization was missing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151441 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-25 07:33:38 +00:00
Richard Smith 359c89df54 When checking whether a reference to a variable is an ICE, look at the type of
the declaration, not at the type of the DeclRefExpr, since within a lambda the
DeclRefExpr can be more const than the declaration is.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151399 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-24 22:12:32 +00:00
Nick Lewycky 0fd7f4db69 Revert r151357. That unreachable is reachable...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151359 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-24 09:07:53 +00:00