Commit Graph

8516 Commits

Author SHA1 Message Date
Douglas Gregor d507d77432 Fix handling of property and ivar lookup in typo correction; the two
kinds of lookup into Objective-C classes were tangled together, a
situation that was compounded by automatically synthesized ivars.

llvm-svn: 116907
2010-10-20 03:06:34 +00:00
Anders Carlsson 274a70ed7f Add a __has_attribute macro that works much like __has_feature and __has_builtin.
llvm-svn: 116906
2010-10-20 02:31:43 +00:00
Douglas Gregor 87074f19e8 Introduce a simple cache for unqualified typo corrections, so that we
don't repeatedly loop through identifiers, correcting the same typo'd
identifier over and over again. 

We still bail out after 20 typo corrections, but this should help
improve performance in the common case where we're typo-correcting
because the user forgot to include a header.

llvm-svn: 116901
2010-10-20 01:32:02 +00:00
Ted Kremenek c8456f8c59 Really^2 fix <rdar://problem/8361834>, this time without crashing.
Now MICache is a linked list (per the FIXME), where we tradeoff between MacroInfo objects being in MICache
and MIChainHead.  MacroInfo objects in the MICache chain are already "Destroy()'ed", so they can be reused.  When
inserting into MICache, we need to remove them from the regular linked list so that they aren't destroyed more than
once.

llvm-svn: 116869
2010-10-19 22:15:20 +00:00
Ted Kremenek 1f1e4bdbf7 Simplify lifetime management of MacroInfo objects in Preprocessor by having the Preprocessor maintain them in a linked
list of allocated MacroInfos.  This requires only 1 extra pointer per MacroInfo object, and allows us to blow them
away in one place.  This fixes an elusive memory leak with MacroInfos (whose exact location I couldn't still figure
out despite substantial digging).

Fixes <rdar://problem/8361834>.

llvm-svn: 116842
2010-10-19 18:16:54 +00:00
John McCall 46a04f86df MSVC space optimization.
llvm-svn: 116797
2010-10-19 05:43:52 +00:00
John McCall be19d72e6d Petty space optimizations in ElaboratedType and DependentNameType.
Petty time optimization in TemplateTypeParmType.

llvm-svn: 116796
2010-10-19 05:23:37 +00:00
John McCall ace48cd872 Redirect templated friend class decls to a new Sema callback and
construct an unsupported friend when there's a friend with a templated
scope specifier.  Fixes a consistency crash, rdar://problem/8540527

llvm-svn: 116786
2010-10-19 01:40:49 +00:00
Douglas Gregor 0787b3224d Tweak code-completion result priorities, so that exact and similar
type matches have a bigger impact. The impetus for this change was
that, when initializing an enumeration value, we want enumerators of
that enumeration type to have a higher priority than, e.g., unrelated
local variables.

llvm-svn: 116774
2010-10-19 00:03:23 +00:00
Daniel Dunbar 473f8a6f88 Driver: Reject -fasm-blocks except on X86 (where we just ignore it, since
passing it is very prevalent in some circles).

llvm-svn: 116761
2010-10-18 22:49:46 +00:00
Daniel Dunbar 2b4de14b1d Driver/IA: Accept and ignore -force_cpusubtype_ALL, as in 'clang -c
-Wa,-force_cpusubtype_ALL t.c'.
 - Tweaks -Wa, and -Xassembler handling to only accept an explicit short list of
   arguments and give an obvious unsupported error on others.

llvm-svn: 116759
2010-10-18 22:36:15 +00:00
Argyrios Kyrtzidis 9beef8e53d Read/write declaration attributes from/to PCH properly. Embed them in the declaration block instead of trying to create another block.
The new block was messing with the assumption that after decls block comes the stmts block.
Fixes http://llvm.org/PR8406

llvm-svn: 116737
2010-10-18 19:20:11 +00:00
Anders Carlsson 778ca32c88 Implement the first half of [dcl.attr.override]p6.
llvm-svn: 116709
2010-10-18 16:24:27 +00:00
Francois Pichet a310806ae5 Microsoft enum extensions. 2 things will change on -fms-extensions:
1. enum underlying type is int by default.
2. Error "enumerator value is not representable in the underlying type"is a ExtWarning

llvm-svn: 116704
2010-10-18 15:01:13 +00:00
Douglas Gregor 6769922d8c Add iteration over the preprocessor conditional stack to PreprocessorLexer
llvm-svn: 116703
2010-10-18 14:43:21 +00:00
Douglas Gregor 70d80598c5 Add declarations nested in a linkage specification to the output of
-ast-print-xml, from Martin Vejnar!

llvm-svn: 116702
2010-10-18 14:35:28 +00:00
Michael J. Spencer feb799c14b Fix Whitespace.
llvm-svn: 116699
2010-10-18 07:10:59 +00:00
Anders Carlsson 0ea1047d51 Implement [dcl.attr.override]p2 and add tests for p1 and p2.
llvm-svn: 116692
2010-10-17 23:36:12 +00:00
John McCall 2c2eb12d9c White-listing templated-scope friend decls is a good idea, but doing it
by marking the decl invalid isn't.  Make some steps towards supporting these
and then hastily shut them down at the last second by marking them as
unsupported.

llvm-svn: 116661
2010-10-16 06:59:13 +00:00
Daniel Dunbar 6358d6866d Driver: Error on -fno-for-scope, which we have no intention of supporting.
llvm-svn: 116627
2010-10-15 22:30:42 +00:00
Francois Pichet 8c2f519b8b bool bit fields are causing problems with MSVC. Replace them with unsigned bit fields.
llvm-svn: 116623
2010-10-15 21:34:50 +00:00
Argyrios Kyrtzidis 59b34c2bb4 Again, add '-include-pch' option to the driver, so it can get passed to the cc1 driver.
llvm-svn: 116608
2010-10-15 18:52:45 +00:00
Argyrios Kyrtzidis dfe47dba37 Revert r116605, a lot more were committed by mistake.
llvm-svn: 116606
2010-10-15 18:51:34 +00:00
Argyrios Kyrtzidis ffbba26285 Add '-include-pch' option to the driver, so it can get passed to the cc1 driver.
llvm-svn: 116605
2010-10-15 18:49:01 +00:00
Fariborz Jahanian 4f99b59df6 Eradicate IsSuper field from ObjCImplicitSetterGetterRefExprClass
AST node. (finishing off radar 8525788).

llvm-svn: 116603
2010-10-15 18:40:05 +00:00
Devang Patel f3ca447c26 TBAA = Type Based Alias Analysis
llvm-svn: 116599
2010-10-15 18:23:36 +00:00
Argyrios Kyrtzidis 434383d703 Read/write to/from PCH DeclarationNameLocs, DeclarationNameInfos and QualifierInfos (rdar://8513756).
llvm-svn: 116598
2010-10-15 18:21:24 +00:00
David Chisnall 2e16ac52e1 Add clang_getLocationForOffset() to libclang, for gives a source location from a character index into a file.
llvm-svn: 116587
2010-10-15 17:07:39 +00:00
Douglas Gregor 36c22a2335 Diagnose C++ [class.mem]p13-14, where a class member has the same name
as the class itself. Fixes PR7082.

llvm-svn: 116573
2010-10-15 13:21:21 +00:00
Craig Silverstein 12a198e5b1 Recurse on a TypeLoc rather than a Type for TypedefDecl, now that the
typloc information is available (I don't think it was, originally).
Submitted as a 'trivial' change.

llvm-svn: 116568
2010-10-15 06:51:01 +00:00
John McCall 1c9c3fd50a Death to blocks, or at least the word "block" in one particular obnoxiously
ambiguous context.

llvm-svn: 116567
2010-10-15 04:57:14 +00:00
Dan Gohman 10169b94cf Wire up the -fstrict-aliasing and -fno-strict-aliasing options
to CodeGenOption flags.

llvm-svn: 116530
2010-10-14 22:36:56 +00:00
Douglas Gregor 57756eabc9 When performing typo correction, look through the set of known
identifiers to determine good typo-correction candidates. Once we've
identified those candidates, we perform name lookup on each of them
and the consider the results. 

This optimization makes typo correction > 2x faster on a benchmark
example using a single typo (NSstring) in a tiny file that includes
Cocoa.h from a precompiled header, since we are deserializing far less
information now during typo correction.

There is a semantic change here, which is interesting. The presence of
a similarly-named entity that is not visible can now affect typo
correction. This is both good (you won't get weird corrections if the
thing you wanted isn't in scope) and bad (you won't get good
corrections if there is a similarly-named-but-completely-unrelated
thing). Time will tell whether it was a good choice or not.

llvm-svn: 116528
2010-10-14 22:11:03 +00:00
John McCall 25c9d1170b At Fariborz's request, a somewhat cleaner bit-combining hack.
llvm-svn: 116524
2010-10-14 21:48:26 +00:00
Argyrios Kyrtzidis a665dc0770 Fix compiler error that clang didn't report (probably same problem as rdar://8552377).
It's more stress-free without access checking though..

llvm-svn: 116521
2010-10-14 21:35:29 +00:00
Argyrios Kyrtzidis 6843141d39 Store in PCH the key function of C++ class to avoid deserializing the complete declaration context in order to compute it.
Progress for rdar://7260160.

llvm-svn: 116508
2010-10-14 20:14:38 +00:00
Argyrios Kyrtzidis 0e88a565c0 Allow deserialization of just the fields of a record, when we want to iterate over them,
instead of deserializing the complete declaration context of the record.

Iterating over the fields of a record is very common (e.g to determine the layout), unfortunately we needlessly deserialize every declaration
that the declaration context of the record contains; this can be bad for large C++ classes that contain a lot of methods.
Fix this by allow deserialization of just the fields when we want to iterate over them.
Progress for rdar://7260160.

llvm-svn: 116507
2010-10-14 20:14:34 +00:00
Argyrios Kyrtzidis 55d1fc2d3c Give a default implementation for ASTDeserializationListener's methods, no functionality change.
llvm-svn: 116506
2010-10-14 20:14:28 +00:00
Argyrios Kyrtzidis 0427be938e Introduce command line option -error-on-deserialized-decl that is accompanied by a name
and emits an error if a declaration with this name is deserialized from PCH.

This is for testing, to make sure that we don't deserialize stuff needlessly.

llvm-svn: 116505
2010-10-14 20:14:25 +00:00
Argyrios Kyrtzidis a11aca4646 Introduce command line option -dump-deserialized-decls which is used to print the PCH decls that got deserialized, for testing purposes.
llvm-svn: 116503
2010-10-14 20:14:18 +00:00
Fariborz Jahanian 681c0754d9 Eliminate usage of ObjCSuperExpr used for
'super' as receiver of property or a setter/getter
methods. //rdar: //8525788

llvm-svn: 116483
2010-10-14 16:04:05 +00:00
John McCall 7f570718d3 Compress bit fields / enums from ReferenceType, BuiltinType, FunctionType, and
ObjCObjectType into Type.

llvm-svn: 116472
2010-10-14 03:00:17 +00:00
Douglas Gregor 5a2bb5ba98 Diagnose when a 'static' member function overrides a virtual function
in a base class. Fixes PR8168.

llvm-svn: 116448
2010-10-13 22:55:32 +00:00
Douglas Gregor a007d36c1b Generalize the checking for qualification of (non-friend) class
members. Provide a hard error when the qualification doesn't match the
current class type, or a warning + Fix-it if it does match the current
class type. Fixes PR8159.

llvm-svn: 116445
2010-10-13 22:19:53 +00:00
Douglas Gregor 392a84bdf6 Eliminate the use of ObjCSuperExpr in code completion.
llvm-svn: 116436
2010-10-13 21:24:53 +00:00
Douglas Gregor e01d2243d3 Update Type::BitsRemainingInType
llvm-svn: 116423
2010-10-13 20:07:36 +00:00
Douglas Gregor f10c97f36e _Bool is not a keyword in C++. Fixes PR7388 and PR8349.
llvm-svn: 116422
2010-10-13 20:00:38 +00:00
Douglas Gregor dc13b04a98 Place conversion warnings for non-type template arguments under the
control of -Wconversion, and ignore them by default.

llvm-svn: 116415
2010-10-13 18:27:55 +00:00
Douglas Gregor 52051cb173 Introduce a bit into Type that keeps track of whether there are any
unnamed or local types within that type. This bit is cached along with
the linkage of a type, so that it can be recomputed (e.g., when we see
that a typedef has given a name to an anonymous declaration).

Use this bit when checking C++03 [temp.arg.type]p2, so that we don't
walk template argument types repeatedly.

llvm-svn: 116413
2010-10-13 18:05:20 +00:00
Douglas Gregor b39215942e Fix a silly bug in the suppression of non-error diagnostics in a
SFINAE context, where we weren't getting the right diagnostic argument
count. I blame DiagnosticBuilder's weirdness. Fixes PR8372.

llvm-svn: 116411
2010-10-13 17:22:14 +00:00