Douglas Gregor [Mon, 21 Dec 2009 20:18:30 +0000 (20:18 +0000)]
Improve on my previous fix for debug information. Rather than
recursing in CGDebugInfo::CreateTypeNode, teach
CanonicalizeTypeForDebugInfo---now called UnwrapTypeForDebugInfo---to
keep unwrapping the type until we hit something that can be
represented by debug information. Thanks to Anders for pointing this out!
Douglas Gregor [Mon, 21 Dec 2009 19:57:21 +0000 (19:57 +0000)]
Teach debug info generation to handle TemplateSpecializationType,
ElaboratedType, QualifiedNameType, and SubstTemplateTypeParmType type
nodes. Also, produce an "unsupported" diagnostic for C++0x type nodes
and "typeof" nodes, rather than asserting nondescriptly.
Eli Friedman [Mon, 21 Dec 2009 01:42:38 +0000 (01:42 +0000)]
Fix for PR5840: fix the kind of name lookup used for classes in
Sema::getTypeName.
"LookupNestedNameSpecifierName" isn't quite the right kind of lookup, though;
it doesn't ignore namespaces. Someone more familiar with the lookup code
should fix this properly.
Douglas Gregor [Sun, 20 Dec 2009 22:01:25 +0000 (22:01 +0000)]
Switch default-initialization of variables of class type (or array thereof) over to InitializationSequence. I could swear that this fixes a PR somewhere, but I couldn't figure out which one
John McCall [Sun, 20 Dec 2009 07:58:13 +0000 (07:58 +0000)]
Don't inject the class name until that magical lbrace.
Because of the rules of base-class lookup* and the restrictions on typedefs, it
was actually impossible for this to cause any problems more serious than the
spurious acceptance of
template <class T> class A : B<A> { ... };
instead of
template <class T> class A : B<A<T> > { ... };
but I'm sure we can all agree that that is a very important restriction which
is well worth making another Parser->Sema call for.
(*) n.b. clang++ does not implement these rules correctly; we are not ignoring
non-type names
John McCall [Sun, 20 Dec 2009 05:57:29 +0000 (05:57 +0000)]
Test the lookup I wasn't sure would be done properly after the last patch.
Clang reasonably adds all the base specifiers in one pass; this is now required
for correctness to prevent lookup from going mad. But this has the advantage of
establishing the correct context when looking up base specifiers, which will be
important for access control.
Daniel Dunbar [Sat, 19 Dec 2009 17:50:07 +0000 (17:50 +0000)]
Remove ';' after method definition. Noticed by clang++, which one would think
would have a higher respect for its own code. This is getting old, is this
warning really adding value?
John McCall [Sat, 19 Dec 2009 10:49:29 +0000 (10:49 +0000)]
Refactor to remove more dependencies on PreDeclaratorDC. I seem to have made
the redeclaration problems in the [temp.explicit]p3 testcase worse, but I can
live with that; they'll need to be fixed more holistically anyhow.
John McCall [Sat, 19 Dec 2009 09:28:58 +0000 (09:28 +0000)]
Just push a new scope when parsing an out-of-line variable definition.
Magically fixes all the terrible lookup problems associated with not pushing
a new scope. Resolves an ancient xfail and an LLVM misparse.
Eli Friedman [Sat, 19 Dec 2009 08:11:05 +0000 (08:11 +0000)]
Initialization improvements: addition of string initialization and a few
small bug fixes in SemaInit, switch over SemaDecl to use it more often, and
change a bunch of diagnostics which are different with the new initialization
code.
Daniel Dunbar [Sat, 19 Dec 2009 03:30:57 +0000 (03:30 +0000)]
Targets: Allow CreateTargetInfo to mutate the target features.
- In particular, it can claim features for itself instead of always passing them on to LLVM.
- This allows using the target features as a generic mechanism for passing target specific options to the TargetInfo instance, which may need them for initializing preprocessor defines, etc.
Douglas Gregor [Sat, 19 Dec 2009 03:01:41 +0000 (03:01 +0000)]
Switch more of Sema::CheckInitializerTypes over to
InitializationSequence. Specially, switch initialization of a C++
class type (either copy- or direct-initialization).
Also, make sure that we create an elidable copy-construction when
performing copy initialization of a C++ class variable. Fixes PR5826.
John McCall [Sat, 19 Dec 2009 02:05:44 +0000 (02:05 +0000)]
Unresolved implicit member accesses are dependent if the object type is dependent.
Avoids an assertion arising during object-argument initialization in overload
resolution. In theory we can resolve this at definition time if the class
hierarchy for the member is fully known.
John McCall [Sat, 19 Dec 2009 00:35:18 +0000 (00:35 +0000)]
Teach TryAnnotateTypeOrScopeToken to deal with already-annotated
scope specifiers. Fix a tentative parsing bug that came up in LLVM.
Incidentally fixes some random FIXMEs in an existing testcase.
Eli Friedman [Fri, 18 Dec 2009 23:47:41 +0000 (23:47 +0000)]
Work in progress for setting the vtable pointers for all bases correctly in
the constructor. This doesn't handle cases requiring the VTT at the moment,
and generates unnecessary stores, but I think it's essentially correct.
Ted Kremenek [Fri, 18 Dec 2009 20:13:39 +0000 (20:13 +0000)]
Enhance GRExprEngine::VisitCallExpr() to be used in an lvalue context. Uncovered a new failing test case along the way, but we're making progress on handling C++ references in the analyzer.
Daniel Dunbar [Fri, 18 Dec 2009 18:42:37 +0000 (18:42 +0000)]
ARM: Fix predefines (__ARM_ARCH_..., __REGISTER_PREFIX).
- This should be done leveraging the backend, but I'm a little refactored
out. I'll fix it one day, I promise.
Torok Edwin [Fri, 18 Dec 2009 17:29:14 +0000 (17:29 +0000)]
Move the 4.4.2 c++ include search to the top, otherwise it was picking the 4.1.3
dirs on my system. Which is wrong, since it was missing the x86_64-pc-linux-gnu
suffix.
Douglas Gregor [Fri, 18 Dec 2009 16:20:58 +0000 (16:20 +0000)]
Change clang_codeComplete API to return the results in a structure on
the heap, so that clients are not forced to copy the results during
the initial iteration. A separate clang_disposeCodeCompleteResults
function frees the returned results.
Ken Dyck [Fri, 18 Dec 2009 15:55:54 +0000 (15:55 +0000)]
Change the return type of ASTContext::getTypeSizeInChars() from uint64_t to the
new opaque value type, CharUnits. This will help us avoid accidentally mixing
quantities that are in bit and character units.
Ken Dyck [Fri, 18 Dec 2009 15:24:05 +0000 (15:24 +0000)]
Rename getByteSize() and getTypeSizeInBytes() in ASTContext to getCharWidth()
and getTypeSizeInChars() to reflect their basis in character type units, not
that of a possibly independent architecture-specific byte.
John McCall [Fri, 18 Dec 2009 10:48:10 +0000 (10:48 +0000)]
Look through using decls when checking whether a name is an acceptable
nested-name specifier name.
I accidentally checked in the test case for this in the last commit ---
fortunately, that refactor was inspired by having debugged this problem already,
so I can fix the bug quick (though probably not fast enough for the buildbots).
John McCall [Fri, 18 Dec 2009 10:40:03 +0000 (10:40 +0000)]
Pull Sema::isAcceptableLookupResult into SemaLookup. Extract the criteria into
different functions and pick the function at lookup initialization time.
In theory we could actually divide the criteria functions into N different
functions for the N cases, but it's so not worth it.
Among other things, lets us invoke LookupQualifiedName without recomputing
IDNS info every time.
Do some refactoring in SemaDecl to avoid an awkward special case in LQN
that was only necessary for redeclaration testing for anonymous structs/unions ---
which could be done more efficiently with a scoped lookup anyway.
Douglas Gregor [Fri, 18 Dec 2009 05:02:21 +0000 (05:02 +0000)]
Switch the initialization required by return statements over to the
new InitializationSequence. This fixes some bugs (e.g., PR5808),
changed some diagnostics, and caused more churn than expected. What's
new:
- InitializationSequence now has a "C conversion sequence" category
and step kind, which falls back to
- Changed the diagnostics for returns to always have the result type
of the function first and the type of the expression second.
CheckSingleAssignmentConstraints to peform checking in C.
- Improved ASTs for initialization of return values. The ASTs now
capture all of the temporaries we need to create, but
intentionally do not bind the tempoary that is actually returned,
so that it won't get destroyed twice.
- Make sure to perform an (elidable!) copy of the class object that
is returned from a class.
- Fix copy elision in CodeGen to properly see through the
subexpressions that occur with elidable copies.
- Give "new" its own entity kind; as with return values and thrown
objects, we don't bind the expression so we don't call a
destructor for it.
Note that, with this patch, I've broken returning move-only types in
C++0x. We'll fix it later, when we tackle NRVO.
Daniel Dunbar [Fri, 18 Dec 2009 02:43:17 +0000 (02:43 +0000)]
Add -dwarf-debug-flags, which provides a way to embed the cc1 level options used
to compile a translation unit into the debug info for that file.
- Used by parts of Darwin build process to check compiler flags, etc.
- <rdar://problem/7256886> clang does not emit AT_APPLE_flags
Sean Callanan [Fri, 18 Dec 2009 00:04:09 +0000 (00:04 +0000)]
Testcase fixes to reflect instruction table changes in the LLVM backend
(http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091214/092780.html)
The instruction fixes were checked and approved by Chris Lattner, but
these testcase fixes are mine; please yell at me if there are any
problems with either.
John McCall [Thu, 17 Dec 2009 23:21:11 +0000 (23:21 +0000)]
Patch over yet more problems with friend declarations which were provoking
problems on LLVM-Code-Syntax. This proved remarkably easy to "fix" once
I settled on how I was going to approach it.
Ted Kremenek [Thu, 17 Dec 2009 20:06:29 +0000 (20:06 +0000)]
Convert GRExprEngine::VisitCallExpr() to use a worklist instead of recursion to evaluate the arguments of a CallExpr. This simplifies the logic and makes it easier to read. (it also avoids any issues with blowing out the stack if the CallExpr had a ridiculous number of arguments)
Chris Lattner [Thu, 17 Dec 2009 05:29:40 +0000 (05:29 +0000)]
reimplement r90860, fixing a couple of problems:
1. Don't make a copy of LangOptions every time a lexer is created.
2. Don't make CharInfo global mutable state.
3. Fix the implementation to properly treat ^Z as EOF instead of as
horizontal whitespace, which matches the semantic implemented by VC++.