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.
Richard Smith [Thu, 22 Aug 2013 23:27:37 +0000 (23:27 +0000)]
Remove SequenceNumber from class/variable template partial specializations.
This was only used to ensure that the traversal order was the same as the
insertion order, but that guarantee was already being provided by the use
of a FoldingSetVector.
Patch by chris.wailes@gmail.com. The following functionality was added:
* The same functionality is now supported for both CXXOperatorCallExprs and CXXMemberCallExprs.
* Factored out some code in StmtVisitor.
* Removed variables from the state map when their destructors are encountered.
* Started adding documentation for the consumed analysis attributes.
Jordan Rose [Thu, 22 Aug 2013 15:50:02 +0000 (15:50 +0000)]
Fix dependencies now that the ARC migrator depends on the static analyzer.
Thanks for pointing this out, Stephen. I think this is right now -- I
attempted to try all four valid combinations with both the autoconf and
CMake builds.
David Blaikie [Thu, 22 Aug 2013 15:23:05 +0000 (15:23 +0000)]
DebugInfo: emit the definition of types when construction vtables are required as these types may never end up emitting the full class data
This might be able to be optimized further by only doing this in the
absence of a key function, but it doesn't look like GCC is doing that so
I'm not rushing to do it just yet.
Required other changes:
- FormatTokens can now have a special role that contains extra data and can do
special formattings. A comma separated list is currently the only
implementation.
- Move penalty calculation entirely into ContinuationIndenter (there was a last
piece still in UnwrappedLineFormatter).
Craig Topper [Thu, 22 Aug 2013 05:28:54 +0000 (05:28 +0000)]
Constify the ASTContext& passed to Stmt creation functions. Also constify the context in couple other functions that are called from creation functions.
Craig Topper [Thu, 22 Aug 2013 04:58:56 +0000 (04:58 +0000)]
Constify the ASTContext& passed to Expr creation functions. Also constify the context in couple other functions that are called from creation functions.
Faisal Vali [Thu, 22 Aug 2013 01:49:11 +0000 (01:49 +0000)]
Implement a rudimentary form of generic lambdas.
Specifically, the following features are not included in this commit:
- any sort of capturing within generic lambdas
- nested lambdas
- conversion operator for captureless lambdas
- ensuring all visitors are generic lambda aware
As an example of what compiles:
template <class F1, class F2>
struct overload : F1, F2 {
using F1::operator();
using F2::operator();
overload(F1 f1, F2 f2) : F1(f1), F2(f2) { }
};
auto Recursive = [](auto Self, auto h, auto ... rest) {
return 1 + Self(Self, rest...);
};
auto Base = [](auto Self, auto h) {
return 1;
};
overload<decltype(Base), decltype(Recursive)> O(Base, Recursive);
int num_params = O(O, 5, 3, "abc", 3.14, 'a');
Please see attached tests for more examples.
Some implementation notes:
- Add a new Declarator context => LambdaExprParameterContext to
clang::Declarator to allow the use of 'auto' in declaring generic
lambda parameters
- Augment AutoType's constructor (similar to how variadic
template-type-parameters ala TemplateTypeParmDecl are implemented) to
accept an IsParameterPack to encode a generic lambda parameter pack.
- Add various helpers to CXXRecordDecl to facilitate identifying
and querying a closure class
- LambdaScopeInfo (which maintains the current lambda's Sema state)
was augmented to house the current depth of the template being
parsed (id est the Parser calls Sema::RecordParsingTemplateParameterDepth)
so that Sema::ActOnLambdaAutoParameter may use it to create the
appropriate list of corresponding TemplateTypeParmDecl for each
auto parameter identified within the generic lambda (also stored
within the current LambdaScopeInfo). Additionally,
a TemplateParameterList data-member was added to hold the invented
TemplateParameterList AST node which will be much more useful
once we teach TreeTransform how to transform generic lambdas.
- SemaLambda.h was added to hold some common lambda utility
functions (this file is likely to grow ...)
- Teach Sema::ActOnStartOfFunctionDef to check whether it
is being called to instantiate a generic lambda's call
operator, and if so, push an appropriately prepared
LambdaScopeInfo object on the stack.
- Teach Sema::ActOnStartOfLambdaDefinition to set the
return type of a lambda without a trailing return type
to 'auto' in C++1y mode, and teach the return type
deduction machinery in SemaStmt.cpp to process either
C++11 and C++14 lambda's correctly depending on the flag.
- various tests were added - but much more will be needed.
A greatful thanks to all reviewers including Eli Friedman,
James Dennett and the ever illuminating Richard Smith. And
yet I am certain that I have allowed unidentified bugs to creep in;
bugs, that I will do my best to slay, once identified!
Larisse Voufo [Thu, 22 Aug 2013 00:28:27 +0000 (00:28 +0000)]
Improve support for static data member templates. This revision still has at least one bug, as it does not respect the variable template specialization hierarchy well.
Eli Friedman [Thu, 22 Aug 2013 00:27:10 +0000 (00:27 +0000)]
Split isFromMainFile into two functions.
Basically, isInMainFile considers line markers, and isWrittenInMainFile
doesn't. Distinguishing between the two is useful when dealing with
files which are preprocessed files or rewritten with -frewrite-includes
(so we don't, for example, print useless warnings).
Rafael Espindola [Wed, 21 Aug 2013 21:59:03 +0000 (21:59 +0000)]
Move -mfpmath handling to -cc1 and implement it for x86.
The original idea was to implement it all on the driver, but to do that the
driver needs to know the sse level and to do that it has to know the default
features of a cpu.
Benjamin Kramer pointed out that if one day we decide to implement support for
' __attribute__ ((__target__ ("arch=core2")))', then the frontend needs to
keep its knowledge of default features of a cpu.
To avoid duplicating which part of clang handles default cpu features,
it is probably better to handle -mfpmath in the frontend.
For ARM this patch is just a small improvement. Instead of a cpu list, we
check if neon is enabled, which allows us to reject things like
-mcpu=cortex-a9 -mfpu=vfp -mfpmath=neon
For X86, since LLVM doesn't support an independent ssefp feature, we just
make sure the selected -mfpmath matches the sse level.
Manman Ren [Wed, 21 Aug 2013 20:58:45 +0000 (20:58 +0000)]
Don't use mangleCXXRTTIName in TBAA for C code.
With r185721, calling mangleCXXRTTIName on C code will cause crashes.
This commit fixes crashes on C testing cases when turning on struct-path TBAA.
For C code, we simply use the Decl name without the context. This can
cause two different structs having the same name, and may cause inaccurate but
conservative alias results.
Benjamin Kramer [Wed, 21 Aug 2013 11:45:27 +0000 (11:45 +0000)]
Sema: Use the right type for PredefinedExpr when it's in a lambda.
1. We now print the return type of lambdas and return type deduced functions
as "auto". Trailing return types with decltype print the underlying type.
2. Use the lambda or block scope for the PredefinedExpr type instead of the
parent function. This fixes PR16946, a strange mismatch between type of the
expression and the actual result.
3. Verify the type in CodeGen.
4. The type for blocks is still wrong. They are numbered and the name is not
known until CodeGen.
Richard Smith [Wed, 21 Aug 2013 01:40:36 +0000 (01:40 +0000)]
If we find an error in the range expression in a range-based for loop, and the
loop variable has a type containing 'auto', set the declaration to be invalid
(because we couldn't deduce its type) to prevent follow-on errors.
Eli Friedman [Tue, 20 Aug 2013 22:44:32 +0000 (22:44 +0000)]
Remove Extension warning for GNU local labels.
We generally don't warn about extensions involving keywords reserved
for the implementation, so we shouldn't warn here either: the
standard doesn't require it, and it doesn't provide useful information
to the user.