Daniel Jasper [Wed, 28 Aug 2013 09:07:32 +0000 (09:07 +0000)]
clang-format: Fix infinite loop in macro special case.
If escaped newlines are aligned right
(FormatStyle.AlignEscapedNewlinesLeft == false), and a line contained
too many characters to fit into the column limit, this would result in
a (virtually) endless loop creating a negative number of spaces.
Instead, allow the escaped newlines to be pushed past the column limit
in this case.
Daniel Jasper [Wed, 28 Aug 2013 08:04:23 +0000 (08:04 +0000)]
clang-format: Fix corner case in ObjC interface definitions.
In
@implementation ObjcClass
- (void)method;
{
}
@end
the ObjC compiler seems to accept the superfluous comma after "method",
but clang-format used to assert on the subsequent "{".
Pavel Labath [Wed, 28 Aug 2013 08:04:08 +0000 (08:04 +0000)]
[analyzer] Assume new returns non-null even under -fno-exceptions
Summary:
-fno-exceptions does not implicitly attach a nothrow specifier to every operator
new. Even in this mode, non-nothrow new must not return a null pointer. Failure
to allocate memory can be signalled by other means, or just by killing the
program. This behaviour is consistent with the compiler - even with
-fno-exceptions, the generated code never tests for null (and would segfault if
the opeator actually happened to return null).
Hal Finkel [Wed, 28 Aug 2013 05:21:45 +0000 (05:21 +0000)]
Revert r189440 - Disable loop vectorizer unrolling when no unrolling requested
As Chandler pointed out, we should not be using -backend-option because this
will cause crashes for users of the tooling interface, etc. A better way to fix
this will be to provide the unrolling pass-manager flag to the loop vectorizer
directly.
Original commit message:
Disable loop vectorizer unrolling when no unrolling requested
In addition to the regular loop unrolling transformation, the loop vectorizer
can also unroll loops. If no unrolling has specifically been requested (by
-fno-unroll-loops), and the loop vectorizer will be used, then add the backend
option to (also) prevent the loop vectorizer from unrolling loops.
I confirmed with Nadav (off list) that disabling vectorizer loop unrolling when
-fno-unroll-loops is provided is the desired behavior.
Hal Finkel [Wed, 28 Aug 2013 04:40:22 +0000 (04:40 +0000)]
Disable loop vectorizer unrolling when no unrolling requested
In addition to the regular loop unrolling transformation, the loop vectorizer
can also unroll loops. If no unrolling has specifically been requested (by
-fno-unroll-loops), and the loop vectorizer will be used, then add the backend
option to (also) prevent the loop vectorizer from unrolling loops.
I confirmed with Nadav (off list) that disabling vectorizer loop unrolling when
-fno-unroll-loops is provided is the desired behavior.
Craig Topper [Wed, 28 Aug 2013 04:02:50 +0000 (04:02 +0000)]
Merge diagnostic group tables to reduce data size and relocation entries.
The individual group and subgroups tables are now two large tables. The option table stores an index into these two tables instead of pointers. This reduces the size of the options tabe since it doesn't need to store pointers. It also reduces the number of relocations needed.
My build shows this reducing DiagnosticsIDs.o and the clang binary by ~20.5K. It also removes ~400 relocation entries from DiagnosticIDs.o.
David Blaikie [Tue, 27 Aug 2013 23:57:18 +0000 (23:57 +0000)]
Revert "PR14569: Omit debug info for thunks"
This reverts commit r189320.
Alexey Samsonov and Dmitry Vyukov presented some arguments for keeping
these around - though it still seems like those tasks could be solved by
a tool just using the symbol table. In a very small number of cases,
thunks may be inlined & debug info might be able to save profilers &
similar tools from misclassifying those cases as part of the caller.
The extra changes here plumb through the VarDecl for various cases to
CodeGenFunction - this provides better fidelity through a few APIs but
generally just causes the CGF::StartFunction to fallback to using the
name of the IR function as the name in the debug info.
The changes to debug-info-global-ctor-dtor.cpp seem like goodness. The
two names that go missing (in favor of only emitting those names as
linkage names) are names that can be demangled - emitting them only as
the linkage name should encourage tools to do just that.
Again, thanks to Dinesh Dwivedi for investigation/work on this issue.
Reid Kleckner [Tue, 27 Aug 2013 23:08:25 +0000 (23:08 +0000)]
Delete CC_Default and use the target default CC everywhere
Summary:
Makes functions with implicit calling convention compatible with
function types with a matching explicit calling convention. This fixes
things like calls to qsort(), which has an explicit __cdecl attribute on
the comparator in Windows headers.
Clang will now infer the calling convention from the declarator. There
are two cases when the CC must be adjusted during redeclaration:
1. When defining a non-inline static method.
2. When redeclaring a function with an implicit or mismatched
convention.
Fixes PR13457, and allows clang to compile CommandLine.cpp for the
Microsoft C++ ABI.
Excellent test cases provided by Alexander Zinenko!
ObjectiveC migrator: Do not add explicit cf annotation for
cf functions which are CF_IMPLICIT_BRIDGING_ENABLED.
Add cf annotation to those not CF_IMPLICIT_BRIDGING_ENABLED
to reduce bridge casts.
Roman Divacky [Tue, 27 Aug 2013 19:27:35 +0000 (19:27 +0000)]
Make the information about disabled ARCMT/Rewriter/StaticAnalyzer available
to lit and use this info to disable Analysis/FixIt/Rewriter/Analysis tests
when those are not compiled into clang.
Samuel Benzaquen [Tue, 27 Aug 2013 16:04:53 +0000 (16:04 +0000)]
Add support for eachOf/allOf/anyOf variadic matchers in the dynamic layer.
Summary:
Add support for eachOf/allOf/anyOf variadic matchers in the dynamic layer.
These function require some late binding behavior for the type conversions, thus changes in VariadicValue's MatcherList.
Edwin Vane [Tue, 27 Aug 2013 15:44:26 +0000 (15:44 +0000)]
Adding a vector version of clang::tooling::shiftedCodePosition().
During the transition of clang::tooling::Replacements from std::set to
std::vector, functions such as clang::tooling::applyAllReplacements() have been
duplicated to take a std::vector<Replacement>. Applying this same temporary
duplication to clang::tooling::shiftedCodePosition().
Samuel Benzaquen [Tue, 27 Aug 2013 15:11:16 +0000 (15:11 +0000)]
Rewrite eachOf/allOf/anyOf to use a variadic operator.
Summary:
Rewrite eachOf/allOf/anyOf to use a variadic operator, instead of hand-written calls to Polymorphic matchers.
This simplifies their definition and future changes to add them to the dynamic registry.
Serge Pavlov [Tue, 27 Aug 2013 13:15:56 +0000 (13:15 +0000)]
Cleanup of OpaquePtr. No functionality changes.
- Some documenation were added.
- Usages of OpaquePtr<A>.getAsVal<A>() were replaced by OpaquePtr<A>.get().
- Methods getAs and getAsVal were renamed to getPtrTo and getPtrAs respectively.
David Blaikie [Tue, 27 Aug 2013 05:21:11 +0000 (05:21 +0000)]
PR14569: Omit debug info for thunks
This was added in r166676 based on PR13942 on the basis that tools may
need debug information for any executable code/function for some fairly
broad/non-specific purposes. It seems to me (as noted in PR14569) that
the major/only purpose is in backtraces, which should generally not
apply to thunks as they won't appear in the stack themselves. By
removing them we fix PR14569 and reduce the size of Clang's debug info.
Strangely enough this doesn't seem to have a substantial impact on
Clang's self-hosted debug info (at least looking at DWO file size) size
at all. Not sure if I failed to test this correctly but I only observed
a 0.004% change in DWO file size over Clang+LLVM.
With thanks to Dinesh Dwivedi for work on this PR.
Rafael Espindola [Mon, 26 Aug 2013 23:23:21 +0000 (23:23 +0000)]
Simplify a bit.
This follows from computeKeyFunction having:
// Template instantiations don't have key functions,see Itanium C++ ABI 5.2.6.
// Same behavior as GCC.
TemplateSpecializationKind TSK = RD->getTemplateSpecializationKind();
if (TSK == TSK_ImplicitInstantiation ||
TSK == TSK_ExplicitInstantiationDefinition)
return 0;
Aaron Ballman [Mon, 26 Aug 2013 22:49:09 +0000 (22:49 +0000)]
Since r179585, __declspec(property) has gotten special treatment as an attribute where it is not processed as part of the typical Sema attribute functionality. Specifying this attribute as being "ignored" because there is no sema handler for it as a Decl attribute, and no AST node generated for it.
Consumed analyis: Renamed *PStatus to *PInfo.
The change was made for readability, as the PropagationInfo objects don't
always contain a status. This is submitted as a separate patch because it
touches a lot of lines and I don't want it cluttering up the next patch.
Patch by chris.wailes@gmail.com.
David Blaikie [Mon, 26 Aug 2013 20:33:21 +0000 (20:33 +0000)]
Simplify/clean up debug info suppression in CodeGenFunction
CodeGenFunction is run on only one function - a new object is made for
each new function. I would add an assertion/flag to this effect, but
there's an exception: ObjC properties involve emitting helper functions
that are all emitted by the same CodeGenFunction object, so such a check
is not possible/correct.
Benjamin Kramer [Sun, 25 Aug 2013 22:46:27 +0000 (22:46 +0000)]
CodeGen: Unify two implementations of canDevirtualizeMemberFunctionCall.
They were mostly copy&paste of each other, move it to CodeGenFunction. Of course
the two implementations have diverged over time; the one in CGExprCXX seems to
be the more modern one so I picked that one and moved it to CGClass which feels
like a better home for it. No intended functionality change.
David Majnemer [Sun, 25 Aug 2013 22:13:27 +0000 (22:13 +0000)]
DebugInfo: Emit info for casted decls in template args
Summary:
Previously the backend wouldn't get to see the underlying GlobalValue
that corresponds to the template argument because it would be hidden by
a cast at the IR level. Instead strip the pointer casts off of the
value until we see the underlying GlobalValue.
Renato Golin [Sat, 24 Aug 2013 14:44:41 +0000 (14:44 +0000)]
Add gcc ARM flags -munaligned-access / -mno-unaligned-access
clang already had a mstrict-align which mentiones "Force all memory
accesses to be aligned (ARM only)". On gcc arm this is controlled by
-munaligned-access / -mno-unaligned-access. Add the gcc versions to
the frontend and make -mstrict-align and alias to -mno-unaligned-access
and only show it in clang -cc1 -help.
Since the default value for unaligned accesses / strict alignment
depends on the tripple, both the enable and disable flags are added.
If both are set, the no-unaligned-access is used.
Renato Golin [Sat, 24 Aug 2013 14:44:35 +0000 (14:44 +0000)]
Add the -ffixed-r9 flag for ARM.
This patch adds the -ffixed-r9 flag to clang to instruct llvm to
globally preserve the contents of r9. The flag is added to the newly
created ARM specific group.
While at it, also place marm / mno-thumb in that group.
David Majnemer [Sat, 24 Aug 2013 08:21:10 +0000 (08:21 +0000)]
DebugInfo: Emit info for constant expressions in template arguments
Summary:
This allows us to handle the general case where a non-type template
argument evaluates to a constant expression which isn't integral or a
declaration.
Hans Wennborg [Fri, 23 Aug 2013 18:05:24 +0000 (18:05 +0000)]
CMake: Don't look for llvm-tblgen when building outside LLVM tree
Previously, the CMake build would look for llvm-tblgen to determine
if a directory is an LLVM build or install directory. Since we don't
want to include llvm-tblgen in the install, look for llvm-config instead,
and use that to find llvm-tblgen.
Dmitri Gribenko [Fri, 23 Aug 2013 18:03:40 +0000 (18:03 +0000)]
Comment parsing: fix a bug where a line with whitespace between two paragraphs
would cause us to concatenate these paragraphs into a single one.
The no-op whitespace churn in test/Index test happened because these tests
don't use the correct approach for testing and are more strict than required
for they are testing.
Jordan Rose [Fri, 23 Aug 2013 15:42:01 +0000 (15:42 +0000)]
Respect -Wnewline-eof even in C++11 mode.
If the user has requested this warning, we should emit it, even if it's not
an extension in the current language mode. However, being an extension is
more important, so prefer the pedantic warning or the pedantic-compatibility
warning if those are enabled.
Daniel Jasper [Fri, 23 Aug 2013 11:57:34 +0000 (11:57 +0000)]
clang-format: Fix corner case for string splitting ..
.. in conjunction with Style.AlwaysBreakBeforeMultilineStrings. Also,
simplify the implementation by handling newly split strings and already
split strings by the same code.
Daniel Jasper [Fri, 23 Aug 2013 10:05:49 +0000 (10:05 +0000)]
clang-format: Handle trailing commas in column layout of braced list.
Before, this was causing errors.
Also exit early in breakProtrudingToken() (before the expensive call to
SourceManager::getSpellingColumnNumber()). This makes formatting huge
(100k+-item) braced lists possible.
Summary:
Instead of digging through the ExplodedGraph, to figure out which edge brought
us here, I compute the value of conditional expression by looking at the
sub-expression values.
To do this, I needed to change the liveness algorithm a bit -- now, the full
conditional expression also depends on all atomic sub-expressions, not only the
outermost ones.
David Majnemer [Fri, 23 Aug 2013 05:39:39 +0000 (05:39 +0000)]
Sema: Properly support Microsoft-mode template arguments
Summary:
There were two things known to be wrong with our implementation of MSVC
mode template arguments:
- We didn't properly handle __uuidof/CXXUuidofExpr and skipped all type
checking completely.
- We didn't allow for MSVC's extension of allowing certain constant
"foldable" expressions from showing up in template arguments.
They allow various casts dereference and address-of operations.
We can make it more general as we find further peculiarities but this
is the known extent.