Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another merge of the upstream 8.x branch #8

Merged
merged 36 commits into from
Feb 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
be8c9e3
Merging r352707, r352714, r352886, r352892, r352895, r352908, r352917…
zmodem Feb 13, 2019
6e3c4d5
Revert r350404
zmodem Feb 13, 2019
c957a99
Merging r353976:
zmodem Feb 14, 2019
1152134
Merging r353968:
zmodem Feb 14, 2019
ff29092
Merging r354074:
zmodem Feb 15, 2019
8015928
Merging r353943:
zmodem Feb 15, 2019
a7da36b
Merging r354035:
zmodem Feb 18, 2019
07a7439
Merging r354147:
zmodem Feb 18, 2019
25c79d9
Merging r354128 and r354131:
zmodem Feb 18, 2019
783fd93
Merging r354144:
zmodem Feb 18, 2019
46fbca3
Merging r353642:
zmodem Feb 18, 2019
096ef4c
Merging r354029:
zmodem Feb 18, 2019
81bd9db
Merging r354122:
zmodem Feb 18, 2019
6051407
Merging r353907:
zmodem Feb 18, 2019
cc3d3f1
Merging r354034 and r354117:
zmodem Feb 18, 2019
e3d91da
[ReleaseNotes] Add note about removal of Nios2 backend. Add some note…
topperc Feb 18, 2019
79a42b6
docs: Remove in-progress warning
zmodem Feb 19, 2019
81717ef
remove another in-progress note
zmodem Feb 19, 2019
6a57428
ReleaseNotes: remove in-progress warning, and minor tweaks
zmodem Feb 19, 2019
363f1d0
ReleaseNotes: remove in-progress warning and doxygen link
zmodem Feb 19, 2019
b1c5e90
ReleaseNotes: remove in-progress warning
zmodem Feb 19, 2019
fbaa8ef
ReleaseNotes: remove in-progress warning
zmodem Feb 19, 2019
5decb13
Merging r354422:
zmodem Feb 20, 2019
d6e87c2
ReleaseNotes: initial ppc support in llvm-exegesis
zmodem Feb 20, 2019
6977a57
ReleaseNotes: mention the new rotation builtins, text by Sanjay
zmodem Feb 20, 2019
e4bde92
ReleaseNotes: AArch64 tiny code model
zmodem Feb 20, 2019
b936e1c
ReleaseNotes: all PowerPC changes
zmodem Feb 20, 2019
83dcd05
Merging r354351:
zmodem Feb 20, 2019
cd76cba
Merging r354402:
zmodem Feb 20, 2019
0157e01
ReleaseNotes: profile-driven cache prefetching. Text by Mircea!
zmodem Feb 21, 2019
96ddd7d
Merging r354497:
zmodem Feb 21, 2019
9d332ff
ReleaseNotes: speculative load hardening; text by Kristof
zmodem Feb 21, 2019
5a681e4
ReleaseNotes: speculative load hardening; text by Kristof
zmodem Feb 21, 2019
6f2b277
Release notes: a few lldb changes, by Raphael Isemann!
zmodem Feb 22, 2019
b821974
ReleaseNotes: -ftrivial-auto-var-init
zmodem Feb 22, 2019
2400dc6
Merge remote-tracking branch 'llvm/release/8.x' into rustc/8.0-2019-0…
alexcrichton Feb 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
===================================================
Extra Clang Tools 8.0.0 (In-Progress) Release Notes
===================================================
=====================================
Extra Clang Tools 8.0.0 Release Notes
=====================================

.. contents::
:local:
:depth: 3

Written by the `LLVM Team <https://llvm.org/>`_

.. warning::

These are in-progress notes for the upcoming Extra Clang Tools 8 release.
Release notes for previous releases can be found on
`the Download Page <https://releases.llvm.org/download.html>`_.

Introduction
============

Expand All @@ -27,11 +21,6 @@ For more information about Clang or LLVM, including information about
the latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or
the `LLVM Web Site <https://llvm.org>`_.

Note that if you are reading this file from a Subversion checkout or the
main Clang web page, this document applies to the *next* release, not
the current one. To see the release notes for a specific release, please
see the `releases page <https://llvm.org/releases/>`_.

What's New in Extra Clang Tools 8.0.0?
======================================

Expand Down
18 changes: 0 additions & 18 deletions clang-tools-extra/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,6 @@ Contents
clang-doc


Doxygen Documentation
=====================
The Doxygen documentation describes the **internal** software that makes up the
tools of clang-tools-extra, not the **external** use of these tools. The Doxygen
documentation contains no instructions about how to use the tools, only the APIs
that make up the software. For usage instructions, please see the user's guide
or reference manual for each tool.

* `Doxygen documentation`_

.. _`Doxygen documentation`: doxygen/annotated.html

.. note::
This documentation is generated directly from the source code with doxygen.
Since the tools of clang-tools-extra are constantly under active
development, what you're about to read is out of date!


Indices and tables
==================

Expand Down
66 changes: 49 additions & 17 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
=======================================
Clang 8.0.0 (In-Progress) Release Notes
=======================================
=========================
Clang 8.0.0 Release Notes
=========================

.. contents::
:local:
:depth: 2

Written by the `LLVM Team <https://llvm.org/>`_

.. warning::

These are in-progress notes for the upcoming Clang 8 release.
Release notes for previous releases can be found on
`the Download Page <https://releases.llvm.org/download.html>`_.

Introduction
============

Expand All @@ -30,11 +24,6 @@ For more information about Clang or LLVM, including information about the
latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or the
`LLVM Web Site <https://llvm.org>`_.

Note that if you are reading this file from a Subversion checkout or the
main Clang web page, this document applies to the *next* release, not
the current one. To see the release notes for a specific release, please
see the `releases page <https://llvm.org/releases/>`_.

What's New in Clang 8.0.0?
==========================

Expand All @@ -50,7 +39,38 @@ Major New Features
profile data captured for one version of a program to be applied
when building another version where symbols have changed (for
example, due to renaming a class or namespace).
See the :doc:`UsersManual` for details.
See the :ref:`UsersManual <profile_remapping>` for details.

- Clang has new options to initialize automatic variables with either a pattern or with zeroes. The default is still that automatic variables are uninitialized. This isn't meant to change the semantics of C and C++. Rather, it's meant to be a last resort when programmers inadvertently have some undefined behavior in their code. These options aim to make undefined behavior hurt less, which security-minded people will be very happy about. Notably, this means that there's no inadvertent information leak when:

* The compiler re-uses stack slots, and a value is used uninitialized.

* The compiler re-uses a register, and a value is used uninitialized.

* Stack structs / arrays / unions with padding are copied.

These options only address stack and register information leaks.

Caveats:

* Variables declared in unreachable code and used later aren't initialized. This affects goto statements, Duff's device, and other objectionable uses of switch statements. This should instead be a hard-error in any serious codebase.

* These options don't affect volatile stack variables.

* Padding isn't fully handled yet.

How to use it on the command line:

* ``-ftrivial-auto-var-init=uninitialized`` (the default)

* ``-ftrivial-auto-var-init=pattern``

* ``-ftrivial-auto-var-init=zero`` ``-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang``

There is also a new attribute to request a variable to not be initialized, mainly to disable initialization of large stack arrays when deemed too expensive:

* ``int dont_initialize_me __attribute((uninitialized));``


Improvements to Clang's diagnostics
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -131,14 +151,24 @@ Non-comprehensive list of changes in this release

- Improved support for MIPS N32 ABI and MIPS R6 target triples.

- Clang now includes builtin functions for bitwise rotation of common value
sizes, such as: `__builtin_rotateleft32
<LanguageExtensions.html#builtin-rotateleft>`_

- Improved optimization for the corresponding MSVC compatibility builtins such
as ``_rotl()``.

New Compiler Flags
------------------

- ``-mspeculative-load-hardening`` Clang now has an option to enable
Speculative Load Hardening.

- ``-fprofile-filter-files=[regexes]`` and ``-fprofile-exclude-files=[regexes]``.

Clang has now options to filter or exclude some files when
instrumenting for gcov-based profiling.
See the :doc:`UsersManual` for details.
See the `UsersManual <UsersManual.html#cmdoption-fprofile-filter-files>`_ for details.

- When using a custom stack alignment, the ``stackrealign`` attribute is now
implicitly set on the main function.
Expand Down Expand Up @@ -175,7 +205,9 @@ New Pragmas in Clang
Attribute Changes in Clang
--------------------------

- ...
* Clang now supports enabling/disabling speculative load hardening on a
per-function basis using the function attribute
``speculative_load_hardening``/``no_speculative_load_hardening``.

Windows Support
---------------
Expand Down
2 changes: 2 additions & 0 deletions clang/docs/UsersManual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,8 @@ In these cases, you can use the flag ``-fno-profile-instr-generate`` (or
Note that these flags should appear after the corresponding profile
flags to have an effect.

.. _profile_remapping:

Profile remapping
^^^^^^^^^^^^^^^^^

Expand Down
5 changes: 5 additions & 0 deletions clang/include/clang/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2577,6 +2577,11 @@ class CallExpr : public Expr {
NumArgs = NewNumArgs;
}

/// Bluntly set a new number of arguments without doing any checks whatsoever.
/// Only used during construction of a CallExpr in a few places in Sema.
/// FIXME: Find a way to remove it.
void setNumArgsUnsafe(unsigned NewNumArgs) { NumArgs = NewNumArgs; }

typedef ExprIterator arg_iterator;
typedef ConstExprIterator const_arg_iterator;
typedef llvm::iterator_range<arg_iterator> arg_range;
Expand Down
9 changes: 1 addition & 8 deletions clang/include/clang/Basic/Attr.td
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,6 @@ def ObjCInstanceMethod : SubsetSubject<ObjCMethod,
[{S->isInstanceMethod()}],
"Objective-C instance methods">;

def ObjCInterfaceDeclInitMethod : SubsetSubject<ObjCMethod,
[{S->getMethodFamily() == OMF_init &&
(isa<ObjCInterfaceDecl>(S->getDeclContext()) ||
(isa<ObjCCategoryDecl>(S->getDeclContext()) &&
cast<ObjCCategoryDecl>(S->getDeclContext())->IsClassExtension()))}],
"init methods of interface or class extension declarations">;

def Struct : SubsetSubject<Record,
[{!S->isUnion()}], "structs">;

Expand Down Expand Up @@ -1762,7 +1755,7 @@ def ObjCExplicitProtocolImpl : InheritableAttr {

def ObjCDesignatedInitializer : Attr {
let Spellings = [Clang<"objc_designated_initializer">];
let Subjects = SubjectList<[ObjCInterfaceDeclInitMethod], ErrorDiag>;
let Subjects = SubjectList<[ObjCMethod], ErrorDiag>;
let Documentation = [Undocumented];
}

Expand Down
3 changes: 3 additions & 0 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -3460,6 +3460,9 @@ def warn_objc_secondary_init_missing_init_call : Warning<
def warn_objc_implementation_missing_designated_init_override : Warning<
"method override for the designated initializer of the superclass %objcinstance0 not found">,
InGroup<ObjCDesignatedInit>;
def err_designated_init_attr_non_init : Error<
"'objc_designated_initializer' attribute only applies to init methods "
"of interface or class extension declarations">;

// objc_bridge attribute diagnostics.
def err_objc_attr_not_id : Error<
Expand Down
5 changes: 0 additions & 5 deletions clang/include/clang/Parse/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,6 @@ class Parser : public CodeCompletionHandler {
/// just a regular sub-expression.
SourceLocation ExprStatementTokLoc;

/// Tests whether an expression value is discarded based on token lookahead.
/// It will return true if the lexer is currently processing the })
/// terminating a GNU statement expression and false otherwise.
bool isExprValueDiscarded();

public:
Parser(Preprocessor &PP, Sema &Actions, bool SkipFunctionBodies);
~Parser() override;
Expand Down
19 changes: 9 additions & 10 deletions clang/include/clang/Sema/Sema.h
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,6 @@ class Sema {
void PopCompoundScope();

sema::CompoundScopeInfo &getCurCompoundScope() const;
bool isCurCompoundStmtAStmtExpr() const;

bool hasAnyUnrecoverableErrorsInThisFunction() const;

Expand Down Expand Up @@ -3690,17 +3689,16 @@ class Sema {
return MakeFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation());
}
FullExprArg MakeFullExpr(Expr *Arg, SourceLocation CC) {
return FullExprArg(
ActOnFinishFullExpr(Arg, CC, /*DiscardedValue*/ false).get());
return FullExprArg(ActOnFinishFullExpr(Arg, CC).get());
}
FullExprArg MakeFullDiscardedValueExpr(Expr *Arg) {
ExprResult FE =
ActOnFinishFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation(),
/*DiscardedValue*/ true);
ActOnFinishFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation(),
/*DiscardedValue*/ true);
return FullExprArg(FE.get());
}

StmtResult ActOnExprStmt(ExprResult Arg, bool DiscardedValue = true);
StmtResult ActOnExprStmt(ExprResult Arg);
StmtResult ActOnExprStmtError();

StmtResult ActOnNullStmt(SourceLocation SemiLoc,
Expand Down Expand Up @@ -5346,12 +5344,13 @@ class Sema {
CreateMaterializeTemporaryExpr(QualType T, Expr *Temporary,
bool BoundToLvalueReference);

ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue) {
return ActOnFinishFullExpr(
Expr, Expr ? Expr->getExprLoc() : SourceLocation(), DiscardedValue);
ExprResult ActOnFinishFullExpr(Expr *Expr) {
return ActOnFinishFullExpr(Expr, Expr ? Expr->getExprLoc()
: SourceLocation());
}
ExprResult ActOnFinishFullExpr(Expr *Expr, SourceLocation CC,
bool DiscardedValue, bool IsConstexpr = false);
bool DiscardedValue = false,
bool IsConstexpr = false);
StmtResult ActOnFinishFullStmt(Stmt *Stmt);

// Marks SS invalid if it represents an incomplete type.
Expand Down
14 changes: 7 additions & 7 deletions clang/lib/CodeGen/CGDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1620,8 +1620,9 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) {
bool capturedByInit =
Init && emission.IsEscapingByRef && isCapturedBy(D, Init);

Address Loc =
capturedByInit ? emission.Addr : emission.getObjectAddress(*this);
bool locIsByrefHeader = !capturedByInit;
const Address Loc =
locIsByrefHeader ? emission.getObjectAddress(*this) : emission.Addr;

// Note: constexpr already initializes everything correctly.
LangOptions::TrivialAutoVarInitKind trivialAutoVarInit =
Expand All @@ -1637,7 +1638,7 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) {
return;

// Only initialize a __block's storage: we always initialize the header.
if (emission.IsEscapingByRef)
if (emission.IsEscapingByRef && !locIsByrefHeader)
Loc = emitBlockByrefAddress(Loc, &D, /*follow=*/false);

CharUnits Size = getContext().getTypeSizeInChars(type);
Expand Down Expand Up @@ -1745,10 +1746,9 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) {
}

llvm::Type *BP = CGM.Int8Ty->getPointerTo(Loc.getAddressSpace());
if (Loc.getType() != BP)
Loc = Builder.CreateBitCast(Loc, BP);

emitStoresForConstant(CGM, D, Loc, isVolatile, Builder, constant);
emitStoresForConstant(
CGM, D, (Loc.getType() == BP) ? Loc : Builder.CreateBitCast(Loc, BP),
isVolatile, Builder, constant);
}

/// Emit an expression as an initializer for an object (variable, field, etc.)
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Frontend/TextDiagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ void TextDiagnostic::emitDiagnosticLoc(FullSourceLoc Loc, PresumedLoc PLoc,
if (LangOpts.MSCompatibilityVersion &&
!LangOpts.isCompatibleWithMSVC(LangOptions::MSVC2015))
OS << ' ';
OS << ": ";
OS << ':';
break;
}

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Parse/ParseObjc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2741,7 +2741,7 @@ StmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) {

// Otherwise, eat the semicolon.
ExpectAndConsumeSemi(diag::err_expected_semi_after_expr);
return Actions.ActOnExprStmt(Res, isExprValueDiscarded());
return Actions.ActOnExprStmt(Res);
}

ExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) {
Expand Down
14 changes: 6 additions & 8 deletions clang/lib/Parse/ParseOpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ Parser::ParseOpenMPDeclareReductionDirective(AccessSpecifier AS) {
Actions.ActOnOpenMPDeclareReductionCombinerStart(getCurScope(), D);
ExprResult CombinerResult =
Actions.ActOnFinishFullExpr(ParseAssignmentExpression().get(),
D->getLocation(), /*DiscardedValue*/ false);
D->getLocation(), /*DiscardedValue=*/true);
Actions.ActOnOpenMPDeclareReductionCombinerEnd(D, CombinerResult.get());

if (CombinerResult.isInvalid() && Tok.isNot(tok::r_paren) &&
Expand Down Expand Up @@ -356,15 +356,15 @@ Parser::ParseOpenMPDeclareReductionDirective(AccessSpecifier AS) {
if (Actions.getLangOpts().CPlusPlus) {
InitializerResult = Actions.ActOnFinishFullExpr(
ParseAssignmentExpression().get(), D->getLocation(),
/*DiscardedValue*/ false);
/*DiscardedValue=*/true);
} else {
ConsumeToken();
ParseOpenMPReductionInitializerForDecl(OmpPrivParm);
}
} else {
InitializerResult = Actions.ActOnFinishFullExpr(
ParseAssignmentExpression().get(), D->getLocation(),
/*DiscardedValue*/ false);
/*DiscardedValue=*/true);
}
Actions.ActOnOpenMPDeclareReductionInitializerEnd(
D, InitializerResult.get(), OmpPrivParm);
Expand Down Expand Up @@ -1455,7 +1455,7 @@ ExprResult Parser::ParseOpenMPParensExpr(StringRef ClauseName,
ExprResult LHS(ParseCastExpression(
/*isUnaryExpression=*/false, /*isAddressOfOperand=*/false, NotTypeCast));
ExprResult Val(ParseRHSOfBinaryExpression(LHS, prec::Conditional));
Val = Actions.ActOnFinishFullExpr(Val.get(), ELoc, /*DiscardedValue*/ false);
Val = Actions.ActOnFinishFullExpr(Val.get(), ELoc);

// Parse ')'.
RLoc = Tok.getLocation();
Expand Down Expand Up @@ -1711,8 +1711,7 @@ OMPClause *Parser::ParseOpenMPSingleExprWithArgClause(OpenMPClauseKind Kind,
SourceLocation ELoc = Tok.getLocation();
ExprResult LHS(ParseCastExpression(false, false, NotTypeCast));
Val = ParseRHSOfBinaryExpression(LHS, prec::Conditional);
Val =
Actions.ActOnFinishFullExpr(Val.get(), ELoc, /*DiscardedValue*/ false);
Val = Actions.ActOnFinishFullExpr(Val.get(), ELoc);
}

// Parse ')'.
Expand Down Expand Up @@ -1997,8 +1996,7 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
Data.ColonLoc = Tok.getLocation();
SourceLocation ELoc = ConsumeToken();
ExprResult Tail = ParseAssignmentExpression();
Tail =
Actions.ActOnFinishFullExpr(Tail.get(), ELoc, /*DiscardedValue*/ false);
Tail = Actions.ActOnFinishFullExpr(Tail.get(), ELoc);
if (Tail.isUsable())
Data.TailExpr = Tail.get();
else
Expand Down
Loading