Benjamin Kramer [Mon, 13 Feb 2017 16:16:43 +0000 (16:16 +0000)]
[ASTUnit] Clear out diagnostic state after creating the preamble.
If the preamble had diagnostic state this would leave behind invalid
state in the DiagnosticsEngine and crash later. The test case runs into
an assertion in DiagnosticsEngine::setSourceManager.
Summary:
Sema::CheckCompletedCoroutineBody was growing unwieldy with building all of the substatements. Also, constructors for CoroutineBodyStmt had way too many parameters.
Instead, CoroutineBodyStmt now defines CtorArgs structure with all of the required construction parameters.
CheckCompleteCoroutineBody delegates construction of individual substatements to short functions one per each substatement.
Also, added a drive-by fix of initializing CoroutinePromise to nullptr in ScopeInfo.h.
And addressed the FIXME that wanted to tail allocate extra room at the end of the CoroutineBodyStmt to hold parameter move expressions. (The comment was longer that the code that implemented tail allocation).
Renato Golin [Sun, 12 Feb 2017 19:08:02 +0000 (19:08 +0000)]
Revert "Attributes on K&R C functions should not cause incompatible..."
...function type with a redeclaration having the same attribute. Fixing this
introduced a secondary problem where we were assuming that K&R functions
could not be attributed types when reporting old-style function definitions
that are not preceded by a prototype."
Also Revert "Hopefully fixes a compile error introduced by r294861."
This reverts commit r294862, r294861, as they bork the ARM builds and
haven't fix it back.
Also, please, short commit titles, long commit decsriptions...
Davide Italiano [Sat, 11 Feb 2017 23:44:37 +0000 (23:44 +0000)]
[Driver] Use stem() and not filename().
On Windows the filename might have an extension, namely
`.exe`, so the search will fail. Sorry, I don't have a
good way to test this as it seems to fail only in some
weird configurations. r284430 has the same modification
for Fuchsia.
CodeGen: use # as the comment leader for ARC marker
Use # as the comment leader for AArch64 auto-release elision marker.
This is to keep it in sync with the value used in swift. When building
libdispatch for Linux AArch64, the auto-release elision marker was
emitted. However, ELF uses # as the comment leader while MachO accepts
both ; and #. Use the common marker for it instead.
CodeGen: annotate ObjC ARC functions with ABI constraints
Certain ARC runtime functions have an ABI contract of being forwarding.
Annotate the functions with the appropriate `returned` attribute on the
arguments. This hoists some of the runtime ABI contract information
into the frontend rather than the backend transformations.
The test adjustments are to mark the returned function parameter as
such. The minor change to the IR output is due to the fact that the
returned reference of the object causes it to extend the lifetime of the
object by returning an autoreleased return value. The result is that
the explicit objc_autorelease call is no longer formed, as autorelease
elision is now possible on the return.
Dylan McKay [Sat, 11 Feb 2017 21:06:07 +0000 (21:06 +0000)]
[AVR] Fix __AVR_xxx macro definitions; authored by Peter Wu
Summary:
The -mmcu option for GCC sets macros like __AVR_ATmega328P__ (with the trailing
underscores), be sure to include these underscores for Clangs -mcpu option.
See "AVR Built-in Macros" in https://gcc.gnu.org/onlinedocs/gcc/AVR-Options.html
Aaron Ballman [Sat, 11 Feb 2017 17:49:53 +0000 (17:49 +0000)]
Attributes on K&R C functions should not cause incompatible function type with a redeclaration having the same attribute. Fixing this introduced a secondary problem where we were assuming that K&R functions could not be attributed types when reporting old-style function definitions that are not preceded by a prototype.
Don't let EvaluationModes dictate whether an invalid base is OK
What we want to actually control this behavior is something more local
than an EvalutationMode. Please see the linked revision for more
discussion on why/etc.
Richard Smith [Fri, 10 Feb 2017 21:40:29 +0000 (21:40 +0000)]
[c++1z] Require an initializer for deduced class template specialization types.
It's actually meaningful and useful to allow such variables to have no
initializer, but we are strictly following the standard here until the C++
committee reaches consensus on allowing this.
Tim Shen [Fri, 10 Feb 2017 21:03:24 +0000 (21:03 +0000)]
[XRay] Implement powerpc64le xray.
Summary:
powerpc64 big-endian is not supported, but I believe that most logic can
be shared, except for xray_powerpc64.cc.
Also add a function InvalidateInstructionCache to xray_util.h, which is
copied from llvm/Support/Memory.cpp. I'm not sure if I need to add a unittest,
and I don't know how.
Eric Christopher [Fri, 10 Feb 2017 04:35:21 +0000 (04:35 +0000)]
Temporarily revert "For X86-64 linux and PPC64 linux align int128 to 16 bytes."
until we can get better TargetMachine::isCompatibleDataLayout to compare - otherwise
we can't code generate existing bitcode without a string equality data layout.
Eric Christopher [Fri, 10 Feb 2017 03:32:34 +0000 (03:32 +0000)]
For X86-64 linux and PPC64 linux align int128 to 16 bytes.
For other platforms we should find out what they need and likely
make the same change, however, a smaller additional change is easier
for platforms we know have it specified in the ABI.
Richard Smith [Fri, 10 Feb 2017 01:32:04 +0000 (01:32 +0000)]
Sink IsExplicitSpecified flag from CXXConstructorDecl and CXXConversionDecl
into FunctionDecl. Makes CXXConversionDecl 8 bytes smaller. No functionality
change intended.
Amjad Aboud [Thu, 9 Feb 2017 22:07:24 +0000 (22:07 +0000)]
[DebugInfo] Added support to Clang FE for generating debug info for preprocessor macros.
Added "-fdebug-macro" flag (and "-fno-debug-macro" flag) to enable (and to disable) emitting macro debug info.
Added CC1 "-debug-info-macro" flag that enables emitting macro debug info.
Richard Smith [Thu, 9 Feb 2017 21:04:43 +0000 (21:04 +0000)]
Rename IsExplicitSpecialization -> IsMemberSpecialization when we're talking
about member specializations to avoid ambiguous and confusing terminology.
Marcos Pividori [Thu, 9 Feb 2017 18:22:35 +0000 (18:22 +0000)]
[windows] [asan] Add wholearchive flag when including asan_cxx lib.
We need -wholearchive for asan_cxx, the same than for asan.
Clang Driver will add asan_cxx at the beginning of the arg list that we pass to
the linker. To ensure that all the static libraries are linked to asan_cxx, we
force the linker to include the object files in asan_cxx.
This fixes some linker errors when compiling with address sanitizer for MT and
passing the static library libFuzzer.
Craig Topper [Thu, 9 Feb 2017 06:10:14 +0000 (06:10 +0000)]
[X86] Clzero flag addition and inclusion under znver1
1. Adds the command line flag for clzero.
2. Includes the clzero flag under znver1.
3. Defines the macro for clzero.
4. Adds a new file which has the intrinsic definition for clzero instruction.
Patch by Ganesh Gopalasubramanian with some additional tests from me.
Richard Smith [Wed, 8 Feb 2017 19:58:48 +0000 (19:58 +0000)]
Don't crash on 'decltype(auto)::'. Rather than treating it as a meaningless
nested-name-specifier (as the standard appears to require), treat it as the
type specifier 'decltype(auto)' followed by a nested-name-specifier starting
with '::'.
Reid Kleckner [Wed, 8 Feb 2017 16:09:32 +0000 (16:09 +0000)]
[MS] Fix C++ destructor thunk line info for a declaration
Sometimes the MS ABI needs to emit thunks for declarations that don't
have bodies. Destructor thunks make calls to inlinable functions, so
they need line info or LLVM will complain.
[clang-format] Break before a sequence of line comments aligned with the next line.
Summary:
Make the comment alignment respect sections of line comments originally alinged
with the next token. Until now the decision how to break a continuous sequence
of line comments into sections was taken without reference to the next token.
source:
```
class A {
public: // comment about public
// comment about a
int a;
}
```
format before:
```
class A {
public: // comment about public
// comment about a
int a;
}
```
format after:
```
class A {
public: // comment about public
// comment about a
int a;
}
```
Craig Topper [Wed, 8 Feb 2017 07:13:22 +0000 (07:13 +0000)]
[X86] Remove 'umip' feature flag.
This feature flag indicates that the processor has support for removing certain instructions from user mode software. But the feature flag by itself doesn't indicate if the support is enabled in the OS. The affected instructions aren't even instructions the compiler would emit. So I don't think think this feature flag should be in the compiler.
Sema: add warning for c++ member variable shadowing
Add a warning for shadowed variables across records. Referencing a
shadow'ed variable may not give the desired variable. Add an optional
warning for the shadowing.
Richard Smith [Wed, 8 Feb 2017 01:16:55 +0000 (01:16 +0000)]
Fix constructor declarator detection for the case when the name is followed by
an attribute-specifier-seq. (Also fixes the same problem for deduction-guides.)
[PCH] Fix a regression when PCH is used with -fmodules
Following up on r291465 after a regression in r276159. When we use
-fmodule-name=X while building a PCH, modular headers in X will be
textually included and the compiler knows that we are not building
module X, so don't serialize such headers in the PCH as being part of a
module, because at this point they are not.
This was causing subtle bugs and malformed AST crashes, for instance,
when using the PCH in subsequent compiler invocation with -fmodules, the
HFI for a modular header would map to the PCH, which would force a
module load of and unexistent module ID.
Martin Probst [Tue, 7 Feb 2017 16:33:13 +0000 (16:33 +0000)]
clang-format: [JS] correcly format object literal methods.
Summary:
In JavaScript, object literals can contain methods:
var x = {
a() { return 1; },
};
Previously, clang-format always parsed nested {} inside a braced list as
further braced lists. Special case this logic for JavaScript to try
parsing as a braced list, but fall back to parsing as a child block.
Summary:
Regex detection would incorrectly classify a trailing `!` operator
(nullability cast) followed by a `/` as the start of a regular
expression literal. This fixes code such as:
var foo = x()! / 10;
Which would previously parse a regexp all the way to the end of the
source file (or next `/`).
Richard Smith [Tue, 7 Feb 2017 01:37:30 +0000 (01:37 +0000)]
P0091R3: Implement basic parsing support for C++17 deduction-guides.
We model deduction-guides as functions with a new kind of name that identifies
the template whose deduction they guide; the bulk of this patch is adding the
new name kind. This gives us a clean way to attach an extensible list of guides
to a class template in a way that doesn't require any special handling in AST
files etc (and we're going to need these functions we come to performing
deduction).
Carlo Bertolli [Mon, 6 Feb 2017 16:03:41 +0000 (16:03 +0000)]
[OpenMP] Remove fixme comment in regression test and related unnecessary statement
https://reviews.llvm.org/D29501
It looks like I forgot to remove a FIXME comment with the associated statement. The test does not need it and it gives the wrong impression of being an incomplete test.
Daniel Jasper [Mon, 6 Feb 2017 10:55:49 +0000 (10:55 +0000)]
clang-format: Fix bug with conflicting BreakBeforeBinaryOperations and AlignAfterOpenBracket
Fix for the formatting options combination of
BreakBeforeBinaryOperators: All, AlignAfterOpenBracket: AlwaysBreak not
handling long templates correctly. This patch allows a break after an
opening left parenthesis, TemplateOpener, or bracket when both options
are enabled.