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.
When using property-dot assignment syntax to call a setter method,
type of rhs need be compared to setter's argument and
not the getter type. Fixes radar 8062778
Fixed a block regression caused by trying to use
an existing ir for load of a bock variable. This cannot be
done across basic blocks.
Fixes radar 8064140.
John McCall [Sat, 5 Jun 2010 06:41:15 +0000 (06:41 +0000)]
Simplify the methods for creating a pointer, reference, member-pointer,
or block-pointer type by removing the qualifiers parameter. Introduce a
method to perform semantic checking when adding qualifiers to a type.
Jeffrey Yasskin [Sat, 5 Jun 2010 01:39:57 +0000 (01:39 +0000)]
Add an extension to avoid an error when a global template has the same name as
a member template, and you try to call the member template with an explicit
template argument. See PR7247
For example, this downgrades the error to a warning in:
John McCall [Fri, 4 Jun 2010 19:02:56 +0000 (19:02 +0000)]
Preserve more information from a block's original function declarator, if one
was given. Remove some unnecessary accounting from BlockScopeInfo. Handle
typedef'ed function types until such time as we decide not.
Daniel Dunbar [Fri, 4 Jun 2010 18:28:41 +0000 (18:28 +0000)]
Driver/Darwin: Model dsymutil properly, as a separate action/tool kind which is
added as the last output step, instead of just hacking it into the link step.
- Among other things, this fixes dSYM generation when using multiple -arch options.
For C++ copied in objects, use copy constructors in
setting up block's descriptor. This is on going work to
support c++ specific issues in setting up blocks
various APIs.
John McCall [Fri, 4 Jun 2010 11:21:44 +0000 (11:21 +0000)]
Restructure how we interpret block-literal declarators. Correctly handle
the case where we pick up block arguments from a typedef. Save the block
signature as it was written, and preserve same through PCH.
John McCall [Fri, 4 Jun 2010 08:34:12 +0000 (08:34 +0000)]
Delay checking for mutable const fields until we're checking the field.
Allows this check to work properly for instantiated fields and removes
an unnecessary GetTypeForDeclarator call.
Anders Carlsson [Fri, 4 Jun 2010 00:54:04 +0000 (00:54 +0000)]
Use CXXRecordDecl::getFinalOverriders to get final overriders. This speeds up vtable layout by moving away from the old final overrider computation code that had O(N^2) complexity in some cases.