John McCall [Mon, 12 Oct 2009 21:59:07 +0000 (21:59 +0000)]
Implement -Wparentheses: warn about using assignments in contexts that require
conditions. Add a fixit to insert the parentheses. Also fix a very minor
possible memory leak in 'for' conditions.
Ted Kremenek [Mon, 12 Oct 2009 20:55:07 +0000 (20:55 +0000)]
Use a BumpPtrAllocator to allocate all aspects of CFG, including CFGBlocks, successor and predecessor vectors, etc.
Speedup: when doing 'clang-cc -analyze -dump-cfg' (without actual printing, just
CFG building) on the amalgamated SQLite source (all of SQLite in one source
file), runtime reduced by 9%.
Douglas Gregor [Mon, 12 Oct 2009 20:18:28 +0000 (20:18 +0000)]
Diagnose the declaration of explicit specializations after an implicit
instantiation has already been required. To do so, keep track of the
point of instantiation for anything that can be instantiated.
If built-in operators could not be selected because of ambiguity in
user-defined type conversions, issue list of ambiguites in addition
to the diagnostic. So, clang now issues the following:
b.cpp:19:19: error: left hand operand to ->* must be a pointer to class compatible with the right hand operand, but is 'struct C1'
int i = c1->*pmf;
~~^
b.cpp:19:19: note: because of ambiguity in conversion of 'struct C1' to 'struct E *'
b.cpp:5:5: note: candidate function
operator E*();
^
b.cpp:11:5: note: candidate function
operator E*();
^
Axel Naumann [Mon, 12 Oct 2009 16:42:18 +0000 (16:42 +0000)]
Don't install Makefiles nor tablegen input in include/.
Fix exclusion of .tmp, which in turn enables installation of $(PROJ_OBJ_ROOT)/tools/clang/include/*.inc.
Benjamin Kramer [Sun, 11 Oct 2009 12:22:00 +0000 (12:22 +0000)]
CMake mingw build fixes.
- llvm's libs must be linked after clang's
- libLLVMSystem depends on psapi on win32 (get_system_libs has it)
- CIndex builds successfully on mingw now
Zhongxing Xu [Sun, 11 Oct 2009 08:08:02 +0000 (08:08 +0000)]
Introduces a new BindingVal which combines direct and
default binding for regions. This allows us to simply a lot of code. A
further simplification could be done is that many methods of
regionstore can only work on Store instead of GRState.
Sebastian Redl [Sat, 10 Oct 2009 12:04:10 +0000 (12:04 +0000)]
Implement the core checking for compatible exception specifications in assignment and initialization.
The exception specification of the assignee must be the same or a subset of the target. In addition, exception specifications on arguments and return types must be equivalent, but this is not implemented yet.
This currently produces two diagnostics for every invalid assignment/initialization, due to the diagnostic produced outside PerformImplicitConversion, e.g. in CheckSingleInitializer. I don't know how to suppress this; in any case I think it is the wrong place for a diagnostic, since there are other diagnostics produced inside the function. So I'm leaving it as it is for the moment.
John McCall [Sat, 10 Oct 2009 05:48:19 +0000 (05:48 +0000)]
Qualified lookup through using declarations. Diagnose a new type of ambiguity.
Split the various ambiguous result enumerators into their own enum. Tests
for most of C++ [namespace.qual].
Anders Carlsson [Fri, 9 Oct 2009 23:51:55 +0000 (23:51 +0000)]
Add CheckCallReturnType and start using it for regular call expressions. This will improve error messages. For
struct B;
B f();
void g() {
f();
}
We now get
t.cpp:6:3: error: calling 'f' with incomplete return type 'struct B'
f();
^~~
t.cpp:3:3: note: 'f' declared here
B f();
^
t.cpp:1:8: note: forward declaration of 'struct B'
struct B;
^
Douglas Gregor [Fri, 9 Oct 2009 22:16:47 +0000 (22:16 +0000)]
Minor tweaks for code-completion:
- Filter out unnamed declarations
- Filter out declarations whose names are reserved for the
implementation (e.g., __bar, _Foo)
- Place OVERLOAD: or COMPLETION: at the beginning of each
code-completion result, so we can easily separate them from other
compilation results.
John McCall [Fri, 9 Oct 2009 21:13:30 +0000 (21:13 +0000)]
Refactor the LookupResult API to simplify most common operations. Require users to
pass a LookupResult reference to lookup routines. Call out uses which assume a single
result.
Douglas Gregor [Fri, 9 Oct 2009 21:11:42 +0000 (21:11 +0000)]
When declaring a friend class template, we may end up finding an
injected-class-name (e.g., when we're referring to other
specializations of the current class template). Make sure that we see
the template rather than the injected-class-name. Fixes PR4768.
Produce good looking diagnostics on ambiguous built-in operators.
Now we produce things like:
bug1.cpp:21:11: error: use of overloaded operator '->*' is ambiguous
int i = c->*pmf; // expected-error {{use of overloaded operator '->*' is ambiguous}} \
~^ ~~~
bug1.cpp:21:11: note: built-in candidate operator ->* ('struct A volatile *', 'int const struct A::*')
bug1.cpp:21:11: note: built-in candidate operator ->* ('struct A volatile *', 'int restrict struct A::*')
...
Still need to look at an issue (indicated as FIXME in the test case).
Steve Naroff [Thu, 8 Oct 2009 23:45:10 +0000 (23:45 +0000)]
- Fixup SortCodeCompleteResult() to properly sort keywords on Mac OS (compare was system dependent). Worked on Linux, failed on Mac OS (which caused the recently added testcase to fail on Linux).
- Sort results in testcase.
Mike Stump [Thu, 8 Oct 2009 23:00:00 +0000 (23:00 +0000)]
"Someone pointed out that in my previous Targets.cpp patch I didn't
handle the long size difference for one of the Windows targets." Patch
by John Thompson.
Mike Stump [Thu, 8 Oct 2009 22:55:36 +0000 (22:55 +0000)]
This fixes support for complex literals, reworked to avoid a goto, and
to add a flag noting the presence of a Microsoft extension suffix (i8,
i16, i32, i64). Patch by John Thompson.
Mike Stump [Thu, 8 Oct 2009 21:57:41 +0000 (21:57 +0000)]
In VC++, the *printf functions put an extra "0" in the exponent part
of a floating point number. This add regular expressions to account
for this. Patch by John Thompson.
Douglas Gregor [Thu, 8 Oct 2009 15:54:21 +0000 (15:54 +0000)]
Don't complain about out-of-line explicit specializations of member
function and member function templates that are not definitions. Add
more tests to ensure that explicit specializations of member function
templates prevent instantiation.
Douglas Gregor [Thu, 8 Oct 2009 15:14:33 +0000 (15:14 +0000)]
Improve checking for specializations of member classes of class
templates, and keep track of how those member classes were
instantiated or specialized.
Make sure that we don't try to instantiate an explicitly-specialized
member class of a class template, when that explicit specialization
was a declaration rather than a definition.
Douglas Gregor [Thu, 8 Oct 2009 07:24:58 +0000 (07:24 +0000)]
For instantiations of static data members of class templates, keep
track of the kind of specialization or instantiation. Also, check the
scope of the specialization and ensure that a specialization
declaration without an initializer is not a definition.
Douglas Gregor [Thu, 8 Oct 2009 00:14:38 +0000 (00:14 +0000)]
Only perform an implicit instantiation of a function if its template
specialization kind is TSK_ImplicitInstantiation. Previously, we would
end up implicitly instantiating functions that had explicit
specialization declarations or explicit instantiation declarations
(with no corresponding definitions).
Douglas Gregor [Wed, 7 Oct 2009 23:56:10 +0000 (23:56 +0000)]
Keep track of whether a member function instantiated from a member
function of a class template was implicitly instantiated, explicitly
instantiated (declaration or definition), or explicitly
specialized. The same MemberSpecializationInfo structure will be used
for static data members and member classes as well.
John McCall [Wed, 7 Oct 2009 23:34:25 +0000 (23:34 +0000)]
Refactoring around friend class templates. Better error message for friend enums.
Don't create a new declaration for friend classes if a declaration already exists.
Douglas Gregor [Wed, 7 Oct 2009 22:35:40 +0000 (22:35 +0000)]
Type checking for specializations of member functions of class
templates. Previously, these weren't handled as specializations at
all. The AST for representing these as specializations is still a work
in progress.
Fixes problem in finding visible convertion functions of a class
where matching conversion types in base classes were still visible.
Plus refactoring and cleanup.
Added a test case.