Douglas Gregor [Wed, 6 Jan 2010 22:00:56 +0000 (22:00 +0000)]
Fix linkage for RTTI names by re-using the logic for computing the
linkage of vtables. Before this, we were emitting RTTI names for
template instantiations with strong external linkage rather than with
weak ODR linkage.
Fix a bug when property is redeclared in multiple
continuation classes and its original declaration
is imported from a protocol. This fixes radar 7509234.
Douglas Gregor [Wed, 6 Jan 2010 17:00:51 +0000 (17:00 +0000)]
Make sure that the key-function computation produces the correct
result for a nested class whose first non-pure virtual member function
has an inline body. Previously, we were checking for the key function
before we had seen the (delayed) inline body.
John McCall [Wed, 6 Jan 2010 09:43:14 +0000 (09:43 +0000)]
Improve the diagnostics used to report implicitly-generated class members
as parts of overload sets. Also, refer to constructors as 'constructors'
rather than functions.
John McCall [Wed, 6 Jan 2010 05:24:50 +0000 (05:24 +0000)]
Significantly rework the calculation of effective integer-expression ranges
for -Wsign-compare and -Wconversion, and use that coordinated logic to drive
both diagnostics. The new logic works more transparently with implicit
conversions, conditional operators, etc., as well as bringing -Wconversion's
ability to deal with pseudo-closed operations (e.g. arithmetic on shorts) to
-Wsign-compare.
Douglas Gregor [Wed, 6 Jan 2010 04:44:19 +0000 (04:44 +0000)]
Make our marking of virtual members functions in a class be
deterministic and work properly with templates. Once a class that
needs a vtable has been defined, we now do one if two things:
- If the class has no key function, we place the class on a list of
classes whose virtual functions will need to be "marked" at the
end of the translation unit. The delay until the end of the
translation unit is needed because we might see template
specializations of these virtual functions.
- If the class has a key function, we do nothing; when the key
function is defined, the class will be placed on the
aforementioned list.
At the end of the translation unit, we "mark" all of the virtual
functions of the classes on the list as used, possibly causing
template instantiation and other classes to be added to the
list. This gets LLVM's lib/Support/CommandLine.cpp compiling again.
Ted Kremenek [Wed, 6 Jan 2010 00:23:04 +0000 (00:23 +0000)]
Per offline discussion with Doug, don't perform typo correction when we have encountered a fatal error. On some files that are woefully wrong (missing headers) this can cause a 3x slowdown in some cases when parsing the file. It makes sense not to perform typo correction in this case because after a fatal error diagnostics will either be suppressed or not really make any sense.
John McCall [Tue, 5 Jan 2010 23:42:56 +0000 (23:42 +0000)]
Add Expr::EvaluateAsBooleanCondition(), which does unprincipled folding to
try to evaluate an expression as a constant boolean condition. This has
the same intended semantics as used in folding conditional operators.
Douglas Gregor [Tue, 5 Jan 2010 21:40:05 +0000 (21:40 +0000)]
Make use of available_externally linkage for vtables when the
non-inline key function of a class template instantiation, when no key
function is present, the class template instantiation itself was
instantiated with an explicit instantiation declaration (aka extern
template). I'm fairly certain that the C++0x specification gives us
this lattitude, although GCC doesn't take advantage of it.
Douglas Gregor [Tue, 5 Jan 2010 19:06:31 +0000 (19:06 +0000)]
Improve key-function computation for templates. In particular:
- All classes can have a key function; templates don't change that.
non-template classes when computing the key function.
- We always mark all of the virtual member functions of class
template instantiations.
- The vtable for an instantiation of a class template has weak
linkage.
We could probably use available_externally linkage for vtables of
classes instantiated by explicit instantiation declarations (extern
templates), but GCC doesn't do this and I'm not 100% that the ABI
permits it.
Steve Naroff [Tue, 5 Jan 2010 17:33:23 +0000 (17:33 +0000)]
Fix <rdar://problem/7490212> clang rewriter: return of the mixed line endings, which is
related to <rdar://problem/6596843> clang ObjC rewriter: Line endings still mixed in rewrite output
This fix was dropped when I integrated the 'objective-rewrite' branch.
Ted Kremenek [Tue, 5 Jan 2010 02:18:06 +0000 (02:18 +0000)]
Make static analysis support for C++ 'this' expression context-sensitive. Essentially treat 'this' as a implicit parameter to the method call, and associate a region with it.
Ted Kremenek [Tue, 5 Jan 2010 00:15:18 +0000 (00:15 +0000)]
Remove references to 'Checker' and 'GRTransferFuncs' from
GRStateManager. Having these references was an abstraction violation,
as they really should only be known about GRExprEngine.
This change required adding a new 'ProcessAssume' callback in
GRSubEngine. GRExprEngine implements this callback by calling
'EvalAssume' on all registered Checker objects as well as the
registered GRTransferFunc object.
John McCall [Mon, 4 Jan 2010 23:31:57 +0000 (23:31 +0000)]
Move the -Wconversion logic into SemaChecking.cpp. There's a fair amount of
overlap between this and -Wsign-compare, which is why I want them in the same
place.
Mike Stump [Mon, 4 Jan 2010 23:01:10 +0000 (23:01 +0000)]
Avoid warnings for functions that return a value using MS-style inline
assembly code. This avoids changing the bahvior when normal asm("")
statements are used.
The type of code affected would be:
void* t4(void) { __asm mov eax, fs:[0x10] }
I hope people like this version, if not, let me know.
John McCall [Mon, 4 Jan 2010 22:35:07 +0000 (22:35 +0000)]
-Wsign-compare shouldn't warn when the signed operand is a conditional operator
whose operands are non-negative integer constant expressions. This comes up
in LLVM in a few places.
Douglas Gregor [Mon, 4 Jan 2010 19:18:44 +0000 (19:18 +0000)]
Teach Preprocessor::macro_begin/macro_end to lazily load all macro
definitions from a precompiled header. This ensures that
code-completion with macro names behaves the same with or without
precompiled headers.
Douglas Gregor [Sun, 3 Jan 2010 18:01:57 +0000 (18:01 +0000)]
Implement typo correction for a variety of Objective-C-specific
constructs:
- Instance variable lookup ("foo->ivar" and, in instance methods, "ivar")
- Property name lookup ("foo.prop")
- Superclasses
- Various places where a class name is required
- Protocol names (e.g., id<proto>)
This seems to cover many of the common places where typos could occur.
Douglas Gregor [Fri, 1 Jan 2010 00:15:04 +0000 (00:15 +0000)]
When typo correction for an id-expression finds a type (or Objective-C
class), provide a suggestion for the type or class found. However,
since we can't recover properly in this case, don't provide a fix-it
hint. Example:
test/FixIt/typo.m:8:3: error: use of undeclared identifier 'NSstring';
did you
mean 'NSString'?
NSstring *str = @"A string";
...
^
1 diagnostic generated.
Douglas Gregor [Fri, 1 Jan 2010 00:03:05 +0000 (00:03 +0000)]
Typo correction for C99 designated field initializers, e.g.,
test/FixIt/typo.c:19:4: error: field designator 'bunds' does not refer to any
field in type 'struct Window'; did you mean 'bounds'?
.bunds.
^~~~~
bounds
Anders Carlsson [Thu, 31 Dec 2009 17:44:32 +0000 (17:44 +0000)]
Remove rtti.cpp, it's very fragile and has been marked XFAIL for a while now. Between rtti-layout.cpp and rtti-linkage.cpp, RTTI testing should be covered.