hanchenye-llvm-project/clang/lib/Serialization
Michael Kruse dc5ce72afa Append new attributes to the end of an AttributeList.
Recommit of r335084 after revert in r335516.

... instead of prepending it at the beginning (the original behavior
since implemented in r122535 2010-12-23). This builds up an
AttributeList in the the order in which the attributes appear in the
source.

The reverse order caused nodes for attributes in the AST (e.g. LoopHint)
to be in the reverse order, and therefore printed in the wrong order in
-ast-dump. Some TODO comments mention this. The order was explicitly
reversed for enable_if attribute overload resolution and name mangling,
which is not necessary anymore with this patch.

The change unfortunately has some secondary effect, especially on
diagnostic output. In the simplest cases, the CHECK lines or expected
diagnostic were changed to the the new output. If the kind of
error/warning changed, the attributes' order was changed instead.

This unfortunately causes some 'previous occurrence here' hints to be
textually after the main marker. This typically happens when attributes
are merged, but are incompatible to each other. Interchanging the role
of the the main and note SourceLocation will also cause the case where
two different declaration's attributes (in contrast to multiple
attributes of the same declaration) are merged to be reverse. There is
no easy fix because sometimes previous attributes are merged into a new
declaration's attribute list, sometimes new attributes are added to a
previous declaration's attribute list. Since 'previous occurrence here'
pointing to locations after the main marker is not rare, I left the
markers as-is; it is only relevant when the attributes are declared in
the same declaration anyway.

Differential Revision: https://reviews.llvm.org/D48100

llvm-svn: 338800
2018-08-03 01:21:16 +00:00
..
ASTCommon.cpp PR33924: merge local declarations that have linkage of some kind within 2018-07-04 02:25:38 +00:00
ASTCommon.h Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
ASTReader.cpp [modules] Defer merging deduced return types. 2018-08-03 01:00:01 +00:00
ASTReaderDecl.cpp Append new attributes to the end of an AttributeList. 2018-08-03 01:21:16 +00:00
ASTReaderInternals.h Remove trailing space 2018-07-30 19:24:48 +00:00
ASTReaderStmt.cpp [AST] Sink 'part of explicit cast' down into ImplicitCastExpr 2018-07-27 07:27:14 +00:00
ASTWriter.cpp [AST][1/4] Move the bit-fields from TagDecl, EnumDecl and RecordDecl into DeclContext 2018-08-01 20:48:16 +00:00
ASTWriterDecl.cpp Serialize DoesNotEscape. 2018-08-01 23:51:53 +00:00
ASTWriterStmt.cpp Remove trailing space 2018-07-30 19:24:48 +00:00
CMakeLists.txt
GeneratePCH.cpp
GlobalModuleIndex.cpp Support: Simplify endian stream interface. NFCI. 2018-05-18 19:46:24 +00:00
Module.cpp Remove trailing space 2018-07-30 19:24:48 +00:00
ModuleFileExtension.cpp
ModuleManager.cpp Remove trailing space 2018-07-30 19:24:48 +00:00
MultiOnDiskHashTable.h Support: Simplify endian stream interface. NFCI. 2018-05-18 19:46:24 +00:00