svn commit: r304311 - in projects/clang390-import/contrib/llvm/tools/clang: include/clang/AST include/clang/Analysis/Analyses include/clang/Basic include/clang/Sema include/clang/Serialization incl...
Dimitry Andric
dim at FreeBSD.org
Wed Aug 17 19:42:57 UTC 2016
Author: dim
Date: Wed Aug 17 19:42:52 2016
New Revision: 304311
URL: https://svnweb.freebsd.org/changeset/base/304311
Log:
Update clang to release_39 branch r278877.
Modified:
projects/clang390-import/contrib/llvm/tools/clang/include/clang/AST/ExternalASTSource.h
projects/clang390-import/contrib/llvm/tools/clang/include/clang/AST/StmtGraphTraits.h
projects/clang390-import/contrib/llvm/tools/clang/include/clang/Analysis/Analyses/Dominators.h
projects/clang390-import/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def
projects/clang390-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticASTKinds.td
projects/clang390-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticParseKinds.td
projects/clang390-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h
projects/clang390-import/contrib/llvm/tools/clang/include/clang/Serialization/ASTReader.h
projects/clang390-import/contrib/llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
projects/clang390-import/contrib/llvm/tools/clang/lib/AST/ASTDiagnostic.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/AST/DeclCXX.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/Analysis/CFG.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/Basic/Targets.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGBlocks.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGStmt.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CoverageMappingGen.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/Driver/ToolChains.h
projects/clang390-import/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/avx512fintrin.h
projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/avxintrin.h
projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/cpuid.h
projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/emmintrin.h
projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/xmmintrin.h
projects/clang390-import/contrib/llvm/tools/clang/lib/Lex/Pragma.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/Parse/ParseExpr.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/Parse/ParseExprCXX.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaExprCXX.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaLambda.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/TreeTransform.h
projects/clang390-import/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp
projects/clang390-import/contrib/llvm/tools/clang/lib/Serialization/ASTWriter.cpp
Directory Properties:
projects/clang390-import/contrib/llvm/tools/clang/ (props changed)
Modified: projects/clang390-import/contrib/llvm/tools/clang/include/clang/AST/ExternalASTSource.h
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/include/clang/AST/ExternalASTSource.h Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/include/clang/AST/ExternalASTSource.h Wed Aug 17 19:42:52 2016 (r304311)
@@ -503,8 +503,9 @@ public:
/// We define this as a wrapping iterator around an int. The
/// iterator_adaptor_base class forwards the iterator methods to basic integer
/// arithmetic.
- class iterator : public llvm::iterator_adaptor_base<
- iterator, int, std::random_access_iterator_tag, T, int> {
+ class iterator
+ : public llvm::iterator_adaptor_base<
+ iterator, int, std::random_access_iterator_tag, T, int, T *, T &> {
LazyVector *Self;
iterator(LazyVector *Self, int Position)
Modified: projects/clang390-import/contrib/llvm/tools/clang/include/clang/AST/StmtGraphTraits.h
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/include/clang/AST/StmtGraphTraits.h Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/include/clang/AST/StmtGraphTraits.h Wed Aug 17 19:42:52 2016 (r304311)
@@ -26,6 +26,7 @@ namespace llvm {
template <> struct GraphTraits<clang::Stmt*> {
typedef clang::Stmt NodeType;
+ typedef clang::Stmt * NodeRef;
typedef clang::Stmt::child_iterator ChildIteratorType;
typedef llvm::df_iterator<clang::Stmt*> nodes_iterator;
@@ -53,6 +54,7 @@ template <> struct GraphTraits<clang::St
template <> struct GraphTraits<const clang::Stmt*> {
typedef const clang::Stmt NodeType;
+ typedef const clang::Stmt * NodeRef;
typedef clang::Stmt::const_child_iterator ChildIteratorType;
typedef llvm::df_iterator<const clang::Stmt*> nodes_iterator;
Modified: projects/clang390-import/contrib/llvm/tools/clang/include/clang/Analysis/Analyses/Dominators.h
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/include/clang/Analysis/Analyses/Dominators.h Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/include/clang/Analysis/Analyses/Dominators.h Wed Aug 17 19:42:52 2016 (r304311)
@@ -168,6 +168,7 @@ private:
namespace llvm {
template <> struct GraphTraits< ::clang::DomTreeNode* > {
typedef ::clang::DomTreeNode NodeType;
+ typedef ::clang::DomTreeNode *NodeRef;
typedef NodeType::iterator ChildIteratorType;
static NodeType *getEntryNode(NodeType *N) {
Modified: projects/clang390-import/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def Wed Aug 17 19:42:52 2016 (r304311)
@@ -303,7 +303,9 @@ TARGET_BUILTIN(__builtin_ia32_pabsd128,
TARGET_BUILTIN(__builtin_ia32_ldmxcsr, "vUi", "", "sse")
TARGET_BUILTIN(__builtin_ia32_stmxcsr, "Ui", "", "sse")
TARGET_BUILTIN(__builtin_ia32_cvtss2si, "iV4f", "", "sse")
+TARGET_BUILTIN(__builtin_ia32_cvttss2si, "iV4f", "", "sse")
TARGET_BUILTIN(__builtin_ia32_cvtss2si64, "LLiV4f", "", "sse")
+TARGET_BUILTIN(__builtin_ia32_cvttss2si64, "LLiV4f", "", "sse")
TARGET_BUILTIN(__builtin_ia32_storehps, "vV2i*V4f", "", "sse")
TARGET_BUILTIN(__builtin_ia32_storelps, "vV2i*V4f", "", "sse")
TARGET_BUILTIN(__builtin_ia32_movmskps, "iV4f", "", "sse")
@@ -328,8 +330,12 @@ TARGET_BUILTIN(__builtin_ia32_cvtpd2dq,
TARGET_BUILTIN(__builtin_ia32_cvtpd2ps, "V4fV2d", "", "sse2")
TARGET_BUILTIN(__builtin_ia32_cvttpd2dq, "V4iV2d", "", "sse2")
TARGET_BUILTIN(__builtin_ia32_cvtsd2si, "iV2d", "", "sse2")
+TARGET_BUILTIN(__builtin_ia32_cvttsd2si, "iV2d", "", "sse2")
TARGET_BUILTIN(__builtin_ia32_cvtsd2si64, "LLiV2d", "", "sse2")
+TARGET_BUILTIN(__builtin_ia32_cvttsd2si64, "LLiV2d", "", "sse2")
+TARGET_BUILTIN(__builtin_ia32_cvtsd2ss, "V4fV4fV2d", "", "sse2")
TARGET_BUILTIN(__builtin_ia32_cvtps2dq, "V4iV4f", "", "sse2")
+TARGET_BUILTIN(__builtin_ia32_cvttps2dq, "V4iV4f", "", "sse2")
TARGET_BUILTIN(__builtin_ia32_clflush, "vvC*", "", "sse2")
TARGET_BUILTIN(__builtin_ia32_lfence, "v", "", "sse2")
TARGET_BUILTIN(__builtin_ia32_mfence, "v", "", "sse2")
@@ -455,7 +461,9 @@ TARGET_BUILTIN(__builtin_ia32_cmpss, "V4
TARGET_BUILTIN(__builtin_ia32_cvtdq2ps256, "V8fV8i", "", "avx")
TARGET_BUILTIN(__builtin_ia32_cvtpd2ps256, "V4fV4d", "", "avx")
TARGET_BUILTIN(__builtin_ia32_cvtps2dq256, "V8iV8f", "", "avx")
+TARGET_BUILTIN(__builtin_ia32_cvttpd2dq256, "V4iV4d", "", "avx")
TARGET_BUILTIN(__builtin_ia32_cvtpd2dq256, "V4iV4d", "", "avx")
+TARGET_BUILTIN(__builtin_ia32_cvttps2dq256, "V8iV8f", "", "avx")
TARGET_BUILTIN(__builtin_ia32_vperm2f128_pd256, "V4dV4dV4dIc", "", "avx")
TARGET_BUILTIN(__builtin_ia32_vperm2f128_ps256, "V8fV8fV8fIc", "", "avx")
TARGET_BUILTIN(__builtin_ia32_vperm2f128_si256, "V8iV8iV8iIc", "", "avx")
Modified: projects/clang390-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticASTKinds.td
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticASTKinds.td Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticASTKinds.td Wed Aug 17 19:42:52 2016 (r304311)
@@ -158,12 +158,6 @@ def warn_integer_constant_overflow : War
"overflow in expression; result is %0 with type %1">,
InGroup<DiagGroup<"integer-overflow">>;
-// This is a temporary diagnostic, and shall be removed once our
-// implementation is complete, and like the preceding constexpr notes belongs
-// in Sema.
-def note_unimplemented_constexpr_lambda_feature_ast : Note<
- "unimplemented constexpr lambda feature: %0 (coming soon!)">;
-
// inline asm related.
let CategoryName = "Inline Assembly Issue" in {
def err_asm_invalid_escape : Error<
Modified: projects/clang390-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticParseKinds.td
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticParseKinds.td Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticParseKinds.td Wed Aug 17 19:42:52 2016 (r304311)
@@ -780,20 +780,11 @@ def warn_cxx98_compat_lambda : Warning<
InGroup<CXX98Compat>, DefaultIgnore;
def err_lambda_missing_parens : Error<
"lambda requires '()' before %select{'mutable'|return type|"
- "attribute specifier|'constexpr'}0">;
-def err_lambda_decl_specifier_repeated : Error<
- "%select{'mutable'|'constexpr'}0 cannot appear multiple times in a lambda declarator">;
+ "attribute specifier}0">;
// C++1z lambda expressions
def err_expected_star_this_capture : Error<
"expected 'this' following '*' in lambda capture list">;
-// C++1z constexpr lambda expressions
-def warn_cxx14_compat_constexpr_on_lambda : Warning<
- "constexpr on lambda expressions is incompatible with C++ standards before C++1z">,
- InGroup<CXXPre1zCompat>, DefaultIgnore;
-def ext_constexpr_on_lambda_cxx1z : ExtWarn<
- "'constexpr' on lambda expressions is a C++1z extension">, InGroup<CXX1z>;
-
// Availability attribute
def err_expected_version : Error<
"expected a version of the form 'major[.minor[.subminor]]'">;
Modified: projects/clang390-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h Wed Aug 17 19:42:52 2016 (r304311)
@@ -5111,8 +5111,7 @@ public:
SourceRange IntroducerRange,
TypeSourceInfo *MethodType,
SourceLocation EndLoc,
- ArrayRef<ParmVarDecl *> Params,
- bool IsConstexprSpecified);
+ ArrayRef<ParmVarDecl *> Params);
/// \brief Endow the lambda scope info with the relevant properties.
void buildLambdaScope(sema::LambdaScopeInfo *LSI,
Modified: projects/clang390-import/contrib/llvm/tools/clang/include/clang/Serialization/ASTReader.h
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/include/clang/Serialization/ASTReader.h Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/include/clang/Serialization/ASTReader.h Wed Aug 17 19:42:52 2016 (r304311)
@@ -843,6 +843,9 @@ private:
/// \brief Whether we have tried loading the global module index yet.
bool TriedLoadingGlobalIndex;
+ ///\brief Whether we are currently processing update records.
+ bool ProcessingUpdateRecords;
+
typedef llvm::DenseMap<unsigned, SwitchCase *> SwitchCaseMapTy;
/// \brief Mapping from switch-case IDs in the chain to switch-case statements
///
@@ -1042,6 +1045,23 @@ private:
~ReadingKindTracker() { Reader.ReadingKind = PrevKind; }
};
+ /// \brief RAII object to mark the start of processing updates.
+ class ProcessingUpdatesRAIIObj {
+ ASTReader &Reader;
+ bool PrevState;
+
+ ProcessingUpdatesRAIIObj(const ProcessingUpdatesRAIIObj &) = delete;
+ void operator=(const ProcessingUpdatesRAIIObj &) = delete;
+
+ public:
+ ProcessingUpdatesRAIIObj(ASTReader &reader)
+ : Reader(reader), PrevState(Reader.ProcessingUpdateRecords) {
+ Reader.ProcessingUpdateRecords = true;
+ }
+
+ ~ProcessingUpdatesRAIIObj() { Reader.ProcessingUpdateRecords = PrevState; }
+ };
+
/// \brief Suggested contents of the predefines buffer, after this
/// PCH file has been processed.
///
@@ -2130,6 +2150,8 @@ public:
/// \brief Loads comments ranges.
void ReadComments() override;
+
+ bool isProcessingUpdateRecords() { return ProcessingUpdateRecords; }
};
/// \brief Helper class that saves the current stream position and
Modified: projects/clang390-import/contrib/llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h Wed Aug 17 19:42:52 2016 (r304311)
@@ -452,6 +452,7 @@ public:
namespace llvm {
template<> struct GraphTraits<clang::ento::ExplodedNode*> {
typedef clang::ento::ExplodedNode NodeType;
+ typedef clang::ento::ExplodedNode *NodeRef;
typedef NodeType::succ_iterator ChildIteratorType;
typedef llvm::df_iterator<NodeType*> nodes_iterator;
@@ -478,6 +479,7 @@ namespace llvm {
template<> struct GraphTraits<const clang::ento::ExplodedNode*> {
typedef const clang::ento::ExplodedNode NodeType;
+ typedef const clang::ento::ExplodedNode *NodeRef;
typedef NodeType::const_succ_iterator ChildIteratorType;
typedef llvm::df_iterator<NodeType*> nodes_iterator;
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/AST/ASTDiagnostic.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/AST/ASTDiagnostic.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/AST/ASTDiagnostic.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -917,6 +917,8 @@ class TemplateDiff {
/// template argument.
InternalIterator(const TemplateSpecializationType *TST)
: TST(TST), Index(0), CurrentTA(nullptr), EndTA(nullptr) {
+ if (!TST) return;
+
if (isEnd()) return;
// Set to first template argument. If not a parameter pack, done.
@@ -937,11 +939,13 @@ class TemplateDiff {
/// isEnd - Returns true if the iterator is one past the end.
bool isEnd() const {
+ assert(TST && "InternalIterator is invalid with a null TST.");
return Index >= TST->getNumArgs();
}
/// &operator++ - Increment the iterator to the next template argument.
InternalIterator &operator++() {
+ assert(TST && "InternalIterator is invalid with a null TST.");
if (isEnd()) {
return *this;
}
@@ -977,6 +981,7 @@ class TemplateDiff {
/// operator* - Returns the appropriate TemplateArgument.
reference operator*() const {
+ assert(TST && "InternalIterator is invalid with a null TST.");
assert(!isEnd() && "Index exceeds number of arguments.");
if (CurrentTA == EndTA)
return TST->getArg(Index);
@@ -986,6 +991,7 @@ class TemplateDiff {
/// operator-> - Allow access to the underlying TemplateArgument.
pointer operator->() const {
+ assert(TST && "InternalIterator is invalid with a null TST.");
return &operator*();
}
};
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/AST/DeclCXX.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/AST/DeclCXX.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/AST/DeclCXX.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -807,6 +807,17 @@ void CXXRecordDecl::addedMember(Decl *D)
data().DefaultedDestructorIsDeleted = true;
}
+ // For an anonymous union member, our overload resolution will perform
+ // overload resolution for its members.
+ if (Field->isAnonymousStructOrUnion()) {
+ data().NeedOverloadResolutionForMoveConstructor |=
+ FieldRec->data().NeedOverloadResolutionForMoveConstructor;
+ data().NeedOverloadResolutionForMoveAssignment |=
+ FieldRec->data().NeedOverloadResolutionForMoveAssignment;
+ data().NeedOverloadResolutionForDestructor |=
+ FieldRec->data().NeedOverloadResolutionForDestructor;
+ }
+
// C++0x [class.ctor]p5:
// A default constructor is trivial [...] if:
// -- for all the non-static data members of its class that are of
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -36,7 +36,6 @@
#include "clang/AST/APValue.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
-#include "clang/AST/ASTLambda.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/Expr.h"
#include "clang/AST/RecordLayout.h"
@@ -2126,22 +2125,7 @@ static bool evaluateVarDeclInit(EvalInfo
// If this is a local variable, dig out its value.
if (Frame) {
Result = Frame->getTemporary(VD);
- if (!Result) {
- // Assume variables referenced within a lambda's call operator that were
- // not declared within the call operator are captures and during checking
- // of a potential constant expression, assume they are unknown constant
- // expressions.
- assert(isLambdaCallOperator(Frame->Callee) &&
- (VD->getDeclContext() != Frame->Callee || VD->isInitCapture()) &&
- "missing value for local variable");
- if (Info.checkingPotentialConstantExpression())
- return false;
- // FIXME: implement capture evaluation during constant expr evaluation.
- Info.FFDiag(E->getLocStart(),
- diag::note_unimplemented_constexpr_lambda_feature_ast)
- << "captures not currently allowed";
- return false;
- }
+ assert(Result && "missing value for local variable");
return true;
}
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Analysis/CFG.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Analysis/CFG.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Analysis/CFG.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -3902,7 +3902,17 @@ CFGImplicitDtor::getDestructorDecl(ASTCo
case CFGElement::AutomaticObjectDtor: {
const VarDecl *var = castAs<CFGAutomaticObjDtor>().getVarDecl();
QualType ty = var->getType();
- ty = ty.getNonReferenceType();
+
+ // FIXME: See CFGBuilder::addLocalScopeForVarDecl.
+ //
+ // Lifetime-extending constructs are handled here. This works for a single
+ // temporary in an initializer expression.
+ if (ty->isReferenceType()) {
+ if (const Expr *Init = var->getInit()) {
+ ty = getReferenceInitTemporaryType(astContext, Init);
+ }
+ }
+
while (const ArrayType *arrayType = astContext.getAsArrayType(ty)) {
ty = arrayType->getElementType();
}
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Basic/Targets.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -7094,9 +7094,9 @@ class MipsTargetInfo : public TargetInfo
if (ABI == "o32")
Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64";
else if (ABI == "n32")
- Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+ Layout = "m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128";
else if (ABI == "n64")
- Layout = "m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+ Layout = "m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128";
else
llvm_unreachable("Invalid ABI");
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGBlocks.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGBlocks.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGBlocks.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -125,10 +125,15 @@ static llvm::Constant *buildBlockDescrip
llvm::Constant *init = llvm::ConstantStruct::getAnon(elements);
+ unsigned AddrSpace = 0;
+ if (C.getLangOpts().OpenCL)
+ AddrSpace = C.getTargetAddressSpace(LangAS::opencl_constant);
llvm::GlobalVariable *global =
new llvm::GlobalVariable(CGM.getModule(), init->getType(), true,
llvm::GlobalValue::InternalLinkage,
- init, "__block_descriptor_tmp");
+ init, "__block_descriptor_tmp", nullptr,
+ llvm::GlobalValue::NotThreadLocal,
+ AddrSpace);
return llvm::ConstantExpr::getBitCast(global, CGM.getBlockDescriptorType());
}
@@ -927,7 +932,10 @@ llvm::Type *CodeGenModule::getBlockDescr
UnsignedLongTy, UnsignedLongTy, nullptr);
// Now form a pointer to that.
- BlockDescriptorType = llvm::PointerType::getUnqual(BlockDescriptorType);
+ unsigned AddrSpace = 0;
+ if (getLangOpts().OpenCL)
+ AddrSpace = getContext().getTargetAddressSpace(LangAS::opencl_constant);
+ BlockDescriptorType = llvm::PointerType::get(BlockDescriptorType, AddrSpace);
return BlockDescriptorType;
}
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -2209,8 +2209,9 @@ RValue CodeGenFunction::EmitBuiltinExpr(
NewArg = Builder.CreateAddrSpaceCast(Arg0, NewArgT);
else
NewArg = Builder.CreateBitOrPointerCast(Arg0, NewArgT);
- auto NewCall = Builder.CreateCall(CGM.CreateRuntimeFunction(FTy,
- E->getDirectCallee()->getName()), {NewArg});
+ auto NewName = std::string("__") + E->getDirectCallee()->getName().str();
+ auto NewCall =
+ Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, NewName), {NewArg});
return RValue::get(Builder.CreateBitOrPointerCast(NewCall,
ConvertType(E->getType())));
}
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -3637,6 +3637,16 @@ void CGDebugInfo::EmitUsingDecl(const Us
// Emitting one decl is sufficient - debuggers can detect that this is an
// overloaded name & provide lookup for all the overloads.
const UsingShadowDecl &USD = **UD.shadow_begin();
+
+ // FIXME: Skip functions with undeduced auto return type for now since we
+ // don't currently have the plumbing for separate declarations & definitions
+ // of free functions and mismatched types (auto in the declaration, concrete
+ // return type in the definition)
+ if (const auto *FD = dyn_cast<FunctionDecl>(USD.getUnderlyingDecl()))
+ if (const auto *AT =
+ FD->getType()->getAs<FunctionProtoType>()->getContainedAutoType())
+ if (AT->getDeducedType().isNull())
+ return;
if (llvm::DINode *Target =
getDeclarationOrDefinition(USD.getUnderlyingDecl()))
DBuilder.createImportedDeclaration(
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGStmt.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGStmt.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CGStmt.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -620,14 +620,7 @@ void CodeGenFunction::EmitIfStmt(const I
RunCleanupsScope ThenScope(*this);
EmitStmt(S.getThen());
}
- {
- auto CurBlock = Builder.GetInsertBlock();
- EmitBranch(ContBlock);
- // Eliminate any empty blocks that may have been created by nested
- // control flow statements in the 'then' clause.
- if (CurBlock)
- SimplifyForwardingBlocks(CurBlock);
- }
+ EmitBranch(ContBlock);
// Emit the 'else' code if present.
if (const Stmt *Else = S.getElse()) {
@@ -643,12 +636,7 @@ void CodeGenFunction::EmitIfStmt(const I
{
// There is no need to emit line number for an unconditional branch.
auto NL = ApplyDebugLocation::CreateEmpty(*this);
- auto CurBlock = Builder.GetInsertBlock();
EmitBranch(ContBlock);
- // Eliminate any empty blocks that may have been created by nested
- // control flow statements emitted in the 'else' clause.
- if (CurBlock)
- SimplifyForwardingBlocks(CurBlock);
}
}
@@ -1261,6 +1249,14 @@ void CodeGenFunction::EmitCaseStmt(const
}
void CodeGenFunction::EmitDefaultStmt(const DefaultStmt &S) {
+ // If there is no enclosing switch instance that we're aware of, then this
+ // default statement can be elided. This situation only happens when we've
+ // constant-folded the switch.
+ if (!SwitchInsn) {
+ EmitStmt(S.getSubStmt());
+ return;
+ }
+
llvm::BasicBlock *DefaultBlock = SwitchInsn->getDefaultDest();
assert(DefaultBlock->empty() &&
"EmitDefaultStmt: Default block already defined?");
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CoverageMappingGen.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CoverageMappingGen.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/CodeGen/CoverageMappingGen.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -351,6 +351,9 @@ struct EmptyCoverageMappingBuilder : pub
gatherFileIDs(FileIDMapping);
emitSourceRegions();
+ if (MappingRegions.empty())
+ return;
+
CoverageMappingWriter Writer(FileIDMapping, None, MappingRegions);
Writer.write(OS);
}
@@ -604,6 +607,9 @@ struct CounterCoverageMappingBuilder
emitExpansionRegions();
gatherSkippedRegions();
+ if (MappingRegions.empty())
+ return;
+
CoverageMappingWriter Writer(VirtualFileMapping, Builder.getExpressions(),
MappingRegions);
Writer.write(OS);
@@ -620,6 +626,11 @@ struct CounterCoverageMappingBuilder
void VisitDecl(const Decl *D) {
Stmt *Body = D->getBody();
+
+ // Do not propagate region counts into system headers.
+ if (Body && SM.isInSystemHeader(SM.getSpellingLoc(getStart(Body))))
+ return;
+
propagateCounts(getRegionCounter(Body), Body);
}
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -3281,6 +3281,19 @@ Tool *CloudABI::buildLinker() const {
return new tools::cloudabi::Linker(*this);
}
+bool CloudABI::isPIEDefault() const {
+ // Only enable PIE on architectures that support PC-relative
+ // addressing. PC-relative addressing is required, as the process
+ // startup code must be able to relocate itself.
+ switch (getTriple().getArch()) {
+ case llvm::Triple::aarch64:
+ case llvm::Triple::x86_64:
+ return true;
+ default:
+ return false;
+ }
+}
+
SanitizerMask CloudABI::getSupportedSanitizers() const {
SanitizerMask Res = ToolChain::getSupportedSanitizers();
Res |= SanitizerKind::SafeStack;
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Driver/ToolChains.h
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Driver/ToolChains.h Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Driver/ToolChains.h Wed Aug 17 19:42:52 2016 (r304311)
@@ -634,8 +634,7 @@ public:
void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
- bool isPIEDefault() const override { return true; }
-
+ bool isPIEDefault() const override;
SanitizerMask getSupportedSanitizers() const override;
SanitizerMask getDefaultSanitizers() const override;
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -3258,7 +3258,7 @@ static bool shouldUseFramePointerForTarg
break;
}
- if (Triple.isOSLinux()) {
+ if (Triple.isOSLinux() || Triple.getOS() == llvm::Triple::CloudABI) {
switch (Triple.getArch()) {
// Don't use a frame pointer on linux if optimizing for certain targets.
case llvm::Triple::mips64:
@@ -4568,8 +4568,8 @@ void Clang::ConstructJob(Compilation &C,
options::OPT_gdwarf_4, options::OPT_gdwarf_5))
DwarfVersion = DwarfVersionNum(A->getSpelling());
- // Forward -gcodeview.
- // 'EmitCodeView might have been set by CL-compatibility argument parsing.
+ // Forward -gcodeview. EmitCodeView might have been set by CL-compatibility
+ // argument parsing.
if (Args.hasArg(options::OPT_gcodeview) || EmitCodeView) {
// DwarfVersion remains at 0 if no explicit choice was made.
CmdArgs.push_back("-gcodeview");
@@ -5020,9 +5020,13 @@ void Clang::ConstructJob(Compilation &C,
Args.AddLastArg(CmdArgs, options::OPT_fdiagnostics_show_template_tree);
Args.AddLastArg(CmdArgs, options::OPT_fno_elide_type);
- // Forward flags for OpenMP
+ // Forward flags for OpenMP. We don't do this if the current action is an
+ // device offloading action.
+ //
+ // TODO: Allow OpenMP offload actions when they become available.
if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
- options::OPT_fno_openmp, false)) {
+ options::OPT_fno_openmp, false) &&
+ JA.isDeviceOffloading(Action::OFK_None)) {
switch (getOpenMPRuntime(getToolChain(), Args)) {
case OMPRT_OMP:
case OMPRT_IOMP5:
@@ -6354,9 +6358,10 @@ void Clang::AddClangCLArgs(const ArgList
CmdArgs.push_back(Args.MakeArgString(Twine(LangOptions::SSPStrong)));
}
- // Emit CodeView if -Z7 or -Zd are present.
+ // Emit CodeView if -Z7, -Zd, or -gline-tables-only are present.
if (Arg *DebugInfoArg =
- Args.getLastArg(options::OPT__SLASH_Z7, options::OPT__SLASH_Zd)) {
+ Args.getLastArg(options::OPT__SLASH_Z7, options::OPT__SLASH_Zd,
+ options::OPT_gline_tables_only)) {
*EmitCodeView = true;
if (DebugInfoArg->getOption().matches(options::OPT__SLASH_Z7))
*DebugInfoKind = codegenoptions::LimitedDebugInfo;
@@ -7453,11 +7458,13 @@ void cloudabi::Linker::ConstructJob(Comp
// CloudABI only supports static linkage.
CmdArgs.push_back("-Bstatic");
-
- // CloudABI uses Position Independent Executables exclusively.
- CmdArgs.push_back("-pie");
CmdArgs.push_back("--no-dynamic-linker");
- CmdArgs.push_back("-zrelro");
+
+ // Provide PIE linker flags in case PIE is default for the architecture.
+ if (ToolChain.isPIEDefault()) {
+ CmdArgs.push_back("-pie");
+ CmdArgs.push_back("-zrelro");
+ }
CmdArgs.push_back("--eh-frame-hdr");
CmdArgs.push_back("--gc-sections");
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/avx512fintrin.h
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/avx512fintrin.h Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/avx512fintrin.h Wed Aug 17 19:42:52 2016 (r304311)
@@ -7484,7 +7484,6 @@ _mm512_mask_cvtsepi64_storeu_epi8 (void
static __inline__ __m256i __DEFAULT_FN_ATTRS
_mm512_cvtsepi64_epi32 (__m512i __A)
{
- __v8si __O;
return (__m256i) __builtin_ia32_pmovsqd512_mask ((__v8di) __A,
(__v8si) _mm256_undefined_si256 (),
(__mmask8) -1);
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/avxintrin.h
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/avxintrin.h Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/avxintrin.h Wed Aug 17 19:42:52 2016 (r304311)
@@ -2117,7 +2117,7 @@ _mm256_cvtps_pd(__m128 __a)
static __inline __m128i __DEFAULT_FN_ATTRS
_mm256_cvttpd_epi32(__m256d __a)
{
- return (__m128i)__builtin_convertvector((__v4df) __a, __v4si);
+ return (__m128i)__builtin_ia32_cvttpd2dq256((__v4df) __a);
}
static __inline __m128i __DEFAULT_FN_ATTRS
@@ -2129,7 +2129,7 @@ _mm256_cvtpd_epi32(__m256d __a)
static __inline __m256i __DEFAULT_FN_ATTRS
_mm256_cvttps_epi32(__m256 __a)
{
- return (__m256i)__builtin_convertvector((__v8sf) __a, __v8si);
+ return (__m256i)__builtin_ia32_cvttps2dq256((__v8sf) __a);
}
static __inline double __DEFAULT_FN_ATTRS
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/cpuid.h
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/cpuid.h Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/cpuid.h Wed Aug 17 19:42:52 2016 (r304311)
@@ -82,6 +82,7 @@
/* Features in %ecx for level 1 */
#define bit_SSE3 0x00000001
#define bit_PCLMULQDQ 0x00000002
+#define bit_PCLMUL bit_PCLMULQDQ /* for gcc compat */
#define bit_DTES64 0x00000004
#define bit_MONITOR 0x00000008
#define bit_DSCPL 0x00000010
@@ -98,15 +99,19 @@
#define bit_PCID 0x00020000
#define bit_DCA 0x00040000
#define bit_SSE41 0x00080000
+#define bit_SSE4_1 bit_SSE41 /* for gcc compat */
#define bit_SSE42 0x00100000
+#define bit_SSE4_2 bit_SSE42 /* for gcc compat */
#define bit_x2APIC 0x00200000
#define bit_MOVBE 0x00400000
#define bit_POPCNT 0x00800000
#define bit_TSCDeadline 0x01000000
#define bit_AESNI 0x02000000
+#define bit_AES bit_AESNI /* for gcc compat */
#define bit_XSAVE 0x04000000
#define bit_OSXSAVE 0x08000000
#define bit_AVX 0x10000000
+#define bit_F16C 0x20000000
#define bit_RDRND 0x40000000
/* Features in %edx for level 1 */
@@ -119,6 +124,7 @@
#define bit_PAE 0x00000040
#define bit_MCE 0x00000080
#define bit_CX8 0x00000100
+#define bit_CMPXCHG8B bit_CX8 /* for gcc compat */
#define bit_APIC 0x00000200
#define bit_SEP 0x00000800
#define bit_MTRR 0x00001000
@@ -133,7 +139,7 @@
#define bit_ACPI 0x00400000
#define bit_MMX 0x00800000
#define bit_FXSR 0x01000000
-#define bit_FXSAVE bit_FXSR /* for gcc compat */
+#define bit_FXSAVE bit_FXSR /* for gcc compat */
#define bit_SSE 0x02000000
#define bit_SSE2 0x04000000
#define bit_SS 0x08000000
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/emmintrin.h
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/emmintrin.h Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/emmintrin.h Wed Aug 17 19:42:52 2016 (r304311)
@@ -417,8 +417,7 @@ _mm_cvtsd_si32(__m128d __a)
static __inline__ __m128 __DEFAULT_FN_ATTRS
_mm_cvtsd_ss(__m128 __a, __m128d __b)
{
- __a[0] = __b[0];
- return __a;
+ return (__m128)__builtin_ia32_cvtsd2ss((__v4sf)__a, (__v2df)__b);
}
static __inline__ __m128d __DEFAULT_FN_ATTRS
@@ -444,7 +443,7 @@ _mm_cvttpd_epi32(__m128d __a)
static __inline__ int __DEFAULT_FN_ATTRS
_mm_cvttsd_si32(__m128d __a)
{
- return __a[0];
+ return __builtin_ia32_cvttsd2si((__v2df)__a);
}
static __inline__ __m64 __DEFAULT_FN_ATTRS
@@ -1707,7 +1706,7 @@ _mm_cvtsd_si64(__m128d __a)
static __inline__ long long __DEFAULT_FN_ATTRS
_mm_cvttsd_si64(__m128d __a)
{
- return __a[0];
+ return __builtin_ia32_cvttsd2si64((__v2df)__a);
}
#endif
@@ -1755,7 +1754,7 @@ _mm_cvtps_epi32(__m128 __a)
static __inline__ __m128i __DEFAULT_FN_ATTRS
_mm_cvttps_epi32(__m128 __a)
{
- return (__m128i)__builtin_convertvector((__v4sf)__a, __v4si);
+ return (__m128i)__builtin_ia32_cvttps2dq((__v4sf)__a);
}
/// \brief Returns a vector of [4 x i32] where the lowest element is the input
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/xmmintrin.h
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/xmmintrin.h Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Headers/xmmintrin.h Wed Aug 17 19:42:52 2016 (r304311)
@@ -1350,7 +1350,7 @@ _mm_cvt_ps2pi(__m128 __a)
static __inline__ int __DEFAULT_FN_ATTRS
_mm_cvttss_si32(__m128 __a)
{
- return __a[0];
+ return __builtin_ia32_cvttss2si((__v4sf)__a);
}
/// \brief Converts a float value contained in the lower 32 bits of a vector of
@@ -1386,7 +1386,7 @@ _mm_cvtt_ss2si(__m128 __a)
static __inline__ long long __DEFAULT_FN_ATTRS
_mm_cvttss_si64(__m128 __a)
{
- return __a[0];
+ return __builtin_ia32_cvttss2si64((__v4sf)__a);
}
/// \brief Converts two low-order float values in a 128-bit vector of
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Lex/Pragma.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Lex/Pragma.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Lex/Pragma.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -354,7 +354,9 @@ void Preprocessor::HandleMicrosoft__prag
/// HandlePragmaOnce - Handle \#pragma once. OnceTok is the 'once'.
///
void Preprocessor::HandlePragmaOnce(Token &OnceTok) {
- if (isInPrimaryFile()) {
+ // Don't honor the 'once' when handling the primary source file, unless
+ // this is a prefix to a TU, which indicates we're generating a PCH file.
+ if (isInPrimaryFile() && TUKind != TU_Prefix) {
Diag(OnceTok, diag::pp_pragma_once_in_main_file);
return;
}
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Parse/ParseExpr.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Parse/ParseExpr.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Parse/ParseExpr.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -447,14 +447,15 @@ Parser::ParseRHSOfBinaryExpression(ExprR
LHS = Actions.ActOnBinOp(getCurScope(), OpToken.getLocation(),
OpToken.getKind(), LHS.get(), RHS.get());
- // In this case, ActOnBinOp performed the CorrectDelayedTyposInExpr check.
- if (!getLangOpts().CPlusPlus)
- continue;
} else {
LHS = Actions.ActOnConditionalOp(OpToken.getLocation(), ColonLoc,
LHS.get(), TernaryMiddle.get(),
RHS.get());
}
+ // In this case, ActOnBinOp or ActOnConditionalOp performed the
+ // CorrectDelayedTyposInExpr check.
+ if (!getLangOpts().CPlusPlus)
+ continue;
}
// Ensure potential typos aren't left undiagnosed.
if (LHS.isInvalid()) {
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Parse/ParseExprCXX.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Parse/ParseExprCXX.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Parse/ParseExprCXX.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -1053,58 +1053,6 @@ bool Parser::TryParseLambdaIntroducer(La
return false;
}
-static void
-tryConsumeMutableOrConstexprToken(Parser &P, SourceLocation &MutableLoc,
- SourceLocation &ConstexprLoc,
- SourceLocation &DeclEndLoc) {
- assert(MutableLoc.isInvalid());
- assert(ConstexprLoc.isInvalid());
- // Consume constexpr-opt mutable-opt in any sequence, and set the DeclEndLoc
- // to the final of those locations. Emit an error if we have multiple
- // copies of those keywords and recover.
-
- while (true) {
- switch (P.getCurToken().getKind()) {
- case tok::kw_mutable: {
- if (MutableLoc.isValid()) {
- P.Diag(P.getCurToken().getLocation(),
- diag::err_lambda_decl_specifier_repeated)
- << 0 << FixItHint::CreateRemoval(P.getCurToken().getLocation());
- }
- MutableLoc = P.ConsumeToken();
- DeclEndLoc = MutableLoc;
- break /*switch*/;
- }
- case tok::kw_constexpr:
- if (ConstexprLoc.isValid()) {
- P.Diag(P.getCurToken().getLocation(),
- diag::err_lambda_decl_specifier_repeated)
- << 1 << FixItHint::CreateRemoval(P.getCurToken().getLocation());
- }
- ConstexprLoc = P.ConsumeToken();
- DeclEndLoc = ConstexprLoc;
- break /*switch*/;
- default:
- return;
- }
- }
-}
-
-static void
-addConstexprToLambdaDeclSpecifier(Parser &P, SourceLocation ConstexprLoc,
- DeclSpec &DS) {
- if (ConstexprLoc.isValid()) {
- P.Diag(ConstexprLoc, !P.getLangOpts().CPlusPlus1z
- ? diag::ext_constexpr_on_lambda_cxx1z
- : diag::warn_cxx14_compat_constexpr_on_lambda);
- const char *PrevSpec = nullptr;
- unsigned DiagID = 0;
- DS.SetConstexprSpec(ConstexprLoc, PrevSpec, DiagID);
- assert(PrevSpec == nullptr && DiagID == 0 &&
- "Constexpr cannot have been set previously!");
- }
-}
-
/// ParseLambdaExpressionAfterIntroducer - Parse the rest of a lambda
/// expression.
ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
@@ -1163,13 +1111,10 @@ ExprResult Parser::ParseLambdaExpression
// compatible with MSVC.
MaybeParseMicrosoftDeclSpecs(Attr, &DeclEndLoc);
- // Parse mutable-opt and/or constexpr-opt, and update the DeclEndLoc.
+ // Parse 'mutable'[opt].
SourceLocation MutableLoc;
- SourceLocation ConstexprLoc;
- tryConsumeMutableOrConstexprToken(*this, MutableLoc, ConstexprLoc,
- DeclEndLoc);
-
- addConstexprToLambdaDeclSpecifier(*this, ConstexprLoc, DS);
+ if (TryConsumeToken(tok::kw_mutable, MutableLoc))
+ DeclEndLoc = MutableLoc;
// Parse exception-specification[opt].
ExceptionSpecificationType ESpecType = EST_None;
@@ -1227,8 +1172,7 @@ ExprResult Parser::ParseLambdaExpression
LParenLoc, FunLocalRangeEnd, D,
TrailingReturnType),
Attr, DeclEndLoc);
- } else if (Tok.isOneOf(tok::kw_mutable, tok::arrow, tok::kw___attribute,
- tok::kw_constexpr) ||
+ } else if (Tok.isOneOf(tok::kw_mutable, tok::arrow, tok::kw___attribute) ||
(Tok.is(tok::l_square) && NextToken().is(tok::l_square))) {
// It's common to forget that one needs '()' before 'mutable', an attribute
// specifier, or the result type. Deal with this.
@@ -1238,7 +1182,6 @@ ExprResult Parser::ParseLambdaExpression
case tok::arrow: TokKind = 1; break;
case tok::kw___attribute:
case tok::l_square: TokKind = 2; break;
- case tok::kw_constexpr: TokKind = 3; break;
default: llvm_unreachable("Unknown token kind");
}
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -6523,6 +6523,12 @@ CheckReturnStackAddr(Sema &S, Expr *RetV
if (!stackE)
return; // Nothing suspicious was found.
+ // Parameters are initalized in the calling scope, so taking the address
+ // of a parameter reference doesn't need a warning.
+ for (auto *DRE : refVars)
+ if (isa<ParmVarDecl>(DRE->getDecl()))
+ return;
+
SourceLocation diagLoc;
SourceRange diagRange;
if (refVars.empty()) {
@@ -6546,6 +6552,13 @@ CheckReturnStackAddr(Sema &S, Expr *RetV
} else if (isa<AddrLabelExpr>(stackE)) { // address of label.
S.Diag(diagLoc, diag::warn_ret_addr_label) << diagRange;
} else { // local temporary.
+ // If there is an LValue->RValue conversion, then the value of the
+ // reference type is used, not the reference.
+ if (auto *ICE = dyn_cast<ImplicitCastExpr>(RetValExp)) {
+ if (ICE->getCastKind() == CK_LValueToRValue) {
+ return;
+ }
+ }
S.Diag(diagLoc, diag::warn_ret_local_temp_addr_ref)
<< lhsType->isReferenceType() << diagRange;
}
@@ -7776,6 +7789,12 @@ bool AnalyzeBitFieldAssignment(Sema &S,
unsigned OriginalWidth = Value.getBitWidth();
unsigned FieldWidth = Bitfield->getBitWidthValue(S.Context);
+ if (Value.isSigned() && Value.isNegative())
+ if (UnaryOperator *UO = dyn_cast<UnaryOperator>(OriginalInit))
+ if (UO->getOpcode() == UO_Minus)
+ if (isa<IntegerLiteral>(UO->getSubExpr()))
+ OriginalWidth = Value.getMinSignedBits();
+
if (OriginalWidth <= FieldWidth)
return false;
@@ -9372,7 +9391,8 @@ void Sema::CheckUnsequencedOperations(Ex
void Sema::CheckCompletedExpr(Expr *E, SourceLocation CheckLoc,
bool IsConstexpr) {
CheckImplicitConversions(E, CheckLoc);
- CheckUnsequencedOperations(E);
+ if (!E->isInstantiationDependent())
+ CheckUnsequencedOperations(E);
if (!IsConstexpr && !E->isValueDependent())
CheckForIntOverflow(E);
}
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaExprCXX.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaExprCXX.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaExprCXX.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -961,32 +961,26 @@ static QualType adjustCVQualifiersForCXX
QualType Sema::getCurrentThisType() {
DeclContext *DC = getFunctionLevelDeclContext();
QualType ThisTy = CXXThisTypeOverride;
+
if (CXXMethodDecl *method = dyn_cast<CXXMethodDecl>(DC)) {
if (method && method->isInstance())
ThisTy = method->getThisType(Context);
}
- if (ThisTy.isNull()) {
- if (isGenericLambdaCallOperatorSpecialization(CurContext) &&
- CurContext->getParent()->getParent()->isRecord()) {
- // This is a generic lambda call operator that is being instantiated
- // within a default initializer - so use the enclosing class as 'this'.
- // There is no enclosing member function to retrieve the 'this' pointer
- // from.
-
- // FIXME: This looks wrong. If we're in a lambda within a lambda within a
- // default member initializer, we need to recurse up more parents to find
- // the right context. Looks like we should be walking up to the parent of
- // the closure type, checking whether that is itself a lambda, and if so,
- // recursing, until we reach a class or a function that isn't a lambda
- // call operator. And we should accumulate the constness of *this on the
- // way.
-
- QualType ClassTy = Context.getTypeDeclType(
- cast<CXXRecordDecl>(CurContext->getParent()->getParent()));
- // There are no cv-qualifiers for 'this' within default initializers,
- // per [expr.prim.general]p4.
- ThisTy = Context.getPointerType(ClassTy);
- }
+
+ if (ThisTy.isNull() && isLambdaCallOperator(CurContext) &&
+ !ActiveTemplateInstantiations.empty()) {
+
+ assert(isa<CXXRecordDecl>(DC) &&
+ "Trying to get 'this' type from static method?");
+
+ // This is a lambda call operator that is being instantiated as a default
+ // initializer. DC must point to the enclosing class type, so we can recover
+ // the 'this' type from it.
+
+ QualType ClassTy = Context.getTypeDeclType(cast<CXXRecordDecl>(DC));
+ // There are no cv-qualifiers for 'this' within default initializers,
+ // per [expr.prim.general]p4.
+ ThisTy = Context.getPointerType(ClassTy);
}
// If we are within a lambda's call operator, the cv-qualifiers of 'this'
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaLambda.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaLambda.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaLambda.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -355,8 +355,7 @@ CXXMethodDecl *Sema::startLambdaDefiniti
SourceRange IntroducerRange,
TypeSourceInfo *MethodTypeInfo,
SourceLocation EndLoc,
- ArrayRef<ParmVarDecl *> Params,
- const bool IsConstexprSpecified) {
+ ArrayRef<ParmVarDecl *> Params) {
QualType MethodType = MethodTypeInfo->getType();
TemplateParameterList *TemplateParams =
getGenericLambdaTemplateParameterList(getCurLambda(), *this);
@@ -393,7 +392,7 @@ CXXMethodDecl *Sema::startLambdaDefiniti
MethodType, MethodTypeInfo,
SC_None,
/*isInline=*/true,
- IsConstexprSpecified,
+ /*isConstExpr=*/false,
EndLoc);
Method->setAccess(AS_public);
@@ -878,9 +877,8 @@ void Sema::ActOnStartOfLambdaDefinition(
CXXRecordDecl *Class = createLambdaClosureType(Intro.Range, MethodTyInfo,
KnownDependent, Intro.Default);
- CXXMethodDecl *Method =
- startLambdaDefinition(Class, Intro.Range, MethodTyInfo, EndLoc, Params,
- ParamInfo.getDeclSpec().isConstexprSpecified());
+ CXXMethodDecl *Method = startLambdaDefinition(Class, Intro.Range,
+ MethodTyInfo, EndLoc, Params);
if (ExplicitParams)
CheckCXXDefaultArguments(Method);
@@ -1599,17 +1597,6 @@ ExprResult Sema::BuildLambdaExpr(SourceL
CaptureInits, ArrayIndexVars,
ArrayIndexStarts, EndLoc,
ContainsUnexpandedParameterPack);
- // If the lambda expression's call operator is not explicitly marked constexpr
- // and we are not in a dependent context, analyze the call operator to infer
- // its constexpr-ness, supressing diagnostics while doing so.
- if (getLangOpts().CPlusPlus1z && !CallOperator->isInvalidDecl() &&
- !CallOperator->isConstexpr() &&
- !Class->getDeclContext()->isDependentContext()) {
- TentativeAnalysisScope DiagnosticScopeGuard(*this);
- CallOperator->setConstexpr(
- CheckConstexprFunctionDecl(CallOperator) &&
- CheckConstexprFunctionBody(CallOperator, CallOperator->getBody()));
- }
if (!CurContext->isDependentContext()) {
switch (ExprEvalContexts.back().Context) {
Modified: projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp Wed Aug 17 19:41:29 2016 (r304310)
+++ projects/clang390-import/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp Wed Aug 17 19:42:52 2016 (r304311)
@@ -5975,8 +5975,12 @@ EnableIfAttr *Sema::CheckEnableIf(Functi
SmallVector<Expr *, 16> ConvertedArgs;
bool InitializationFailed = false;
+ // Ignore any variadic parameters. Converting them is pointless, since the
+ // user can't refer to them in the enable_if condition.
+ unsigned ArgSizeNoVarargs = std::min(Function->param_size(), Args.size());
+
// Convert the arguments.
- for (unsigned I = 0, E = Args.size(); I != E; ++I) {
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list