Summary:
Transform the token sequence for:
typename typedef T U;
to:
typename T typedef U;
Raise a diagnostic when this happens but only if we succeeded handling
the typename.
Reviewers: rsmith, rnk
Reviewed By: rsmith
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1433
llvm-svn: 189867
This fixes pr13124.
From the discussion at
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-June/022606.html
we know that we cannot make funcions in a weak_odr vtable also weak_odr. They
should remain linkonce_odr.
The side effect is that we cannot emit a available_externally vtable unless we
also emit a copy of the function. This also has an issue: If codegen is going
to output a function, sema has to mark it used. Given llvm.org/pr9114, it looks
like sema cannot be more aggressive at marking functions used because
of vtables.
This leaves us with a few unpleasant options:
* Marking functions in vtables used if possible. This sounds a bit sloppy, so
we should avoid it.
* Producing available_externally vtables only when all the functions in it are
already used or weak_odr. This would cover cases like
--------------------
struct foo {
virtual ~foo();
};
struct bar : public foo {
virtual void zed();
};
void f() {
foo *x(new bar);
delete x;
}
void g(bar *x) {
x->~bar(); // force the destructor to be used
}
--------------------------
and
----------------------------------
template<typename T>
struct bar {
virtual ~bar();
};
template<typename T>
bar<T>::~bar() {
}
// make the destructor weak_odr instead of linkonce_odr
extern template class bar<int>;
void f() {
bar<int> *x(new bar<int>);
delete x;
}
----------------------------
These look like corner cases, so it is unclear if it is worth it.
* And finally: Just nuke this optimization. That is what this patch implements.
llvm-svn: 189852
Patch by chris.wailes@gmail.com
Functions can now declare what state the consumable type the are returning will
be in. This is then used on the caller side and checked on the callee side.
Constructors now use this attribute instead of the 'consumes' attribute.
llvm-svn: 189843
This paves the way for adding support for modeling the destructor of a
region before it is deleted. The statement "delete <expr>" now generates
this series of CFG elements:
1. <expr>
2. [B1.1]->~Foo() (Implicit destructor)
3. delete [B1.1]
Patch by Karthik Bhat!
llvm-svn: 189828
Implements parsing of lambdas in the UnwrappedLineParser.
This introduces the correct line breaks; the formatting of
lambda captures are still incorrect, and the braces are also
still formatted as if they were braced init lists instead of
blocks.
llvm-svn: 189818
Summary:
I have no idea why these were there in the first place, but now they are
certainly not necessary.
Reviewers: rsmith
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1581
llvm-svn: 189813
Summary:
Remove DynCastMatcher, since it is pretty much the same as Matcher<T>::WrappedMatcher.
This reduces the number of template instantiations and number of symbols in the object file.
Reviewers: klimek
CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1560
llvm-svn: 189800
been an oversight, as it definitely works. Every test which changed had
the const written on the LHS of the auto already.
Notably, this also makes things like cpp11-migrate's formation of 'const
auto &' variables much more familiar.
Yes, many people feel that 'const' and other qualifiers belong on the
RHS of the type. I'm not going to argue about that because Clang already
*overwhelming* places the qualifiers on the LHS when it can and on the
RHS when it must. We shouldn't diverge for auto. We should add a tool to
clang-tidy that fixes this in either direction, and then wire up
clang-tidy to tools like cpp11-migrate to fix their placement after
transforms.
llvm-svn: 189769
Summary:
Store first and last newline position in the token text for string literals and
comments to avoid doing .find('\n') for each possible solution.
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D1556
llvm-svn: 189758
This is an improved version of r186498. It enables ExprEngine to reason about
temporary object destructors. However, these destructor calls are never
inlined, since this feature is still broken. Still, this is sufficient to
properly handle noreturn temporary destructors.
Now, the analyzer correctly handles expressions like "a || A()", and executes the
destructor of "A" only on the paths where "a" evaluted to false.
Temporary destructor processing is still off by default and one has to
explicitly request it by setting cfg-temporary-dtors=true.
Reviewers: jordan_rose
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1259
llvm-svn: 189746
fallback syntax used when we fail to find a '.clang-format' file. Adjust
variable names appropriately.
Update the editor integration pieces that specify a '-style' option to
specify it as '-style=file'. I left the functionality in place because
even if the preferred method is to use '.clang-format' files, this way
if someone needs to clobber the style in their editor we show how to do
so in these examples.
Also check in a '.clang-format' file for Clang to ensure that separate
checkouts and builds of Clang from LLVM can still get the nice
formatting. =] This unfortunately required nuking the test for the
absence of a '.clang-format' file as now the directory happening to be
under your clang source tree will cause there to always be a file. ;]
llvm-svn: 189741
InitializedEntity::EntityKind as an index for one of its %select. Over time,
EntityKind has been expanded, but the diagnostic text has not been updated.
This adds additional text to the %select to cover the new enum values. A
comment has been added to the end of the enum regarding this situation. This
fixes the crasher in PR17043.
llvm-svn: 189716
of some sort (but not an object, block pointer or CF pointers),
and is not annotated with the objc_returns_inner_pointer attribute,
we should suggest NS_RETURNS_INNER_POINTER annotation for these methods.
llvm-svn: 189707
Patch by chris.wailes@gmail.com
Adds the 'consumable' attribute that can be attached to classes. This replaces
the previous method of scanning a class's methods to see if any of them have
consumed analysis attributes attached to them. If consumed analysis attributes
are attached to methods of a class that isn't marked 'consumable' a warning
is generated.
llvm-svn: 189702
This will never happen in the analyzed code code, but can happen for checkers
that over-eagerly dereference pointers without checking that it's safe.
UnknownVal is a harmless enough value to get back.
Fixes an issue added in r189590, caught by our internal buildbot.
llvm-svn: 189688
specified NSUInteger as the followup typedef.
With this change, NS_OPTIONS is only inferred
based on looking up how enumerators are speficied
(if they her hexadecimal, power of 2, or have
bitwise constant expressions).
llvm-svn: 189682
Summary:
Reduce the number of symbols by changing how templates are instantiated per function bound in the registry.
This change reduces the number of sections in Registry.cpp.o by a little over 10%.
Reviewers: klimek
CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1557
llvm-svn: 189676
Almost by accident, clang-format seems to be able to format protocol
buffer definitions (https://code.google.com/p/protobuf/).
The only change is that a space is required between numeric constants
and opening square brackets (for default values). While this might in
theory be used for array subscripts (int val = 4[MyArray]), I have not
seen this pattern in practice much. If this is wrong, we can make this
smarter in the future.
llvm-svn: 189663
This never really worked. Even if we find and execute link.exe in the VS bin dir
this way, link.exe wouldn't find the DLLs it needs, libraries, etc.
It also causes trouble when the user has multiple versions of VS installed,
one of them is in the path, but this code finds the other one (PR17041).
Revert until we can fix this properly.
> Windows ToolChain: add VS bin dir to PogramPaths
>
> We have a lot of fancy logic to find Visual Studio, which is currently used
> to set the system header include paths.
>
> Use the same code to set the ProgramPaths, which is used for finding programs
> such as link.exe. Previously, Clang would just search PATH for link.exe,
> but now it should find it if it's able to find Visual Studio.
llvm-svn: 189661
Summary:
Previously, Sema was reusing parts of the AST when synthesizing an assignment
operator, turning it into a AS-dag. This caused problems for the static
analyzer, which assumed an expression appears in the tree only once.
Here I make sure to always create a fresh Expr, when inserting something into
the AST, fixing PR16745 in the process.
Reviewers: doug.gregor
CC: cfe-commits, jordan_rose
Differential Revision: http://llvm-reviews.chandlerc.com/D1425
llvm-svn: 189659
Before:
aaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccc(
dddddddddddddddddddddddddddddd));
aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(
dddddddddddddddddddddddddddddd));
After:
aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccc(
dddddddddddddddddddddddddddddd));
aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(
dddddddddddddddddddddddddddddd));
This was overlooked when interducing the new builder-type call
detection in r189337. Also, some minor reorganization of a test.
llvm-svn: 189658
While this looks kind of nice, it wastes horizontal space and does not
seem to be common in the LLVM codebase.
Before:
return llvm::StringSwitch<Reference::Kind>(name)
.StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR)
.StartsWith(".eh_frame", ORDER_EH_FRAME)
.StartsWith(".init", ORDER_INIT)
.StartsWith(".fini", ORDER_FINI)
.StartsWith(".hash", ORDER_HASH)
.Default(ORDER_TEXT);
After:
return llvm::StringSwitch<Reference::Kind>(name)
.StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR)
.StartsWith(".eh_frame", ORDER_EH_FRAME)
.StartsWith(".init", ORDER_INIT)
.StartsWith(".fini", ORDER_FINI)
.StartsWith(".hash", ORDER_HASH)
.Default(ORDER_TEXT);
llvm-svn: 189657
these in eagerly if we're not actually processing a translation unit. The added
laziness here also avoids us loading in parts of a CXXRecordDecl earlier than an
upcoming class template specialization merging patch would like.
Ideally, we should mark the vtable as used when we see a definition for the key
function, rather than having a separate pass over dynamic classes at the end of
the TU. The existing approach is pretty bad for PCH/modules, since it forcibly
loads the declarations of all key functions in all imported modules, whether or
not those key functions are defined.
llvm-svn: 189627
I changed the diagnostic printing code because it's probably better
to cut off a digit from DBL_MAX than to print something like
1.300000001 when the user wrote 1.3.
llvm-svn: 189625
We use CXX mangler to generate unique identifier for external C++ struct,
union, class and enum. Types with unique identifier are added to retained
types by DIBuilder.
Testing cases are updated to reflect the unique identifier generated for types.
The order of MDNodes is changed because of retained types and testing cases
are updated accordingly.
Testing case debug-info-uuid.cpp now emits error with Itanium mangler, since
uuid is not yet handled in Itanium mangler. And it will check for the error
message.
llvm-svn: 189622
We had further discussions on how to retain types, whether to do it in front end
or in DIBuilder. And we agree to do it in DIBuilder so front ends
generating unique identifier do not need to worry about retaining them.
llvm-svn: 189609
We use CXX mangler to generate unique identifier for external C++ struct,
union, class and enum. Types with unique identifier are added to RetainedTypes
to make sure they are treated as used even when all uses are replaced with
the identifiers.
A single type can be added to RetainedTypes multiple times. For example, both
createForwardDecl and createLimitedType can add the same type to RetainedTypes.
A set is used to avoid duplication when updating AllRetainTypes in DIBuilder.
Testing cases are updated to reflect the unique identifier generated for types.
The order of MDNodes is changed because of retained types and testing cases
are updated accordingly.
Testing case debug-info-uuid.cpp now emits error with Itanium mangler, since
uuid is not yet handled in Itanium mangler.
We choose to update RetainedTypes in clang, then at finalize(), we update
AllRetainTypes in DIBuilder. The other choice is to update AllRetainTypes
in DIBuilder when creating a DICompositeType with unique identifier. This
option requires using ValueHandle for AllRetainTypes in DIBuilder since
the created DICompositeType can be modified later on by setContainingType etc.
llvm-svn: 189600
Summary:
Calculate characters in the first and the last line correctly so that
we only break before the literal when needed.
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D1544
llvm-svn: 189595
Patch by chris.wailes@gmail.com.
* The TestedVarsVisitor was folded into the ConsumedStmtVisitor.
* The VarTestResult class was updated to allow these changes.
* The PropagationInfo class was updated for the same reasons.
* Correctly handle short-circuiting of Boolean operations.
* Blocks are now marked as unreachable when we can statically prove we will
never branch to them.
* Unreachable blocks are skipped by the analysis.
llvm-svn: 189594
Summary:
RegionStoreManager had an optimization which replaces references to empty
structs with UnknownVal. Unfortunately, this check didn't take into account
possible field members in base classes.
To address this, I changed this test to "is empty and has no base classes". I
don't consider it worth the trouble to go through base classes and check if all
of them are empty.
Reviewers: jordan_rose
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1547
llvm-svn: 189590
The environments can inject some declaration in every translation unit,
which can match very generic matchers, thus failing the tests.
Summary:
Fix tests to be more specific.
The environments can inject some declaration in every translation unit,
which can match very generic matchers, thus failing the tests.
Reviewers: aaron.ballman
CC: klimek, cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1541
llvm-svn: 189587
We now count the original token's column directly when lexing the
tokens, where we already have all knowledge about where lines start.
Before this patch, formatting:
void f() {
\tg();
\th();
}
would incorrectly count the \t's as 1 character if only the line
containing h() was reformatted, and thus indent h() at offset 1.
llvm-svn: 189585
Fixes PR17018. Only partial test coverage because I don't want
to try to write a test which generates a file whose name contains a newline.
llvm-svn: 189557
Passing inconsistent munaligned-access / mno-unaligned-access
flags, intentionally resulted in a warning and the flag
no-unaligned-access being used.
Gcc does, at least in practice, use the last flag in such a
case. This patch updates clang behaviour accordingly; use the
last flag or base alignment behaviour on the target (which
llvm will do if no flag is explicitly passed)
Patch by Jeroen Hofstee.
llvm-svn: 189542
Summary:
We would not perform substitution at an appropriate point, allowing strange
results to appear. We would accepts things that we shouldn't or mangle things incorrectly. Note that this hasn't fixed the other cases like
template-template parameters or non-type template parameters.
Reviewers: doug.gregor, rjmccall, rsmith
Reviewed By: rsmith
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1507
llvm-svn: 189540
instance methods returning non-void. This will be quite noisy. So, it is
placed under a new migrator flag -objcmt-migrate-readonly-property.
llvm-svn: 189537
When sysroot is not set, look for libstdc++ first on the clang install
directory. Before this change if clang was installed alongside a gcc with
the same version as the system one we would select the system libstdc++.
Unfortunately this is hard to test as only the non-sysroot case is changed.
llvm-svn: 189536
hasRelatedResultType() as it knows of methods which have
related result type by default. Such methods do not need
a redundant 'instancetype'.
llvm-svn: 189520
Both functions will take a Type pointer instead of a Decl pointer. This helps
with follow-up type uniquing patches, which need the Type pointer to call
CXX mangler to generate unique identifiers.
No functionality change.
llvm-svn: 189519
Right now, the output for Itanium vs. Microsoft is the same. Once we start
calling mangler to get the unique identifier, this testing case will require
support for uuid mangling.
llvm-svn: 189518
Apparently, gcc's -traditional-cpp behaves slightly differently in C++ mode;
specifically, it discards "//" comments. Match gcc's behavior.
<rdar://problem/14808126>
llvm-svn: 189515
We translate these into #define directives; to preserve gcc-compatible
semantics (where the expanded macro includes the backslash), we add
an extra "\\\n" to the end of the synthesized "#define".
<rdar://problem/14810220>
llvm-svn: 189511
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.
Second try. This time with a fix for C++11 builds.
Reviewers: klimek
CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1536
llvm-svn: 189500
Seperate the parts related to uuid from debug-info-template.cpp to
debug-info-uuid.cpp since Itanium mangler does not have support for mangling
uuid yet.
Remove -fms-extensions from RUN line of debug-info-template.cpp.
RUN line of debug-info-uuid.cpp has -fms-extensions and -cxx-abi microsoft.
llvm-svn: 189498
In the transition from declaration (with some members) to definition, we
were overwriting the list of members with the empty list when attaching
template parameters.
The fix is in llvm::DICompositeType::addMember (along with asserts that
cause this bug to be covered by existing Clang test cases), including
adding some asserts to catch this sort of issue which found issues fixed
in this commit.
llvm-svn: 189494
When casting the address of a FunctionTextRegion to bool, or when adding
constraints to such an address, use a stand-in symbol to represent the
presence or absence of the function if the function is weakly linked.
This is groundwork for possible simple availability testing checks, and
can already catch mistakes involving inverted null checks for
weakly-linked functions.
Currently, the implementation reuses the "extent" symbols, originally created
for tracking the size of a malloc region. Since FunctionTextRegions cannot
be dereferenced, the extent symbol will never be used for anything else.
Still, this probably deserves a refactoring in the future.
This patch does not attempt to support testing the presence of weak
/variables/ (global variables), which would likely require much more of
a change and a generalization of "region structure metadata", like the
current "extents", vs. "region contents metadata", like CStringChecker's
"string length".
Patch by Richard <tarka.t.otter@googlemail.com>!
llvm-svn: 189492
Two changes:
* Don't add an extra penalty on breaking the same token multiple times.
Generally, we should prefer not to break, but once we break, the
normal line breaking penalties apply.
* Slightly increase the penalty for breaking comments. In general, the
author has put some thought into how to break the comment and we
should not overwrite this unnecessarily.
With a 40-column column limit, formatting
aaaaaa("aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa");
Leads to:
Before:
aaaaaa(
"aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa "
"aaaaaaaaaaaaaaaa");
After:
aaaaaa("aaaaaaaaaaaaaaaa "
"aaaaaaaaaaaaaaaa "
"aaaaaaaaaaaaaaaa");
llvm-svn: 189466
These operations "vector add high-half narrow" actually correspond to the
sequence:
%sum = add <4 x i32> %lhs, %rhs
%high = lshr <4 x i32> %sum, <i32 16, i32 16, i32 16, i32 16>
%res = trunc <4 x i32> %high to <4 x i16>
Now that LLVM can spot this, Clang should emit the corresponding LLVM IR.
llvm-svn: 189463
The NEON intrinsics vqdmlal and vqdmlsl are really just combinations of a
saturating-doubling-multiply (vqdmull) and a saturating add/sub, so now that
LLVM can spot those patterns Clang should emit them instead of specialised
intrinsics.
Feature already tested by existing ARM NEON intrinsics tests.
llvm-svn: 189462
The code leading to a segfault was:
#pragma omp threadprivate(y)), // long comment leading to a line break
This fixes llvm.org/PR16513.
llvm-svn: 189460
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.
This fixes llvm.org/PR16515.
llvm-svn: 189459
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 "{".
This fixes llvm.org/PR16604.
llvm-svn: 189453
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).
Reviewers: jordan_rose
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1528
llvm-svn: 189452
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.
llvm-svn: 189441
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.
llvm-svn: 189440
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.
llvm-svn: 189438
Summary:
Instead of calling getAsTemplate(), call
getAsTemplateOrTemplatePattern() because it handles the
TemplateExpansion case too.
This fixes PR16997.
Reviewers: doug.gregor, rsmith
Reviewed By: rsmith
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1512
llvm-svn: 189422
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.
llvm-svn: 189421
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!
Reviewers: rsmith
Differential Revision: http://llvm-reviews.chandlerc.com/D1231
llvm-svn: 189412
cf functions which are CF_IMPLICIT_BRIDGING_ENABLED.
Add cf annotation to those not CF_IMPLICIT_BRIDGING_ENABLED
to reduce bridge casts.
llvm-svn: 189409
This exposes the -fsanitize=address option and adds the runtime library
to the link command.
Differential Revision: http://llvm-reviews.chandlerc.com/D1526
llvm-svn: 189389
Variables set in a makefile are not overridden by environment variables.
Make sure we actually override CC and CXX when using scan-build.
Patch by Steve McCoy!
llvm-svn: 189372
We error on -O5 and higher. While it is tempting to do the same for -O4, I
agree with Jordan Rose: we should warn for a release at least first.
llvm-svn: 189369
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.
Reviewers: klimek
CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1531
llvm-svn: 189362
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().
llvm-svn: 189358
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.
Reviewers: klimek
CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1427
llvm-svn: 189357
- 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.
llvm-svn: 189346
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.
llvm-svn: 189320
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;
llvm-svn: 189287
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.
llvm-svn: 189278
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.
llvm-svn: 189277
- __func__ or __FUNCTION__ returns captured statement's parent
function name, not the one compiler generated.
Differential Revision: http://llvm-reviews.chandlerc.com/D1491
Reviewed by bkramer
llvm-svn: 189219
which add another wrinkle to the installation of the libstdc++ headers.
Add at least some basic testing of the weirdnesses of Gentoo's layout.
llvm-svn: 189212
Specific arrangements of comments after trailing commas could confuse
the column width calculation, e.g. in:
vector<int> x = { a, b,
/* some */ /* comment */ };
llvm-svn: 189211
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.
llvm-svn: 189203
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.
Reviewers: dblaikie, echristo, majnemer
Reviewed By: majnemer
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1508
llvm-svn: 189200
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.
Patch by Jeroen Hofstee.
llvm-svn: 189175
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.
Patch by Jeroen Hofstee.
llvm-svn: 189174
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.
This fixes PR16939.
Reviewers: dblaikie, rsmith
Reviewed By: dblaikie
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1453
llvm-svn: 189165
One step toward differentiating following two commands:
clang -O3 -flto a.c -c, and
clang -O3 -emit-llvm a.c
Thanks many awesome folks for clarifying things.
llvm-svn: 189148
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.
Differential Revision: http://llvm-reviews.chandlerc.com/D1483
llvm-svn: 189127
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.
llvm-svn: 189126
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.
<rdar://problem/12922063>
llvm-svn: 189110
This should be done, only if we are still in the unary expression's
scope.
Before:
bool aaaa = !aaaaaaaa( // break
aaaaaaaaaaa);
*aaaaaa = aaaaaaa( // break
aaaaaaaaaaaaaaaa);
After:
bool aaaa = !aaaaaaaa( // break
aaaaaaaaaaa); // <- (unchanged)
*aaaaaa = aaaaaaa( // break
aaaaaaaaaaaaaaaa); // <- (no longer indented relative to "*")
llvm-svn: 189108
.. in conjunction with Style.AlwaysBreakBeforeMultilineStrings. Also,
simplify the implementation by handling newly split strings and already
split strings by the same code.
llvm-svn: 189102
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.
llvm-svn: 189094
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.
Reviewers: jordan_rose
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1340
llvm-svn: 189090
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.
Reviewers: rsmith, doug.gregor, rjmccall
Reviewed By: doug.gregor
CC: cfe-commits, rnk
Differential Revision: http://llvm-reviews.chandlerc.com/D1444
llvm-svn: 189087
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.
llvm-svn: 189075
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.
llvm-svn: 189059
Summary:
These typically come from static data members of class template
specializations. This accomplishes two things:
1. May expose GlobalOpt optimizations for Itanium C++ ABI code.
2. Works toward fixing double initialization in the Microsoft C++ ABI.
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1475
llvm-svn: 189051
Summary:
Refactor VariantMatcher to use an interface underneath.
It supports "Single" and "Polymorphic". Will support more in the future.
Reviewers: klimek
CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1446
llvm-svn: 189032
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.
See also LLVM changes to the configure script.
llvm-svn: 189027
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.
llvm-svn: 189022
With this patch, braced lists (with more than 3 elements are formatted in a
column layout if possible). E.g.:
static const uint16_t CallerSavedRegs64Bit[] = {
X86::RAX, X86::RDX, X86::RCX, X86::RSI, X86::RDI,
X86::R8, X86::R9, X86::R10, X86::R11, 0
};
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).
Review: http://llvm-reviews.chandlerc.com/D1457
llvm-svn: 189018