John McCall [Fri, 11 Jun 2010 10:04:22 +0000 (10:04 +0000)]
Conversions from Objective C object pointers to bool are "pointer conversions
to bool" in the sense of C++ [over.ics.rank]p4 bullet 1. I have decreed it.
Jeffrey Yasskin [Fri, 11 Jun 2010 06:58:43 +0000 (06:58 +0000)]
Fix the 64-bit build. operator<<(DiagnosticBuilder, long) doesn't exist, so
ptrdiff_t (long on 64-bit, apparently) is ambiguous between the int and
unsigned int overloads.
Jeffrey Yasskin [Fri, 11 Jun 2010 05:57:47 +0000 (05:57 +0000)]
Add an option -fshow-overloads=best|all to limit the number of overload
candidates printed. We default to 'all'. At the moment, 'best' prints only
the first 4 overloads, but we'll improve that over time.
Tom Care [Fri, 11 Jun 2010 04:22:02 +0000 (04:22 +0000)]
Small fixes regarding printf fix suggestions.
- Added some handling of flags that become invalid when changing the conversion specifier.
- Changed fixit behavior to remove unnecessary length modifiers.
- Separated some tests out and added some comments.
Charles Davis [Fri, 11 Jun 2010 03:07:32 +0000 (03:07 +0000)]
Start implementing the Microsoft-style name mangler. Mangle simple names
(but not their types; that's later).
NOTE: Right now, variables in the global namespace don't get mangled, even
though they're supposed to be. This is because the default mangler
implements the shouldMangleDeclName() method that tells clang not to mangle
them. This will be fixed in a later patch.
John McCall [Fri, 11 Jun 2010 00:33:02 +0000 (00:33 +0000)]
Split DependentNameType into two types. DependentNameType represents the
case of an elaborated-type-specifier like 'typename A<T>::foo', and
DependentTemplateSpecializationType represents the case of an
elaborated-type-specifier like 'typename A<T>::template B<T>'. The TypeLoc
representation of a DependentTST conveniently exactly matches that of an
ElaboratedType wrapping a TST.
Kill off the explicit rebuild methods for RebuildInCurrentInstantiation;
the standard implementations work fine because the nested name specifier
is computable in the newly-entered context.
Chandler Carruth [Thu, 10 Jun 2010 10:31:57 +0000 (10:31 +0000)]
Another chunk of the new RecursiveASTVisitor implementation: switch the return
value semantics such that we recurse while the visitors return true, and halt
as soon as one returns false. Patch by csilvers.
Daniel Dunbar [Wed, 9 Jun 2010 22:44:34 +0000 (22:44 +0000)]
Driver: Change Option parsing to always create arguments referring to unaliased
options.
- This matches the intent of the .td files, and will simplify alias handling.
- PR7321.
Daniel Dunbar [Wed, 9 Jun 2010 19:19:01 +0000 (19:19 +0000)]
Driver: Change Option parsing to always create arguments referring to unaliased
options.
- This matches the intent of the .td files, and will simplify alias handling.
- PR7321.
Major redesign of the RecursiveASTVisitor. This implements the majority of the
new design discussed on cfe-dev, with further steps in that direction to come.
It is already much more complete than the previous visitor.
Patch by Zhanyong and Craig with 80 column wraps and one missing declaration
added by me.
John McCall [Wed, 9 Jun 2010 07:26:17 +0000 (07:26 +0000)]
Correctly handle > 257 substitutions in a single mangling, and don't introduce
a spurious substitution for an unscoped dependent template-id after introducing
a substitution for the scoped template-id.
Douglas Gregor [Wed, 9 Jun 2010 05:25:34 +0000 (05:25 +0000)]
Fix a typo that breaks the GCC build. Turns out that Clang isn't
diagnosing this code as an error when it should, so I've filed
http://llvm.org/bugs/show_bug.cgi?id=7325.
Tom Care [Wed, 9 Jun 2010 04:11:11 +0000 (04:11 +0000)]
Added FixIt support to printf format string checking.
- Refactored LengthModifier to be a class.
- Added toString methods in all member classes of FormatSpecifier.
- FixIt suggestions keep user specified flags unless incorrect.
Limitations:
- The suggestions are not conversion specifier sensitive. For example, if we have a 'pad with zeroes' flag, and the correction is a string conversion specifier, we do not remove the flag. Clang will warn us on the next compilation.
A test/Sema/format-strings-fixit.c
M include/clang/Analysis/Analyses/PrintfFormatString.h
M lib/Analysis/PrintfFormatString.cpp
M lib/Sema/SemaChecking.cpp
Douglas Gregor [Wed, 9 Jun 2010 03:53:18 +0000 (03:53 +0000)]
Tweak our handling of the notion of a standard conversion sequence
being a subsequence of another standard conversion sequence. Instead
of requiring exact type equality for the second conversion step,
require type *similarity*, which is type equality with cv-qualifiers
removed at all levels. This appears to match the behavior of EDG and
VC++ (albeit not GCC), and feels more intuitive. Big thanks to John
for the line of reasoning that supports this change: since
cv-qualifiers are orthogonal to the second conversion step, we should
ignore them in the type comparison.
Tom Care [Wed, 9 Jun 2010 00:15:39 +0000 (00:15 +0000)]
Added helper function to Type class to determine if a type is a builtin type. This complements the existing function that determines if a type is a specific builtin type.
Ted Kremenek [Tue, 8 Jun 2010 23:00:58 +0000 (23:00 +0000)]
Fix memory leak in ASTContext where ASTRecordLayout objects involving C++ structures wouldn't have
their associated memory destroyed when using a BumpPtrAllocator. These objects internally use
a DenseMap.
Anders Carlsson [Tue, 8 Jun 2010 22:30:17 +0000 (22:30 +0000)]
Rename __tcf_ to __cxx_global_array_dtor. Remove the UniqueAggreDestructorCount from CodeGenFunction and let LLVM handle uniquing the internal functions instead.
Douglas Gregor [Tue, 8 Jun 2010 21:27:36 +0000 (21:27 +0000)]
When referring to a tag that was previously declared only as a friend,
build a new declaration for that tag type that will be visible for
future lookups of that tag.
Douglas Gregor [Tue, 8 Jun 2010 21:03:17 +0000 (21:03 +0000)]
A built-in overload candidate is consider a non-template function when
determining whether one overload candidate is better than
another. Fixes PR7319.
Daniel Dunbar [Tue, 8 Jun 2010 20:34:18 +0000 (20:34 +0000)]
Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.
- This eliminates most dependencies on how Clang is installed relative to LLVM.
Douglas Gregor [Tue, 8 Jun 2010 19:23:49 +0000 (19:23 +0000)]
Teach the PrintFunctionNames example to be a proper module, so that
Clang can load it as a plugin. Original fix by Troy D. Straszheim,
which I extended with Darwin support. Fixes PR6801.
Anders Carlsson [Tue, 8 Jun 2010 16:20:35 +0000 (16:20 +0000)]
When checking whether we can place a base subobject at an offset, we don't need to go past the highest offset that's known to contain an empty base subobject.
Nate Begeman [Tue, 8 Jun 2010 02:47:44 +0000 (02:47 +0000)]
Since the enum values for each arch's builtins overlap, it is not appropriate to check them when compiling or other archs. Fixes a problem where compiling for NEON would use x86 sema rules.
Nate Begeman [Tue, 8 Jun 2010 00:16:34 +0000 (00:16 +0000)]
Extend __builtin_shufflevector to expose the full power of the llvm shufflevector instruction. This means it can now be used for vector truncation and concatenation. This will be used for the ARM NEON implementation.
Daniel Dunbar [Mon, 7 Jun 2010 23:28:45 +0000 (23:28 +0000)]
Driver: Support invoking Clang on .ll or .bc inputs.
- We actually pretend that we have two separate types for LLVM assembly/bitcode because we need to use the standard suffixes with LTO ('clang -O4 -c t.c' should generate 't.o').
It is now possible to do something like:
$ clang -emit-llvm -S t.c -o t.ll ... assorted other compile flags ...
$ clang -c t.ll -o t.o ... assorted other compile flags ...
and expect that the output will be almost* identical to:
$ clang -c t.c -o t.o ... assorted other compile flags ...
because all the target settings (default CPU, target features, etc.) will all be initialized properly by the driver/frontend.
*: This isn't perfect yet, because in practice we will end up running the optimization passes twice. It's possible to get something equivalent out with a well placed -mllvm -disable-llvm-optzns, but I'm still thinking about the cleanest way to solve this problem more generally.
Daniel Dunbar [Mon, 7 Jun 2010 23:27:59 +0000 (23:27 +0000)]
Frontend: Add CodeGenAction support for handling LLVM IR.\r - This magically enables using 'clang -cc1' as a replacement for most of 'llvm-as', 'llvm-dis', 'llc' and 'opt' functionality.\r\rFor example, 'llvm-as' is:\r $ clang -cc1 -emit-llvm-bc FOO.ll -o FOO.bc
and 'llvm-dis' is:\r $ clang -cc1 -emit-llvm FOO.bc -o -
and 'opt' is, e.g.:
$ clang -cc1 -emit-llvm -O3 -o FOO.opt.ll FOO.ll
and 'llc' is, e.g.:
$ clang -cc1 -S -o - FOO.ll
The nice thing about using the backend tools this way is that they are guaranteed to exactly match how the compiler generates code (for example, setting the same backend options).
Daniel Dunbar [Mon, 7 Jun 2010 23:26:47 +0000 (23:26 +0000)]
Frontend: Add FrontendAction support for handling LLVM IR inputs.
- These inputs follow an abbreviated execution path, but are still worth handling by FrontendAction so they reuse all the other clang -cc1 features.