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

4921 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor a5fb7c3b56 Implement support for cached code completions for
nested-name-specifiers. Also includes fixes to the generation of
nested-name-specifier result in the non-cached case; we were producing
lame results for namespaces and namespace aliases, which (1) didn't
always have nested-name-specifiers when we want them, and (2) did not
have the necessary "::" as part of the completion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111203 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 23:05:20 +00:00
Fariborz Jahanian 57dae1a312 Diagnose assiging to an interface object in
non-fragile abi mode as sizes are not statically known.
Fixes radar 8315734.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111191 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 21:51:12 +00:00
Argyrios Kyrtzidis 881b36ccbf Fix initialization for members of anonymous struct in a union.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111159 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 17:27:13 +00:00
Argyrios Kyrtzidis dd7744d01e Emit diagnostic error when the field of an anonymous struct is non trivial.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111158 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 17:27:08 +00:00
Douglas Gregor 1827e10051 When caching global completion results, keep track of the simplified
type class, so that we can adjust priorities appropriately when the
preferred type for the context and the actual type of the completion
are similar.

This gets us one step closer to parity of the cached completion
results with the non-cached completion results.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111139 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 16:18:59 +00:00
Charles Davis f231df318d Error out if reinterpret_casting between member pointers of two different
sizes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111119 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 05:30:44 +00:00
Charles Davis d18f9f965b Err on incomplete class types in member pointers when compiling for the
Microsoft C++ ABI, for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111118 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 04:01:50 +00:00
Argyrios Kyrtzidis 06999f8ff6 Don't warn for the common pattern of disallowing copying:
class S {
  S(const S&); // DO NOT IMPLEMENT
  void operator=(const S&); // DO NOT IMPLEMENT
};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111100 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15 10:17:33 +00:00
Douglas Gregor 8071e4212a Extend the code-completion caching infrastructure to include global
declarations (in addition to macros). Each kind of declaration maps to
a certain set of completion contexts, and the ASTUnit completion logic
introduces the completion strings for those declarations if the actual
code-completion occurs in one of the contexts where it matters. 

There are a few new code-completion-context kinds. Without these,
certain completions (e.g., after "using namespace") would need to
suppress all global completions, which would be unfortunate.

Note that we don't get the priorities right for global completions,
because we don't have enough type information. We'll need a way to
compare types in an ASTContext-agnostic way before this can be
implemented.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111093 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15 06:18:01 +00:00
Eli Friedman de7a0fcdf9 Use Enumerators.data() instead of &Enumerators[0] to fix a potential
assertion failure.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111092 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15 02:27:09 +00:00
Argyrios Kyrtzidis ba6f816d63 Remove dead code, caught by unused function warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111091 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15 01:15:58 +00:00
Argyrios Kyrtzidis bbc6454bb9 Commit improved version of 111026 & 111027.
Unused warnings for functions:
-static functions
-functions in anonymous namespace
-class methods in anonymous namespace
-class method specializations in anonymous namespace
-function specializations in anonymous namespace

Unused warnings for variables:
-static variables
-variables in anonymous namespace
-static data members in anonymous namespace
-static data members specializations in anonymous namespace

Reveals lots of opportunities for dead code removal in llvm codebase that will
interest my esteemed colleagues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15 01:15:20 +00:00
Eli Friedman 09865a903a PR3344: Downgrade "too many braces around scalar initializer" to a warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111067 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14 03:14:53 +00:00
Douglas Gregor 87c08a5d6b Implement caching of code-completion results for macro definitions
when the CXTranslationUnit_CacheCompletionResults option is given to
clang_parseTranslationUnit(). Essentially, we compute code-completion
results for macro definitions after we have parsed the file, then
store an ASTContext-agnostic version of those results (completion
string, cursor kind, priority, and active contexts) in the
ASTUnit. When performing code completion in that ASTUnit, we splice 
the macro definition results into the results provided by the actual
code-completion (which has had macros turned off) before libclang gets
those results. We use completion context information to only splice in
those results that make sense for that context.

With a completion involving all of the macros from Cocoa.h and a few other
system libraries (totally ~8500 macro definitions) living in a
precompiled header, we get about a 9% performance improvement from
code completion, since we no longer have to deserialize all of the
macro definitions from the precompiled header. 

Note that macro definitions are merely the canary; the cache is
designed to also support other top-level declarations, which should be
a bigger performance win. That optimization will be next.

Note also that there is no mechanism for determining when to throw
away the cache and recompute its contents.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111051 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 22:48:40 +00:00
Argyrios Kyrtzidis 05eac86d54 Revert 111026 & 111027, build breakage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111036 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 20:13:06 +00:00
Argyrios Kyrtzidis 30c0dd86f0 The unused warnings extravaganza continues. Warn for:
-static variables
-variables in anonymous namespace (fixes rdar://7794535)
-static data members in anonymous namespace
-static data members specializations in anonymous namespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111027 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 18:42:40 +00:00
Argyrios Kyrtzidis f6d1d43d68 Expand the unused warnings for functions. Warn for:
-static function declarations
-functions in anonymous namespace
-class methods in anonymous namespace
-class method specializations in anonymous namespace
-function specializations in anonymous namespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111026 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 18:42:29 +00:00
Argyrios Kyrtzidis 49b96d1a38 Change Sema's UnusedStaticFuncs to UnusedFileScopedDecls to allow also keeping track of unused file scoped variables.
This is only preparation, currently only static function definitions are tracked, as before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111025 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 18:42:17 +00:00
Fariborz Jahanian f759b4dc74 When issuing warning for future conflict resolution,
(nonfragile-abi2), do not consider 'ivar' access
in class methods. Also, improve on diagnostics.
Radar 8304561.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111023 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 18:09:39 +00:00
Abramo Bagnara 7bd067635d Fixed NNS insertion in MemberPointerType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111013 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 12:56:25 +00:00
John McCall 8ba6691248 Work around a crash when checking access to injected class names
qua templates.  The current fix suppresses the access check entirely
in this case;  to do better, we'd need to be able to say that a
particular lookup result came from a particular injected class name,
which is not easy to do with the current representation of LookupResult.
This is on my known-problems list.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111009 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 07:02:08 +00:00
Douglas Gregor 914ed9d30e Teach ASTUnit to hold on to the Sema object and ASTConsumer that are
used when parsing (or re-parsing) a file. Also, when loading a
precompiled header into ASTUnit, create a Sema object that holds onto
semantic-analysis information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111003 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 03:15:25 +00:00
John McCall b859206341 Perform access control when template lookup finds a class template.
This is *really* hacky.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110997 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 02:23:42 +00:00
Eli Friedman de7e66256b Zap unused UnaryOperator::OffsetOf.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 01:36:11 +00:00
Sebastian Redl 0b17c61e8f Instead of modifying the ObjC AST to not modify existing declarations, teach chained PCH to overwrite declarations from earlier PCH files in dependent ones. Tell Sema to note when it changes AST nodes so that they have to be reserialized. Finally, the ObjCProtocolDecls created in forward decls, like the ObjCInterfaceDecls in @class forward decls, are not lexically part of the decl context; only the definition is.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110989 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 00:28:03 +00:00
Douglas Gregor 46ea32a4b5 Add a ParseAST overload that takes a Sema object, so that the caller
can create (and hold on to) the Sema object. Also, move Sema-related
initialization/finalization with its various consumers and external
sources into the Sema constructor and destructor, rather than placing
it in ParseAST.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110973 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 22:51:45 +00:00
Fariborz Jahanian 80a785c245 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110965 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 22:33:42 +00:00
Fariborz Jahanian ea16110ce3 Patch to issue warning when colllection expresion's type
does not implement 'countByEnumeratingWithState' API.
Implements radar 7634669.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110964 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 22:25:42 +00:00
John McCall b7f4ffe073 Implement -Wcast-align. The initial design of this diagnostic diverges
from GCC's in that we warn on *any* increase in alignment requirements, not
just those that are enforced by hardware.  Please let us know if this causes
major problems for you (which it shouldn't, since it's an optional warning).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110959 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 21:44:57 +00:00
John McCall d69fd7f34f Fixing the build isn't good enough; back out r110956 and r110953.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110958 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 21:39:05 +00:00
John McCall e783d000b1 dgregor should write code that compiles.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110956 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 21:23:27 +00:00
Douglas Gregor 0eeb81baac Add a ParseAST overload that takes a Sema object, so that the caller
can create (and hold on to) the Sema object. Also, move Sema-related
initialization/finalization with its various consumers and external
sources into the Sema constructor and destructor, rather than placing
it in ParseAST.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110952 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 20:50:39 +00:00
Douglas Gregor e737f5041a Move Sema's headers into include/clang/Sema, renaming a few along the way.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110945 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 20:07:10 +00:00
Douglas Gregor c9ef405559 Downgrade error about nonnull attribute bbeing applied to a function without point arguments to a warning
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110939 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 18:48:43 +00:00
Abramo Bagnara ef3dce817d Added locations and type source info for DeclarationName inside UsingDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110912 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 11:46:03 +00:00
Jordy Rose 2a479929f7 Remove OwnershipAttr::Kind, since it's essentially redundant with attr::Kind the way it's being used. Also fix isa<OwnershipAttr> support, break more-than-80-char lines, and other miscellaneous ownership attr cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110908 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 08:54:03 +00:00
John McCall 7b49202090 Handle the obvious case for diagnosing redeclarations of extern "C" functions.
Fixes PR7859.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110906 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 07:09:11 +00:00
John McCall 507384f007 Bail out of MaybeBindToTemporary if the record type is invalid. Test case
is 8.5MB, sorry.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110901 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 02:40:37 +00:00
John McCall fcadea2556 Fix a crash on invalid when declaring an implicit member of a class with an
invalid destructor.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110891 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 00:57:17 +00:00
John McCall b3b50a8b2c Don't try to implicitly declare special members of an invalid class.
Fixes a crash in a rather large and difficult-to-reduce test case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110882 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 23:52:36 +00:00
Abramo Bagnara 2577743c56 Added locations and type source info for DeclarationName.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 22:01:17 +00:00
Douglas Gregor e6b1bb6e7f Once code completion has completed, pass a "completion context" on to
the code-completion consumer. The consumer can use this information to
augument, filter, or display the code-completion results.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110858 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 21:23:17 +00:00
Fariborz Jahanian faa3449a0f IRGen support for functions returning objc object
types. Fixes PR7865.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110832 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 17:37:35 +00:00
Benjamin Kramer 476d8b863c Random temporary string cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110807 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 14:47:12 +00:00
Douglas Gregor 7f1c547ee6 If name lookup finds different type declarations in different scopes
that actually refer to the same underlying type, it is not an
ambiguity; add uniquing support based on the canonical type of type
declarations. Fixes <rdar://problem/8296180>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110806 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 14:45:53 +00:00
Douglas Gregor deacbdca55 Speculatively revert r110610 " Make ObjCInterfaceDecl redeclarable,
and create separate decl nodes for forward declarations and the
definition," which appears to be causing significant Objective-C
breakage.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110803 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 12:19:30 +00:00
Douglas Gregor 604eb65686 Improve our handling of user-defined conversions when computing
implicit conversion sequences. In particular, model the "standard
conversion" from a class to its own type (or a base type) directly as
a standard conversion in the normal path *without* trying to determine
if there is a valid copy constructor. This appears to match the intent
of C++ [over.best.ics]p6 and more closely matches GCC and EDG.

As part of this, model non-lvalue reference initialization via
user-defined conversion in overloading the same way we handle it in
InitializationSequence, separating the "general user-defined
conversion" and "conversion to compatible class type" cases.

The churn in the overload-call-copycon.cpp test case is because the
test case was originally wrong; it assumed that we should do more
checking for copy constructors that we actually should, which affected
overload resolution.

Fixes PR7055. Bootstrapped okay.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110773 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 02:15:33 +00:00
Fariborz Jahanian ba55198301 Fix a spurious warning when message sent to qualified-id
type receiver (pr7861).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110696 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-10 18:10:50 +00:00
Douglas Gregor 9bcd4d4a4b Eliminate unnecessary uses of TemporaryBase in TreeTransform;
transforming TypeSourceInfos already gives us proper (and better)
source-location information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110678 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-10 14:27:00 +00:00
Abramo Bagnara 22f638a58e Fixed redundant NNS loading.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110677 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-10 13:46:45 +00:00