aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2015-03-23 12:09:02 -0700
committerStephen Hines <srhines@google.com>2015-03-31 17:07:53 -0700
commit0e2c34f92f00628d48968dfea096d36381f494cb (patch)
tree03a142fc9174f13e1e3120853592c56778f14fe5 /include
parentf6595cb19f570efe109abe570c726ebd7afd3973 (diff)
downloadclang-0e2c34f92f00628d48968dfea096d36381f494cb.tar.gz
Update aosp/master clang for rebase to r230699.
Change-Id: I6a546ab3d4ae37119eebb735e102cca4f80ab520
Diffstat (limited to 'include')
-rw-r--r--include/clang-c/Index.h19
-rw-r--r--include/clang/AST/ASTConsumer.h6
-rw-r--r--include/clang/AST/ASTContext.h8
-rw-r--r--include/clang/AST/ASTTypeTraits.h61
-rw-r--r--include/clang/AST/ASTUnresolvedSet.h2
-rw-r--r--include/clang/AST/CanonicalType.h110
-rw-r--r--include/clang/AST/CommentCommandTraits.h4
-rw-r--r--include/clang/AST/CommentLexer.h4
-rw-r--r--include/clang/AST/CommentParser.h4
-rw-r--r--include/clang/AST/CommentSema.h4
-rw-r--r--include/clang/AST/Decl.h33
-rw-r--r--include/clang/AST/DeclBase.h86
-rw-r--r--include/clang/AST/DeclCXX.h9
-rw-r--r--include/clang/AST/DeclContextInternals.h16
-rw-r--r--include/clang/AST/DeclLookups.h10
-rw-r--r--include/clang/AST/DeclObjC.h4
-rw-r--r--include/clang/AST/DeclTemplate.h107
-rw-r--r--include/clang/AST/DeclarationName.h6
-rw-r--r--include/clang/AST/DependentDiagnostic.h3
-rw-r--r--include/clang/AST/EvaluatedExprVisitor.h11
-rw-r--r--include/clang/AST/Expr.h56
-rw-r--r--include/clang/AST/ExprCXX.h29
-rw-r--r--include/clang/AST/ExprObjC.h9
-rw-r--r--include/clang/AST/ExternalASTSource.h2
-rw-r--r--include/clang/AST/Mangle.h6
-rw-r--r--include/clang/AST/NestedNameSpecifier.h4
-rw-r--r--include/clang/AST/RecordLayout.h4
-rw-r--r--include/clang/AST/RecursiveASTVisitor.h20
-rw-r--r--include/clang/AST/Stmt.h8
-rw-r--r--include/clang/AST/StmtIterator.h4
-rw-r--r--include/clang/AST/StmtOpenMP.h299
-rw-r--r--include/clang/AST/TemplateBase.h4
-rw-r--r--include/clang/AST/Type.h68
-rw-r--r--include/clang/AST/TypeLoc.h2
-rw-r--r--include/clang/AST/TypeNodes.def2
-rw-r--r--include/clang/AST/UnresolvedSet.h88
-rw-r--r--include/clang/ASTMatchers/ASTMatchFinder.h4
-rw-r--r--include/clang/ASTMatchers/ASTMatchers.h139
-rw-r--r--include/clang/ASTMatchers/ASTMatchersInternal.h256
-rw-r--r--include/clang/ASTMatchers/ASTMatchersMacros.h13
-rw-r--r--include/clang/ASTMatchers/Dynamic/Registry.h2
-rw-r--r--include/clang/ASTMatchers/Dynamic/VariantValue.h2
-rw-r--r--include/clang/Analysis/Analyses/FormatString.h13
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafety.h13
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafetyCommon.h13
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafetyTIL.h13
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafetyTraverse.h1
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafetyUtil.h13
-rw-r--r--include/clang/Analysis/AnalysisContext.h4
-rw-r--r--include/clang/Analysis/CFG.h2
-rw-r--r--include/clang/Basic/AddressSpaces.h1
-rw-r--r--include/clang/Basic/Attr.td99
-rw-r--r--include/clang/Basic/AttrDocs.td167
-rw-r--r--include/clang/Basic/Attributes.h4
-rw-r--r--include/clang/Basic/Builtins.def36
-rw-r--r--include/clang/Basic/Builtins.h4
-rw-r--r--include/clang/Basic/BuiltinsARM.def4
-rw-r--r--include/clang/Basic/BuiltinsNVPTX.def30
-rw-r--r--include/clang/Basic/BuiltinsR600.def2
-rw-r--r--include/clang/Basic/BuiltinsX86.def213
-rw-r--r--include/clang/Basic/Diagnostic.h20
-rw-r--r--include/clang/Basic/DiagnosticCommonKinds.td15
-rw-r--r--include/clang/Basic/DiagnosticDriverKinds.td6
-rw-r--r--include/clang/Basic/DiagnosticFrontendKinds.td4
-rw-r--r--include/clang/Basic/DiagnosticGroups.td20
-rw-r--r--include/clang/Basic/DiagnosticLexKinds.td14
-rw-r--r--include/clang/Basic/DiagnosticOptions.def3
-rw-r--r--include/clang/Basic/DiagnosticOptions.h5
-rw-r--r--include/clang/Basic/DiagnosticParseKinds.td38
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td209
-rw-r--r--include/clang/Basic/DiagnosticSerializationKinds.td5
-rw-r--r--include/clang/Basic/FileManager.h13
-rw-r--r--include/clang/Basic/IdentifierTable.h15
-rw-r--r--include/clang/Basic/LangOptions.def10
-rw-r--r--include/clang/Basic/LangOptions.h9
-rw-r--r--include/clang/Basic/Module.h47
-rw-r--r--include/clang/Basic/PlistSupport.h23
-rw-r--r--include/clang/Basic/SanitizerBlacklist.h3
-rw-r--r--include/clang/Basic/Sanitizers.def8
-rw-r--r--include/clang/Basic/SourceManager.h14
-rw-r--r--include/clang/Basic/Specifiers.h7
-rw-r--r--include/clang/Basic/TargetCXXABI.h10
-rw-r--r--include/clang/Basic/TargetInfo.h47
-rw-r--r--include/clang/Basic/TokenKinds.def5
-rw-r--r--include/clang/Basic/VirtualFileSystem.h2
-rw-r--r--include/clang/CodeGen/CGFunctionInfo.h21
-rw-r--r--include/clang/CodeGen/ModuleBuilder.h2
-rw-r--r--include/clang/Config/config.h9
-rw-r--r--include/clang/Config/config.h.cmake3
-rw-r--r--include/clang/Config/config.h.in3
-rw-r--r--include/clang/Driver/Action.h11
-rw-r--r--include/clang/Driver/CC1Options.td19
-rw-r--r--include/clang/Driver/CLCompatOptions.td27
-rw-r--r--include/clang/Driver/Driver.h21
-rw-r--r--include/clang/Driver/Job.h2
-rw-r--r--include/clang/Driver/Multilib.h1
-rw-r--r--include/clang/Driver/Options.td113
-rw-r--r--include/clang/Driver/Phases.h1
-rw-r--r--include/clang/Driver/SanitizerArgs.h9
-rw-r--r--include/clang/Driver/Tool.h1
-rw-r--r--include/clang/Driver/ToolChain.h18
-rw-r--r--include/clang/Format/Format.h7
-rw-r--r--include/clang/Frontend/ASTConsumers.h1
-rw-r--r--include/clang/Frontend/ASTUnit.h8
-rw-r--r--include/clang/Frontend/CodeGenOptions.def10
-rw-r--r--include/clang/Frontend/CodeGenOptions.h10
-rw-r--r--include/clang/Frontend/CompilerInstance.h17
-rw-r--r--include/clang/Frontend/CompilerInvocation.h2
-rw-r--r--include/clang/Frontend/FrontendOptions.h3
-rw-r--r--include/clang/Frontend/MultiplexConsumer.h2
-rw-r--r--include/clang/Frontend/PreprocessorOutputOptions.h2
-rw-r--r--include/clang/Frontend/VerifyDiagnosticConsumer.h4
-rw-r--r--include/clang/Lex/HeaderMap.h5
-rw-r--r--include/clang/Lex/HeaderSearch.h11
-rw-r--r--include/clang/Lex/HeaderSearchOptions.h13
-rw-r--r--include/clang/Lex/Lexer.h24
-rw-r--r--include/clang/Lex/MacroInfo.h2
-rw-r--r--include/clang/Lex/ModuleMap.h52
-rw-r--r--include/clang/Lex/PTHLexer.h4
-rw-r--r--include/clang/Lex/PTHManager.h4
-rw-r--r--include/clang/Lex/PreprocessingRecord.h19
-rw-r--r--include/clang/Lex/Preprocessor.h25
-rw-r--r--include/clang/Lex/PreprocessorLexer.h4
-rw-r--r--include/clang/Lex/Token.h25
-rw-r--r--include/clang/Lex/TokenLexer.h4
-rw-r--r--include/clang/Parse/Parser.h25
-rw-r--r--include/clang/Rewrite/Core/DeltaTree.h2
-rw-r--r--include/clang/Rewrite/Core/RewriteRope.h2
-rw-r--r--include/clang/Rewrite/Core/TokenRewriter.h4
-rw-r--r--include/clang/Rewrite/Frontend/ASTConsumers.h1
-rw-r--r--include/clang/Sema/AttributeList.h15
-rw-r--r--include/clang/Sema/CodeCompleteConsumer.h8
-rw-r--r--include/clang/Sema/DeclSpec.h27
-rw-r--r--include/clang/Sema/DelayedDiagnostic.h4
-rw-r--r--include/clang/Sema/Initialization.h2
-rw-r--r--include/clang/Sema/Lookup.h20
-rw-r--r--include/clang/Sema/ObjCMethodList.h29
-rw-r--r--include/clang/Sema/Overload.h15
-rw-r--r--include/clang/Sema/Ownership.h2
-rw-r--r--include/clang/Sema/Scope.h11
-rw-r--r--include/clang/Sema/ScopeInfo.h16
-rw-r--r--include/clang/Sema/Sema.h155
-rw-r--r--include/clang/Sema/SemaInternal.h14
-rw-r--r--include/clang/Sema/Template.h4
-rw-r--r--include/clang/Sema/TemplateDeduction.h18
-rw-r--r--include/clang/Sema/TypoCorrection.h2
-rw-r--r--include/clang/Serialization/ASTBitCodes.h11
-rw-r--r--include/clang/Serialization/ASTReader.h100
-rw-r--r--include/clang/Serialization/ASTWriter.h27
-rw-r--r--include/clang/Serialization/ContinuousRangeMap.h4
-rw-r--r--include/clang/Serialization/GlobalModuleIndex.h4
-rw-r--r--include/clang/Serialization/Module.h5
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h2
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h8
-rw-r--r--include/clang/StaticAnalyzer/Core/Checker.h49
-rw-r--r--include/clang/StaticAnalyzer/Core/CheckerManager.h63
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h2
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h4
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h2
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h10
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/Store.h2
-rw-r--r--include/clang/StaticAnalyzer/Frontend/FrontendActions.h2
-rw-r--r--include/clang/Tooling/ArgumentsAdjusters.h75
-rw-r--r--include/clang/Tooling/Tooling.h15
-rw-r--r--include/clang/module.modulemap83
165 files changed, 2637 insertions, 1438 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index 6e3bd07b7a..ac8ce1c85e 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -2126,7 +2126,7 @@ enum CXCursorKind {
*/
CXCursor_MSAsmStmt = 229,
- /** \brief The null satement ";": C99 6.8.3p3.
+ /** \brief The null statement ";": C99 6.8.3p3.
*
* This cursor kind is used to describe the null statement.
*/
@@ -2141,7 +2141,7 @@ enum CXCursorKind {
*/
CXCursor_OMPParallelDirective = 232,
- /** \brief OpenMP simd directive.
+ /** \brief OpenMP SIMD directive.
*/
CXCursor_OMPSimdDirective = 233,
@@ -2209,11 +2209,11 @@ enum CXCursorKind {
*/
CXCursor_OMPAtomicDirective = 249,
- /** \brief OpenMP for simd directive.
+ /** \brief OpenMP for SIMD directive.
*/
CXCursor_OMPForSimdDirective = 250,
- /** \brief OpenMP parallel for simd directive.
+ /** \brief OpenMP parallel for SIMD directive.
*/
CXCursor_OMPParallelForSimdDirective = 251,
@@ -2276,7 +2276,12 @@ enum CXCursorKind {
*/
CXCursor_ModuleImportDecl = 600,
CXCursor_FirstExtraDecl = CXCursor_ModuleImportDecl,
- CXCursor_LastExtraDecl = CXCursor_ModuleImportDecl
+ CXCursor_LastExtraDecl = CXCursor_ModuleImportDecl,
+
+ /**
+ * \brief A code completion overload candidate.
+ */
+ CXCursor_OverloadCandidate = 700
};
/**
@@ -2849,7 +2854,7 @@ enum CXCallingConv {
CXCallingConv_X86Pascal = 5,
CXCallingConv_AAPCS = 6,
CXCallingConv_AAPCS_VFP = 7,
- CXCallingConv_PnaclCall = 8,
+ /* Value 8 was PnaclCall, but it was never used, so it could safely be re-used. */
CXCallingConv_IntelOclBicc = 9,
CXCallingConv_X86_64Win64 = 10,
CXCallingConv_X86_64SysV = 11,
@@ -3345,7 +3350,7 @@ CINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor);
/**
* \brief Represents the storage classes as declared in the source. CX_SC_Invalid
- * was added for the clase that the passed cursor in not a declaration.
+ * was added for the case that the passed cursor in not a declaration.
*/
enum CX_StorageClass {
CX_SC_Invalid,
diff --git a/include/clang/AST/ASTConsumer.h b/include/clang/AST/ASTConsumer.h
index 736a10bec9..b2730e4622 100644
--- a/include/clang/AST/ASTConsumer.h
+++ b/include/clang/AST/ASTConsumer.h
@@ -129,11 +129,7 @@ public:
/// required.
///
/// \param RD The class whose vtable was used.
- ///
- /// \param DefinitionRequired Whether a definition of this vtable is
- /// required in this translation unit; otherwise, it is only needed if
- /// it was actually used.
- virtual void HandleVTable(CXXRecordDecl *RD, bool DefinitionRequired) {}
+ virtual void HandleVTable(CXXRecordDecl *RD) {}
/// \brief If the consumer is interested in entities getting modified after
/// their initial creation, it should return a pointer to
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index ef87fa6dd9..0bc0330882 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -273,8 +273,6 @@ class ASTContext : public RefCountedBase<ASTContext> {
/// \brief Declaration for the CUDA cudaConfigureCall function.
FunctionDecl *cudaConfigureCallDecl;
- TypeSourceInfo NullTypeSourceInfo;
-
/// \brief Keeps track of all declaration attributes.
///
/// Since so few decls have attrs, we keep them in a hash map instead of
@@ -2173,8 +2171,6 @@ public:
getTrivialTypeSourceInfo(QualType T,
SourceLocation Loc = SourceLocation()) const;
- TypeSourceInfo *getNullTypeSourceInfo() { return &NullTypeSourceInfo; }
-
/// \brief Add a deallocation callback that will be invoked when the
/// ASTContext is destroyed.
///
@@ -2267,8 +2263,8 @@ public:
static unsigned NumImplicitDestructorsDeclared;
private:
- ASTContext(const ASTContext &) LLVM_DELETED_FUNCTION;
- void operator=(const ASTContext &) LLVM_DELETED_FUNCTION;
+ ASTContext(const ASTContext &) = delete;
+ void operator=(const ASTContext &) = delete;
public:
/// \brief Initialize built-in types.
diff --git a/include/clang/AST/ASTTypeTraits.h b/include/clang/AST/ASTTypeTraits.h
index efeac563db..dc3c34f28d 100644
--- a/include/clang/AST/ASTTypeTraits.h
+++ b/include/clang/AST/ASTTypeTraits.h
@@ -23,6 +23,7 @@
#include "clang/AST/TemplateBase.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/LLVM.h"
+#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/Support/AlignOf.h"
namespace llvm {
@@ -90,6 +91,21 @@ public:
static ASTNodeKind getMostDerivedCommonAncestor(ASTNodeKind Kind1,
ASTNodeKind Kind2);
+ /// \brief Hooks for using ASTNodeKind as a key in a DenseMap.
+ struct DenseMapInfo {
+ // ASTNodeKind() is a good empty key because it is represented as a 0.
+ static inline ASTNodeKind getEmptyKey() { return ASTNodeKind(); }
+ // NKI_NumberOfKinds is not a valid value, so it is good for a
+ // tombstone key.
+ static inline ASTNodeKind getTombstoneKey() {
+ return ASTNodeKind(NKI_NumberOfKinds);
+ }
+ static unsigned getHashValue(const ASTNodeKind &Val) { return Val.KindId; }
+ static bool isEqual(const ASTNodeKind &LHS, const ASTNodeKind &RHS) {
+ return LHS.KindId == RHS.KindId;
+ }
+ };
+
private:
/// \brief Kind ids.
///
@@ -129,6 +145,8 @@ private:
template <class T> struct KindToKindId {
static const NodeKindId Id = NKI_None;
};
+ template <class T>
+ struct KindToKindId<const T> : KindToKindId<T> {};
/// \brief Per kind info.
struct KindInfo {
@@ -205,6 +223,14 @@ public:
return BaseConverter<T>::get(NodeKind, Storage.buffer);
}
+ /// \brief Retrieve the stored node as type \c T.
+ ///
+ /// Similar to \c get(), but asserts that the type is what we are expecting.
+ template <typename T>
+ const T &getUnchecked() const {
+ return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
+ }
+
ASTNodeKind getNodeKind() const { return NodeKind; }
/// \brief Returns a pointer that identifies the stored AST node.
@@ -235,14 +261,15 @@ public:
return getMemoizationData() < Other.getMemoizationData();
}
bool operator==(const DynTypedNode &Other) const {
- if (!NodeKind.isBaseOf(Other.NodeKind) &&
- !Other.NodeKind.isBaseOf(NodeKind))
+ // DynTypedNode::create() stores the exact kind of the node in NodeKind.
+ // If they contain the same node, their NodeKind must be the same.
+ if (!NodeKind.isSame(Other.NodeKind))
return false;
// FIXME: Implement for other types.
- if (ASTNodeKind::getFromNodeKind<QualType>().isBaseOf(NodeKind)) {
- return *get<QualType>() == *Other.get<QualType>();
- }
+ if (ASTNodeKind::getFromNodeKind<QualType>().isSame(NodeKind))
+ return getUnchecked<QualType>() == Other.getUnchecked<QualType>();
+
assert(getMemoizationData() && Other.getMemoizationData());
return getMemoizationData() == Other.getMemoizationData();
}
@@ -258,10 +285,14 @@ private:
/// \brief Converter that uses dyn_cast<T> from a stored BaseT*.
template <typename T, typename BaseT> struct DynCastPtrConverter {
static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
- if (ASTNodeKind::getFromNodeKind<BaseT>().isBaseOf(NodeKind))
- return dyn_cast<T>(*reinterpret_cast<BaseT *const *>(Storage));
+ if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
+ return cast<T>(*reinterpret_cast<BaseT *const *>(Storage));
return nullptr;
}
+ static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
+ assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
+ return *cast<T>(*reinterpret_cast<BaseT *const *>(Storage));
+ }
static DynTypedNode create(const BaseT &Node) {
DynTypedNode Result;
Result.NodeKind = ASTNodeKind::getFromNode(Node);
@@ -278,6 +309,10 @@ private:
return *reinterpret_cast<T *const *>(Storage);
return nullptr;
}
+ static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
+ assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
+ return **reinterpret_cast<T *const *>(Storage);
+ }
static DynTypedNode create(const T &Node) {
DynTypedNode Result;
Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
@@ -294,6 +329,10 @@ private:
return reinterpret_cast<const T *>(Storage);
return nullptr;
}
+ static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
+ assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
+ return *reinterpret_cast<const T *>(Storage);
+ }
static DynTypedNode create(const T &Node) {
DynTypedNode Result;
Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
@@ -375,4 +414,12 @@ template <typename T, typename EnablerT> struct DynTypedNode::BaseConverter {
} // end namespace ast_type_traits
} // end namespace clang
+namespace llvm {
+
+template <>
+struct DenseMapInfo<clang::ast_type_traits::ASTNodeKind>
+ : clang::ast_type_traits::ASTNodeKind::DenseMapInfo {};
+
+} // end namespace llvm
+
#endif
diff --git a/include/clang/AST/ASTUnresolvedSet.h b/include/clang/AST/ASTUnresolvedSet.h
index 84b0842492..9078a0e802 100644
--- a/include/clang/AST/ASTUnresolvedSet.h
+++ b/include/clang/AST/ASTUnresolvedSet.h
@@ -76,7 +76,7 @@ public:
}
void append(ASTContext &C, iterator I, iterator E) {
- Decls.append(C, I.ir, E.ir);
+ Decls.append(C, I.I, E.I);
}
DeclAccessPair &operator[](unsigned I) { return Decls[I]; }
diff --git a/include/clang/AST/CanonicalType.h b/include/clang/AST/CanonicalType.h
index aa3c846829..b25800bfed 100644
--- a/include/clang/AST/CanonicalType.h
+++ b/include/clang/AST/CanonicalType.h
@@ -16,8 +16,8 @@
#define LLVM_CLANG_AST_CANONICALTYPE_H
#include "clang/AST/Type.h"
+#include "llvm/ADT/iterator.h"
#include "llvm/Support/Casting.h"
-#include <iterator>
namespace clang {
@@ -80,7 +80,7 @@ public:
operator QualType() const { return Stored; }
/// \brief Implicit conversion to bool.
- LLVM_EXPLICIT operator bool() const { return !isNull(); }
+ explicit operator bool() const { return !isNull(); }
bool isNull() const {
return Stored.isNull();
@@ -381,93 +381,20 @@ namespace clang {
/// \brief Iterator adaptor that turns an iterator over canonical QualTypes
/// into an iterator over CanQualTypes.
-template<typename InputIterator>
-class CanTypeIterator {
- InputIterator Iter;
-
-public:
- typedef CanQualType value_type;
- typedef value_type reference;
- typedef CanProxy<Type> pointer;
- typedef typename std::iterator_traits<InputIterator>::difference_type
- difference_type;
- typedef typename std::iterator_traits<InputIterator>::iterator_category
- iterator_category;
-
- CanTypeIterator() : Iter() { }
- explicit CanTypeIterator(InputIterator Iter) : Iter(Iter) { }
-
- // Input iterator
- reference operator*() const {
- return CanQualType::CreateUnsafe(*Iter);
- }
-
- pointer operator->() const;
-
- CanTypeIterator &operator++() {
- ++Iter;
- return *this;
- }
-
- CanTypeIterator operator++(int) {
- CanTypeIterator Tmp(*this);
- ++Iter;
- return Tmp;
- }
-
- friend bool operator==(const CanTypeIterator& X, const CanTypeIterator &Y) {
- return X.Iter == Y.Iter;
- }
- friend bool operator!=(const CanTypeIterator& X, const CanTypeIterator &Y) {
- return X.Iter != Y.Iter;
- }
-
- // Bidirectional iterator
- CanTypeIterator &operator--() {
- --Iter;
- return *this;
- }
-
- CanTypeIterator operator--(int) {
- CanTypeIterator Tmp(*this);
- --Iter;
- return Tmp;
- }
-
- // Random access iterator
- reference operator[](difference_type n) const {
- return CanQualType::CreateUnsafe(Iter[n]);
- }
-
- CanTypeIterator &operator+=(difference_type n) {
- Iter += n;
- return *this;
- }
-
- CanTypeIterator &operator-=(difference_type n) {
- Iter -= n;
- return *this;
- }
-
- friend CanTypeIterator operator+(CanTypeIterator X, difference_type n) {
- X += n;
- return X;
- }
-
- friend CanTypeIterator operator+(difference_type n, CanTypeIterator X) {
- X += n;
- return X;
- }
-
- friend CanTypeIterator operator-(CanTypeIterator X, difference_type n) {
- X -= n;
- return X;
- }
-
- friend difference_type operator-(const CanTypeIterator &X,
- const CanTypeIterator &Y) {
- return X - Y;
- }
+template <typename InputIterator>
+struct CanTypeIterator
+ : llvm::iterator_adaptor_base<
+ CanTypeIterator<InputIterator>, InputIterator,
+ typename std::iterator_traits<InputIterator>::iterator_category,
+ CanQualType,
+ typename std::iterator_traits<InputIterator>::difference_type,
+ CanProxy<Type>, CanQualType> {
+ CanTypeIterator() {}
+ explicit CanTypeIterator(InputIterator Iter)
+ : CanTypeIterator::iterator_adaptor_base(std::move(Iter)) {}
+
+ CanQualType operator*() const { return CanQualType::CreateUnsafe(*this->I); }
+ CanProxy<Type> operator->() const;
};
template<>
@@ -727,9 +654,8 @@ CanProxy<T> CanQual<T>::operator->() const {
return CanProxy<T>(*this);
}
-template<typename InputIterator>
-typename CanTypeIterator<InputIterator>::pointer
-CanTypeIterator<InputIterator>::operator->() const {
+template <typename InputIterator>
+CanProxy<Type> CanTypeIterator<InputIterator>::operator->() const {
return CanProxy<Type>(*this);
}
diff --git a/include/clang/AST/CommentCommandTraits.h b/include/clang/AST/CommentCommandTraits.h
index ec6d83c030..289f2fd345 100644
--- a/include/clang/AST/CommentCommandTraits.h
+++ b/include/clang/AST/CommentCommandTraits.h
@@ -166,8 +166,8 @@ public:
static const CommandInfo *getBuiltinCommandInfo(unsigned CommandID);
private:
- CommandTraits(const CommandTraits &) LLVM_DELETED_FUNCTION;
- void operator=(const CommandTraits &) LLVM_DELETED_FUNCTION;
+ CommandTraits(const CommandTraits &) = delete;
+ void operator=(const CommandTraits &) = delete;
const CommandInfo *getRegisteredCommandInfo(StringRef Name) const;
const CommandInfo *getRegisteredCommandInfo(unsigned CommandID) const;
diff --git a/include/clang/AST/CommentLexer.h b/include/clang/AST/CommentLexer.h
index d995df9212..f190b932c0 100644
--- a/include/clang/AST/CommentLexer.h
+++ b/include/clang/AST/CommentLexer.h
@@ -221,8 +221,8 @@ public:
/// \brief Comment lexer.
class Lexer {
private:
- Lexer(const Lexer &) LLVM_DELETED_FUNCTION;
- void operator=(const Lexer &) LLVM_DELETED_FUNCTION;
+ Lexer(const Lexer &) = delete;
+ void operator=(const Lexer &) = delete;
/// Allocator for strings that are semantic values of tokens and have to be
/// computed (for example, resolved decimal character references).
diff --git a/include/clang/AST/CommentParser.h b/include/clang/AST/CommentParser.h
index 2c444f0dc3..42bf4c989a 100644
--- a/include/clang/AST/CommentParser.h
+++ b/include/clang/AST/CommentParser.h
@@ -28,8 +28,8 @@ class CommandTraits;
/// Doxygen comment parser.
class Parser {
- Parser(const Parser &) LLVM_DELETED_FUNCTION;
- void operator=(const Parser &) LLVM_DELETED_FUNCTION;
+ Parser(const Parser &) = delete;
+ void operator=(const Parser &) = delete;
friend class TextTokenRetokenizer;
diff --git a/include/clang/AST/CommentSema.h b/include/clang/AST/CommentSema.h
index 4ae6fe0c61..9b05d397ba 100644
--- a/include/clang/AST/CommentSema.h
+++ b/include/clang/AST/CommentSema.h
@@ -31,8 +31,8 @@ namespace comments {
class CommandTraits;
class Sema {
- Sema(const Sema &) LLVM_DELETED_FUNCTION;
- void operator=(const Sema &) LLVM_DELETED_FUNCTION;
+ Sema(const Sema &) = delete;
+ void operator=(const Sema &) = delete;
/// Allocator for AST nodes.
llvm::BumpPtrAllocator &Allocator;
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index b946636ebd..63ef79616f 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -179,14 +179,17 @@ public:
const PrintingPolicy &Policy,
bool Qualified) const;
- /// declarationReplaces - Determine whether this declaration, if
+ /// \brief Determine whether this declaration, if
/// known to be well-formed within its context, will replace the
/// declaration OldD if introduced into scope. A declaration will
/// replace another declaration if, for example, it is a
/// redeclaration of the same variable or function, but not if it is
/// a declaration of a different kind (function vs. class) or an
/// overloaded function.
- bool declarationReplaces(NamedDecl *OldD) const;
+ ///
+ /// \param IsKnownNewer \c true if this declaration is known to be newer
+ /// than \p OldD (for instance, if this declaration is newly-created).
+ bool declarationReplaces(NamedDecl *OldD, bool IsKnownNewer = true) const;
/// \brief Determine whether this declaration has linkage.
bool hasLinkage() const;
@@ -535,8 +538,8 @@ struct QualifierInfo {
private:
// Copy constructor and copy assignment are disabled.
- QualifierInfo(const QualifierInfo&) LLVM_DELETED_FUNCTION;
- QualifierInfo& operator=(const QualifierInfo&) LLVM_DELETED_FUNCTION;
+ QualifierInfo(const QualifierInfo&) = delete;
+ QualifierInfo& operator=(const QualifierInfo&) = delete;
};
/// \brief Represents a ValueDecl that came out of a declarator.
@@ -840,7 +843,7 @@ public:
return !isFileVarDecl() && getTSCSpec() == TSCS_unspecified;
// Global Named Register (GNU extension)
- if (getStorageClass() == SC_Register && !isLocalVarDecl())
+ if (getStorageClass() == SC_Register && !isLocalVarDeclOrParm())
return false;
// Return true for: Auto, Register.
@@ -906,6 +909,11 @@ public:
return false;
}
+ /// \brief Similar to isLocalVarDecl but also includes parameters.
+ bool isLocalVarDeclOrParm() const {
+ return isLocalVarDecl() || getKind() == Decl::ParmVar;
+ }
+
/// isFunctionOrMethodVarDecl - Similar to isLocalVarDecl, but
/// excludes variables declared in blocks.
bool isFunctionOrMethodVarDecl() const {
@@ -1477,6 +1485,9 @@ private:
bool IsLateTemplateParsed : 1;
bool IsConstexpr : 1;
+ /// \brief Indicates if the function uses __try.
+ bool UsesSEHTry : 1;
+
/// \brief Indicates if the function was a definition but its body was
/// skipped.
unsigned HasSkippedBody : 1;
@@ -1565,8 +1576,8 @@ protected:
HasWrittenPrototype(true), IsDeleted(false), IsTrivial(false),
IsDefaulted(false), IsExplicitlyDefaulted(false),
HasImplicitReturnZero(false), IsLateTemplateParsed(false),
- IsConstexpr(isConstexprSpecified), HasSkippedBody(false),
- EndRangeLoc(NameInfo.getEndLoc()),
+ IsConstexpr(isConstexprSpecified), UsesSEHTry(false),
+ HasSkippedBody(false), EndRangeLoc(NameInfo.getEndLoc()),
TemplateOrSpecialization(),
DNLoc(NameInfo.getInfo()) {}
@@ -1746,6 +1757,10 @@ public:
bool isConstexpr() const { return IsConstexpr; }
void setConstexpr(bool IC) { IsConstexpr = IC; }
+ /// Whether this is a (C++11) constexpr function or constexpr constructor.
+ bool usesSEHTry() const { return UsesSEHTry; }
+ void setUsesSEHTry(bool UST) { UsesSEHTry = UST; }
+
/// \brief Whether this function has been deleted.
///
/// A function that is "deleted" (via the C++0x "= delete" syntax)
@@ -3274,6 +3289,10 @@ public:
/// intra-object-overflow bugs.
bool mayInsertExtraPadding(bool EmitRemark = false) const;
+ /// Finds the first data member which has a name.
+ /// nullptr is returned if no named data member exists.
+ const FieldDecl *findFirstNamedDataMember() const;
+
private:
/// \brief Deserialize just the fields.
void LoadFieldsFromExternalStorage() const;
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h
index 984ab13df4..121bd00535 100644
--- a/include/clang/AST/DeclBase.h
+++ b/include/clang/AST/DeclBase.h
@@ -18,6 +18,7 @@
#include "clang/AST/DeclarationName.h"
#include "clang/Basic/Specifiers.h"
#include "llvm/ADT/PointerUnion.h"
+#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/PrettyStackTrace.h"
@@ -1005,9 +1006,62 @@ public:
void print(raw_ostream &OS) const override;
};
-typedef MutableArrayRef<NamedDecl *> DeclContextLookupResult;
+/// \brief The results of name lookup within a DeclContext. This is either a
+/// single result (with no stable storage) or a collection of results (with
+/// stable storage provided by the lookup table).
+class DeclContextLookupResult {
+ typedef ArrayRef<NamedDecl *> ResultTy;
+ ResultTy Result;
+ // If there is only one lookup result, it would be invalidated by
+ // reallocations of the name table, so store it separately.
+ NamedDecl *Single;
-typedef ArrayRef<NamedDecl *> DeclContextLookupConstResult;
+ static NamedDecl *const SingleElementDummyList;
+
+public:
+ DeclContextLookupResult() : Result(), Single() {}
+ DeclContextLookupResult(ArrayRef<NamedDecl *> Result)
+ : Result(Result), Single() {}
+ DeclContextLookupResult(NamedDecl *Single)
+ : Result(SingleElementDummyList), Single(Single) {}
+
+ class iterator;
+ typedef llvm::iterator_adaptor_base<iterator, ResultTy::iterator,
+ std::random_access_iterator_tag,
+ NamedDecl *const> IteratorBase;
+ class iterator : public IteratorBase {
+ value_type SingleElement;
+
+ public:
+ iterator() : IteratorBase(), SingleElement() {}
+ explicit iterator(pointer Pos, value_type Single = nullptr)
+ : IteratorBase(Pos), SingleElement(Single) {}
+
+ reference operator*() const {
+ return SingleElement ? SingleElement : IteratorBase::operator*();
+ }
+ };
+ typedef iterator const_iterator;
+ typedef iterator::pointer pointer;
+ typedef iterator::reference reference;
+
+ iterator begin() const { return iterator(Result.begin(), Single); }
+ iterator end() const { return iterator(Result.end(), Single); }
+
+ bool empty() const { return Result.empty(); }
+ pointer data() const { return Single ? &Single : Result.data(); }
+ size_t size() const { return Single ? 1 : Result.size(); }
+ reference front() const { return Single ? Single : Result.front(); }
+ reference back() const { return Single ? Single : Result.back(); }
+ reference operator[](size_t N) const { return Single ? Single : Result[N]; }
+
+ // FIXME: Remove this from the interface
+ DeclContextLookupResult slice(size_t N) const {
+ DeclContextLookupResult Sliced = Result.slice(N);
+ Sliced.Single = Single;
+ return Sliced;
+ }
+};
/// DeclContext - This is used only as base class of specific decl types that
/// can act as declaration contexts. These decls are (only the top classes
@@ -1520,26 +1574,15 @@ public:
/// @brief Checks whether a declaration is in this context.
bool containsDecl(Decl *D) const;
- /// lookup_iterator - An iterator that provides access to the results
- /// of looking up a name within this context.
- typedef NamedDecl **lookup_iterator;
-
- /// lookup_const_iterator - An iterator that provides non-mutable
- /// access to the results of lookup up a name within this context.
- typedef NamedDecl * const * lookup_const_iterator;
-
typedef DeclContextLookupResult lookup_result;
- typedef DeclContextLookupConstResult lookup_const_result;
+ typedef lookup_result::iterator lookup_iterator;
/// lookup - Find the declarations (if any) with the given Name in
/// this context. Returns a range of iterators that contains all of
/// the declarations with this name, with object, function, member,
/// and enumerator names preceding any tag name. Note that this
/// routine will not look into parent contexts.
- lookup_result lookup(DeclarationName Name);
- lookup_const_result lookup(DeclarationName Name) const {
- return const_cast<DeclContext*>(this)->lookup(Name);
- }
+ lookup_result lookup(DeclarationName Name) const;
/// \brief Find the declarations with the given name that are visible
/// within this context; don't attempt to retrieve anything from an
@@ -1593,7 +1636,16 @@ public:
all_lookups_iterator noload_lookups_begin() const;
all_lookups_iterator noload_lookups_end() const;
- typedef llvm::iterator_range<UsingDirectiveDecl * const *> udir_range;
+ struct udir_iterator;
+ typedef llvm::iterator_adaptor_base<udir_iterator, lookup_iterator,
+ std::random_access_iterator_tag,
+ UsingDirectiveDecl *> udir_iterator_base;
+ struct udir_iterator : udir_iterator_base {
+ udir_iterator(lookup_iterator I) : udir_iterator_base(I) {}
+ UsingDirectiveDecl *operator*() const;
+ };
+
+ typedef llvm::iterator_range<udir_iterator> udir_range;
udir_range using_directives() const;
@@ -1672,7 +1724,7 @@ private:
template<decl_iterator (DeclContext::*Begin)() const,
decl_iterator (DeclContext::*End)() const>
- void buildLookupImpl(DeclContext *DCtx);
+ void buildLookupImpl(DeclContext *DCtx, bool Internal);
void makeDeclVisibleInContextWithFlags(NamedDecl *D, bool Internal,
bool Rediscoverable);
void makeDeclVisibleInContextImpl(NamedDecl *D, bool Internal);
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h
index 062c1527d7..ed6e2dc752 100644
--- a/include/clang/AST/DeclCXX.h
+++ b/include/clang/AST/DeclCXX.h
@@ -826,7 +826,11 @@ public:
/// This value is used for lazy creation of default constructors.
bool needsImplicitDefaultConstructor() const {
return !data().UserDeclaredConstructor &&
- !(data().DeclaredSpecialMembers & SMF_DefaultConstructor);
+ !(data().DeclaredSpecialMembers & SMF_DefaultConstructor) &&
+ // C++14 [expr.prim.lambda]p20:
+ // The closure type associated with a lambda-expression has no
+ // default constructor.
+ !isLambda();
}
/// \brief Determine whether this class has any user-declared constructors.
@@ -1089,8 +1093,7 @@ public:
/// \brief Get all conversion functions visible in current class,
/// including conversion function templates.
- std::pair<conversion_iterator, conversion_iterator>
- getVisibleConversionFunctions();
+ llvm::iterator_range<conversion_iterator> getVisibleConversionFunctions();
/// Determine whether this class is an aggregate (C++ [dcl.init.aggr]),
/// which is a class with no user-declared constructors, no private
diff --git a/include/clang/AST/DeclContextInternals.h b/include/clang/AST/DeclContextInternals.h
index 9068c00a79..ff37758c25 100644
--- a/include/clang/AST/DeclContextInternals.h
+++ b/include/clang/AST/DeclContextInternals.h
@@ -142,31 +142,29 @@ public:
/// represents.
DeclContext::lookup_result getLookupResult() {
if (isNull())
- return DeclContext::lookup_result(DeclContext::lookup_iterator(nullptr),
- DeclContext::lookup_iterator(nullptr));
+ return DeclContext::lookup_result();
// If we have a single NamedDecl, return it.
- if (getAsDecl()) {
+ if (NamedDecl *ND = getAsDecl()) {
assert(!isNull() && "Empty list isn't allowed");
// Data is a raw pointer to a NamedDecl*, return it.
- void *Ptr = &Data;
- return DeclContext::lookup_result((NamedDecl**)Ptr, (NamedDecl**)Ptr+1);
+ return DeclContext::lookup_result(ND);
}
assert(getAsVector() && "Must have a vector at this point");
DeclsTy &Vector = *getAsVector();
// Otherwise, we have a range result.
- return DeclContext::lookup_result(Vector.begin(), Vector.end());
+ return DeclContext::lookup_result(Vector);
}
/// HandleRedeclaration - If this is a redeclaration of an existing decl,
/// replace the old one with D and return true. Otherwise return false.
- bool HandleRedeclaration(NamedDecl *D) {
+ bool HandleRedeclaration(NamedDecl *D, bool IsKnownNewer) {
// Most decls only have one entry in their list, special case it.
if (NamedDecl *OldD = getAsDecl()) {
- if (!D->declarationReplaces(OldD))
+ if (!D->declarationReplaces(OldD, IsKnownNewer))
return false;
setOnlyValue(D);
return true;
@@ -177,7 +175,7 @@ public:
for (DeclsTy::iterator OD = Vec.begin(), ODEnd = Vec.end();
OD != ODEnd; ++OD) {
NamedDecl *OldD = *OD;
- if (D->declarationReplaces(OldD)) {
+ if (D->declarationReplaces(OldD, IsKnownNewer)) {
*OD = D;
return true;
}
diff --git a/include/clang/AST/DeclLookups.h b/include/clang/AST/DeclLookups.h
index d2016af89f..eba2266724 100644
--- a/include/clang/AST/DeclLookups.h
+++ b/include/clang/AST/DeclLookups.h
@@ -75,7 +75,10 @@ inline DeclContext::lookups_range DeclContext::lookups() const {
if (StoredDeclsMap *Map = Primary->buildLookup())
return lookups_range(all_lookups_iterator(Map->begin(), Map->end()),
all_lookups_iterator(Map->end(), Map->end()));
- return lookups_range();
+
+ // Synthesize an empty range. This requires that two default constructed
+ // versions of these iterators form a valid empty range.
+ return lookups_range(all_lookups_iterator(), all_lookups_iterator());
}
inline DeclContext::all_lookups_iterator DeclContext::lookups_begin() const {
@@ -91,7 +94,10 @@ inline DeclContext::lookups_range DeclContext::noload_lookups() const {
if (StoredDeclsMap *Map = Primary->getLookupPtr())
return lookups_range(all_lookups_iterator(Map->begin(), Map->end()),
all_lookups_iterator(Map->end(), Map->end()));
- return lookups_range();
+
+ // Synthesize an empty range. This requires that two default constructed
+ // versions of these iterators form a valid empty range.
+ return lookups_range(all_lookups_iterator(), all_lookups_iterator());
}
inline
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index 55d4b0f169..97ce132a76 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -33,8 +33,8 @@ class ObjCPropertyImplDecl;
class CXXCtorInitializer;
class ObjCListBase {
- ObjCListBase(const ObjCListBase &) LLVM_DELETED_FUNCTION;
- void operator=(const ObjCListBase &) LLVM_DELETED_FUNCTION;
+ ObjCListBase(const ObjCListBase &) = delete;
+ void operator=(const ObjCListBase &) = delete;
protected:
/// List is an array of pointers to objects that are not owned by this object.
void **List;
diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h
index 9283d2dc43..39b5208a66 100644
--- a/include/clang/AST/DeclTemplate.h
+++ b/include/clang/AST/DeclTemplate.h
@@ -158,8 +158,8 @@ class TemplateArgumentList {
/// argument list.
unsigned NumArguments;
- TemplateArgumentList(const TemplateArgumentList &Other) LLVM_DELETED_FUNCTION;
- void operator=(const TemplateArgumentList &Other) LLVM_DELETED_FUNCTION;
+ TemplateArgumentList(const TemplateArgumentList &Other) = delete;
+ void operator=(const TemplateArgumentList &Other) = delete;
TemplateArgumentList(const TemplateArgument *Args, unsigned NumArgs,
bool Owned)
@@ -545,47 +545,32 @@ protected:
template <typename EntryType> struct SpecEntryTraits {
typedef EntryType DeclType;
- static DeclType *getMostRecentDecl(EntryType *D) {
- return D->getMostRecentDecl();
+ static DeclType *getDecl(EntryType *D) {
+ return D;
+ }
+ static ArrayRef<TemplateArgument> getTemplateArgs(EntryType *D) {
+ return D->getTemplateArgs().asArray();
}
};
- template <typename EntryType,
- typename _SETraits = SpecEntryTraits<EntryType>,
- typename _DeclType = typename _SETraits::DeclType>
- class SpecIterator : public std::iterator<std::forward_iterator_tag,
- _DeclType*, ptrdiff_t,
- _DeclType*, _DeclType*> {
- typedef _SETraits SETraits;
- typedef _DeclType DeclType;
-
- typedef typename llvm::FoldingSetVector<EntryType>::iterator
- SetIteratorType;
-
- SetIteratorType SetIter;
-
- public:
- SpecIterator() : SetIter() {}
- SpecIterator(SetIteratorType SetIter) : SetIter(SetIter) {}
+ template <typename EntryType, typename SETraits = SpecEntryTraits<EntryType>,
+ typename DeclType = typename SETraits::DeclType>
+ struct SpecIterator
+ : llvm::iterator_adaptor_base<
+ SpecIterator<EntryType, SETraits, DeclType>,
+ typename llvm::FoldingSetVector<EntryType>::iterator,
+ typename std::iterator_traits<typename llvm::FoldingSetVector<
+ EntryType>::iterator>::iterator_category,
+ DeclType *, ptrdiff_t, DeclType *, DeclType *> {
+ SpecIterator() {}
+ explicit SpecIterator(
+ typename llvm::FoldingSetVector<EntryType>::iterator SetIter)
+ : SpecIterator::iterator_adaptor_base(std::move(SetIter)) {}
DeclType *operator*() const {
- return SETraits::getMostRecentDecl(&*SetIter);
+ return SETraits::getDecl(&*this->I)->getMostRecentDecl();
}
DeclType *operator->() const { return **this; }
-
- SpecIterator &operator++() { ++SetIter; return *this; }
- SpecIterator operator++(int) {
- SpecIterator tmp(*this);
- ++(*this);
- return tmp;
- }
-
- bool operator==(SpecIterator Other) const {
- return SetIter == Other.SetIter;
- }
- bool operator!=(SpecIterator Other) const {
- return SetIter != Other.SetIter;
- }
};
template <typename EntryType>
@@ -598,6 +583,10 @@ protected:
findSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
ArrayRef<TemplateArgument> Args, void *&InsertPos);
+ template <class Derived, class EntryType>
+ void addSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
+ EntryType *Entry, void *InsertPos);
+
struct CommonBase {
CommonBase() : InstantiatedFromMember(nullptr, false) { }
@@ -737,9 +726,12 @@ template <> struct RedeclarableTemplateDecl::
SpecEntryTraits<FunctionTemplateSpecializationInfo> {
typedef FunctionDecl DeclType;
- static DeclType *
- getMostRecentDecl(FunctionTemplateSpecializationInfo *I) {
- return I->Function->getMostRecentDecl();
+ static DeclType *getDecl(FunctionTemplateSpecializationInfo *I) {
+ return I->Function;
+ }
+ static ArrayRef<TemplateArgument>
+ getTemplateArgs(FunctionTemplateSpecializationInfo *I) {
+ return I->TemplateArguments->asArray();
}
};
@@ -788,9 +780,6 @@ protected:
friend class FunctionDecl;
- /// \brief Load any lazily-loaded specializations from the external source.
- void LoadLazySpecializations() const;
-
/// \brief Retrieve the set of function template specializations of this
/// function template.
llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> &
@@ -804,6 +793,9 @@ protected:
void *InsertPos);
public:
+ /// \brief Load any lazily-loaded specializations from the external source.
+ void LoadLazySpecializations() const;
+
/// Get the underlying function declaration of the template.
FunctionDecl *getTemplatedDecl() const {
return static_cast<FunctionDecl*>(TemplatedDecl);
@@ -843,6 +835,15 @@ public:
static_cast<const RedeclarableTemplateDecl *>(this)->getPreviousDecl());
}
+ FunctionTemplateDecl *getMostRecentDecl() {
+ return cast<FunctionTemplateDecl>(
+ static_cast<RedeclarableTemplateDecl *>(this)
+ ->getMostRecentDecl());
+ }
+ const FunctionTemplateDecl *getMostRecentDecl() const {
+ return const_cast<FunctionTemplateDecl*>(this)->getMostRecentDecl();
+ }
+
FunctionTemplateDecl *getInstantiatedFromMemberTemplate() {
return cast_or_null<FunctionTemplateDecl>(
RedeclarableTemplateDecl::getInstantiatedFromMemberTemplate());
@@ -903,7 +904,7 @@ public:
/// This class is inheritedly privately by different kinds of template
/// parameters and is not part of the Decl hierarchy. Just a facility.
class TemplateParmPosition {
- TemplateParmPosition() LLVM_DELETED_FUNCTION;
+ TemplateParmPosition() = delete;
protected:
TemplateParmPosition(unsigned D, unsigned P)
@@ -1827,9 +1828,6 @@ protected:
uint32_t *LazySpecializations;
};
- /// \brief Load any lazily-loaded specializations from the external source.
- void LoadLazySpecializations() const;
-
/// \brief Retrieve the set of specializations of this class template.
llvm::FoldingSetVector<ClassTemplateSpecializationDecl> &
getSpecializations() const;
@@ -1851,6 +1849,9 @@ protected:
}
public:
+ /// \brief Load any lazily-loaded specializations from the external source.
+ void LoadLazySpecializations() const;
+
/// \brief Get the underlying class declarations of the template.
CXXRecordDecl *getTemplatedDecl() const {
return static_cast<CXXRecordDecl *>(TemplatedDecl);
@@ -2662,9 +2663,6 @@ protected:
uint32_t *LazySpecializations;
};
- /// \brief Load any lazily-loaded specializations from the external source.
- void LoadLazySpecializations() const;
-
/// \brief Retrieve the set of specializations of this variable template.
llvm::FoldingSetVector<VarTemplateSpecializationDecl> &
getSpecializations() const;
@@ -2686,6 +2684,9 @@ protected:
}
public:
+ /// \brief Load any lazily-loaded specializations from the external source.
+ void LoadLazySpecializations() const;
+
/// \brief Get the underlying variable declarations of the template.
VarDecl *getTemplatedDecl() const {
return static_cast<VarDecl *>(TemplatedDecl);
@@ -2739,6 +2740,14 @@ public:
this)->getPreviousDecl());
}
+ VarTemplateDecl *getMostRecentDecl() {
+ return cast<VarTemplateDecl>(
+ static_cast<RedeclarableTemplateDecl *>(this)->getMostRecentDecl());
+ }
+ const VarTemplateDecl *getMostRecentDecl() const {
+ return const_cast<VarTemplateDecl *>(this)->getMostRecentDecl();
+ }
+
VarTemplateDecl *getInstantiatedFromMemberTemplate() {
return cast_or_null<VarTemplateDecl>(
RedeclarableTemplateDecl::getInstantiatedFromMemberTemplate());
diff --git a/include/clang/AST/DeclarationName.h b/include/clang/AST/DeclarationName.h
index 49e51e09b8..ec0fb0b971 100644
--- a/include/clang/AST/DeclarationName.h
+++ b/include/clang/AST/DeclarationName.h
@@ -184,7 +184,7 @@ public:
// operator bool() - Evaluates true when this declaration name is
// non-empty.
- LLVM_EXPLICIT operator bool() const {
+ explicit operator bool() const {
return ((Ptr & PtrMask) != 0) ||
(reinterpret_cast<IdentifierInfo *>(Ptr & ~PtrMask));
}
@@ -344,8 +344,8 @@ class DeclarationNameTable {
CXXOperatorIdName *CXXOperatorNames; // Operator names
void *CXXLiteralOperatorNames; // Actually a CXXOperatorIdName*
- DeclarationNameTable(const DeclarationNameTable&) LLVM_DELETED_FUNCTION;
- void operator=(const DeclarationNameTable&) LLVM_DELETED_FUNCTION;
+ DeclarationNameTable(const DeclarationNameTable&) = delete;
+ void operator=(const DeclarationNameTable&) = delete;
public:
DeclarationNameTable(const ASTContext &C);
diff --git a/include/clang/AST/DependentDiagnostic.h b/include/clang/AST/DependentDiagnostic.h
index 63066797b3..8e038c83c9 100644
--- a/include/clang/AST/DependentDiagnostic.h
+++ b/include/clang/AST/DependentDiagnostic.h
@@ -178,7 +178,8 @@ inline DeclContext::ddiag_range DeclContext::ddiags() const {
= static_cast<DependentStoredDeclsMap*>(getPrimaryContext()->getLookupPtr());
if (!Map)
- return ddiag_range();
+ // Return an empty range using the always-end default constructor.
+ return ddiag_range(ddiag_iterator(), ddiag_iterator());
return ddiag_range(ddiag_iterator(Map->FirstDiagnostic), ddiag_iterator());
}
diff --git a/include/clang/AST/EvaluatedExprVisitor.h b/include/clang/AST/EvaluatedExprVisitor.h
index 12c4fcc49b..59de104b83 100644
--- a/include/clang/AST/EvaluatedExprVisitor.h
+++ b/include/clang/AST/EvaluatedExprVisitor.h
@@ -56,6 +56,17 @@ public:
return this->Visit(E->getChosenSubExpr());
}
+ void VisitGenericSelectionExpr(GenericSelectionExpr *E) {
+ // The controlling expression of a generic selection is not evaluated.
+
+ // Don't visit either child expression if the condition is type-dependent.
+ if (E->isResultDependent())
+ return;
+ // Only the selected subexpression matters; the other subexpressions and the
+ // controlling expression are not evaluated.
+ return this->Visit(E->getResultExpr());
+ }
+
void VisitDesignatedInitExpr(DesignatedInitExpr *E) {
// Only the actual initializer matters; the designators are all constant
// expressions.
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index d94e225c74..c8f121bc19 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -586,8 +586,13 @@ public:
/// HasSideEffects - This routine returns true for all those expressions
/// which have any effect other than producing a value. Example is a function
- /// call, volatile variable read, or throwing an exception.
- bool HasSideEffects(const ASTContext &Ctx) const;
+ /// call, volatile variable read, or throwing an exception. If
+ /// IncludePossibleEffects is false, this call treats certain expressions with
+ /// potential side effects (such as function call-like expressions,
+ /// instantiation-dependent expressions, or invocations from a macro) as not
+ /// having side effects.
+ bool HasSideEffects(const ASTContext &Ctx,
+ bool IncludePossibleEffects = true) const;
/// \brief Determine whether this expression involves a call to any function
/// that is not trivial.
@@ -886,9 +891,9 @@ public:
/// DeclRefExprBits.HasTemplateKWAndArgsInfo:
/// Specifies when this declaration reference expression has an explicit
/// C++ template keyword and/or template argument list.
-/// DeclRefExprBits.RefersToEnclosingLocal
+/// DeclRefExprBits.RefersToEnclosingVariableOrCapture
/// Specifies when this declaration reference expression (validly)
-/// refers to a local variable from a different function.
+/// refers to an enclosed local or a captured variable.
class DeclRefExpr : public Expr {
/// \brief The declaration that we are referencing.
ValueDecl *D;
@@ -933,7 +938,7 @@ class DeclRefExpr : public Expr {
DeclRefExpr(const ASTContext &Ctx,
NestedNameSpecifierLoc QualifierLoc,
SourceLocation TemplateKWLoc,
- ValueDecl *D, bool refersToEnclosingLocal,
+ ValueDecl *D, bool RefersToEnlosingVariableOrCapture,
const DeclarationNameInfo &NameInfo,
NamedDecl *FoundD,
const TemplateArgumentListInfo *TemplateArgs,
@@ -948,7 +953,7 @@ class DeclRefExpr : public Expr {
void computeDependence(const ASTContext &C);
public:
- DeclRefExpr(ValueDecl *D, bool refersToEnclosingLocal, QualType T,
+ DeclRefExpr(ValueDecl *D, bool RefersToEnclosingVariableOrCapture, QualType T,
ExprValueKind VK, SourceLocation L,
const DeclarationNameLoc &LocInfo = DeclarationNameLoc())
: Expr(DeclRefExprClass, T, VK, OK_Ordinary, false, false, false, false),
@@ -957,20 +962,22 @@ public:
DeclRefExprBits.HasTemplateKWAndArgsInfo = 0;
DeclRefExprBits.HasFoundDecl = 0;
DeclRefExprBits.HadMultipleCandidates = 0;
- DeclRefExprBits.RefersToEnclosingLocal = refersToEnclosingLocal;
+ DeclRefExprBits.RefersToEnclosingVariableOrCapture =
+ RefersToEnclosingVariableOrCapture;
computeDependence(D->getASTContext());
}
static DeclRefExpr *
Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
- SourceLocation TemplateKWLoc, ValueDecl *D, bool isEnclosingLocal,
- SourceLocation NameLoc, QualType T, ExprValueKind VK,
- NamedDecl *FoundD = nullptr,
+ SourceLocation TemplateKWLoc, ValueDecl *D,
+ bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc,
+ QualType T, ExprValueKind VK, NamedDecl *FoundD = nullptr,
const TemplateArgumentListInfo *TemplateArgs = nullptr);
static DeclRefExpr *
Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
- SourceLocation TemplateKWLoc, ValueDecl *D, bool isEnclosingLocal,
+ SourceLocation TemplateKWLoc, ValueDecl *D,
+ bool RefersToEnclosingVariableOrCapture,
const DeclarationNameInfo &NameInfo, QualType T, ExprValueKind VK,
NamedDecl *FoundD = nullptr,
const TemplateArgumentListInfo *TemplateArgs = nullptr);
@@ -1144,10 +1151,10 @@ public:
DeclRefExprBits.HadMultipleCandidates = V;
}
- /// Does this DeclRefExpr refer to a local declaration from an
- /// enclosing function scope?
- bool refersToEnclosingLocal() const {
- return DeclRefExprBits.RefersToEnclosingLocal;
+ /// \brief Does this DeclRefExpr refer to an enclosing local or a captured
+ /// variable?
+ bool refersToEnclosingVariableOrCapture() const {
+ return DeclRefExprBits.RefersToEnclosingVariableOrCapture;
}
static bool classof(const Stmt *T) {
@@ -1232,8 +1239,8 @@ class APNumericStorage {
bool hasAllocation() const { return llvm::APInt::getNumWords(BitWidth) > 1; }
- APNumericStorage(const APNumericStorage &) LLVM_DELETED_FUNCTION;
- void operator=(const APNumericStorage &) LLVM_DELETED_FUNCTION;
+ APNumericStorage(const APNumericStorage &) = delete;
+ void operator=(const APNumericStorage &) = delete;
protected:
APNumericStorage() : VAL(0), BitWidth(0) { }
@@ -1990,18 +1997,7 @@ public:
UnaryExprOrTypeTraitExpr(UnaryExprOrTypeTrait ExprKind, Expr *E,
QualType resultType, SourceLocation op,
- SourceLocation rp) :
- Expr(UnaryExprOrTypeTraitExprClass, resultType, VK_RValue, OK_Ordinary,
- false, // Never type-dependent (C++ [temp.dep.expr]p3).
- // Value-dependent if the argument is type-dependent.
- E->isTypeDependent(),
- E->isInstantiationDependent(),
- E->containsUnexpandedParameterPack()),
- OpLoc(op), RParenLoc(rp) {
- UnaryExprOrTypeTraitExprBits.Kind = ExprKind;
- UnaryExprOrTypeTraitExprBits.IsType = false;
- Argument.Ex = E;
- }
+ SourceLocation rp);
/// \brief Construct an empty sizeof/alignof expression.
explicit UnaryExprOrTypeTraitExpr(EmptyShell Empty)
@@ -2280,7 +2276,7 @@ public:
/// getCallReturnType - Get the return type of the call expr. This is not
/// always the type of the expr itself, if the return type is a reference
/// type.
- QualType getCallReturnType() const;
+ QualType getCallReturnType(const ASTContext &Ctx) const;
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h
index 040fbe7f92..d1a6063b6b 100644
--- a/include/clang/AST/ExprCXX.h
+++ b/include/clang/AST/ExprCXX.h
@@ -17,10 +17,10 @@
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
+#include "clang/AST/LambdaCapture.h"
#include "clang/AST/TemplateBase.h"
#include "clang/AST/UnresolvedSet.h"
#include "clang/Basic/ExpressionTraits.h"
-#include "clang/AST/LambdaCapture.h"
#include "clang/Basic/TypeTraits.h"
#include "llvm/Support/Compiler.h"
@@ -86,6 +86,13 @@ public:
/// of the right bracket.
SourceLocation getOperatorLoc() const { return getRParenLoc(); }
+ SourceLocation getExprLoc() const LLVM_READONLY {
+ return (Operator < OO_Plus || Operator >= OO_Arrow ||
+ Operator == OO_PlusPlus || Operator == OO_MinusMinus)
+ ? getLocStart()
+ : getOperatorLoc();
+ }
+
SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
SourceRange getSourceRange() const { return Range; }
@@ -1127,7 +1134,7 @@ public:
ConstructionKind ConstructKind,
SourceRange ParenOrBraceRange);
- CXXConstructorDecl* getConstructor() const { return Constructor; }
+ CXXConstructorDecl *getConstructor() const { return Constructor; }
void setConstructor(CXXConstructorDecl *C) { Constructor = C; }
SourceLocation getLocation() const { return Loc; }
@@ -1404,14 +1411,13 @@ class LambdaExpr : public Expr {
unsigned *getArrayIndexStarts() const {
return reinterpret_cast<unsigned *>(getStoredStmts() + NumCaptures + 1);
}
-
+
/// \brief Retrieve the complete set of array-index variables.
VarDecl **getArrayIndexVars() const {
- unsigned ArrayIndexSize =
- llvm::RoundUpToAlignment(sizeof(unsigned) * (NumCaptures + 1),
- llvm::alignOf<VarDecl*>());
+ unsigned ArrayIndexSize = llvm::RoundUpToAlignment(
+ sizeof(unsigned) * (NumCaptures + 1), llvm::alignOf<VarDecl *>());
return reinterpret_cast<VarDecl **>(
- reinterpret_cast<char*>(getArrayIndexStarts()) + ArrayIndexSize);
+ reinterpret_cast<char *>(getArrayIndexStarts()) + ArrayIndexSize);
}
public:
@@ -1686,6 +1692,10 @@ public:
/// not be done, the deallocation function shall not be called,
/// and the value of the new-expression shall be null.
///
+ /// C++ DR1748:
+ /// If the allocation function is a reserved placement allocation
+ /// function that returns null, the behavior is undefined.
+ ///
/// An allocation function is not allowed to return null unless it
/// has a non-throwing exception-specification. The '03 rule is
/// identical except that the definition of a non-throwing
@@ -2915,8 +2925,9 @@ public:
SourceLocation getLocStart() const LLVM_READONLY;
SourceLocation getLocEnd() const LLVM_READONLY {
- assert(RParenLoc.isValid() || NumArgs == 1);
- return RParenLoc.isValid() ? RParenLoc : getArg(0)->getLocEnd();
+ if (!RParenLoc.isValid() && NumArgs > 0)
+ return getArg(NumArgs - 1)->getLocEnd();
+ return RParenLoc;
}
static bool classof(const Stmt *T) {
diff --git a/include/clang/AST/ExprObjC.h b/include/clang/AST/ExprObjC.h
index 817c0cc431..f296e8f71d 100644
--- a/include/clang/AST/ExprObjC.h
+++ b/include/clang/AST/ExprObjC.h
@@ -124,6 +124,15 @@ public:
// Iterators
child_range children() { return child_range(&SubExpr, &SubExpr+1); }
+
+ typedef ConstExprIterator const_arg_iterator;
+
+ const_arg_iterator arg_begin() const {
+ return reinterpret_cast<Stmt const * const*>(&SubExpr);
+ }
+ const_arg_iterator arg_end() const {
+ return reinterpret_cast<Stmt const * const*>(&SubExpr + 1);
+ }
friend class ASTStmtReader;
};
diff --git a/include/clang/AST/ExternalASTSource.h b/include/clang/AST/ExternalASTSource.h
index ff1d180ee8..f35639c191 100644
--- a/include/clang/AST/ExternalASTSource.h
+++ b/include/clang/AST/ExternalASTSource.h
@@ -344,7 +344,7 @@ public:
/// \brief Whether this pointer is non-NULL.
///
/// This operation does not require the AST node to be deserialized.
- LLVM_EXPLICIT operator bool() const { return Ptr != 0; }
+ explicit operator bool() const { return Ptr != 0; }
/// \brief Whether this pointer is non-NULL.
///
diff --git a/include/clang/AST/Mangle.h b/include/clang/AST/Mangle.h
index cbe08a1a76..20ce32e3ba 100644
--- a/include/clang/AST/Mangle.h
+++ b/include/clang/AST/Mangle.h
@@ -132,12 +132,18 @@ public:
virtual void mangleDynamicAtExitDestructor(const VarDecl *D,
raw_ostream &) = 0;
+ virtual void mangleSEHFilterExpression(const NamedDecl *EnclosingDecl,
+ raw_ostream &Out) = 0;
+
/// Generates a unique string for an externally visible type for use with TBAA
/// or type uniquing.
/// TODO: Extend this to internal types by generating names that are unique
/// across translation units so it can be used with LTO.
virtual void mangleTypeName(QualType T, raw_ostream &) = 0;
+ virtual void mangleCXXVTableBitSet(const CXXRecordDecl *RD,
+ raw_ostream &) = 0;
+
/// @}
};
diff --git a/include/clang/AST/NestedNameSpecifier.h b/include/clang/AST/NestedNameSpecifier.h
index 518f1232fe..4da17b0c07 100644
--- a/include/clang/AST/NestedNameSpecifier.h
+++ b/include/clang/AST/NestedNameSpecifier.h
@@ -102,7 +102,7 @@ private:
Specifier(Other.Specifier) {
}
- void operator=(const NestedNameSpecifier &) LLVM_DELETED_FUNCTION;
+ void operator=(const NestedNameSpecifier &) = delete;
/// \brief Either find or insert the given nested name specifier
/// mockup in the given context.
@@ -245,7 +245,7 @@ public:
/// \brief Evalutes true when this nested-name-specifier location is
/// non-empty.
- LLVM_EXPLICIT operator bool() const { return Qualifier; }
+ explicit operator bool() const { return Qualifier; }
/// \brief Evalutes true when this nested-name-specifier location is
/// empty.
diff --git a/include/clang/AST/RecordLayout.h b/include/clang/AST/RecordLayout.h
index 7b7799884a..f9240f2b48 100644
--- a/include/clang/AST/RecordLayout.h
+++ b/include/clang/AST/RecordLayout.h
@@ -163,8 +163,8 @@ private:
void Destroy(ASTContext &Ctx);
- ASTRecordLayout(const ASTRecordLayout &) LLVM_DELETED_FUNCTION;
- void operator=(const ASTRecordLayout &) LLVM_DELETED_FUNCTION;
+ ASTRecordLayout(const ASTRecordLayout &) = delete;
+ void operator=(const ASTRecordLayout &) = delete;
public:
/// getAlignment - Get the record alignment in characters.
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h
index a1d36180d7..ff8e74b650 100644
--- a/include/clang/AST/RecursiveASTVisitor.h
+++ b/include/clang/AST/RecursiveASTVisitor.h
@@ -2032,12 +2032,20 @@ DEF_TRAVERSE_STMT(CXXStaticCastExpr, {
// to the syntactic form.
template <typename Derived>
bool RecursiveASTVisitor<Derived>::TraverseInitListExpr(InitListExpr *S) {
- if (InitListExpr *Syn = S->getSyntacticForm())
- S = Syn;
- TRY_TO(WalkUpFromInitListExpr(S));
- // All we need are the default actions. FIXME: use a helper function.
- for (Stmt::child_range range = S->children(); range; ++range) {
- TRY_TO(TraverseStmt(*range));
+ InitListExpr *Syn = S->isSemanticForm() ? S->getSyntacticForm() : S;
+ if (Syn) {
+ TRY_TO(WalkUpFromInitListExpr(Syn));
+ // All we need are the default actions. FIXME: use a helper function.
+ for (Stmt::child_range range = Syn->children(); range; ++range) {
+ TRY_TO(TraverseStmt(*range));
+ }
+ }
+ InitListExpr *Sem = S->isSemanticForm() ? S : S->getSemanticForm();
+ if (Sem) {
+ TRY_TO(WalkUpFromInitListExpr(Sem));
+ for (Stmt::child_range range = Sem->children(); range; ++range) {
+ TRY_TO(TraverseStmt(*range));
+ }
}
return true;
}
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index 380c3b956e..465bceaa19 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -212,7 +212,7 @@ protected:
unsigned HasTemplateKWAndArgsInfo : 1;
unsigned HasFoundDecl : 1;
unsigned HadMultipleCandidates : 1;
- unsigned RefersToEnclosingLocal : 1;
+ unsigned RefersToEnclosingVariableOrCapture : 1;
};
class CastExprBitfields {
@@ -583,6 +583,7 @@ public:
body_range body() { return body_range(body_begin(), body_end()); }
body_iterator body_begin() { return Body; }
body_iterator body_end() { return Body + size(); }
+ Stmt *body_front() { return !body_empty() ? Body[0] : nullptr; }
Stmt *body_back() { return !body_empty() ? Body[size()-1] : nullptr; }
void setLastStmt(Stmt *S) {
@@ -598,6 +599,9 @@ public:
}
const_body_iterator body_begin() const { return Body; }
const_body_iterator body_end() const { return Body + size(); }
+ const Stmt *body_front() const {
+ return !body_empty() ? Body[0] : nullptr;
+ }
const Stmt *body_back() const {
return !body_empty() ? Body[size() - 1] : nullptr;
}
@@ -1015,7 +1019,7 @@ public:
SourceLocation getLocStart() const LLVM_READONLY { return SwitchLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
- return SubExprs[BODY]->getLocEnd();
+ return SubExprs[BODY] ? SubExprs[BODY]->getLocEnd() : SubExprs[COND]->getLocEnd();
}
// Iterators
diff --git a/include/clang/AST/StmtIterator.h b/include/clang/AST/StmtIterator.h
index 6ffe74f2d7..ec7329a4a0 100644
--- a/include/clang/AST/StmtIterator.h
+++ b/include/clang/AST/StmtIterator.h
@@ -148,7 +148,7 @@ struct StmtRange : std::pair<StmtIterator,StmtIterator> {
: std::pair<StmtIterator,StmtIterator>(begin, end) {}
bool empty() const { return first == second; }
- LLVM_EXPLICIT operator bool() const { return !empty(); }
+ explicit operator bool() const { return !empty(); }
Stmt *operator->() const { return first.operator->(); }
Stmt *&operator*() const { return first.operator*(); }
@@ -191,7 +191,7 @@ struct ConstStmtRange : std::pair<ConstStmtIterator,ConstStmtIterator> {
: std::pair<ConstStmtIterator,ConstStmtIterator>(begin, end) {}
bool empty() const { return first == second; }
- LLVM_EXPLICIT operator bool() const { return !empty(); }
+ explicit operator bool() const { return !empty(); }
const Stmt *operator->() const { return first.operator->(); }
const Stmt *operator*() const { return first.operator*(); }
diff --git a/include/clang/AST/StmtOpenMP.h b/include/clang/AST/StmtOpenMP.h
index 6a2832cdad..aed7691cf7 100644
--- a/include/clang/AST/StmtOpenMP.h
+++ b/include/clang/AST/StmtOpenMP.h
@@ -254,6 +254,13 @@ class OMPLoopDirective : public OMPExecutableDirective {
unsigned CollapsedNum;
/// \brief Offsets to the stored exprs.
+ /// This enumeration contains offsets to all the pointers to children
+ /// expressions stored in OMPLoopDirective.
+ /// The first 9 children are nesessary for all the loop directives, and
+ /// the next 7 are specific to the worksharing ones.
+ /// After the fixed children, three arrays of length CollapsedNum are
+ /// allocated: loop counters, their updates and final values.
+ ///
enum {
AssociatedStmtOffset = 0,
IterationVariableOffset = 1,
@@ -264,27 +271,43 @@ class OMPLoopDirective : public OMPExecutableDirective {
SeparatedCondOffset = 6,
InitOffset = 7,
IncOffset = 8,
- ArraysOffset = 9
+ // The '...End' enumerators do not correspond to child expressions - they
+ // specify the offset to the end (and start of the following counters/
+ // updates/finals arrays).
+ DefaultEnd = 9,
+ // The following 7 exprs are used by worksharing loops only.
+ IsLastIterVariableOffset = 9,
+ LowerBoundVariableOffset = 10,
+ UpperBoundVariableOffset = 11,
+ StrideVariableOffset = 12,
+ EnsureUpperBoundOffset = 13,
+ NextLowerBoundOffset = 14,
+ NextUpperBoundOffset = 15,
+ // Offset to the end (and start of the following counters/updates/finals
+ // arrays) for worksharing loop directives.
+ WorksharingEnd = 16,
};
/// \brief Get the counters storage.
MutableArrayRef<Expr *> getCounters() {
- Expr **Storage =
- reinterpret_cast<Expr **>(&(*(std::next(child_begin(), ArraysOffset))));
+ Expr **Storage = reinterpret_cast<Expr **>(
+ &(*(std::next(child_begin(), getArraysOffset(getDirectiveKind())))));
return MutableArrayRef<Expr *>(Storage, CollapsedNum);
}
/// \brief Get the updates storage.
MutableArrayRef<Expr *> getUpdates() {
Expr **Storage = reinterpret_cast<Expr **>(
- &*std::next(child_begin(), ArraysOffset + CollapsedNum));
+ &*std::next(child_begin(),
+ getArraysOffset(getDirectiveKind()) + CollapsedNum));
return MutableArrayRef<Expr *>(Storage, CollapsedNum);
}
/// \brief Get the final counter updates storage.
MutableArrayRef<Expr *> getFinals() {
Expr **Storage = reinterpret_cast<Expr **>(
- &*std::next(child_begin(), ArraysOffset + 2 * CollapsedNum));
+ &*std::next(child_begin(),
+ getArraysOffset(getDirectiveKind()) + 2 * CollapsedNum));
return MutableArrayRef<Expr *>(Storage, CollapsedNum);
}
@@ -305,13 +328,21 @@ protected:
unsigned CollapsedNum, unsigned NumClauses,
unsigned NumSpecialChildren = 0)
: OMPExecutableDirective(That, SC, Kind, StartLoc, EndLoc, NumClauses,
- numLoopChildren(CollapsedNum) +
+ numLoopChildren(CollapsedNum, Kind) +
NumSpecialChildren),
CollapsedNum(CollapsedNum) {}
+ /// \brief Offset to the start of children expression arrays.
+ static unsigned getArraysOffset(OpenMPDirectiveKind Kind) {
+ return isOpenMPWorksharingDirective(Kind) ? WorksharingEnd
+ : DefaultEnd;
+ }
+
/// \brief Children number.
- static unsigned numLoopChildren(unsigned CollapsedNum) {
- return ArraysOffset + 3 * CollapsedNum; // Counters, Updates and Finals
+ static unsigned numLoopChildren(unsigned CollapsedNum,
+ OpenMPDirectiveKind Kind) {
+ return getArraysOffset(Kind) +
+ 3 * CollapsedNum; // Counters, Updates and Finals
}
void setIterationVariable(Expr *IV) {
@@ -332,11 +363,123 @@ protected:
}
void setInit(Expr *Init) { *std::next(child_begin(), InitOffset) = Init; }
void setInc(Expr *Inc) { *std::next(child_begin(), IncOffset) = Inc; }
+ void setIsLastIterVariable(Expr *IL) {
+ assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
+ "expected worksharing loop directive");
+ *std::next(child_begin(), IsLastIterVariableOffset) = IL;
+ }
+ void setLowerBoundVariable(Expr *LB) {
+ assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
+ "expected worksharing loop directive");
+ *std::next(child_begin(), LowerBoundVariableOffset) = LB;
+ }
+ void setUpperBoundVariable(Expr *UB) {
+ assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
+ "expected worksharing loop directive");
+ *std::next(child_begin(), UpperBoundVariableOffset) = UB;
+ }
+ void setStrideVariable(Expr *ST) {
+ assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
+ "expected worksharing loop directive");
+ *std::next(child_begin(), StrideVariableOffset) = ST;
+ }
+ void setEnsureUpperBound(Expr *EUB) {
+ assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
+ "expected worksharing loop directive");
+ *std::next(child_begin(), EnsureUpperBoundOffset) = EUB;
+ }
+ void setNextLowerBound(Expr *NLB) {
+ assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
+ "expected worksharing loop directive");
+ *std::next(child_begin(), NextLowerBoundOffset) = NLB;
+ }
+ void setNextUpperBound(Expr *NUB) {
+ assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
+ "expected worksharing loop directive");
+ *std::next(child_begin(), NextUpperBoundOffset) = NUB;
+ }
void setCounters(ArrayRef<Expr *> A);
void setUpdates(ArrayRef<Expr *> A);
void setFinals(ArrayRef<Expr *> A);
public:
+ /// \brief The expressions built for the OpenMP loop CodeGen for the
+ /// whole collapsed loop nest.
+ struct HelperExprs {
+ /// \brief Loop iteration variable.
+ Expr *IterationVarRef;
+ /// \brief Loop last iteration number.
+ Expr *LastIteration;
+ /// \brief Calculation of last iteration.
+ Expr *CalcLastIteration;
+ /// \brief Loop pre-condition.
+ Expr *PreCond;
+ /// \brief Loop condition.
+ Expr *Cond;
+ /// \brief A condition with 1 iteration separated.
+ Expr *SeparatedCond;
+ /// \brief Loop iteration variable init.
+ Expr *Init;
+ /// \brief Loop increment.
+ Expr *Inc;
+ /// \brief IsLastIteration - local flag variable passed to runtime.
+ Expr *IL;
+ /// \brief LowerBound - local variable passed to runtime.
+ Expr *LB;
+ /// \brief UpperBound - local variable passed to runtime.
+ Expr *UB;
+ /// \brief Stride - local variable passed to runtime.
+ Expr *ST;
+ /// \brief EnsureUpperBound -- expression LB = min(LB, NumIterations).
+ Expr *EUB;
+ /// \brief Update of LowerBound for statically sheduled 'omp for' loops.
+ Expr *NLB;
+ /// \brief Update of UpperBound for statically sheduled 'omp for' loops.
+ Expr *NUB;
+ /// \brief Counters Loop counters.
+ SmallVector<Expr *, 4> Counters;
+ /// \brief Expressions for loop counters update for CodeGen.
+ SmallVector<Expr *, 4> Updates;
+ /// \brief Final loop counter values for GodeGen.
+ SmallVector<Expr *, 4> Finals;
+
+ /// \brief Check if all the expressions are built (does not check the
+ /// worksharing ones).
+ bool builtAll() {
+ return IterationVarRef != nullptr && LastIteration != nullptr &&
+ PreCond != nullptr && Cond != nullptr &&
+ SeparatedCond != nullptr && Init != nullptr && Inc != nullptr;
+ }
+
+ /// \brief Initialize all the fields to null.
+ /// \param Size Number of elements in the counters/finals/updates arrays.
+ void clear(unsigned Size) {
+ IterationVarRef = nullptr;
+ LastIteration = nullptr;
+ CalcLastIteration = nullptr;
+ PreCond = nullptr;
+ Cond = nullptr;
+ SeparatedCond = nullptr;
+ Init = nullptr;
+ Inc = nullptr;
+ IL = nullptr;
+ LB = nullptr;
+ UB = nullptr;
+ ST = nullptr;
+ EUB = nullptr;
+ NLB = nullptr;
+ NUB = nullptr;
+ Counters.resize(Size);
+ Updates.resize(Size);
+ Finals.resize(Size);
+ for (unsigned i = 0; i < Size; ++i) {
+ Counters[i] = nullptr;
+ Updates[i] = nullptr;
+ Finals[i] = nullptr;
+ }
+ }
+ };
+
/// \brief Get number of collapsed loops.
unsigned getCollapsedNumber() const { return CollapsedNum; }
@@ -369,6 +512,48 @@ public:
return const_cast<Expr *>(
reinterpret_cast<const Expr *>(*std::next(child_begin(), IncOffset)));
}
+ Expr *getIsLastIterVariable() const {
+ assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
+ "expected worksharing loop directive");
+ return const_cast<Expr *>(reinterpret_cast<const Expr *>(
+ *std::next(child_begin(), IsLastIterVariableOffset)));
+ }
+ Expr *getLowerBoundVariable() const {
+ assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
+ "expected worksharing loop directive");
+ return const_cast<Expr *>(reinterpret_cast<const Expr *>(
+ *std::next(child_begin(), LowerBoundVariableOffset)));
+ }
+ Expr *getUpperBoundVariable() const {
+ assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
+ "expected worksharing loop directive");
+ return const_cast<Expr *>(reinterpret_cast<const Expr *>(
+ *std::next(child_begin(), UpperBoundVariableOffset)));
+ }
+ Expr *getStrideVariable() const {
+ assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
+ "expected worksharing loop directive");
+ return const_cast<Expr *>(reinterpret_cast<const Expr *>(
+ *std::next(child_begin(), StrideVariableOffset)));
+ }
+ Expr *getEnsureUpperBound() const {
+ assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
+ "expected worksharing loop directive");
+ return const_cast<Expr *>(reinterpret_cast<const Expr *>(
+ *std::next(child_begin(), EnsureUpperBoundOffset)));
+ }
+ Expr *getNextLowerBound() const {
+ assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
+ "expected worksharing loop directive");
+ return const_cast<Expr *>(reinterpret_cast<const Expr *>(
+ *std::next(child_begin(), NextLowerBoundOffset)));
+ }
+ Expr *getNextUpperBound() const {
+ assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
+ "expected worksharing loop directive");
+ return const_cast<Expr *>(reinterpret_cast<const Expr *>(
+ *std::next(child_begin(), NextUpperBoundOffset)));
+ }
const Stmt *getBody() const {
// This relies on the loop form is already checked by Sema.
Stmt *Body = getAssociatedStmt()->IgnoreContainers(true);
@@ -449,24 +634,13 @@ public:
/// \param CollapsedNum Number of collapsed loops.
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
- /// \param IV Loop iteration variable for CodeGen.
- /// \param LastIteration Loop last iteration number for CodeGen.
- /// \param CalcLastIteration Calculation of last iteration.
- /// \param PreCond Pre-condition.
- /// \param Cond Condition.
- /// \param SeparatedCond Condition with 1 iteration separated.
- /// \param Inc Loop increment.
- /// \param Counters Loop counters.
- /// \param Updates Expressions for loop counters update for CodeGen.
- /// \param Finals Final loop counter values for GodeGen.
- ///
- static OMPSimdDirective *
- Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
- unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
- Stmt *AssociatedStmt, Expr *IV, Expr *LastIteration,
- Expr *CalcLastIteration, Expr *PreCond, Expr *Cond,
- Expr *SeparatedCond, Expr *Init, Expr *Inc, ArrayRef<Expr *> Counters,
- ArrayRef<Expr *> Updates, ArrayRef<Expr *> Finals);
+ /// \param Exprs Helper expressions for CodeGen.
+ ///
+ static OMPSimdDirective *Create(const ASTContext &C, SourceLocation StartLoc,
+ SourceLocation EndLoc, unsigned CollapsedNum,
+ ArrayRef<OMPClause *> Clauses,
+ Stmt *AssociatedStmt,
+ const HelperExprs &Exprs);
/// \brief Creates an empty directive with the place
/// for \a NumClauses clauses.
@@ -524,24 +698,13 @@ public:
/// \param CollapsedNum Number of collapsed loops.
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
- /// \param IV Loop iteration variable for CodeGen.
- /// \param LastIteration Loop last iteration number for CodeGen.
- /// \param CalcLastIteration Calculation of last iteration.
- /// \param PreCond Pre-condition.
- /// \param Cond Condition.
- /// \param SeparatedCond Condition with 1 iteration separated.
- /// \param Inc Loop increment.
- /// \param Counters Loop counters.
- /// \param Updates Expressions for loop counters update for CodeGen.
- /// \param Finals Final loop counter values for GodeGen.
- ///
- static OMPForDirective *
- Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
- unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
- Stmt *AssociatedStmt, Expr *IV, Expr *LastIteration,
- Expr *CalcLastIteration, Expr *PreCond, Expr *Cond,
- Expr *SeparatedCond, Expr *Init, Expr *Inc, ArrayRef<Expr *> Counters,
- ArrayRef<Expr *> Updates, ArrayRef<Expr *> Finals);
+ /// \param Exprs Helper expressions for CodeGen.
+ ///
+ static OMPForDirective *Create(const ASTContext &C, SourceLocation StartLoc,
+ SourceLocation EndLoc, unsigned CollapsedNum,
+ ArrayRef<OMPClause *> Clauses,
+ Stmt *AssociatedStmt,
+ const HelperExprs &Exprs);
/// \brief Creates an empty directive with the place
/// for \a NumClauses clauses.
@@ -600,24 +763,12 @@ public:
/// \param CollapsedNum Number of collapsed loops.
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
- /// \param IV Loop iteration variable for CodeGen.
- /// \param LastIteration Loop last iteration number for CodeGen.
- /// \param CalcLastIteration Calculation of last iteration.
- /// \param PreCond Pre-condition.
- /// \param Cond Condition.
- /// \param SeparatedCond Condition with 1 iteration separated.
- /// \param Inc Loop increment.
- /// \param Counters Loop counters.
- /// \param Updates Expressions for loop counters update for CodeGen.
- /// \param Finals Final loop counter values for GodeGen.
+ /// \param Exprs Helper expressions for CodeGen.
///
static OMPForSimdDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
- Stmt *AssociatedStmt, Expr *IV, Expr *LastIteration,
- Expr *CalcLastIteration, Expr *PreCond, Expr *Cond,
- Expr *SeparatedCond, Expr *Init, Expr *Inc, ArrayRef<Expr *> Counters,
- ArrayRef<Expr *> Updates, ArrayRef<Expr *> Finals);
+ Stmt *AssociatedStmt, const HelperExprs &Exprs);
/// \brief Creates an empty directive with the place
/// for \a NumClauses clauses.
@@ -949,24 +1100,12 @@ public:
/// \param CollapsedNum Number of collapsed loops.
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
- /// \param IV Loop iteration variable for CodeGen.
- /// \param LastIteration Loop last iteration number for CodeGen.
- /// \param CalcLastIteration Calculation of last iteration.
- /// \param PreCond Pre-condition.
- /// \param Cond Condition.
- /// \param SeparatedCond Condition with 1 iteration separated.
- /// \param Inc Loop increment.
- /// \param Counters Loop counters.
- /// \param Updates Expressions for loop counters update for CodeGen.
- /// \param Finals Final loop counter values for GodeGen.
+ /// \param Exprs Helper expressions for CodeGen.
///
static OMPParallelForDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
- Stmt *AssociatedStmt, Expr *IV, Expr *LastIteration,
- Expr *CalcLastIteration, Expr *PreCond, Expr *Cond,
- Expr *SeparatedCond, Expr *Init, Expr *Inc, ArrayRef<Expr *> Counters,
- ArrayRef<Expr *> Updates, ArrayRef<Expr *> Finals);
+ Stmt *AssociatedStmt, const HelperExprs &Exprs);
/// \brief Creates an empty directive with the place
/// for \a NumClauses clauses.
@@ -1030,24 +1169,12 @@ public:
/// \param CollapsedNum Number of collapsed loops.
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
- /// \param IV Loop iteration variable for CodeGen.
- /// \param LastIteration Loop last iteration number for CodeGen.
- /// \param CalcLastIteration Calculation of last iteration.
- /// \param PreCond Pre-condition.
- /// \param Cond Condition.
- /// \param SeparatedCond Condition with 1 iteration separated.
- /// \param Inc Loop increment.
- /// \param Counters Loop counters.
- /// \param Updates Expressions for loop counters update for CodeGen.
- /// \param Finals Final loop counter values for GodeGen.
+ /// \param Exprs Helper expressions for CodeGen.
///
static OMPParallelForSimdDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
- Stmt *AssociatedStmt, Expr *IV, Expr *LastIteration,
- Expr *CalcLastIteration, Expr *PreCond, Expr *Cond,
- Expr *SeparatedCond, Expr *Init, Expr *Inc, ArrayRef<Expr *> Counters,
- ArrayRef<Expr *> Updates, ArrayRef<Expr *> Finals);
+ Stmt *AssociatedStmt, const HelperExprs &Exprs);
/// \brief Creates an empty directive with the place
/// for \a NumClauses clauses.
diff --git a/include/clang/AST/TemplateBase.h b/include/clang/AST/TemplateBase.h
index f3c6440f40..1d01753c10 100644
--- a/include/clang/AST/TemplateBase.h
+++ b/include/clang/AST/TemplateBase.h
@@ -18,8 +18,8 @@
#include "clang/AST/TemplateName.h"
#include "clang/AST/Type.h"
#include "llvm/ADT/APSInt.h"
-#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
@@ -114,7 +114,7 @@ private:
struct TV TypeOrValue;
};
- TemplateArgument(TemplateName, bool) LLVM_DELETED_FUNCTION;
+ TemplateArgument(TemplateName, bool) = delete;
public:
/// \brief Construct an empty, invalid template argument.
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index 4f194b022d..b252d484e3 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -16,6 +16,7 @@
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/TemplateName.h"
+#include "clang/Basic/AddressSpaces.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/ExceptionSpecificationType.h"
#include "clang/Basic/LLVM.h"
@@ -25,11 +26,11 @@
#include "clang/Basic/Visibility.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/FoldingSet.h"
-#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/ErrorHandling.h"
namespace clang {
@@ -400,21 +401,36 @@ public:
Mask |= qs.Mask;
}
+ /// \brief Returns true if this address space is a superset of the other one.
+ /// OpenCL v2.0 defines conversion rules (OpenCLC v2.0 s6.5.5) and notion of
+ /// overlapping address spaces.
+ /// CL1.1 or CL1.2:
+ /// every address space is a superset of itself.
+ /// CL2.0 adds:
+ /// __generic is a superset of any address space except for __constant.
+ bool isAddressSpaceSupersetOf(Qualifiers other) const {
+ return
+ // Address spaces must match exactly.
+ getAddressSpace() == other.getAddressSpace() ||
+ // Otherwise in OpenCLC v2.0 s6.5.5: every address space except
+ // for __constant can be used as __generic.
+ (getAddressSpace() == LangAS::opencl_generic &&
+ other.getAddressSpace() != LangAS::opencl_constant);
+ }
+
/// \brief Determines if these qualifiers compatibly include another set.
/// Generally this answers the question of whether an object with the other
/// qualifiers can be safely used as an object with these qualifiers.
bool compatiblyIncludes(Qualifiers other) const {
- return
- // Address spaces must match exactly.
- getAddressSpace() == other.getAddressSpace() &&
- // ObjC GC qualifiers can match, be added, or be removed, but can't be
- // changed.
- (getObjCGCAttr() == other.getObjCGCAttr() ||
- !hasObjCGCAttr() || !other.hasObjCGCAttr()) &&
- // ObjC lifetime qualifiers must match exactly.
- getObjCLifetime() == other.getObjCLifetime() &&
- // CVR qualifiers may subset.
- (((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask & CVRMask));
+ return isAddressSpaceSupersetOf(other) &&
+ // ObjC GC qualifiers can match, be added, or be removed, but can't
+ // be changed.
+ (getObjCGCAttr() == other.getObjCGCAttr() || !hasObjCGCAttr() ||
+ !other.hasObjCGCAttr()) &&
+ // ObjC lifetime qualifiers must match exactly.
+ getObjCLifetime() == other.getObjCLifetime() &&
+ // CVR qualifiers may subset.
+ (((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask & CVRMask));
}
/// \brief Determines if these qualifiers compatibly include another set of
@@ -440,7 +456,7 @@ public:
bool operator==(Qualifiers Other) const { return Mask == Other.Mask; }
bool operator!=(Qualifiers Other) const { return Mask != Other.Mask; }
- LLVM_EXPLICIT operator bool() const { return hasQualifiers(); }
+ explicit operator bool() const { return hasQualifiers(); }
Qualifiers &operator+=(Qualifiers R) {
addQualifiers(R);
@@ -1163,8 +1179,8 @@ public:
};
private:
- Type(const Type &) LLVM_DELETED_FUNCTION;
- void operator=(const Type &) LLVM_DELETED_FUNCTION;
+ Type(const Type &) = delete;
+ void operator=(const Type &) = delete;
/// Bitfields required by the Type class.
class TypeBitfields {
@@ -1691,6 +1707,11 @@ public:
/// type of a class template or class template partial specialization.
CXXRecordDecl *getAsCXXRecordDecl() const;
+ /// \brief Retrieves the TagDecl that this type refers to, either
+ /// because the type is a TagType or because it is the injected-class-name
+ /// type of a class template or class template partial specialization.
+ TagDecl *getAsTagDecl() const;
+
/// If this is a pointer or reference to a RecordType, return the
/// CXXRecordDecl that that type refers to.
///
@@ -1988,6 +2009,22 @@ public:
QualType getPointeeType() const { return PointeeType; }
+ /// \brief Returns true if address spaces of pointers overlap.
+ /// OpenCL v2.0 defines conversion rules for pointers to different
+ /// address spaces (OpenCLC v2.0 s6.5.5) and notion of overlapping
+ /// address spaces.
+ /// CL1.1 or CL1.2:
+ /// address spaces overlap iff they are they same.
+ /// CL2.0 adds:
+ /// __generic overlaps with any address space except for __constant.
+ bool isAddressSpaceOverlapping(const PointerType &other) const {
+ Qualifiers thisQuals = PointeeType.getQualifiers();
+ Qualifiers otherQuals = other.getPointeeType().getQualifiers();
+ // Address spaces overlap if at least one of them is a superset of another
+ return thisQuals.isAddressSpaceSupersetOf(otherQuals) ||
+ otherQuals.isAddressSpaceSupersetOf(thisQuals);
+ }
+
bool isSugared() const { return false; }
QualType desugar() const { return QualType(this, 0); }
@@ -3435,7 +3472,6 @@ public:
attr_thiscall,
attr_pascal,
attr_vectorcall,
- attr_pnaclcall,
attr_inteloclbicc,
attr_ms_abi,
attr_sysv_abi,
diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h
index 4f3c811ce2..e29fa49032 100644
--- a/include/clang/AST/TypeLoc.h
+++ b/include/clang/AST/TypeLoc.h
@@ -93,7 +93,7 @@ public:
}
bool isNull() const { return !Ty; }
- LLVM_EXPLICIT operator bool() const { return Ty; }
+ explicit operator bool() const { return Ty; }
/// \brief Returns the size of type source info data block for the given type.
static unsigned getFullDataSizeForType(QualType Ty);
diff --git a/include/clang/AST/TypeNodes.def b/include/clang/AST/TypeNodes.def
index 3b2665bb88..2549f0bf50 100644
--- a/include/clang/AST/TypeNodes.def
+++ b/include/clang/AST/TypeNodes.def
@@ -11,7 +11,7 @@
// enumerated by providing its name (e.g., "Builtin" or "Enum") and
// base class (e.g., "Type" or "TagType"). Depending on where in the
// abstract syntax tree the type will show up, the enumeration uses
-// one of four different macros:
+// one of five different macros:
//
// TYPE(Class, Base) - A type that can show up anywhere in the AST,
// and might be dependent, canonical, or non-canonical. All clients
diff --git a/include/clang/AST/UnresolvedSet.h b/include/clang/AST/UnresolvedSet.h
index a11f22d201..26ee1cf71c 100644
--- a/include/clang/AST/UnresolvedSet.h
+++ b/include/clang/AST/UnresolvedSet.h
@@ -19,74 +19,36 @@
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
-#include <iterator>
+#include "llvm/ADT/iterator.h"
namespace clang {
/// The iterator over UnresolvedSets. Serves as both the const and
/// non-const iterator.
-class UnresolvedSetIterator {
-private:
- typedef MutableArrayRef<DeclAccessPair> DeclsTy;
- typedef DeclsTy::iterator IteratorTy;
-
- IteratorTy ir;
-
+class UnresolvedSetIterator : public llvm::iterator_adaptor_base<
+ UnresolvedSetIterator, DeclAccessPair *,
+ std::random_access_iterator_tag, NamedDecl *,
+ std::ptrdiff_t, NamedDecl *, NamedDecl *> {
friend class UnresolvedSetImpl;
friend class ASTUnresolvedSet;
friend class OverloadExpr;
- explicit UnresolvedSetIterator(DeclsTy::iterator ir) : ir(ir) {}
- explicit UnresolvedSetIterator(DeclsTy::const_iterator ir) :
- ir(const_cast<DeclsTy::iterator>(ir)) {}
-
- IteratorTy getIterator() const { return ir; }
-
+
+ explicit UnresolvedSetIterator(DeclAccessPair *Iter)
+ : iterator_adaptor_base(Iter) {}
+ explicit UnresolvedSetIterator(const DeclAccessPair *Iter)
+ : iterator_adaptor_base(const_cast<DeclAccessPair *>(Iter)) {}
+
public:
UnresolvedSetIterator() {}
- typedef std::iterator_traits<IteratorTy>::difference_type difference_type;
- typedef NamedDecl *value_type;
- typedef NamedDecl **pointer;
- typedef NamedDecl *reference;
- typedef std::iterator_traits<IteratorTy>::iterator_category iterator_category;
-
- NamedDecl *getDecl() const { return ir->getDecl(); }
- void setDecl(NamedDecl *ND) const { return ir->setDecl(ND); }
- AccessSpecifier getAccess() const { return ir->getAccess(); }
- void setAccess(AccessSpecifier AS) { ir->setAccess(AS); }
- DeclAccessPair getPair() const { return *ir; }
+ NamedDecl *getDecl() const { return I->getDecl(); }
+ void setDecl(NamedDecl *ND) const { return I->setDecl(ND); }
+ AccessSpecifier getAccess() const { return I->getAccess(); }
+ void setAccess(AccessSpecifier AS) { I->setAccess(AS); }
+ const DeclAccessPair &getPair() const { return *I; }
NamedDecl *operator*() const { return getDecl(); }
-
- UnresolvedSetIterator &operator++() { ++ir; return *this; }
- UnresolvedSetIterator operator++(int) { return UnresolvedSetIterator(ir++); }
- UnresolvedSetIterator &operator--() { --ir; return *this; }
- UnresolvedSetIterator operator--(int) { return UnresolvedSetIterator(ir--); }
-
- UnresolvedSetIterator &operator+=(difference_type d) {
- ir += d; return *this;
- }
- UnresolvedSetIterator operator+(difference_type d) const {
- return UnresolvedSetIterator(ir + d);
- }
- UnresolvedSetIterator &operator-=(difference_type d) {
- ir -= d; return *this;
- }
- UnresolvedSetIterator operator-(difference_type d) const {
- return UnresolvedSetIterator(ir - d);
- }
- value_type operator[](difference_type d) const { return *(*this + d); }
-
- difference_type operator-(const UnresolvedSetIterator &o) const {
- return ir - o.ir;
- }
-
- bool operator==(const UnresolvedSetIterator &o) const { return ir == o.ir; }
- bool operator!=(const UnresolvedSetIterator &o) const { return ir != o.ir; }
- bool operator<(const UnresolvedSetIterator &o) const { return ir < o.ir; }
- bool operator<=(const UnresolvedSetIterator &o) const { return ir <= o.ir; }
- bool operator>=(const UnresolvedSetIterator &o) const { return ir >= o.ir; }
- bool operator>(const UnresolvedSetIterator &o) const { return ir > o.ir; }
+ NamedDecl *operator->() const { return **this; }
};
/// \brief A set of unresolved declarations.
@@ -132,21 +94,17 @@ public:
/// Replaces the declaration at the given iterator with the new one,
/// preserving the original access bits.
- void replace(iterator I, NamedDecl *New) {
- I.ir->setDecl(New);
- }
+ void replace(iterator I, NamedDecl *New) { I.I->setDecl(New); }
void replace(iterator I, NamedDecl *New, AccessSpecifier AS) {
- I.ir->set(New, AS);
+ I.I->set(New, AS);
}
void erase(unsigned I) { decls()[I] = decls().pop_back_val(); }
- void erase(iterator I) { *I.ir = decls().pop_back_val(); }
+ void erase(iterator I) { *I.I = decls().pop_back_val(); }
- void setAccess(iterator I, AccessSpecifier AS) {
- I.ir->setAccess(AS);
- }
+ void setAccess(iterator I, AccessSpecifier AS) { I.I->setAccess(AS); }
void clear() { decls().clear(); }
void set_size(unsigned N) { decls().set_size(N); }
@@ -154,9 +112,7 @@ public:
bool empty() const { return decls().empty(); }
unsigned size() const { return decls().size(); }
- void append(iterator I, iterator E) {
- decls().append(I.ir, E.ir);
- }
+ void append(iterator I, iterator E) { decls().append(I.I, E.I); }
DeclAccessPair &operator[](unsigned I) { return decls()[I]; }
const DeclAccessPair &operator[](unsigned I) const { return decls()[I]; }
diff --git a/include/clang/ASTMatchers/ASTMatchFinder.h b/include/clang/ASTMatchers/ASTMatchFinder.h
index e5fc44c050..ce2674e442 100644
--- a/include/clang/ASTMatchers/ASTMatchFinder.h
+++ b/include/clang/ASTMatchers/ASTMatchFinder.h
@@ -199,9 +199,9 @@ public:
/// \brief For each \c Matcher<> a \c MatchCallback that will be called
/// when it matches.
struct MatchersByType {
- std::vector<std::pair<DeclarationMatcher, MatchCallback *>> Decl;
+ std::vector<std::pair<internal::DynTypedMatcher, MatchCallback *>>
+ DeclOrStmt;
std::vector<std::pair<TypeMatcher, MatchCallback *>> Type;
- std::vector<std::pair<StatementMatcher, MatchCallback *>> Stmt;
std::vector<std::pair<NestedNameSpecifierMatcher, MatchCallback *>>
NestedNameSpecifier;
std::vector<std::pair<NestedNameSpecifierLocMatcher, MatchCallback *>>
diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h
index 37c7b16934..f317981517 100644
--- a/include/clang/ASTMatchers/ASTMatchers.h
+++ b/include/clang/ASTMatchers/ASTMatchers.h
@@ -45,6 +45,7 @@
#ifndef LLVM_CLANG_ASTMATCHERS_ASTMATCHERS_H
#define LLVM_CLANG_ASTMATCHERS_ASTMATCHERS_H
+#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/ASTMatchers/ASTMatchersInternal.h"
@@ -142,6 +143,111 @@ typedef internal::Matcher<NestedNameSpecifierLoc> NestedNameSpecifierLocMatcher;
/// Usable as: Any Matcher
inline internal::TrueMatcher anything() { return internal::TrueMatcher(); }
+/// \brief Matches the top declaration context.
+///
+/// Given
+/// \code
+/// int X;
+/// namespace NS {
+/// int Y;
+/// } // namespace NS
+/// \endcode
+/// decl(hasDeclContext(translationUnitDecl()))
+/// matches "int X", but not "int Y".
+const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl>
+ translationUnitDecl;
+
+/// \brief Matches typedef declarations.
+///
+/// Given
+/// \code
+/// typedef int X;
+/// \endcode
+/// typedefDecl()
+/// matches "typedef int X"
+const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl> typedefDecl;
+
+/// \brief Matches AST nodes that were expanded within the main-file.
+///
+/// Example matches X but not Y (matcher = recordDecl(isExpansionInMainFile())
+/// \code
+/// #include <Y.h>
+/// class X {};
+/// \endcode
+/// Y.h:
+/// \code
+/// class Y {};
+/// \endcode
+///
+/// Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
+AST_POLYMORPHIC_MATCHER(isExpansionInMainFile,
+ AST_POLYMORPHIC_SUPPORTED_TYPES_3(Decl, Stmt,
+ TypeLoc)) {
+ auto &SourceManager = Finder->getASTContext().getSourceManager();
+ return SourceManager.isInMainFile(
+ SourceManager.getExpansionLoc(Node.getLocStart()));
+}
+
+/// \brief Matches AST nodes that were expanded within system-header-files.
+///
+/// Example matches Y but not X
+/// (matcher = recordDecl(isExpansionInSystemHeader())
+/// \code
+/// #include <SystemHeader.h>
+/// class X {};
+/// \endcode
+/// SystemHeader.h:
+/// \code
+/// class Y {};
+/// \endcode
+///
+/// Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
+AST_POLYMORPHIC_MATCHER(isExpansionInSystemHeader,
+ AST_POLYMORPHIC_SUPPORTED_TYPES_3(Decl, Stmt,
+ TypeLoc)) {
+ auto &SourceManager = Finder->getASTContext().getSourceManager();
+ auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getLocStart());
+ if (ExpansionLoc.isInvalid()) {
+ return false;
+ }
+ return SourceManager.isInSystemHeader(ExpansionLoc);
+}
+
+/// \brief Matches AST nodes that were expanded within files whose name is
+/// partially matching a given regex.
+///
+/// Example matches Y but not X
+/// (matcher = recordDecl(isExpansionInFileMatching("AST.*"))
+/// \code
+/// #include "ASTMatcher.h"
+/// class X {};
+/// \endcode
+/// ASTMatcher.h:
+/// \code
+/// class Y {};
+/// \endcode
+///
+/// Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
+AST_POLYMORPHIC_MATCHER_P(isExpansionInFileMatching,
+ AST_POLYMORPHIC_SUPPORTED_TYPES_3(Decl, Stmt,
+ TypeLoc),
+ std::string, RegExp) {
+ auto &SourceManager = Finder->getASTContext().getSourceManager();
+ auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getLocStart());
+ if (ExpansionLoc.isInvalid()) {
+ return false;
+ }
+ auto FileEntry =
+ SourceManager.getFileEntryForID(SourceManager.getFileID(ExpansionLoc));
+ if (!FileEntry) {
+ return false;
+ }
+
+ auto Filename = FileEntry->getName();
+ llvm::Regex RE(RegExp);
+ return RE.match(Filename);
+}
+
/// \brief Matches declarations.
///
/// Examples matches \c X, \c C, and the friend declaration inside \c C;
@@ -1682,7 +1788,7 @@ AST_MATCHER_P(CXXRecordDecl, isDerivedFrom,
}
/// \brief Overloaded method as shortcut for \c isDerivedFrom(hasName(...)).
-AST_MATCHER_P_OVERLOAD(CXXRecordDecl, isDerivedFrom, StringRef, BaseName, 1) {
+AST_MATCHER_P_OVERLOAD(CXXRecordDecl, isDerivedFrom, std::string, BaseName, 1) {
assert(!BaseName.empty());
return isDerivedFrom(hasName(BaseName)).matches(Node, Finder, Builder);
}
@@ -1697,8 +1803,8 @@ AST_MATCHER_P_OVERLOAD(CXXRecordDecl, isSameOrDerivedFrom,
/// \brief Overloaded method as shortcut for
/// \c isSameOrDerivedFrom(hasName(...)).
-AST_MATCHER_P_OVERLOAD(CXXRecordDecl, isSameOrDerivedFrom, StringRef, BaseName,
- 1) {
+AST_MATCHER_P_OVERLOAD(CXXRecordDecl, isSameOrDerivedFrom, std::string,
+ BaseName, 1) {
assert(!BaseName.empty());
return isSameOrDerivedFrom(hasName(BaseName)).matches(Node, Finder, Builder);
}
@@ -3067,12 +3173,10 @@ AST_POLYMORPHIC_MATCHER(
/// \endcode
/// functionDecl(isInstantiated())
/// matches 'A(int) {...};' and 'A(unsigned) {...}'.
-AST_MATCHER(Decl, isInstantiated) {
+AST_MATCHER_FUNCTION(internal::Matcher<Decl>, isInstantiated) {
auto IsInstantiation = decl(anyOf(recordDecl(isTemplateInstantiation()),
functionDecl(isTemplateInstantiation())));
- auto InnerMatcher =
- decl(anyOf(IsInstantiation, hasAncestor(IsInstantiation)));
- return InnerMatcher.matches(Node, Finder, Builder);
+ return decl(anyOf(IsInstantiation, hasAncestor(IsInstantiation)));
}
/// \brief Matches statements inside of a template instantiation.
@@ -3089,11 +3193,10 @@ AST_MATCHER(Decl, isInstantiated) {
/// unless(stmt(isInTemplateInstantiation()))
/// will NOT match j += 42; as it's shared between the template definition and
/// instantiation.
-AST_MATCHER(Stmt, isInTemplateInstantiation) {
- auto InnerMatcher =
- stmt(hasAncestor(decl(anyOf(recordDecl(isTemplateInstantiation()),
- functionDecl(isTemplateInstantiation())))));
- return InnerMatcher.matches(Node, Finder, Builder);
+AST_MATCHER_FUNCTION(internal::Matcher<Stmt>, isInTemplateInstantiation) {
+ return stmt(
+ hasAncestor(decl(anyOf(recordDecl(isTemplateInstantiation()),
+ functionDecl(isTemplateInstantiation())))));
}
/// \brief Matches explicit template specializations of function, class, or
@@ -3122,6 +3225,18 @@ AST_MATCHER_FUNCTION_P_OVERLOAD(internal::BindableMatcher<TypeLoc>, loc,
new internal::TypeLocTypeMatcher(InnerMatcher));
}
+/// \brief Matches type \c void.
+///
+/// Given
+/// \code
+/// struct S { void func(); };
+/// \endcode
+/// functionDecl(returns(voidType()))
+/// matches "void func();"
+AST_MATCHER(Type, voidType) {
+ return Node.isVoidType();
+}
+
/// \brief Matches builtin Types.
///
/// Given
diff --git a/include/clang/ASTMatchers/ASTMatchersInternal.h b/include/clang/ASTMatchers/ASTMatchersInternal.h
index 1b8040cf44..86a31ea280 100644
--- a/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -44,6 +44,7 @@
#include "clang/AST/Type.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/VariadicFunction.h"
+#include "llvm/Support/ManagedStatic.h"
#include <map>
#include <string>
#include <vector>
@@ -218,10 +219,7 @@ public:
bool dynMatches(const ast_type_traits::DynTypedNode &DynNode,
ASTMatchFinder *Finder,
BoundNodesTreeBuilder *Builder) const override {
- if (const T *Node = DynNode.get<T>()) {
- return matches(*Node, Finder, Builder);
- }
- return false;
+ return matches(DynNode.getUnchecked<T>(), Finder, Builder);
}
};
@@ -289,6 +287,11 @@ public:
void setAllowBind(bool AB) { AllowBind = AB; }
+ /// \brief Check whether this matcher could ever match a node of kind \p Kind.
+ /// \return \c false if this matcher will never match such a node. Otherwise,
+ /// return \c true.
+ bool canMatchNodesOfKind(ast_type_traits::ASTNodeKind Kind) const;
+
/// \brief Return a matcher that points to the same implementation, but
/// restricts the node types for \p Kind.
DynTypedMatcher dynCastTo(const ast_type_traits::ASTNodeKind Kind) const;
@@ -297,6 +300,14 @@ public:
bool matches(const ast_type_traits::DynTypedNode &DynNode,
ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder) const;
+ /// \brief Same as matches(), but skips the kind check.
+ ///
+ /// It is faster, but the caller must ensure the node is valid for the
+ /// kind of this matcher.
+ bool matchesNoKindCheck(const ast_type_traits::DynTypedNode &DynNode,
+ ASTMatchFinder *Finder,
+ BoundNodesTreeBuilder *Builder) const;
+
/// \brief Bind the specified \p ID to the matcher.
/// \return A new matcher with the \p ID bound to it if this matcher supports
/// binding. Otherwise, returns an empty \c Optional<>.
@@ -836,19 +847,11 @@ protected:
/// \brief A type-list implementation.
///
-/// A list is declared as a tree of type list nodes, where the leafs are the
-/// types.
-/// However, it is used as a "linked list" of types, by using the ::head and
-/// ::tail typedefs.
-/// Each node supports up to 4 children (instead of just 2) to reduce the
-/// nesting required by large lists.
-template <typename T1 = void, typename T2 = void, typename T3 = void,
- typename T4 = void>
-struct TypeList {
- /// \brief Implementation detail. Combined with the specializations below,
- /// this typedef allows for flattening of nested structures.
- typedef TypeList<T1, T2, T3, T4> self;
+/// A "linked list" of types, accessible by using the ::head and ::tail
+/// typedefs.
+template <typename... Ts> struct TypeList {}; // Empty sentinel type list.
+template <typename T1, typename... Ts> struct TypeList<T1, Ts...> {
/// \brief The first type on the list.
typedef T1 head;
@@ -856,24 +859,7 @@ struct TypeList {
///
/// This type is used to do recursion. TypeList<>/EmptyTypeList indicates the
/// end of the list.
- typedef typename TypeList<T2, T3, T4>::self tail;
-};
-
-/// \brief Template specialization to allow nested lists.
-///
-/// First element is a typelist. Pop its first element.
-template <typename Sub1, typename Sub2, typename Sub3, typename Sub4,
- typename T2, typename T3, typename T4>
-struct TypeList<TypeList<Sub1, Sub2, Sub3, Sub4>, T2, T3,
- T4> : public TypeList<Sub1,
- typename TypeList<Sub2, Sub3, Sub4>::self,
- typename TypeList<T2, T3, T4>::self> {};
-
-/// \brief Template specialization to allow nested lists.
-///
-/// First element is an empty typelist. Skip it.
-template <typename T2, typename T3, typename T4>
-struct TypeList<TypeList<>, T2, T3, T4> : public TypeList<T2, T3, T4> {
+ typedef TypeList<Ts...> tail;
};
/// \brief The empty type list.
@@ -895,9 +881,8 @@ struct TypeListContainsSuperOf<EmptyTypeList, T> {
/// \brief A "type list" that contains all types.
///
/// Useful for matchers like \c anything and \c unless.
-typedef TypeList<
- TypeList<Decl, Stmt, NestedNameSpecifier, NestedNameSpecifierLoc>,
- TypeList<QualType, Type, TypeLoc, CXXCtorInitializer> > AllNodeBaseTypes;
+typedef TypeList<Decl, Stmt, NestedNameSpecifier, NestedNameSpecifierLoc,
+ QualType, Type, TypeLoc, CXXCtorInitializer> AllNodeBaseTypes;
/// \brief Helper meta-function to extract the argument out of a function of
/// type void(Arg).
@@ -910,17 +895,15 @@ template <class T> struct ExtractFunctionArgMeta<void(T)> {
/// \brief Default type lists for ArgumentAdaptingMatcher matchers.
typedef AllNodeBaseTypes AdaptativeDefaultFromTypes;
-typedef TypeList<TypeList<Decl, Stmt, NestedNameSpecifier>,
- TypeList<NestedNameSpecifierLoc, TypeLoc, QualType> >
-AdaptativeDefaultToTypes;
+typedef TypeList<Decl, Stmt, NestedNameSpecifier, NestedNameSpecifierLoc,
+ TypeLoc, QualType> AdaptativeDefaultToTypes;
/// \brief All types that are supported by HasDeclarationMatcher above.
-typedef TypeList<TypeList<CallExpr, CXXConstructExpr, DeclRefExpr, EnumType>,
- TypeList<InjectedClassNameType, LabelStmt, MemberExpr>,
- TypeList<QualType, RecordType, TagType>,
- TypeList<TemplateSpecializationType, TemplateTypeParmType,
- TypedefType, UnresolvedUsingType> >
-HasDeclarationSupportedTypes;
+typedef TypeList<CallExpr, CXXConstructExpr, DeclRefExpr, EnumType,
+ InjectedClassNameType, LabelStmt, MemberExpr, QualType,
+ RecordType, TagType, TemplateSpecializationType,
+ TemplateTypeParmType, TypedefType,
+ UnresolvedUsingType> HasDeclarationSupportedTypes;
/// \brief Converts a \c Matcher<T> to a matcher of desired type \c To by
/// "adapting" a \c To into a \c T.
@@ -1133,153 +1116,45 @@ private:
/// \brief VariadicOperatorMatcher related types.
/// @{
-/// \brief "No argument" placeholder to use as template paratemers.
-struct VariadicOperatorNoArg {};
-
/// \brief Polymorphic matcher object that uses a \c
/// DynTypedMatcher::VariadicOperator operator.
///
/// Input matchers can have any type (including other polymorphic matcher
/// types), and the actual Matcher<T> is generated on demand with an implicit
/// coversion operator.
-template <typename P1, typename P2 = VariadicOperatorNoArg,
- typename P3 = VariadicOperatorNoArg,
- typename P4 = VariadicOperatorNoArg,
- typename P5 = VariadicOperatorNoArg,
- typename P6 = VariadicOperatorNoArg,
- typename P7 = VariadicOperatorNoArg,
- typename P8 = VariadicOperatorNoArg,
- typename P9 = VariadicOperatorNoArg>
-class VariadicOperatorMatcher {
+template <typename... Ps> class VariadicOperatorMatcher {
public:
- VariadicOperatorMatcher(DynTypedMatcher::VariadicOperator Op,
- const P1 &Param1,
- const P2 &Param2 = VariadicOperatorNoArg(),
- const P3 &Param3 = VariadicOperatorNoArg(),
- const P4 &Param4 = VariadicOperatorNoArg(),
- const P5 &Param5 = VariadicOperatorNoArg(),
- const P6 &Param6 = VariadicOperatorNoArg(),
- const P7 &Param7 = VariadicOperatorNoArg(),
- const P8 &Param8 = VariadicOperatorNoArg(),
- const P9 &Param9 = VariadicOperatorNoArg())
- : Op(Op), Param1(Param1), Param2(Param2), Param3(Param3),
- Param4(Param4), Param5(Param5), Param6(Param6), Param7(Param7),
- Param8(Param8), Param9(Param9) {}
+ VariadicOperatorMatcher(DynTypedMatcher::VariadicOperator Op, Ps &&... Params)
+ : Op(Op), Params(std::forward<Ps>(Params)...) {}
template <typename T> operator Matcher<T>() const {
- std::vector<DynTypedMatcher> Matchers;
- addMatcher<T>(Param1, Matchers);
- addMatcher<T>(Param2, Matchers);
- addMatcher<T>(Param3, Matchers);
- addMatcher<T>(Param4, Matchers);
- addMatcher<T>(Param5, Matchers);
- addMatcher<T>(Param6, Matchers);
- addMatcher<T>(Param7, Matchers);
- addMatcher<T>(Param8, Matchers);
- addMatcher<T>(Param9, Matchers);
- return DynTypedMatcher::constructVariadic(Op, std::move(Matchers))
+ return DynTypedMatcher::constructVariadic(
+ Op, getMatchers<T>(llvm::index_sequence_for<Ps...>()))
.template unconditionalConvertTo<T>();
}
private:
- template <typename T>
- static void addMatcher(const Matcher<T> &M,
- std::vector<DynTypedMatcher> &Matchers) {
- Matchers.push_back(M);
+ // Helper method to unpack the tuple into a vector.
+ template <typename T, std::size_t... Is>
+ std::vector<DynTypedMatcher> getMatchers(llvm::index_sequence<Is...>) const {
+ return {Matcher<T>(std::get<Is>(Params))...};
}
- /// \brief Overload to ignore \c VariadicOperatorNoArg arguments.
- template <typename T>
- static void addMatcher(VariadicOperatorNoArg,
- std::vector<DynTypedMatcher> &Matchers) {}
-
const DynTypedMatcher::VariadicOperator Op;
- const P1 Param1;
- const P2 Param2;
- const P3 Param3;
- const P4 Param4;
- const P5 Param5;
- const P6 Param6;
- const P7 Param7;
- const P8 Param8;
- const P9 Param9;
+ std::tuple<Ps...> Params;
};
/// \brief Overloaded function object to generate VariadicOperatorMatcher
/// objects from arbitrary matchers.
-///
-/// It supports 1-9 argument overloaded operator(). More can be added if needed.
template <unsigned MinCount, unsigned MaxCount>
struct VariadicOperatorMatcherFunc {
DynTypedMatcher::VariadicOperator Op;
- template <unsigned Count, typename T>
- struct EnableIfValidArity
- : public std::enable_if<MinCount <= Count && Count <= MaxCount, T> {};
-
- template <typename M1>
- typename EnableIfValidArity<1, VariadicOperatorMatcher<M1> >::type
- operator()(const M1 &P1) const {
- return VariadicOperatorMatcher<M1>(Op, P1);
- }
- template <typename M1, typename M2>
- typename EnableIfValidArity<2, VariadicOperatorMatcher<M1, M2> >::type
- operator()(const M1 &P1, const M2 &P2) const {
- return VariadicOperatorMatcher<M1, M2>(Op, P1, P2);
- }
- template <typename M1, typename M2, typename M3>
- typename EnableIfValidArity<3, VariadicOperatorMatcher<M1, M2, M3> >::type
- operator()(const M1 &P1, const M2 &P2, const M3 &P3) const {
- return VariadicOperatorMatcher<M1, M2, M3>(Op, P1, P2, P3);
- }
- template <typename M1, typename M2, typename M3, typename M4>
- typename EnableIfValidArity<4, VariadicOperatorMatcher<M1, M2, M3, M4> >::type
- operator()(const M1 &P1, const M2 &P2, const M3 &P3, const M4 &P4) const {
- return VariadicOperatorMatcher<M1, M2, M3, M4>(Op, P1, P2, P3, P4);
- }
- template <typename M1, typename M2, typename M3, typename M4, typename M5>
- typename EnableIfValidArity<
- 5, VariadicOperatorMatcher<M1, M2, M3, M4, M5> >::type
- operator()(const M1 &P1, const M2 &P2, const M3 &P3, const M4 &P4,
- const M5 &P5) const {
- return VariadicOperatorMatcher<M1, M2, M3, M4, M5>(Op, P1, P2, P3, P4, P5);
- }
- template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6>
- typename EnableIfValidArity<
- 6, VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6> >::type
- operator()(const M1 &P1, const M2 &P2, const M3 &P3, const M4 &P4,
- const M5 &P5, const M6 &P6) const {
- return VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6>(
- Op, P1, P2, P3, P4, P5, P6);
- }
- template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7>
- typename EnableIfValidArity<
- 7, VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6, M7> >::type
- operator()(const M1 &P1, const M2 &P2, const M3 &P3, const M4 &P4,
- const M5 &P5, const M6 &P6, const M7 &P7) const {
- return VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6, M7>(
- Op, P1, P2, P3, P4, P5, P6, P7);
- }
- template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8>
- typename EnableIfValidArity<
- 8, VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6, M7, M8> >::type
- operator()(const M1 &P1, const M2 &P2, const M3 &P3, const M4 &P4,
- const M5 &P5, const M6 &P6, const M7 &P7, const M8 &P8) const {
- return VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6, M7, M8>(
- Op, P1, P2, P3, P4, P5, P6, P7, P8);
- }
- template <typename M1, typename M2, typename M3, typename M4, typename M5,
- typename M6, typename M7, typename M8, typename M9>
- typename EnableIfValidArity<
- 9, VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6, M7, M8, M9> >::type
- operator()(const M1 &P1, const M2 &P2, const M3 &P3, const M4 &P4,
- const M5 &P5, const M6 &P6, const M7 &P7, const M8 &P8,
- const M9 &P9) const {
- return VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6, M7, M8, M9>(
- Op, P1, P2, P3, P4, P5, P6, P7, P8, P9);
+ template <typename... Ms>
+ VariadicOperatorMatcher<Ms...> operator()(Ms &&... Ps) const {
+ static_assert(MinCount <= sizeof...(Ms) && sizeof...(Ms) <= MaxCount,
+ "invalid number of parameters for variadic matcher");
+ return VariadicOperatorMatcher<Ms...>(Op, std::forward<Ms>(Ps)...);
}
};
@@ -1445,6 +1320,32 @@ private:
const ValueT ExpectedValue;
};
+/// \brief Template specializations to easily write matchers for floating point
+/// literals.
+template <>
+inline bool ValueEqualsMatcher<FloatingLiteral, double>::matchesNode(
+ const FloatingLiteral &Node) const {
+ if ((&Node.getSemantics()) == &llvm::APFloat::IEEEsingle)
+ return Node.getValue().convertToFloat() == ExpectedValue;
+ if ((&Node.getSemantics()) == &llvm::APFloat::IEEEdouble)
+ return Node.getValue().convertToDouble() == ExpectedValue;
+ return false;
+}
+template <>
+inline bool ValueEqualsMatcher<FloatingLiteral, float>::matchesNode(
+ const FloatingLiteral &Node) const {
+ if ((&Node.getSemantics()) == &llvm::APFloat::IEEEsingle)
+ return Node.getValue().convertToFloat() == ExpectedValue;
+ if ((&Node.getSemantics()) == &llvm::APFloat::IEEEdouble)
+ return Node.getValue().convertToDouble() == ExpectedValue;
+ return false;
+}
+template <>
+inline bool ValueEqualsMatcher<FloatingLiteral, llvm::APFloat>::matchesNode(
+ const FloatingLiteral &Node) const {
+ return ExpectedValue.compare(Node.getValue()) == llvm::APFloat::cmpEqual;
+}
+
/// \brief A VariadicDynCastAllOfMatcher<SourceT, TargetT> object is a
/// variadic functor that takes a number of Matcher<TargetT> and returns a
/// Matcher<SourceT> that matches TargetT nodes that are matched by all of the
@@ -1610,6 +1511,23 @@ private:
const Matcher<InnerTBase> InnerMatcher;
};
+/// \brief A simple memoizer of T(*)() functions.
+///
+/// It will call the passed 'Func' template parameter at most once.
+/// Used to support AST_MATCHER_FUNCTION() macro.
+template <typename Matcher, Matcher (*Func)()> class MemoizedMatcher {
+ struct Wrapper {
+ Wrapper() : M(Func()) {}
+ Matcher M;
+ };
+
+public:
+ static const Matcher &getInstance() {
+ static llvm::ManagedStatic<Wrapper> Instance;
+ return Instance->M;
+ }
+};
+
// Define the create() method out of line to silence a GCC warning about
// the struct "Func" having greater visibility than its base, which comes from
// using the flag -fvisibility-inlines-hidden.
diff --git a/include/clang/ASTMatchers/ASTMatchersMacros.h b/include/clang/ASTMatchers/ASTMatchersMacros.h
index 4d57b94c7f..7167dfb898 100644
--- a/include/clang/ASTMatchers/ASTMatchersMacros.h
+++ b/include/clang/ASTMatchers/ASTMatchersMacros.h
@@ -37,6 +37,17 @@
#ifndef LLVM_CLANG_ASTMATCHERS_ASTMATCHERSMACROS_H
#define LLVM_CLANG_ASTMATCHERS_ASTMATCHERSMACROS_H
+/// \brief AST_MATCHER_FUNCTION(ReturnType, DefineMatcher) {
+/// defines a zero parameter function named DefineMatcher() that returns a
+/// ReturnType object.
+#define AST_MATCHER_FUNCTION(ReturnType, DefineMatcher) \
+ inline ReturnType DefineMatcher##_getInstance(); \
+ inline ReturnType DefineMatcher() { \
+ return internal::MemoizedMatcher< \
+ ReturnType, DefineMatcher##_getInstance>::getInstance(); \
+ } \
+ inline ReturnType DefineMatcher##_getInstance()
+
/// \brief AST_MATCHER_FUNCTION_P(ReturnType, DefineMatcher, ParamType, Param) {
/// defines a single-parameter function named DefineMatcher() that returns a
/// ReturnType object.
@@ -190,7 +201,7 @@
#define AST_POLYMORPHIC_SUPPORTED_TYPES_4(t1, t2, t3, t4) \
void(internal::TypeList<t1, t2, t3, t4>)
#define AST_POLYMORPHIC_SUPPORTED_TYPES_5(t1, t2, t3, t4, t5) \
- void(internal::TypeList<t1, t2, t3, internal::TypeList<t4, t5> >)
+ void(internal::TypeList<t1, t2, t3, t4, t5>)
/// \brief AST_POLYMORPHIC_MATCHER(DefineMatcher) { ... }
/// defines a single-parameter function named DefineMatcher() that is
diff --git a/include/clang/ASTMatchers/Dynamic/Registry.h b/include/clang/ASTMatchers/Dynamic/Registry.h
index ad24a8d1b7..fc1e783a6c 100644
--- a/include/clang/ASTMatchers/Dynamic/Registry.h
+++ b/include/clang/ASTMatchers/Dynamic/Registry.h
@@ -123,7 +123,7 @@ public:
Diagnostics *Error);
private:
- Registry() LLVM_DELETED_FUNCTION;
+ Registry() = delete;
};
} // namespace dynamic
diff --git a/include/clang/ASTMatchers/Dynamic/VariantValue.h b/include/clang/ASTMatchers/Dynamic/VariantValue.h
index a9bd3d5011..ae22e37d8e 100644
--- a/include/clang/ASTMatchers/Dynamic/VariantValue.h
+++ b/include/clang/ASTMatchers/Dynamic/VariantValue.h
@@ -258,7 +258,7 @@ public:
VariantValue(const VariantMatcher &Matchers);
/// \brief Returns true iff this is not an empty value.
- LLVM_EXPLICIT operator bool() const { return hasValue(); }
+ explicit operator bool() const { return hasValue(); }
bool hasValue() const { return Type != VT_Nothing; }
/// \brief Unsigned value functions.
diff --git a/include/clang/Analysis/Analyses/FormatString.h b/include/clang/Analysis/Analyses/FormatString.h
index 174cce4f36..d67aa51713 100644
--- a/include/clang/Analysis/Analyses/FormatString.h
+++ b/include/clang/Analysis/Analyses/FormatString.h
@@ -49,7 +49,7 @@ public:
const char *toString() const { return representation; }
// Overloaded operators for bool like qualities
- LLVM_EXPLICIT operator bool() const { return flag; }
+ explicit operator bool() const { return flag; }
OptionalFlag& operator=(const bool &rhs) {
flag = rhs;
return *this; // Return a reference to myself.
@@ -161,6 +161,12 @@ public:
ObjCObjArg, // '@'
ObjCBeg = ObjCObjArg, ObjCEnd = ObjCObjArg,
+ // FreeBSD kernel specific specifiers.
+ FreeBSDbArg,
+ FreeBSDDArg,
+ FreeBSDrArg,
+ FreeBSDyArg,
+
// GlibC specific specifiers.
PrintErrno, // 'm'
@@ -204,7 +210,8 @@ public:
return EndScanList ? EndScanList - Position : 1;
}
- bool isIntArg() const { return kind >= IntArgBeg && kind <= IntArgEnd; }
+ bool isIntArg() const { return (kind >= IntArgBeg && kind <= IntArgEnd) ||
+ kind == FreeBSDrArg || kind == FreeBSDyArg; }
bool isUIntArg() const { return kind >= UIntArgBeg && kind <= UIntArgEnd; }
bool isAnyIntArg() const { return kind >= IntArgBeg && kind <= UIntArgEnd; }
const char *toString() const;
@@ -646,7 +653,7 @@ public:
bool ParsePrintfString(FormatStringHandler &H,
const char *beg, const char *end, const LangOptions &LO,
- const TargetInfo &Target);
+ const TargetInfo &Target, bool isFreeBSDKPrintf);
bool ParseFormatStringHasSArg(const char *beg, const char *end, const LangOptions &LO,
const TargetInfo &Target);
diff --git a/include/clang/Analysis/Analyses/ThreadSafety.h b/include/clang/Analysis/Analyses/ThreadSafety.h
index 458bb576f4..eeadb77ab0 100644
--- a/include/clang/Analysis/Analyses/ThreadSafety.h
+++ b/include/clang/Analysis/Analyses/ThreadSafety.h
@@ -26,6 +26,8 @@
namespace clang {
namespace threadSafety {
+class BeforeSet;
+
/// This enum distinguishes between different kinds of operations that may
/// need to be protected by locks. We use this enum in error handling.
enum ProtectedOperationKind {
@@ -183,6 +185,14 @@ public:
virtual void handleFunExcludesLock(StringRef Kind, Name FunName,
Name LockName, SourceLocation Loc) {}
+
+ /// Warn that L1 cannot be acquired before L2.
+ virtual void handleLockAcquiredBefore(StringRef Kind, Name L1Name,
+ Name L2Name, SourceLocation Loc) {}
+
+ /// Warn that there is a cycle in acquired_before/after dependencies.
+ virtual void handleBeforeAfterCycle(Name L1Name, SourceLocation Loc) {}
+
/// Called by the analysis when starting analysis of a function.
/// Used to issue suggestions for changes to annotations.
virtual void enterFunction(const FunctionDecl *FD) {}
@@ -203,7 +213,8 @@ private:
/// at the end of each block, and issue warnings for thread safety violations.
/// Each block in the CFG is traversed exactly once.
void runThreadSafetyAnalysis(AnalysisDeclContext &AC,
- ThreadSafetyHandler &Handler);
+ ThreadSafetyHandler &Handler,
+ BeforeSet **Bset);
/// \brief Helper function that returns a LockKind required for the given level
/// of access.
diff --git a/include/clang/Analysis/Analyses/ThreadSafetyCommon.h b/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
index 76d83892dd..9b7725ab0f 100644
--- a/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
+++ b/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
@@ -27,7 +27,6 @@
#include "clang/Analysis/Analyses/ThreadSafetyTraverse.h"
#include "clang/Analysis/AnalysisContext.h"
#include "clang/Basic/OperatorKinds.h"
-
#include <memory>
#include <ostream>
#include <sstream>
@@ -287,6 +286,14 @@ public:
sx::partiallyMatches(CapExpr, other.CapExpr);
}
+ const ValueDecl* valueDecl() const {
+ if (Negated)
+ return nullptr;
+ if (auto *P = dyn_cast<til::Project>(CapExpr))
+ return P->clangDecl();
+ return nullptr;
+ }
+
std::string toString() const {
if (Negated)
return "!" + sx::toString(CapExpr);
@@ -423,8 +430,8 @@ private:
}
private:
- BlockInfo(const BlockInfo &) LLVM_DELETED_FUNCTION;
- void operator=(const BlockInfo &) LLVM_DELETED_FUNCTION;
+ BlockInfo(const BlockInfo &) = delete;
+ void operator=(const BlockInfo &) = delete;
};
// We implement the CFGVisitor API
diff --git a/include/clang/Analysis/Analyses/ThreadSafetyTIL.h b/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
index e06593c690..4b5946617d 100644
--- a/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
+++ b/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
@@ -50,11 +50,10 @@
// All clang include dependencies for this file must be put in
// ThreadSafetyUtil.h.
#include "ThreadSafetyUtil.h"
-
-#include <stdint.h>
#include <algorithm>
#include <cassert>
#include <cstddef>
+#include <stdint.h>
#include <utility>
@@ -283,7 +282,7 @@ public:
/// SExpr objects cannot be deleted.
// This declaration is public to workaround a gcc bug that breaks building
// with REQUIRES_EH=1.
- void operator delete(void *) LLVM_DELETED_FUNCTION;
+ void operator delete(void *) = delete;
/// Returns the instruction ID for this expression.
/// All basic block instructions have a unique ID (i.e. virtual register).
@@ -310,10 +309,10 @@ protected:
BasicBlock* Block;
private:
- SExpr() LLVM_DELETED_FUNCTION;
+ SExpr() = delete;
/// SExpr objects must be created in an arena.
- void *operator new(size_t) LLVM_DELETED_FUNCTION;
+ void *operator new(size_t) = delete;
};
@@ -425,7 +424,7 @@ public:
Future() : SExpr(COP_Future), Status(FS_pending), Result(nullptr) {}
private:
- virtual ~Future() LLVM_DELETED_FUNCTION;
+ virtual ~Future() = delete;
public:
// A lazy rewriting strategy should subclass Future and override this method.
@@ -1369,7 +1368,7 @@ public:
ArrayRef<BasicBlock*> successors();
ArrayRef<BasicBlock*> successors() const {
- return const_cast<const Terminator*>(this)->successors();
+ return const_cast<Terminator*>(this)->successors();
}
};
diff --git a/include/clang/Analysis/Analyses/ThreadSafetyTraverse.h b/include/clang/Analysis/Analyses/ThreadSafetyTraverse.h
index 541f0bfd17..705fe910d0 100644
--- a/include/clang/Analysis/Analyses/ThreadSafetyTraverse.h
+++ b/include/clang/Analysis/Analyses/ThreadSafetyTraverse.h
@@ -18,7 +18,6 @@
#define LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETYTRAVERSE_H
#include "ThreadSafetyTIL.h"
-
#include <ostream>
namespace clang {
diff --git a/include/clang/Analysis/Analyses/ThreadSafetyUtil.h b/include/clang/Analysis/Analyses/ThreadSafetyUtil.h
index 5a7572425c..42808a80ec 100644
--- a/include/clang/Analysis/Analyses/ThreadSafetyUtil.h
+++ b/include/clang/Analysis/Analyses/ThreadSafetyUtil.h
@@ -14,17 +14,16 @@
#ifndef LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETYUTIL_H
#define LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETYUTIL_H
+#include "clang/AST/ExprCXX.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/AlignOf.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Compiler.h"
-#include "clang/AST/ExprCXX.h"
-
#include <cassert>
#include <cstddef>
-#include <vector>
-#include <utility>
#include <ostream>
+#include <utility>
+#include <vector>
namespace clang {
namespace threadSafety {
@@ -227,7 +226,7 @@ private:
static const size_t InitialCapacity = 4;
- SimpleArray(const SimpleArray<T> &A) LLVM_DELETED_FUNCTION;
+ SimpleArray(const SimpleArray<T> &A) = delete;
T *Data;
size_t Size;
@@ -256,8 +255,8 @@ class CopyOnWriteVector {
};
// No copy constructor or copy assignment. Use clone() with move assignment.
- CopyOnWriteVector(const CopyOnWriteVector &V) LLVM_DELETED_FUNCTION;
- void operator=(const CopyOnWriteVector &V) LLVM_DELETED_FUNCTION;
+ CopyOnWriteVector(const CopyOnWriteVector &V) = delete;
+ void operator=(const CopyOnWriteVector &V) = delete;
public:
CopyOnWriteVector() : Data(nullptr) {}
diff --git a/include/clang/Analysis/AnalysisContext.h b/include/clang/Analysis/AnalysisContext.h
index 0ebdf15f2c..a20fc518b4 100644
--- a/include/clang/Analysis/AnalysisContext.h
+++ b/include/clang/Analysis/AnalysisContext.h
@@ -173,8 +173,8 @@ public:
typedef const VarDecl * const * referenced_decls_iterator;
- std::pair<referenced_decls_iterator, referenced_decls_iterator>
- getReferencedBlockVars(const BlockDecl *BD);
+ llvm::iterator_range<referenced_decls_iterator>
+ getReferencedBlockVars(const BlockDecl *BD);
/// Return the ImplicitParamDecl* associated with 'self' if this
/// AnalysisDeclContext wraps an ObjCMethodDecl. Returns NULL otherwise.
diff --git a/include/clang/Analysis/CFG.h b/include/clang/Analysis/CFG.h
index beea867228..3fddbb90fe 100644
--- a/include/clang/Analysis/CFG.h
+++ b/include/clang/Analysis/CFG.h
@@ -322,7 +322,7 @@ public:
Stmt &operator*() { return *getStmt(); }
const Stmt &operator*() const { return *getStmt(); }
- LLVM_EXPLICIT operator bool() const { return getStmt(); }
+ explicit operator bool() const { return getStmt(); }
};
/// CFGBlock - Represents a single basic block in a source-level CFG.
diff --git a/include/clang/Basic/AddressSpaces.h b/include/clang/Basic/AddressSpaces.h
index 4b1cea50f8..8dd75660c6 100644
--- a/include/clang/Basic/AddressSpaces.h
+++ b/include/clang/Basic/AddressSpaces.h
@@ -30,6 +30,7 @@ enum ID {
opencl_global = Offset,
opencl_local,
opencl_constant,
+ opencl_generic,
cuda_device,
cuda_constant,
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td
index 2450bdd6ad..82e7a3b20f 100644
--- a/include/clang/Basic/Attr.td
+++ b/include/clang/Basic/Attr.td
@@ -115,6 +115,10 @@ def DeclBase : AttrSubject;
def FunctionLike : SubsetSubject<DeclBase,
[{S->getFunctionType(false) != NULL}]>;
+def OpenCLKernelFunction : SubsetSubject<Function, [{
+ S->hasAttr<OpenCLKernelAttr>()
+}]>;
+
// HasFunctionProto is a more strict version of FunctionLike, so it should
// never be specified in a Subjects list along with FunctionLike (due to the
// inclusive nature of subject testing).
@@ -220,12 +224,14 @@ class SubjectList<list<AttrSubject> subjects, SubjectDiag diag = WarnDiag,
string CustomDiag = customDiag;
}
-class LangOpt<string name> {
+class LangOpt<string name, bit negated = 0> {
string Name = name;
+ bit Negated = negated;
}
def MicrosoftExt : LangOpt<"MicrosoftExt">;
def Borland : LangOpt<"Borland">;
def CUDA : LangOpt<"CUDA">;
+def COnly : LangOpt<"CPlusPlus", 1>;
// Defines targets for target-specific attributes. The list of strings should
// specify architectures for which the target applies, based off the ArchType
@@ -339,6 +345,8 @@ def AddressSpace : TypeAttr {
def Alias : Attr {
let Spellings = [GCC<"alias">];
let Args = [StringArgument<"Aliasee">];
+ let Subjects = SubjectList<[Function, GlobalVar], ErrorDiag,
+ "ExpectedFunctionGlobalVarMethodOrProperty">;
let Documentation = [Undocumented];
}
@@ -624,22 +632,27 @@ def OpenCLImageAccess : Attr {
def OpenCLPrivateAddressSpace : TypeAttr {
let Spellings = [Keyword<"__private">, Keyword<"private">];
- let Documentation = [Undocumented];
+ let Documentation = [OpenCLAddressSpacePrivateDocs];
}
def OpenCLGlobalAddressSpace : TypeAttr {
let Spellings = [Keyword<"__global">, Keyword<"global">];
- let Documentation = [Undocumented];
+ let Documentation = [OpenCLAddressSpaceGlobalDocs];
}
def OpenCLLocalAddressSpace : TypeAttr {
let Spellings = [Keyword<"__local">, Keyword<"local">];
- let Documentation = [Undocumented];
+ let Documentation = [OpenCLAddressSpaceLocalDocs];
}
def OpenCLConstantAddressSpace : TypeAttr {
let Spellings = [Keyword<"__constant">, Keyword<"constant">];
- let Documentation = [Undocumented];
+ let Documentation = [OpenCLAddressSpaceConstantDocs];
+}
+
+def OpenCLGenericAddressSpace : TypeAttr {
+ let Spellings = [Keyword<"__generic">, Keyword<"generic">];
+ let Documentation = [OpenCLAddressSpaceGenericDocs];
}
def Kernel : Attr {
@@ -703,6 +716,25 @@ def MinSize : InheritableAttr {
let Documentation = [Undocumented];
}
+def FlagEnum : InheritableAttr {
+ let Spellings = [GNU<"flag_enum">];
+ let Subjects = SubjectList<[Enum]>;
+ let Documentation = [FlagEnumDocs];
+ let LangOpts = [COnly];
+ let AdditionalMembers = [{
+private:
+ llvm::APInt FlagBits;
+public:
+ llvm::APInt &getFlagBits() {
+ return FlagBits;
+ }
+
+ const llvm::APInt &getFlagBits() const {
+ return FlagBits;
+ }
+}];
+}
+
def Flatten : InheritableAttr {
let Spellings = [GCC<"flatten">];
let Subjects = SubjectList<[Function], ErrorDiag>;
@@ -763,9 +795,9 @@ def IBOutletCollection : InheritableAttr {
let Documentation = [Undocumented];
}
-def Malloc : InheritableAttr {
- let Spellings = [GCC<"malloc">];
-// let Subjects = [Function];
+def Restrict : InheritableAttr {
+ let Spellings = [Declspec<"restrict">, GCC<"malloc">];
+ let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented];
}
@@ -864,6 +896,38 @@ def NoMips16 : InheritableAttr, TargetSpecificAttr<TargetMips> {
let Documentation = [Undocumented];
}
+// This is not a TargetSpecificAttr so that is silently accepted and
+// ignored on other targets as encouraged by the OpenCL spec.
+//
+// See OpenCL 1.2 6.11.5: "It is our intention that a particular
+// implementation of OpenCL be free to ignore all attributes and the
+// resulting executable binary will produce the same result."
+//
+// However, only AMD GPU targets will emit the corresponding IR
+// attribute.
+//
+// FIXME: This provides a sub-optimal error message if you attempt to
+// use this in CUDA, since CUDA does not use the same terminology.
+def AMDGPUNumVGPR : InheritableAttr {
+ let Spellings = [GNU<"amdgpu_num_vgpr">];
+ let Args = [UnsignedArgument<"NumVGPR">];
+ let Documentation = [AMDGPUNumVGPRDocs];
+
+// FIXME: This should be for OpenCLKernelFunction, but is not to
+// workaround needing to see kernel attribute before others to know if
+// this should be rejected on non-kernels.
+ let Subjects = SubjectList<[Function], ErrorDiag,
+ "ExpectedKernelFunction">;
+}
+
+def AMDGPUNumSGPR : InheritableAttr {
+ let Spellings = [GNU<"amdgpu_num_sgpr">];
+ let Args = [UnsignedArgument<"NumSGPR">];
+ let Documentation = [AMDGPUNumSGPRDocs];
+ let Subjects = SubjectList<[Function], ErrorDiag,
+ "ExpectedKernelFunction">;
+}
+
def NoSplitStack : InheritableAttr {
let Spellings = [GCC<"no_split_stack">];
let Subjects = SubjectList<[Function], ErrorDiag>;
@@ -922,7 +986,8 @@ def NoThrow : InheritableAttr {
def ObjCBridge : InheritableAttr {
let Spellings = [GNU<"objc_bridge">];
- let Subjects = SubjectList<[Record], ErrorDiag>;
+ let Subjects = SubjectList<[Record, TypedefName], ErrorDiag,
+ "ExpectedStructOrUnionOrTypedef">;
let Args = [IdentifierArgument<"BridgedType">];
let Documentation = [Undocumented];
}
@@ -1082,12 +1147,6 @@ def Packed : InheritableAttr {
let Documentation = [Undocumented];
}
-def PnaclCall : InheritableAttr {
- let Spellings = [GNU<"pnaclcall">];
-// let Subjects = [Function, ObjCMethod];
- let Documentation = [Undocumented];
-}
-
def IntelOclBicc : InheritableAttr {
let Spellings = [GNU<"intel_ocl_bicc">];
// let Subjects = [Function, ObjCMethod];
@@ -1707,11 +1766,17 @@ def TypeTagForDatatype : InheritableAttr {
// Microsoft-related attributes
-def MsProperty : IgnoredAttr {
+def MSNoVTable : InheritableAttr {
+ let Spellings = [Declspec<"novtable">];
+ let Subjects = SubjectList<[CXXRecord]>;
+ let Documentation = [MSNoVTableDocs];
+}
+
+def : IgnoredAttr {
let Spellings = [Declspec<"property">];
}
-def MsStruct : InheritableAttr {
+def MSStruct : InheritableAttr {
let Spellings = [GCC<"ms_struct">];
let Subjects = SubjectList<[Record]>;
let Documentation = [Undocumented];
diff --git a/include/clang/Basic/AttrDocs.td b/include/clang/Basic/AttrDocs.td
index cf8b662357..64e4cea5b6 100644
--- a/include/clang/Basic/AttrDocs.td
+++ b/include/clang/Basic/AttrDocs.td
@@ -673,6 +673,66 @@ The semantics are as follows:
}];
}
+def DocCatAMDGPURegisterAttributes :
+ DocumentationCategory<"AMD GPU Register Attributes"> {
+ let Content = [{
+Clang supports attributes for controlling register usage on AMD GPU
+targets. These attributes may be attached to a kernel function
+definition and is an optimization hint to the backend for the maximum
+number of registers to use. This is useful in cases where register
+limited occupancy is known to be an important factor for the
+performance for the kernel.
+
+The semantics are as follows:
+
+- The backend will attempt to limit the number of used registers to
+ the specified value, but the exact number used is not
+ guaranteed. The number used may be rounded up to satisfy the
+ allocation requirements or ABI constraints of the subtarget. For
+ example, on Southern Islands VGPRs may only be allocated in
+ increments of 4, so requesting a limit of 39 VGPRs will really
+ attempt to use up to 40. Requesting more registers than the
+ subtarget supports will truncate to the maximum allowed. The backend
+ may also use fewer registers than requested whenever possible.
+
+- 0 implies the default no limit on register usage.
+
+- Ignored on older VLIW subtargets which did not have separate scalar
+ and vector registers, R600 through Northern Islands.
+
+}];
+}
+
+
+def AMDGPUNumVGPRDocs : Documentation {
+ let Category = DocCatAMDGPURegisterAttributes;
+ let Content = [{
+Clang supports the
+``__attribute__((amdgpu_num_vgpr(<num_registers>)))`` attribute on AMD
+Southern Islands GPUs and later for controlling the number of vector
+registers. A typical value would be between 4 and 256 in increments
+of 4.
+}];
+}
+
+def AMDGPUNumSGPRDocs : Documentation {
+ let Category = DocCatAMDGPURegisterAttributes;
+ let Content = [{
+
+Clang supports the
+``__attribute__((amdgpu_num_sgpr(<num_registers>)))`` attribute on AMD
+Southern Islands GPUs and later for controlling the number of scalar
+registers. A typical value would be between 8 and 104 in increments of
+8.
+
+Due to common instruction constraints, an additional 2-4 SGPRs are
+typically required for internal use depending on features used. This
+value is a hint for the total number of SGPRs to use, and not the
+number of user SGPRs, so no special consideration needs to be given
+for these.
+}];
+}
+
def DocCatCallingConvs : DocumentationCategory<"Calling Conventions"> {
let Content = [{
Clang supports several different calling conventions, depending on the target
@@ -1136,6 +1196,16 @@ behavior of the program is undefined.
}];
}
+def FlagEnumDocs : Documentation {
+ let Category = DocCatType;
+ let Content = [{
+This attribute can be added to an enumerator to signal to the compiler that it
+is intended to be used as a flag type. This will cause the compiler to assume
+that the range of the type includes all of the values that you can get by
+manipulating bits of the enumerator when issuing warnings.
+ }];
+}
+
def MSInheritanceDocs : Documentation {
let Category = DocCatType;
let Heading = "__single_inhertiance, __multiple_inheritance, __virtual_inheritance";
@@ -1183,6 +1253,15 @@ an error:
}];
}
+def MSNoVTableDocs : Documentation {
+ let Category = DocCatType;
+ let Content = [{
+This attribute can be added to a class declaration or definition to signal to
+the compiler that constructors and destructors will not reference the virtual
+function table.
+ }];
+}
+
def OptnoneDocs : Documentation {
let Category = DocCatFunction;
let Content = [{
@@ -1194,7 +1273,8 @@ entire application without optimization. Avoiding optimization on the
specified function can improve the quality of the debugging information
for that function.
-This attribute is incompatible with the ``always_inline`` attribute.
+This attribute is incompatible with the ``always_inline`` and ``minsize``
+attributes.
}];
}
@@ -1265,3 +1345,88 @@ for further details including limitations of the unroll hints.
}];
}
+def DocOpenCLAddressSpaces : DocumentationCategory<"OpenCL Address Spaces"> {
+ let Content = [{
+The address space qualifier may be used to specify the region of memory that is
+used to allocate the object. OpenCL supports the following address spaces:
+__generic(generic), __global(global), __local(local), __private(private),
+__constant(constant).
+
+ .. code-block:: c
+
+ __constant int c = ...;
+
+ __generic int* foo(global int* g) {
+ __local int* l;
+ private int p;
+ ...
+ return l;
+ }
+
+More details can be found in the OpenCL C language Spec v2.0, Section 6.5.
+ }];
+}
+
+def OpenCLAddressSpaceGenericDocs : Documentation {
+ let Category = DocOpenCLAddressSpaces;
+ let Heading = "__generic(generic)";
+ let Content = [{
+The generic address space attribute is only available with OpenCL v2.0 and later.
+It can be used with pointer types. Variables in global and local scope and
+function parameters in non-kernel functions can have the generic address space
+type attribute. It is intended to be a placeholder for any other address space
+except for '__constant' in OpenCL code which can be used with multiple address
+spaces.
+ }];
+}
+
+def OpenCLAddressSpaceConstantDocs : Documentation {
+ let Category = DocOpenCLAddressSpaces;
+ let Heading = "__constant(constant)";
+ let Content = [{
+The constant address space attribute signals that an object is located in
+a constant (non-modifiable) memory region. It is available to all work items.
+Any type can be annotated with the constant address space attribute. Objects
+with the constant address space qualifier can be declared in any scope and must
+have an initializer.
+ }];
+}
+
+def OpenCLAddressSpaceGlobalDocs : Documentation {
+ let Category = DocOpenCLAddressSpaces;
+ let Heading = "__global(global)";
+ let Content = [{
+The global address space attribute specifies that an object is allocated in
+global memory, which is accessible by all work items. The content stored in this
+memory area persists between kernel executions. Pointer types to the global
+address space are allowed as function parameters or local variables. Starting
+with OpenCL v2.0, the global address space can be used with global (program
+scope) variables and static local variable as well.
+ }];
+}
+
+def OpenCLAddressSpaceLocalDocs : Documentation {
+ let Category = DocOpenCLAddressSpaces;
+ let Heading = "__local(local)";
+ let Content = [{
+The local address space specifies that an object is allocated in the local (work
+group) memory area, which is accessible to all work items in the same work
+group. The content stored in this memory region is not accessible after
+the kernel execution ends. In a kernel function scope, any variable can be in
+the local address space. In other scopes, only pointer types to the local address
+space are allowed. Local address space variables cannot have an initializer.
+ }];
+}
+
+def OpenCLAddressSpacePrivateDocs : Documentation {
+ let Category = DocOpenCLAddressSpaces;
+ let Heading = "__private(private)";
+ let Content = [{
+The private address space specifies that an object is allocated in the private
+(work item) memory. Other work items cannot access the same memory area and its
+content is destroyed after work item execution ends. Local variables can be
+declared in the private address space. Function arguments are always in the
+private address space. Kernel function arguments of a pointer or an array type
+cannot point to the private address space.
+ }];
+}
diff --git a/include/clang/Basic/Attributes.h b/include/clang/Basic/Attributes.h
index 982e12d9f2..a64dd5666b 100644
--- a/include/clang/Basic/Attributes.h
+++ b/include/clang/Basic/Attributes.h
@@ -10,16 +10,14 @@
#ifndef LLVM_CLANG_BASIC_ATTRIBUTES_H
#define LLVM_CLANG_BASIC_ATTRIBUTES_H
-#include "llvm/ADT/Triple.h"
#include "clang/Basic/LangOptions.h"
+#include "llvm/ADT/Triple.h"
namespace clang {
class IdentifierInfo;
enum class AttrSyntax {
- /// Is the attribute identifier generally known for any syntax?
- Generic,
/// Is the identifier known as a GNU-style attribute?
GNU,
/// Is the identifier known as a __declspec-style attribute?
diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def
index dc668a161c..632509bf89 100644
--- a/include/clang/Basic/Builtins.def
+++ b/include/clang/Basic/Builtins.def
@@ -448,8 +448,8 @@ BUILTIN(__builtin_extract_return_addr, "v*v*", "n")
BUILTIN(__builtin_frame_address, "v*IUi", "n")
BUILTIN(__builtin___clear_cache, "vc*c*", "n")
BUILTIN(__builtin_flt_rounds, "i", "nc")
-BUILTIN(__builtin_setjmp, "iv**", "j")
-BUILTIN(__builtin_longjmp, "vv**i", "r")
+BUILTIN(__builtin_setjmp, "iv**", "Fj")
+BUILTIN(__builtin_longjmp, "vv**i", "Fr")
BUILTIN(__builtin_unwind_init, "v", "")
BUILTIN(__builtin_eh_return_data_regno, "iIi", "nc")
BUILTIN(__builtin_snprintf, "ic*zcC*.", "nFp:2:")
@@ -497,6 +497,7 @@ BUILTIN(__builtin_unreachable, "v", "nr")
BUILTIN(__builtin_shufflevector, "v." , "nc")
BUILTIN(__builtin_convertvector, "v." , "nct")
BUILTIN(__builtin_alloca, "v*z" , "n")
+BUILTIN(__builtin_call_with_static_chain, "v.", "nt")
// "Overloaded" Atomic operator builtins. These are overloaded to support data
// types of i8, i16, i32, i64, and i128. The front-end sees calls to the
@@ -691,19 +692,28 @@ BUILTIN(__builtin_index, "c*cC*i", "Fn")
BUILTIN(__builtin_rindex, "c*cC*i", "Fn")
// Microsoft builtins. These are only active with -fms-extensions.
-LANGBUILTIN(_alloca, "v*z", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__assume, "vb", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__noop, "i.", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__debugbreak, "v", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__va_start, "vc**.", "nt", ALL_MS_LANGUAGES)
+LANGBUILTIN(_alloca, "v*z", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__assume, "vb", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__debugbreak, "v", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__exception_code, "ULi", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(_exception_code, "ULi", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__exception_info, "v*", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(_exception_info, "v*", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__abnormal_termination, "i", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(_abnormal_termination, "i", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(_InterlockedCompareExchange, "LiLiD*LiLi", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(_InterlockedCompareExchangePointer, "v*v*D*v*v*", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedIncrement, "LiLiD*", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedDecrement, "LiLiD*", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedExchangeAdd, "LiLiD*Li", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedExchangePointer, "v*v*D*v*", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedExchange, "LiLiD*Li", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__readfsdword, "ULiULi", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(_InterlockedDecrement, "LiLiD*", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(_InterlockedExchangeAdd, "LiLiD*Li", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(_InterlockedExchange, "LiLiD*Li", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(_InterlockedExchangePointer, "v*v*D*v*", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(_InterlockedIncrement, "LiLiD*", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__noop, "i.", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__readfsdword, "ULiULi", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__va_start, "vc**.", "nt", ALL_MS_LANGUAGES)
+
+// Microsoft library builtins.
+LIBBUILTIN(_setjmpex, "iJ", "fj", "setjmpex.h", ALL_MS_LANGUAGES)
// C99 library functions
// C99 stdlib.h
diff --git a/include/clang/Basic/Builtins.h b/include/clang/Basic/Builtins.h
index f9d30e4056..3ce2255c86 100644
--- a/include/clang/Basic/Builtins.h
+++ b/include/clang/Basic/Builtins.h
@@ -29,7 +29,7 @@ namespace clang {
class ASTContext;
class QualType;
class LangOptions;
-
+
enum LanguageID {
GNU_LANG = 0x1, // builtin requires GNU mode.
C_LANG = 0x2, // builtin for c only.
@@ -40,7 +40,7 @@ namespace clang {
ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG, // builtin requires GNU mode.
ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG // builtin requires MS mode.
};
-
+
namespace Builtin {
enum ID {
NotBuiltin = 0, // This is not a builtin function.
diff --git a/include/clang/Basic/BuiltinsARM.def b/include/clang/Basic/BuiltinsARM.def
index 1f2f9a3840..98d5ab73aa 100644
--- a/include/clang/Basic/BuiltinsARM.def
+++ b/include/clang/Basic/BuiltinsARM.def
@@ -85,6 +85,8 @@ BUILTIN(__builtin_arm_isb, "vUi", "nc")
BUILTIN(__builtin_arm_prefetch, "vvC*UiUi", "nc")
// MSVC
+LANGBUILTIN(__emit, "vIUiC", "", ALL_MS_LANGUAGES)
+
LANGBUILTIN(__yield, "v", "", ALL_MS_LANGUAGES)
LANGBUILTIN(__wfe, "v", "", ALL_MS_LANGUAGES)
LANGBUILTIN(__wfi, "v", "", ALL_MS_LANGUAGES)
@@ -94,7 +96,7 @@ LANGBUILTIN(__sevl, "v", "", ALL_MS_LANGUAGES)
LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES)
-LANGBUILTIN(__ldrexd, "WiCDWi*", "", ALL_MS_LANGUAGES)
+LANGBUILTIN(__ldrexd, "WiWiCD*", "", ALL_MS_LANGUAGES)
LANGBUILTIN(_MoveFromCoprocessor, "UiUiUiUiUiUi", "", ALL_MS_LANGUAGES)
LANGBUILTIN(_MoveFromCoprocessor2, "UiUiUiUiUiUi", "", ALL_MS_LANGUAGES)
LANGBUILTIN(_MoveToCoprocessor, "vUiUiUiUiUiUi", "", ALL_MS_LANGUAGES)
diff --git a/include/clang/Basic/BuiltinsNVPTX.def b/include/clang/Basic/BuiltinsNVPTX.def
index 7e9b5eea83..9c920dce5c 100644
--- a/include/clang/Basic/BuiltinsNVPTX.def
+++ b/include/clang/Basic/BuiltinsNVPTX.def
@@ -139,8 +139,8 @@ BUILTIN(__nvvm_brev64, "ULLiULLi", "")
// Sad
-BUILTIN(__nvvm_sad_i, "iii", "")
-BUILTIN(__nvvm_sad_ui, "UiUiUi", "")
+BUILTIN(__nvvm_sad_i, "iiii", "")
+BUILTIN(__nvvm_sad_ui, "UiUiUiUi", "")
// Floor, Ceil
@@ -255,19 +255,19 @@ BUILTIN(__nvvm_rsqrt_approx_d, "dd", "")
// Add
-BUILTIN(__nvvm_add_rn_ftz_f, "ff", "")
-BUILTIN(__nvvm_add_rn_f, "ff", "")
-BUILTIN(__nvvm_add_rz_ftz_f, "ff", "")
-BUILTIN(__nvvm_add_rz_f, "ff", "")
-BUILTIN(__nvvm_add_rm_ftz_f, "ff", "")
-BUILTIN(__nvvm_add_rm_f, "ff", "")
-BUILTIN(__nvvm_add_rp_ftz_f, "ff", "")
-BUILTIN(__nvvm_add_rp_f, "ff", "")
-
-BUILTIN(__nvvm_add_rn_d, "dd", "")
-BUILTIN(__nvvm_add_rz_d, "dd", "")
-BUILTIN(__nvvm_add_rm_d, "dd", "")
-BUILTIN(__nvvm_add_rp_d, "dd", "")
+BUILTIN(__nvvm_add_rn_ftz_f, "fff", "")
+BUILTIN(__nvvm_add_rn_f, "fff", "")
+BUILTIN(__nvvm_add_rz_ftz_f, "fff", "")
+BUILTIN(__nvvm_add_rz_f, "fff", "")
+BUILTIN(__nvvm_add_rm_ftz_f, "fff", "")
+BUILTIN(__nvvm_add_rm_f, "fff", "")
+BUILTIN(__nvvm_add_rp_ftz_f, "fff", "")
+BUILTIN(__nvvm_add_rp_f, "fff", "")
+
+BUILTIN(__nvvm_add_rn_d, "ddd", "")
+BUILTIN(__nvvm_add_rz_d, "ddd", "")
+BUILTIN(__nvvm_add_rm_d, "ddd", "")
+BUILTIN(__nvvm_add_rp_d, "ddd", "")
// Convert
diff --git a/include/clang/Basic/BuiltinsR600.def b/include/clang/Basic/BuiltinsR600.def
index 79a82f7b4b..84fc4fae4e 100644
--- a/include/clang/Basic/BuiltinsR600.def
+++ b/include/clang/Basic/BuiltinsR600.def
@@ -30,5 +30,7 @@ BUILTIN(__builtin_amdgpu_rsq_clamped, "dd", "nc")
BUILTIN(__builtin_amdgpu_rsq_clampedf, "ff", "nc")
BUILTIN(__builtin_amdgpu_ldexp, "ddi", "nc")
BUILTIN(__builtin_amdgpu_ldexpf, "ffi", "nc")
+BUILTIN(__builtin_amdgpu_class, "bdi", "nc")
+BUILTIN(__builtin_amdgpu_classf, "bfi", "nc")
#undef BUILTIN
diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def
index 79bfd4b5b2..4ed8f48310 100644
--- a/include/clang/Basic/BuiltinsX86.def
+++ b/include/clang/Basic/BuiltinsX86.def
@@ -187,13 +187,45 @@ BUILTIN(__builtin_ia32_ucomisdgt, "iV2dV2d", "")
BUILTIN(__builtin_ia32_ucomisdge, "iV2dV2d", "")
BUILTIN(__builtin_ia32_ucomisdneq, "iV2dV2d", "")
BUILTIN(__builtin_ia32_cmpps, "V4fV4fV4fIc", "")
+BUILTIN(__builtin_ia32_cmpeqps, "V4fV4fV4f", "")
+BUILTIN(__builtin_ia32_cmpltps, "V4fV4fV4f", "")
+BUILTIN(__builtin_ia32_cmpleps, "V4fV4fV4f", "")
+BUILTIN(__builtin_ia32_cmpunordps, "V4fV4fV4f", "")
+BUILTIN(__builtin_ia32_cmpneqps, "V4fV4fV4f", "")
+BUILTIN(__builtin_ia32_cmpnltps, "V4fV4fV4f", "")
+BUILTIN(__builtin_ia32_cmpnleps, "V4fV4fV4f", "")
+BUILTIN(__builtin_ia32_cmpordps, "V4fV4fV4f", "")
BUILTIN(__builtin_ia32_cmpss, "V4fV4fV4fIc", "")
+BUILTIN(__builtin_ia32_cmpeqss, "V4fV4fV4f", "")
+BUILTIN(__builtin_ia32_cmpltss, "V4fV4fV4f", "")
+BUILTIN(__builtin_ia32_cmpless, "V4fV4fV4f", "")
+BUILTIN(__builtin_ia32_cmpunordss, "V4fV4fV4f", "")
+BUILTIN(__builtin_ia32_cmpneqss, "V4fV4fV4f", "")
+BUILTIN(__builtin_ia32_cmpnltss, "V4fV4fV4f", "")
+BUILTIN(__builtin_ia32_cmpnless, "V4fV4fV4f", "")
+BUILTIN(__builtin_ia32_cmpordss, "V4fV4fV4f", "")
BUILTIN(__builtin_ia32_minps, "V4fV4fV4f", "")
BUILTIN(__builtin_ia32_maxps, "V4fV4fV4f", "")
BUILTIN(__builtin_ia32_minss, "V4fV4fV4f", "")
BUILTIN(__builtin_ia32_maxss, "V4fV4fV4f", "")
BUILTIN(__builtin_ia32_cmppd, "V2dV2dV2dIc", "")
+BUILTIN(__builtin_ia32_cmpeqpd, "V2dV2dV2d", "")
+BUILTIN(__builtin_ia32_cmpltpd, "V2dV2dV2d", "")
+BUILTIN(__builtin_ia32_cmplepd, "V2dV2dV2d", "")
+BUILTIN(__builtin_ia32_cmpunordpd, "V2dV2dV2d", "")
+BUILTIN(__builtin_ia32_cmpneqpd, "V2dV2dV2d", "")
+BUILTIN(__builtin_ia32_cmpnltpd, "V2dV2dV2d", "")
+BUILTIN(__builtin_ia32_cmpnlepd, "V2dV2dV2d", "")
+BUILTIN(__builtin_ia32_cmpordpd, "V2dV2dV2d", "")
BUILTIN(__builtin_ia32_cmpsd, "V2dV2dV2dIc", "")
+BUILTIN(__builtin_ia32_cmpeqsd, "V2dV2dV2d", "")
+BUILTIN(__builtin_ia32_cmpltsd, "V2dV2dV2d", "")
+BUILTIN(__builtin_ia32_cmplesd, "V2dV2dV2d", "")
+BUILTIN(__builtin_ia32_cmpunordsd, "V2dV2dV2d", "")
+BUILTIN(__builtin_ia32_cmpneqsd, "V2dV2dV2d", "")
+BUILTIN(__builtin_ia32_cmpnltsd, "V2dV2dV2d", "")
+BUILTIN(__builtin_ia32_cmpnlesd, "V2dV2dV2d", "")
+BUILTIN(__builtin_ia32_cmpordsd, "V2dV2dV2d", "")
BUILTIN(__builtin_ia32_minpd, "V2dV2dV2d", "")
BUILTIN(__builtin_ia32_maxpd, "V2dV2dV2d", "")
BUILTIN(__builtin_ia32_minsd, "V2dV2dV2d", "")
@@ -284,8 +316,6 @@ BUILTIN(__builtin_ia32_psraw128, "V8sV8sV8s", "")
BUILTIN(__builtin_ia32_psrad128, "V4iV4iV4i", "")
BUILTIN(__builtin_ia32_psrlw128, "V8sV8sV8s", "")
BUILTIN(__builtin_ia32_psrld128, "V4iV4iV4i", "")
-BUILTIN(__builtin_ia32_pslldqi128, "V2LLiV2LLiIi", "")
-BUILTIN(__builtin_ia32_psrldqi128, "V2LLiV2LLiIi", "")
BUILTIN(__builtin_ia32_psrlq128, "V2LLiV2LLiV2LLi", "")
BUILTIN(__builtin_ia32_psllw128, "V8sV8sV8s", "")
BUILTIN(__builtin_ia32_pslld128, "V4iV4iV4i", "")
@@ -307,8 +337,6 @@ BUILTIN(__builtin_ia32_insertps128, "V4fV4fV4fIc", "")
BUILTIN(__builtin_ia32_pblendvb128, "V16cV16cV16cV16c", "")
BUILTIN(__builtin_ia32_pblendw128, "V8sV8sV8sIc", "")
-BUILTIN(__builtin_ia32_blendpd, "V2dV2dV2dIc", "")
-BUILTIN(__builtin_ia32_blendps, "V4fV4fV4fIc", "")
BUILTIN(__builtin_ia32_blendvpd, "V2dV2dV2dV2d", "")
BUILTIN(__builtin_ia32_blendvps, "V4fV4fV4fV4f", "")
@@ -404,13 +432,11 @@ BUILTIN(__builtin_ia32_vpermilvarpd, "V2dV2dV2LLi", "")
BUILTIN(__builtin_ia32_vpermilvarps, "V4fV4fV4i", "")
BUILTIN(__builtin_ia32_vpermilvarpd256, "V4dV4dV4LLi", "")
BUILTIN(__builtin_ia32_vpermilvarps256, "V8fV8fV8i", "")
-BUILTIN(__builtin_ia32_blendpd256, "V4dV4dV4dIc", "")
-BUILTIN(__builtin_ia32_blendps256, "V8fV8fV8fIc", "")
BUILTIN(__builtin_ia32_blendvpd256, "V4dV4dV4dV4d", "")
BUILTIN(__builtin_ia32_blendvps256, "V8fV8fV8fV8f", "")
BUILTIN(__builtin_ia32_dpps256, "V8fV8fV8fIc", "")
-BUILTIN(__builtin_ia32_cmppd256, "V4dV4dV4dc", "")
-BUILTIN(__builtin_ia32_cmpps256, "V8fV8fV8fc", "")
+BUILTIN(__builtin_ia32_cmppd256, "V4dV4dV4dIc", "")
+BUILTIN(__builtin_ia32_cmpps256, "V8fV8fV8fIc", "")
BUILTIN(__builtin_ia32_vextractf128_pd256, "V2dV4dIc", "")
BUILTIN(__builtin_ia32_vextractf128_ps256, "V4fV8fIc", "")
BUILTIN(__builtin_ia32_vextractf128_si256, "V4iV8iIc", "")
@@ -706,12 +732,12 @@ BUILTIN(__builtin_ia32_vfmaddsubps256, "V8fV8fV8fV8f", "")
BUILTIN(__builtin_ia32_vfmaddsubpd256, "V4dV4dV4dV4d", "")
BUILTIN(__builtin_ia32_vfmsubaddps256, "V8fV8fV8fV8f", "")
BUILTIN(__builtin_ia32_vfmsubaddpd256, "V4dV4dV4dV4d", "")
-BUILTIN(__builtin_ia32_vfmaddpd512_mask, "V8dV8dV8dV8dUci", "")
-BUILTIN(__builtin_ia32_vfmsubpd512_mask, "V8dV8dV8dV8dUci", "")
-BUILTIN(__builtin_ia32_vfnmaddpd512_mask, "V8dV8dV8dV8dUci", "")
-BUILTIN(__builtin_ia32_vfmaddps512_mask, "V16fV16fV16fV16fUsi", "")
-BUILTIN(__builtin_ia32_vfmsubps512_mask, "V16fV16fV16fV16fUsi", "")
-BUILTIN(__builtin_ia32_vfnmaddps512_mask, "V16fV16fV16fV16fUsi", "")
+BUILTIN(__builtin_ia32_vfmaddpd512_mask, "V8dV8dV8dV8dUcIi", "")
+BUILTIN(__builtin_ia32_vfmsubpd512_mask, "V8dV8dV8dV8dUcIi", "")
+BUILTIN(__builtin_ia32_vfnmaddpd512_mask, "V8dV8dV8dV8dUcIi", "")
+BUILTIN(__builtin_ia32_vfmaddps512_mask, "V16fV16fV16fV16fUsIi", "")
+BUILTIN(__builtin_ia32_vfmsubps512_mask, "V16fV16fV16fV16fUsIi", "")
+BUILTIN(__builtin_ia32_vfnmaddps512_mask, "V16fV16fV16fV16fUsIi", "")
// XOP
BUILTIN(__builtin_ia32_vpmacssww, "V8sV8sV8sV8s", "")
@@ -788,29 +814,31 @@ BUILTIN(__builtin_ia32_rdtsc, "ULLi", "")
BUILTIN(__builtin_ia32_rdtscp, "ULLiUi*", "")
// AVX-512
-BUILTIN(__builtin_ia32_sqrtpd512_mask, "V8dV8dV8dUcCi", "")
-BUILTIN(__builtin_ia32_sqrtps512_mask, "V16fV16fV16fUsCi", "")
+BUILTIN(__builtin_ia32_sqrtpd512_mask, "V8dV8dV8dUcIi", "")
+BUILTIN(__builtin_ia32_sqrtps512_mask, "V16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_rsqrt14sd_mask, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_rsqrt14ss_mask, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_rsqrt14pd512_mask, "V8dV8dV8dUc", "")
BUILTIN(__builtin_ia32_rsqrt14ps512_mask, "V16fV16fV16fUs", "")
-BUILTIN(__builtin_ia32_rsqrt28sd_mask, "V2dV2dV2dV2dUcCi", "")
-BUILTIN(__builtin_ia32_rsqrt28ss_mask, "V4fV4fV4fV4fUcCi", "")
-BUILTIN(__builtin_ia32_rsqrt28pd_mask, "V8dV8dV8dUcCi", "")
-BUILTIN(__builtin_ia32_rsqrt28ps_mask, "V16fV16fV16fUsCi", "")
+BUILTIN(__builtin_ia32_rsqrt28sd_mask, "V2dV2dV2dV2dUcIi", "")
+BUILTIN(__builtin_ia32_rsqrt28ss_mask, "V4fV4fV4fV4fUcIi", "")
+BUILTIN(__builtin_ia32_rsqrt28pd_mask, "V8dV8dV8dUcIi", "")
+BUILTIN(__builtin_ia32_rsqrt28ps_mask, "V16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_rcp14sd_mask, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_rcp14ss_mask, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_rcp14pd512_mask, "V8dV8dV8dUc", "")
BUILTIN(__builtin_ia32_rcp14ps512_mask, "V16fV16fV16fUs", "")
-BUILTIN(__builtin_ia32_rcp28sd_mask, "V2dV2dV2dV2dUcCi", "")
-BUILTIN(__builtin_ia32_rcp28ss_mask, "V4fV4fV4fV4fUcCi", "")
-BUILTIN(__builtin_ia32_rcp28pd_mask, "V8dV8dV8dUcCi", "")
-BUILTIN(__builtin_ia32_rcp28ps_mask, "V16fV16fV16fUsCi", "")
-BUILTIN(__builtin_ia32_cvttps2dq512_mask, "V16iV16fV16iUsCi", "")
-BUILTIN(__builtin_ia32_cvttps2udq512_mask, "V16iV16fV16iUsCi", "")
-BUILTIN(__builtin_ia32_cvttpd2dq512_mask, "V8iV8dV8iUcCi", "")
-BUILTIN(__builtin_ia32_cvttpd2udq512_mask, "V8iV8dV8iUcCi", "")
-BUILTIN(__builtin_ia32_cmpps512_mask, "UsV16fV16fCiUsi", "")
+BUILTIN(__builtin_ia32_rcp28sd_mask, "V2dV2dV2dV2dUcIi", "")
+BUILTIN(__builtin_ia32_rcp28ss_mask, "V4fV4fV4fV4fUcIi", "")
+BUILTIN(__builtin_ia32_rcp28pd_mask, "V8dV8dV8dUcIi", "")
+BUILTIN(__builtin_ia32_rcp28ps_mask, "V16fV16fV16fUsIi", "")
+BUILTIN(__builtin_ia32_exp2pd_mask, "V8dV8dV8dUcIi", "")
+BUILTIN(__builtin_ia32_exp2ps_mask, "V16fV16fV16fUsIi", "")
+BUILTIN(__builtin_ia32_cvttps2dq512_mask, "V16iV16fV16iUsIi", "")
+BUILTIN(__builtin_ia32_cvttps2udq512_mask, "V16iV16fV16iUsIi", "")
+BUILTIN(__builtin_ia32_cvttpd2dq512_mask, "V8iV8dV8iUcIi", "")
+BUILTIN(__builtin_ia32_cvttpd2udq512_mask, "V8iV8dV8iUcIi", "")
+BUILTIN(__builtin_ia32_cmpps512_mask, "UsV16fV16fIcUsIi", "")
BUILTIN(__builtin_ia32_pcmpeqb512_mask, "LLiV64cV64cLLi", "")
BUILTIN(__builtin_ia32_pcmpeqd512_mask, "sV16iV16is", "")
BUILTIN(__builtin_ia32_pcmpeqq512_mask, "cV8LLiV8LLic", "")
@@ -823,24 +851,36 @@ BUILTIN(__builtin_ia32_pcmpeqb128_mask, "sV16cV16cs", "")
BUILTIN(__builtin_ia32_pcmpeqd128_mask, "cV4iV4ic", "")
BUILTIN(__builtin_ia32_pcmpeqq128_mask, "cV2LLiV2LLic", "")
BUILTIN(__builtin_ia32_pcmpeqw128_mask, "cV8sV8sc", "")
-BUILTIN(__builtin_ia32_cmppd512_mask, "UcV8dV8dCiUci", "")
-BUILTIN(__builtin_ia32_rndscaleps_mask, "V16fV16fCiV16fUsCi", "")
-BUILTIN(__builtin_ia32_rndscalepd_mask, "V8dV8dCiV8dUcCi", "")
-BUILTIN(__builtin_ia32_cvtps2dq512_mask, "V16iV16fV16iUsCi", "")
-BUILTIN(__builtin_ia32_cvtpd2dq512_mask, "V8iV8dV8iUcCi", "")
-BUILTIN(__builtin_ia32_cvtps2udq512_mask, "V16iV16fV16iUsCi", "")
-BUILTIN(__builtin_ia32_cvtpd2udq512_mask, "V8iV8dV8iUcCi", "")
-BUILTIN(__builtin_ia32_minps512_mask, "V16fV16fV16fV16fUsCi", "")
-BUILTIN(__builtin_ia32_minpd512_mask, "V8dV8dV8dV8dUcCi", "")
-BUILTIN(__builtin_ia32_maxps512_mask, "V16fV16fV16fV16fUsCi", "")
-BUILTIN(__builtin_ia32_maxpd512_mask, "V8dV8dV8dV8dUcCi", "")
-BUILTIN(__builtin_ia32_cvtdq2ps512_mask, "V16fV16iV16fUsCi", "")
-BUILTIN(__builtin_ia32_cvtudq2ps512_mask, "V16fV16iV16fUsCi", "")
+BUILTIN(__builtin_ia32_pcmpgtb512_mask, "LLiV64cV64cLLi", "")
+BUILTIN(__builtin_ia32_pcmpgtd512_mask, "sV16iV16is", "")
+BUILTIN(__builtin_ia32_pcmpgtq512_mask, "cV8LLiV8LLic", "")
+BUILTIN(__builtin_ia32_pcmpgtw512_mask, "iV32sV32si", "")
+BUILTIN(__builtin_ia32_pcmpgtb256_mask, "iV32cV32ci", "")
+BUILTIN(__builtin_ia32_pcmpgtd256_mask, "cV8iV8ic", "")
+BUILTIN(__builtin_ia32_pcmpgtq256_mask, "cV4LLiV4LLic", "")
+BUILTIN(__builtin_ia32_pcmpgtw256_mask, "sV16sV16ss", "")
+BUILTIN(__builtin_ia32_pcmpgtb128_mask, "sV16cV16cs", "")
+BUILTIN(__builtin_ia32_pcmpgtd128_mask, "cV4iV4ic", "")
+BUILTIN(__builtin_ia32_pcmpgtq128_mask, "cV2LLiV2LLic", "")
+BUILTIN(__builtin_ia32_pcmpgtw128_mask, "cV8sV8sc", "")
+BUILTIN(__builtin_ia32_cmppd512_mask, "UcV8dV8dIcUcIi", "")
+BUILTIN(__builtin_ia32_rndscaleps_mask, "V16fV16fIiV16fUsIi", "")
+BUILTIN(__builtin_ia32_rndscalepd_mask, "V8dV8dIiV8dUcIi", "")
+BUILTIN(__builtin_ia32_cvtps2dq512_mask, "V16iV16fV16iUsIi", "")
+BUILTIN(__builtin_ia32_cvtpd2dq512_mask, "V8iV8dV8iUcIi", "")
+BUILTIN(__builtin_ia32_cvtps2udq512_mask, "V16iV16fV16iUsIi", "")
+BUILTIN(__builtin_ia32_cvtpd2udq512_mask, "V8iV8dV8iUcIi", "")
+BUILTIN(__builtin_ia32_minps512_mask, "V16fV16fV16fV16fUsIi", "")
+BUILTIN(__builtin_ia32_minpd512_mask, "V8dV8dV8dV8dUcIi", "")
+BUILTIN(__builtin_ia32_maxps512_mask, "V16fV16fV16fV16fUsIi", "")
+BUILTIN(__builtin_ia32_maxpd512_mask, "V8dV8dV8dV8dUcIi", "")
+BUILTIN(__builtin_ia32_cvtdq2ps512_mask, "V16fV16iV16fUsIi", "")
+BUILTIN(__builtin_ia32_cvtudq2ps512_mask, "V16fV16iV16fUsIi", "")
BUILTIN(__builtin_ia32_cvtdq2pd512_mask, "V8dV8iV8dUc", "")
BUILTIN(__builtin_ia32_cvtudq2pd512_mask, "V8dV8iV8dUc", "")
-BUILTIN(__builtin_ia32_cvtpd2ps512_mask, "V8fV8dV8fUcCi", "")
-BUILTIN(__builtin_ia32_vcvtps2ph512_mask, "V16sV16fCiV16sUs", "")
-BUILTIN(__builtin_ia32_vcvtph2ps512_mask, "V16fV16sV16fUsCi", "")
+BUILTIN(__builtin_ia32_cvtpd2ps512_mask, "V8fV8dV8fUcIi", "")
+BUILTIN(__builtin_ia32_vcvtps2ph512_mask, "V16sV16fIiV16sUs", "")
+BUILTIN(__builtin_ia32_vcvtph2ps512_mask, "V16fV16sV16fUsIi", "")
BUILTIN(__builtin_ia32_pabsd512_mask, "V16iV16iV16iUs", "")
BUILTIN(__builtin_ia32_pabsq512_mask, "V8LLiV8LLiV8LLiUc", "")
BUILTIN(__builtin_ia32_pmaxsd512_mask, "V16iV16iV16iV16iUs", "")
@@ -865,41 +905,72 @@ BUILTIN(__builtin_ia32_pbroadcastq512_mem_mask, "V8LLiLLiV8LLiUc", "")
BUILTIN(__builtin_ia32_loaddqusi512_mask, "V16ivC*V16iUs", "")
BUILTIN(__builtin_ia32_loaddqudi512_mask, "V8LLivC*V8LLiUc", "")
BUILTIN(__builtin_ia32_loadups512_mask, "V16fvC*V16fUs", "")
+BUILTIN(__builtin_ia32_loadaps512_mask, "V16fvC*V16fUs", "")
BUILTIN(__builtin_ia32_loadupd512_mask, "V8dvC*V8dUc", "")
+BUILTIN(__builtin_ia32_loadapd512_mask, "V8dvC*V8dUc", "")
BUILTIN(__builtin_ia32_storedqudi512_mask, "vv*V8LLiUc", "")
BUILTIN(__builtin_ia32_storedqusi512_mask, "vv*V16iUs", "")
BUILTIN(__builtin_ia32_storeupd512_mask, "vv*V8dUc", "")
+BUILTIN(__builtin_ia32_storeapd512_mask, "vv*V8dUc", "")
BUILTIN(__builtin_ia32_storeups512_mask, "vv*V16fUs", "")
+BUILTIN(__builtin_ia32_storeaps512_mask, "vv*V16fUs", "")
BUILTIN(__builtin_ia32_vpermt2vard512_mask, "V16iV16iV16iV16iUs", "")
BUILTIN(__builtin_ia32_vpermt2varq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "")
BUILTIN(__builtin_ia32_vpermt2varps512_mask, "V16fV16iV16fV16fUs", "")
BUILTIN(__builtin_ia32_vpermt2varpd512_mask, "V8dV8LLiV8dV8dUc", "")
-BUILTIN(__builtin_ia32_alignq512_mask, "V8LLiV8LLiV8LLiUcV8LLiUc", "")
-BUILTIN(__builtin_ia32_alignd512_mask, "V16iV16iV16iUcV16iUc", "")
-BUILTIN(__builtin_ia32_gathersiv8df, "V8dV8dv*V8iUcCi", "")
-BUILTIN(__builtin_ia32_gathersiv16sf, "V16fV16fv*UsCi", "")
-BUILTIN(__builtin_ia32_gatherdiv8df, "V8dV8dv*V8LLiUcCi", "")
-BUILTIN(__builtin_ia32_gatherdiv16sf, "V8fV8fv*V8LLiUcCi", "")
-BUILTIN(__builtin_ia32_gathersiv8di, "V8LLiV8LLiv*V8iUcCi", "")
-BUILTIN(__builtin_ia32_gathersiv16si, "V16iV16iv*UsCi", "")
-BUILTIN(__builtin_ia32_gatherdiv8di, "V8LLiV8LLiv*V8LLiUcCi", "")
-BUILTIN(__builtin_ia32_gatherdiv16si, "V8iV8iv*V8LLiUcCi", "")
-BUILTIN(__builtin_ia32_scattersiv8df, "vv*UcV8iV8dCi", "")
-BUILTIN(__builtin_ia32_scattersiv16sf, "vv*UsV16iV16fCi", "")
-BUILTIN(__builtin_ia32_scatterdiv8df, "vv*UcV8LLiV8dCi", "")
-BUILTIN(__builtin_ia32_scatterdiv16sf, "vv*UcV8LLiV8fCi", "")
-BUILTIN(__builtin_ia32_scattersiv8di, "vv*UcV8iV8LLiCi", "")
-BUILTIN(__builtin_ia32_scattersiv16si, "vv*UsV16iV16iCi", "")
-BUILTIN(__builtin_ia32_scatterdiv8di, "vv*UcV8LLiV8LLiCi", "")
-BUILTIN(__builtin_ia32_scatterdiv16si, "vv*UcV8LLiV8iCi", "")
-BUILTIN(__builtin_ia32_gatherpfdpd, "vUcV8iv*CiCi", "")
-BUILTIN(__builtin_ia32_gatherpfdps, "vUsV16iv*CiCi", "")
-BUILTIN(__builtin_ia32_gatherpfqpd, "vUcV8LLiv*CiCi", "")
-BUILTIN(__builtin_ia32_gatherpfqps, "vUcV8LLiv*CiCi", "")
-BUILTIN(__builtin_ia32_scatterpfdpd, "vUcV8iv*CiCi", "")
-BUILTIN(__builtin_ia32_scatterpfdps, "vUsV16iv*CiCi", "")
-BUILTIN(__builtin_ia32_scatterpfqpd, "vUcV8LLiv*CiCi", "")
-BUILTIN(__builtin_ia32_scatterpfqps, "vUcV8LLiv*CiCi", "")
+BUILTIN(__builtin_ia32_alignq512_mask, "V8LLiV8LLiV8LLiIcV8LLiUc", "")
+BUILTIN(__builtin_ia32_alignd512_mask, "V16iV16iV16iIcV16iUs", "")
+BUILTIN(__builtin_ia32_extractf64x4_mask, "V4dV8dIcV4dUc", "")
+BUILTIN(__builtin_ia32_extractf32x4_mask, "V4fV16fIcV4fUc", "")
+BUILTIN(__builtin_ia32_gathersiv8df, "V8dV8dvC*V8iUcIi", "")
+BUILTIN(__builtin_ia32_gathersiv16sf, "V16fV16fvC*UsIi", "")
+BUILTIN(__builtin_ia32_gatherdiv8df, "V8dV8dvC*V8LLiUcIi", "")
+BUILTIN(__builtin_ia32_gatherdiv16sf, "V8fV8fvC*V8LLiUcIi", "")
+BUILTIN(__builtin_ia32_gathersiv8di, "V8LLiV8LLivC*V8iUcIi", "")
+BUILTIN(__builtin_ia32_gathersiv16si, "V16iV16ivC*UsIi", "")
+BUILTIN(__builtin_ia32_gatherdiv8di, "V8LLiV8LLivC*V8LLiUcIi", "")
+BUILTIN(__builtin_ia32_gatherdiv16si, "V8iV8ivC*V8LLiUcIi", "")
+BUILTIN(__builtin_ia32_scattersiv8df, "vv*UcV8iV8dIi", "")
+BUILTIN(__builtin_ia32_scattersiv16sf, "vv*UsV16iV16fIi", "")
+BUILTIN(__builtin_ia32_scatterdiv8df, "vv*UcV8LLiV8dIi", "")
+BUILTIN(__builtin_ia32_scatterdiv16sf, "vv*UcV8LLiV8fIi", "")
+BUILTIN(__builtin_ia32_scattersiv8di, "vv*UcV8iV8LLiIi", "")
+BUILTIN(__builtin_ia32_scattersiv16si, "vv*UsV16iV16iIi", "")
+BUILTIN(__builtin_ia32_scatterdiv8di, "vv*UcV8LLiV8LLiIi", "")
+BUILTIN(__builtin_ia32_scatterdiv16si, "vv*UcV8LLiV8iIi", "")
+BUILTIN(__builtin_ia32_gatherpfdpd, "vUcV8ivC*IiIi", "")
+BUILTIN(__builtin_ia32_gatherpfdps, "vUsV16ivC*IiIi", "")
+BUILTIN(__builtin_ia32_gatherpfqpd, "vUcV8LLivC*IiIi", "")
+BUILTIN(__builtin_ia32_gatherpfqps, "vUcV8LLivC*IiIi", "")
+BUILTIN(__builtin_ia32_scatterpfdpd, "vUcV8iv*IiIi", "")
+BUILTIN(__builtin_ia32_scatterpfdps, "vUsV16iv*IiIi", "")
+BUILTIN(__builtin_ia32_scatterpfqpd, "vUcV8LLiv*IiIi", "")
+BUILTIN(__builtin_ia32_scatterpfqps, "vUcV8LLiv*IiIi", "")
BUILTIN(__builtin_ia32_knothi, "UsUs", "")
+BUILTIN(__builtin_ia32_cmpb128_mask, "UsV16cV16cIcUs", "")
+BUILTIN(__builtin_ia32_cmpd128_mask, "UcV4iV4iIcUc", "")
+BUILTIN(__builtin_ia32_cmpq128_mask, "UcV2LLiV2LLiIcUc", "")
+BUILTIN(__builtin_ia32_cmpw128_mask, "UcV8sV8sIcUc", "")
+BUILTIN(__builtin_ia32_cmpb256_mask, "UiV32cV32cIcUi", "")
+BUILTIN(__builtin_ia32_cmpd256_mask, "UcV8iV8iIcUc", "")
+BUILTIN(__builtin_ia32_cmpq256_mask, "UcV4LLiV4LLiIcUc", "")
+BUILTIN(__builtin_ia32_cmpw256_mask, "UsV16sV16sIcUs", "")
+BUILTIN(__builtin_ia32_cmpb512_mask, "ULLiV64cV64cIcULLi", "")
+BUILTIN(__builtin_ia32_cmpd512_mask, "UsV16iV16iIcUs", "")
+BUILTIN(__builtin_ia32_cmpq512_mask, "UcV8LLiV8LLiIcUc", "")
+BUILTIN(__builtin_ia32_cmpw512_mask, "UiV32sV32sIcUi", "")
+BUILTIN(__builtin_ia32_ucmpb128_mask, "UsV16cV16cIcUs", "")
+BUILTIN(__builtin_ia32_ucmpd128_mask, "UcV4iV4iIcUc", "")
+BUILTIN(__builtin_ia32_ucmpq128_mask, "UcV2LLiV2LLiIcUc", "")
+BUILTIN(__builtin_ia32_ucmpw128_mask, "UcV8sV8sIcUc", "")
+BUILTIN(__builtin_ia32_ucmpb256_mask, "UiV32cV32cIcUi", "")
+BUILTIN(__builtin_ia32_ucmpd256_mask, "UcV8iV8iIcUc", "")
+BUILTIN(__builtin_ia32_ucmpq256_mask, "UcV4LLiV4LLiIcUc", "")
+BUILTIN(__builtin_ia32_ucmpw256_mask, "UsV16sV16sIcUs", "")
+BUILTIN(__builtin_ia32_ucmpb512_mask, "ULLiV64cV64cIcULLi", "")
+BUILTIN(__builtin_ia32_ucmpd512_mask, "UsV16iV16iIcUs", "")
+BUILTIN(__builtin_ia32_ucmpq512_mask, "UcV8LLiV8LLiIcUc", "")
+BUILTIN(__builtin_ia32_ucmpw512_mask, "UiV32sV32sIcUi", "")
+
#undef BUILTIN
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h
index 31a29fa200..f72809cab6 100644
--- a/include/clang/Basic/Diagnostic.h
+++ b/include/clang/Basic/Diagnostic.h
@@ -132,8 +132,8 @@ public:
/// the user. DiagnosticsEngine is tied to one translation unit and one
/// SourceManager.
class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
- DiagnosticsEngine(const DiagnosticsEngine &) LLVM_DELETED_FUNCTION;
- void operator=(const DiagnosticsEngine &) LLVM_DELETED_FUNCTION;
+ DiagnosticsEngine(const DiagnosticsEngine &) = delete;
+ void operator=(const DiagnosticsEngine &) = delete;
public:
/// \brief The level of the diagnostic, after it has been through mapping.
@@ -347,6 +347,7 @@ public:
DiagnosticOptions *DiagOpts,
DiagnosticConsumer *client = nullptr,
bool ShouldOwnClient = true);
+ ~DiagnosticsEngine();
const IntrusiveRefCntPtr<DiagnosticIDs> &getDiagnosticIDs() const {
return Diags;
@@ -876,7 +877,7 @@ class DiagnosticBuilder {
/// call to ForceEmit.
mutable bool IsForceEmit;
- void operator=(const DiagnosticBuilder &) LLVM_DELETED_FUNCTION;
+ void operator=(const DiagnosticBuilder &) = delete;
friend class DiagnosticsEngine;
DiagnosticBuilder()
@@ -990,7 +991,8 @@ public:
void AddFixItHint(const FixItHint &Hint) const {
assert(isActive() && "Clients must not add to cleared diagnostic!");
- DiagObj->DiagFixItHints.push_back(Hint);
+ if (!Hint.isNull())
+ DiagObj->DiagFixItHints.push_back(Hint);
}
void addFlagValue(StringRef V) const { DiagObj->FlagValue = V; }
@@ -1094,7 +1096,13 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
const FixItHint &Hint) {
- if (!Hint.isNull())
+ DB.AddFixItHint(Hint);
+ return DB;
+}
+
+inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
+ ArrayRef<FixItHint> Hints) {
+ for (const FixItHint &Hint : Hints)
DB.AddFixItHint(Hint);
return DB;
}
@@ -1259,7 +1267,7 @@ public:
~StoredDiagnostic();
/// \brief Evaluates true when this object stores a diagnostic.
- LLVM_EXPLICIT operator bool() const { return Message.size() > 0; }
+ explicit operator bool() const { return Message.size() > 0; }
unsigned getID() const { return ID; }
DiagnosticsEngine::Level getLevel() const { return Level; }
diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td
index ff9ed69022..afdd9269d0 100644
--- a/include/clang/Basic/DiagnosticCommonKinds.td
+++ b/include/clang/Basic/DiagnosticCommonKinds.td
@@ -81,8 +81,13 @@ def err_deleted_non_function : Error<
"only functions can have deleted definitions">;
def err_module_not_found : Error<"module '%0' not found">, DefaultFatal;
def err_module_not_built : Error<"could not build module '%0'">, DefaultFatal;
+def err_module_build_disabled: Error<
+ "module '%0' is needed but has not been provided, and implicit use of module "
+ "files is disabled">, DefaultFatal;
def err_module_lock_failure : Error<
"could not acquire lock file for module '%0'">, DefaultFatal;
+def err_module_lock_timeout : Error<
+ "timed out waiting to acquire lock file for module '%0'">, DefaultFatal;
def err_module_cycle : Error<"cyclic dependency in module '%0': %1">,
DefaultFatal;
def note_pragma_entered_here : Note<"#pragma entered here">;
@@ -112,6 +117,16 @@ def ext_integer_literal_too_large_for_signed : ExtWarn<
"interpreting as unsigned">,
InGroup<DiagGroup<"implicitly-unsigned-literal">>;
+// SEH
+def err_seh_expected_handler : Error<
+ "expected '__except' or '__finally' block">;
+def err_seh___except_block : Error<
+ "%0 only allowed in __except block or filter expression">;
+def err_seh___except_filter : Error<
+ "%0 only allowed in __except filter expression">;
+def err_seh___finally_block : Error<
+ "%0 only allowed in __finally block">;
+
// Sema && AST
def note_invalid_subexpr_in_const_expr : Note<
"subexpression not valid in a constant expression">;
diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td
index 41c78ee669..76853d8810 100644
--- a/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/include/clang/Basic/DiagnosticDriverKinds.td
@@ -160,6 +160,12 @@ def warn_missing_sysroot : Warning<"no such sysroot directory: '%0'">,
InGroup<DiagGroup<"missing-sysroot">>;
def warn_debug_compression_unavailable : Warning<"cannot compress debug sections (zlib not installed)">,
InGroup<DiagGroup<"debug-compression-unavailable">>;
+def warn_drv_enabling_rtti_with_exceptions : Warning<
+ "implicitly enabling rtti for exception handling">,
+ InGroup<DiagGroup<"rtti-for-exceptions">>;
+def warn_drv_disabling_vptr_no_rtti_default : Warning<
+ "implicitly disabling vptr sanitizer because rtti wasn't enabled">,
+ InGroup<DiagGroup<"auto-disable-vptr-sanitizer">>;
def note_drv_command_failed_diag_msg : Note<
"diagnostic msg: %0">;
diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td
index 15f74b1169..13e2865a52 100644
--- a/include/clang/Basic/DiagnosticFrontendKinds.td
+++ b/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -35,6 +35,10 @@ def err_fe_backend_plugin: Error<"%0">, BackendInfo;
def remark_fe_backend_plugin: Remark<"%0">, BackendInfo, InGroup<RemarkBackendPlugin>;
def note_fe_backend_plugin: Note<"%0">, BackendInfo;
+def warn_fe_override_module : Warning<
+ "overriding the module target triple with %0">,
+ InGroup<DiagGroup<"override-module">>;
+
def remark_fe_backend_optimization_remark : Remark<"%0">, BackendInfo,
InGroup<BackendOptimizationRemark>;
def remark_fe_backend_optimization_remark_missed : Remark<"%0">, BackendInfo,
diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td
index cc4508a894..215ff06ddb 100644
--- a/include/clang/Basic/DiagnosticGroups.td
+++ b/include/clang/Basic/DiagnosticGroups.td
@@ -60,7 +60,7 @@ def ExternCCompat : DiagGroup<"extern-c-compat">;
def KeywordCompat : DiagGroup<"keyword-compat">;
def GNUCaseRange : DiagGroup<"gnu-case-range">;
def CastAlign : DiagGroup<"cast-align">;
-def : DiagGroup<"cast-qual">;
+def CastQual : DiagGroup<"cast-qual">;
def : DiagGroup<"char-align">;
def Comment : DiagGroup<"comment">;
def GNUComplexInteger : DiagGroup<"gnu-complex-integer">;
@@ -190,6 +190,7 @@ def OverloadedShiftOpParentheses: DiagGroup<"overloaded-shift-op-parentheses">;
def DanglingElse: DiagGroup<"dangling-else">;
def DanglingField : DiagGroup<"dangling-field">;
def DistributedObjectModifiers : DiagGroup<"distributed-object-modifiers">;
+def FlagEnum : DiagGroup<"flag-enum">;
def InfiniteRecursion : DiagGroup<"infinite-recursion">;
def GNUImaginaryConstant : DiagGroup<"gnu-imaginary-constant">;
def IgnoredQualifiers : DiagGroup<"ignored-qualifiers">;
@@ -273,6 +274,7 @@ def ObjCInvalidIBOutletProperty : DiagGroup<"invalid-iboutlet">;
def ObjCRootClass : DiagGroup<"objc-root-class">;
def ObjCPointerIntrospectPerformSelector : DiagGroup<"deprecated-objc-pointer-introspection-performSelector">;
def ObjCPointerIntrospect : DiagGroup<"deprecated-objc-pointer-introspection", [ObjCPointerIntrospectPerformSelector]>;
+def ObjCMultipleMethodNames : DiagGroup<"objc-multiple-method-names">;
def DeprecatedObjCIsaUsage : DiagGroup<"deprecated-objc-isa-usage">;
def ExplicitInitializeCall : DiagGroup<"explicit-initialize-call">;
def Packed : DiagGroup<"packed">;
@@ -292,6 +294,7 @@ def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy",
[CXX98CompatBindToTemporaryCopy]>;
def SelfAssignmentField : DiagGroup<"self-assign-field">;
def SelfAssignment : DiagGroup<"self-assign", [SelfAssignmentField]>;
+def SelfMove : DiagGroup<"self-move">;
def SemiBeforeMethodBody : DiagGroup<"semicolon-before-method-body">;
def Sentinel : DiagGroup<"sentinel">;
def MissingMethodReturnType : DiagGroup<"missing-method-return-type">;
@@ -336,6 +339,8 @@ def : DiagGroup<"sequence-point", [Unsequenced]>;
// Preprocessor warnings.
def AmbiguousMacro : DiagGroup<"ambiguous-macro">;
+def KeywordAsMacro : DiagGroup<"keyword-macro">;
+def ReservedIdAsMacro : DiagGroup<"reserved-id-macro">;
// Just silence warnings about -Wstrict-aliasing for now.
def : DiagGroup<"strict-aliasing=0">;
@@ -405,12 +410,17 @@ def UnusedMemberFunction : DiagGroup<"unused-member-function",
def UnusedLabel : DiagGroup<"unused-label">;
def UnusedParameter : DiagGroup<"unused-parameter">;
def UnusedResult : DiagGroup<"unused-result">;
-def UnusedValue : DiagGroup<"unused-value", [UnusedComparison, UnusedResult]>;
+def PotentiallyEvaluatedExpression : DiagGroup<"potentially-evaluated-expression">;
+def UnevaluatedExpression : DiagGroup<"unevaluated-expression",
+ [PotentiallyEvaluatedExpression]>;
+def UnusedValue : DiagGroup<"unused-value", [UnusedComparison, UnusedResult,
+ UnevaluatedExpression]>;
def UnusedConstVariable : DiagGroup<"unused-const-variable">;
def UnusedVariable : DiagGroup<"unused-variable",
[UnusedConstVariable]>;
def UnusedLocalTypedef : DiagGroup<"unused-local-typedef">;
def UnusedPropertyIvar : DiagGroup<"unused-property-ivar">;
+def UnusedGetterReturnValue : DiagGroup<"unused-getter-return-value">;
def UsedButMarkedUnused : DiagGroup<"used-but-marked-unused">;
def UserDefinedLiterals : DiagGroup<"user-defined-literals">;
def Reorder : DiagGroup<"reorder">;
@@ -419,8 +429,6 @@ def ImplicitAtomic : DiagGroup<"implicit-atomic-properties">;
def CustomAtomic : DiagGroup<"custom-atomic-properties">;
def AtomicProperties : DiagGroup<"atomic-properties",
[ImplicitAtomic, CustomAtomic]>;
-// FIXME: Remove arc-abi once an Xcode is released that doesn't pass this flag.
-def : DiagGroup<"arc-abi">;
def ARCUnsafeRetainedAssign : DiagGroup<"arc-unsafe-retained-assign">;
def ARCRetainCycles : DiagGroup<"arc-retain-cycles">;
def ARCNonPodMemAccess : DiagGroup<"arc-non-pod-memaccess">;
@@ -579,6 +587,7 @@ def Most : DiagGroup<"most", [
Reorder,
ReturnType,
SelfAssignment,
+ SelfMove,
SizeofArrayArgument,
SizeofArrayDecay,
StringPlusInt,
@@ -741,3 +750,6 @@ def SerializedDiagnostics : DiagGroup<"serialized-diagnostics">;
// A warning group for warnings about code that clang accepts when
// compiling CUDA C/C++ but which is not compatible with the CUDA spec.
def CudaCompat : DiagGroup<"cuda-compat">;
+
+// A warning group for things that will change semantics in the future.
+def FutureCompat : DiagGroup<"future-compat">;
diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td
index 2fcfa02c39..3fa9bcf419 100644
--- a/include/clang/Basic/DiagnosticLexKinds.td
+++ b/include/clang/Basic/DiagnosticLexKinds.td
@@ -290,6 +290,11 @@ def note_pp_ambiguous_macro_chosen : Note<
"expanding this definition of %0">;
def note_pp_ambiguous_macro_other : Note<
"other definition of %0">;
+def warn_pp_macro_hides_keyword : Extension<
+ "keyword is hidden by macro definition">, InGroup<KeywordAsMacro>;
+def warn_pp_macro_is_reserved_id : Warning<
+ "macro name is a reserved identifier">, DefaultIgnore,
+ InGroup<ReservedIdAsMacro>;
def pp_invalid_string_literal : Warning<
"invalid string literal, ignoring final '\\'">;
@@ -327,7 +332,7 @@ def warn_cxx98_compat_variadic_macro : Warning<
InGroup<CXX98CompatPedantic>, DefaultIgnore;
def ext_named_variadic_macro : Extension<
"named variadic macros are a GNU extension">, InGroup<VariadicMacros>;
-def err_embedded_include : Error<
+def err_embedded_directive : Error<
"embedding a #%0 directive within macro arguments is not supported">;
def ext_embedded_directive : Extension<
"embedding a directive within macro arguments has undefined behavior">,
@@ -620,9 +625,10 @@ def warn_uncovered_module_header : Warning<
InGroup<IncompleteUmbrella>;
def err_expected_id_building_module : Error<
"expected a module name in '__building_module' expression">;
-def error_use_of_private_header_outside_module : Error<
- "use of private header from outside its module: '%0'">;
-def error_undeclared_use_of_module : Error<
+def warn_use_of_private_header_outside_module : Warning<
+ "use of private header from outside its module: '%0'">,
+ InGroup<DiagGroup<"private-header">>, DefaultError;
+def err_undeclared_use_of_module : Error<
"module %0 does not depend on a module exporting '%1'">;
def warn_non_modular_include_in_framework_module : Warning<
"include of non-modular header inside framework module '%0'">,
diff --git a/include/clang/Basic/DiagnosticOptions.def b/include/clang/Basic/DiagnosticOptions.def
index a360a5a84e..fdd325446e 100644
--- a/include/clang/Basic/DiagnosticOptions.def
+++ b/include/clang/Basic/DiagnosticOptions.def
@@ -81,6 +81,8 @@ VALUE_DIAGOPT(MacroBacktraceLimit, 32, DefaultMacroBacktraceLimit)
VALUE_DIAGOPT(TemplateBacktraceLimit, 32, DefaultTemplateBacktraceLimit)
/// Limit depth of constexpr backtrace.
VALUE_DIAGOPT(ConstexprBacktraceLimit, 32, DefaultConstexprBacktraceLimit)
+/// Limit number of times to perform spell checking.
+VALUE_DIAGOPT(SpellCheckingLimit, 32, DefaultSpellCheckingLimit)
VALUE_DIAGOPT(TabStop, 32, DefaultTabStop) /// The distance between tab stops.
/// Column limit for formatting message diagnostics, or 0 if unused.
@@ -92,4 +94,3 @@ VALUE_DIAGOPT(MessageLength, 32, 0)
#undef SEMANTIC_DIAGOPT
#undef SEMANTIC_ENUM_DIAGOPT
#undef SEMANTIC_VALUE_DIAGOPT
-
diff --git a/include/clang/Basic/DiagnosticOptions.h b/include/clang/Basic/DiagnosticOptions.h
index 3e4d0eefbc..a16c7747ce 100644
--- a/include/clang/Basic/DiagnosticOptions.h
+++ b/include/clang/Basic/DiagnosticOptions.h
@@ -27,13 +27,14 @@ enum OverloadsShown : unsigned {
/// \brief Options for controlling the compiler diagnostics engine.
class DiagnosticOptions : public RefCountedBase<DiagnosticOptions>{
public:
- enum TextDiagnosticFormat { Clang, Msvc, Vi };
+ enum TextDiagnosticFormat { Clang, MSVC, Vi };
// Default values.
enum { DefaultTabStop = 8, MaxTabStop = 100,
DefaultMacroBacktraceLimit = 6,
DefaultTemplateBacktraceLimit = 10,
- DefaultConstexprBacktraceLimit = 10 };
+ DefaultConstexprBacktraceLimit = 10,
+ DefaultSpellCheckingLimit = 50 };
// Define simple diagnostic options (with no accessors).
#define DIAGOPT(Name, Bits, Default) unsigned Name : Bits;
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index 6bf19108b1..c8915a739b 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -25,6 +25,8 @@ def err_msasm_unsupported_arch : Error<
"Unsupported architecture '%0' for MS-style inline assembly">;
def err_msasm_unable_to_create_target : Error<
"MS-style inline assembly is not available: %0">;
+def err_gnu_inline_asm_disabled : Error<
+ "GNU-style inline assembly is disabled">;
}
let CategoryName = "Parse Issue" in {
@@ -108,6 +110,9 @@ def ext_alignof_expr : ExtWarn<
def warn_microsoft_dependent_exists : Warning<
"dependent %select{__if_not_exists|__if_exists}0 declarations are ignored">,
InGroup<DiagGroup<"microsoft-exists">>;
+def warn_microsoft_qualifiers_ignored : Warning<
+ "qualifiers after comma in declarator list are ignored">,
+ InGroup<IgnoredAttributes>;
def ext_c11_generic_selection : Extension<
"generic selections are a C11-specific feature">, InGroup<C11>;
@@ -128,6 +133,8 @@ def ext_gnu_indirect_goto : Extension<
"use of GNU indirect-goto extension">, InGroup<GNULabelsAsValue>;
def ext_gnu_address_of_label : Extension<
"use of GNU address-of-label extension">, InGroup<GNULabelsAsValue>;
+def err_stmtexpr_file_scope : Error<
+ "statement expression not allowed at file scope">;
def ext_gnu_statement_expr : Extension<
"use of GNU statement expression extension">, InGroup<GNUStatementExpression>;
def ext_gnu_conditional_expr : Extension<
@@ -290,13 +297,8 @@ def ext_for_range : ExtWarn<
def warn_cxx98_compat_for_range : Warning<
"range-based for loop is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
-def ext_for_range_identifier : ExtWarn<
- "range-based for loop with implicit deduced type is a C++1z extension">,
- InGroup<CXX1z>;
-def warn_cxx14_compat_for_range_identifier : Warning<
- "range-based for loop with implicit deduced type is incompatible with "
- "C++ standards before C++1z">,
- InGroup<CXXPre1zCompat>, DefaultIgnore;
+def err_for_range_identifier : Error<
+ "range-based for loop requires type for loop variable">;
def err_for_range_expected_decl : Error<
"for range declaration must declare a variable">;
def err_argument_required_after_attribute : Error<
@@ -604,6 +606,8 @@ def err_ms_property_expected_accessor_name : Error<
"expected name of accessor method">;
def err_ms_property_expected_comma_or_rparen : Error<
"expected ',' or ')' at end of property accessor list">;
+def err_ms_property_initializer : Error<
+ "property declaration cannot have an in-class initializer">;
/// C++ Templates
def err_expected_template : Error<"expected template">;
@@ -800,6 +804,10 @@ def warn_cxx98_compat_lambda : Warning<
def err_lambda_missing_parens : Error<
"lambda requires '()' before %select{'mutable'|return type|"
"attribute specifier}0">;
+def warn_init_capture_direct_list_init : Warning<
+ "direct list initialization of a lambda init-capture will change meaning in "
+ "a future version of Clang; insert an '=' to avoid a change in behavior">,
+ InGroup<FutureCompat>;
// Availability attribute
def err_expected_version : Error<
@@ -934,8 +942,8 @@ def err_pragma_optimize_extra_argument : Error<
"unexpected extra argument '%0' to '#pragma clang optimize'">;
// OpenCL Section 6.8.g
-def err_not_opencl_storage_class_specifier : Error<
- "OpenCL does not support the '%0' storage class specifier">;
+def err_opencl_unknown_type_specifier : Error<
+ "OpenCL does not support the '%0' %select{type qualifier|storage class specifier}1">;
// OpenCL EXTENSION pragma (OpenCL 1.1 [9.1])
def warn_pragma_expected_colon : Warning<
@@ -945,18 +953,6 @@ def warn_pragma_expected_enable_disable : Warning<
def warn_pragma_unknown_extension : Warning<
"unknown OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>;
-def err_seh_expected_handler : Error<
- "expected '__except' or '__finally' block">;
-
-def err_seh___except_block : Error<
- "%0 only allowed in __except block">;
-
-def err_seh___except_filter : Error<
- "%0 only allowed in __except filter expression">;
-
-def err_seh___finally_block : Error<
- "%0 only allowed in __finally block">;
-
// OpenMP support.
def warn_pragma_omp_ignored : Warning<
"unexpected '#pragma omp ...' in program">, InGroup<SourceUsesOpenMP>, DefaultIgnore;
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index aa93e63a4d..16d9337574 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -1,3 +1,4 @@
+
//==--- DiagnosticSemaKinds.td - libsema diagnostics ----------------------===//
//
// The LLVM Compiler Infrastructure
@@ -64,6 +65,9 @@ def err_typecheck_converted_constant_expression : Error<
"value of type %0 is not implicitly convertible to %1">;
def err_typecheck_converted_constant_expression_disallowed : Error<
"conversion from %0 to %1 is not allowed in a converted constant expression">;
+def err_typecheck_converted_constant_expression_indirect : Error<
+ "conversion from %0 to %1 in converted constant expression would "
+ "bind reference to a temporary">;
def err_expr_not_cce : Error<
"%select{case value|enumerator value|non-type template argument|array size}0 "
"is not a constant expression">;
@@ -582,7 +586,8 @@ def warn_atprotocol_protocol : Warning<
"@protocol is using a forward protocol declaration of %0">, InGroup<AtProtocol>;
def warn_readonly_property : Warning<
"attribute 'readonly' of property %0 restricts attribute "
- "'readwrite' of property inherited from %1">;
+ "'readwrite' of property inherited from %1">,
+ InGroup<PropertyAttr>;
def warn_property_attribute : Warning<
"'%1' attribute on property %0 does not match the property inherited from %2">,
@@ -717,7 +722,8 @@ def warn_implements_nscopying : Warning<
"default assign attribute on property %0 which implements "
"NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
-def warn_multiple_method_decl : Warning<"multiple methods named %0 found">;
+def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
+ InGroup<ObjCMultipleMethodNames>;
def warn_strict_multiple_method_decl : Warning<
"multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
def warn_accessor_property_type_mismatch : Warning<
@@ -792,6 +798,12 @@ def warn_cocoa_naming_owned_rule : Warning<
"property follows Cocoa naming"
" convention for returning 'owned' objects">,
InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
+def err_cocoa_naming_owned_rule : Error<
+ "property follows Cocoa naming"
+ " convention for returning 'owned' objects">;
+def note_cocoa_naming_declare_family : Note<
+ "explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
+ "object">;
def warn_auto_synthesizing_protocol_property :Warning<
"auto property synthesis will not synthesize property %0"
" declared in protocol %1">,
@@ -823,9 +835,6 @@ def warn_property_getter_owning_mismatch : Warning<
def error_property_setter_ambiguous_use : Error<
"synthesized properties %0 and %1 both claim setter %2 -"
" use of this setter will cause unexpected behavior">;
-def err_cocoa_naming_owned_rule : Error<
- "property follows Cocoa naming"
- " convention for returning 'owned' objects">;
def warn_default_atomic_custom_getter_setter : Warning<
"atomic by default property %0 has a user defined %select{getter|setter}1 "
"(property should be marked 'atomic' if this is intended)">,
@@ -1222,13 +1231,19 @@ def warn_cxx98_compat_enum_nested_name_spec : Warning<
InGroup<CXX98Compat>, DefaultIgnore;
def err_nested_name_spec_is_not_class : Error<
"%0 cannot appear before '::' because it is not a class"
- "%select{ or namespace|, namespace, or scoped enumeration}1; did you mean ':'?">;
+ "%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
+def ext_nested_name_spec_is_enum : ExtWarn<
+ "use of enumeration in a nested name specifier is a C++11 extension">,
+ InGroup<CXX11>;
// C++ class members
def err_storageclass_invalid_for_member : Error<
"storage class specified for a member declaration">;
def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
+def ext_mutable_reference : ExtWarn<
+ "'mutable' on a reference type is a Microsoft extension">,
+ InGroup<Microsoft>;
def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
def err_mutable_nonmember : Error<
"'mutable' can only be applied to member variables">;
@@ -1287,6 +1302,8 @@ def err_missing_default_ctor : Error<
"%select{|implicit default |inheriting }0constructor for %1 must explicitly "
"initialize the %select{base class|member}2 %3 which does not have a default "
"constructor">;
+def note_due_to_dllexported_class : Note<
+ "due to '%0' being dllexported%select{|; try compiling in C++11 mode}1">;
def err_illegal_union_or_anon_struct_member : Error<
"%select{anonymous struct|union}0 member %1 has a non-trivial "
@@ -1496,6 +1513,9 @@ def note_uninit_reference_member : Note<
"uninitialized reference member is here">;
def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
InGroup<Uninitialized>;
+def warn_base_class_is_uninit : Warning<
+ "base class %0 is uninitialized when used here to access %q1">,
+ InGroup<Uninitialized>;
def warn_reference_field_is_uninit : Warning<
"reference %0 is not yet bound to a value when used here">,
InGroup<Uninitialized>;
@@ -1627,6 +1647,10 @@ def err_auto_var_init_multiple_expressions : Error<
def err_auto_var_init_paren_braces : Error<
"cannot deduce type for variable %0 with type %1 from "
"parenthesized initializer list">;
+def warn_auto_var_direct_list_init : Warning<
+ "direct list initialization of a variable with a deduced type will change "
+ "meaning in a future version of Clang; insert an '=' to avoid a change in "
+ "behavior">, InGroup<FutureCompat>;
def err_auto_new_ctor_multiple_expressions : Error<
"new expression for type %0 contains multiple constructor arguments">;
def err_auto_missing_trailing_return : Error<
@@ -1868,6 +1892,8 @@ def err_enable_if_never_constant_expr : Error<
"'enable_if' attribute expression never produces a constant expression">;
def err_constexpr_body_no_return : Error<
"no return statement in constexpr function">;
+def err_constexpr_return_missing_expr : Error<
+ "non-void constexpr function %0 should return a value">;
def warn_cxx11_compat_constexpr_body_no_return : Warning<
"constexpr function with no return statements is incompatible with C++ "
"standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
@@ -1888,8 +1914,6 @@ def err_constexpr_ctor_missing_init : Error<
"constexpr constructor must initialize all members">;
def note_constexpr_ctor_missing_init : Note<
"member not initialized by constructor">;
-def err_constexpr_method_non_literal : Error<
- "non-literal type %0 cannot have constexpr members">;
def note_non_literal_no_constexpr_ctors : Note<
"%0 is not literal because it is not an aggregate and has no constexpr "
"constructors other than copy or move constructors">;
@@ -2013,6 +2037,8 @@ def err_typecheck_vector_not_convertable : Error<
"can't convert between vector values of different size (%0 and %1)">;
def err_typecheck_vector_not_convertable_non_scalar : Error<
"can't convert between vector and non-scalar values (%0 and %1)">;
+def err_typecheck_vector_lengths_not_equal : Error<
+ "vector operands do not have the same number of elements (%0 and %1)">;
def err_ext_vector_component_exceeds_length : Error<
"vector component access exceeds type %0">;
def err_ext_vector_component_name_illegal : Error<
@@ -2193,6 +2219,9 @@ def err_attribute_dllimport_static_field_definition : Error<
def warn_attribute_dllimport_static_field_definition : Warning<
"definition of dllimport static field">,
InGroup<DiagGroup<"dllimport-static-field-def">>;
+def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
+ "explicit instantiation declaration should not be 'dllexport'">,
+ InGroup<DiagGroup<"dllexport-explicit-instantation-decl">>;
def warn_invalid_initializer_from_system_header : Warning<
"invalid constructor form class in system header, should not be explicit">,
InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
@@ -2228,7 +2257,7 @@ def warn_attribute_wrong_decl_type : Warning<
"%0 attribute only applies to %select{functions|unions|"
"variables and functions|functions and methods|parameters|"
"functions, methods and blocks|functions, methods, and classes|"
- "functions, methods, and parameters|classes|variables|methods|"
+ "functions, methods, and parameters|classes|enums|variables|methods|"
"variables, functions and labels|fields and global variables|structs|"
"variables and typedefs|thread-local variables|"
"variables and fields|variables, data members and tag types|"
@@ -2236,8 +2265,8 @@ def warn_attribute_wrong_decl_type : Warning<
"struct or union|struct, union or class|types|"
"Objective-C instance methods|init methods of interface or class extension declarations|"
"variables, functions and classes|Objective-C protocols|"
- "functions and global variables|structs or typedefs|"
- "interface or protocol declarations}1">,
+ "functions and global variables|structs, unions, and typedefs|structs and typedefs|"
+ "interface or protocol declarations|kernel functions}1">,
InGroup<IgnoredAttributes>;
def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>;
def warn_type_attribute_wrong_type : Warning<
@@ -2376,6 +2405,13 @@ def warn_fun_excludes_mutex : Warning<
def warn_cannot_resolve_lock : Warning<
"cannot resolve lock expression">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
+def warn_acquired_before : Warning<
+ "%0 '%1' must be acquired before '%2'">,
+ InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
+def warn_acquired_before_after_cycle : Warning<
+ "Cycle in acquired_before/after dependencies, starting with '%0'">,
+ InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
+
// Thread safety warnings negative capabilities
def warn_acquire_requires_negative_cap : Warning<
@@ -2599,6 +2635,7 @@ def warn_attribute_protected_visibility :
InGroup<DiagGroup<"unsupported-visibility">>;
def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
def note_previous_attribute : Note<"previous attribute is here">;
+def note_conflicting_attribute : Note<"conflicting attribute is here">;
def note_attribute : Note<"attribute is here">;
def err_mismatched_ms_inheritance : Error<
"inheritance model does not match %select{definition|previous declaration}0">;
@@ -2620,9 +2657,6 @@ def warn_attribute_nonnull_no_pointers : Warning<
def warn_attribute_nonnull_parm_no_args : Warning<
"'nonnull' attribute when used on parameters takes no arguments">,
InGroup<IgnoredAttributes>;
-def warn_attribute_malloc_pointer_only : Warning<
- "'malloc' attribute only applies to functions returning a pointer type">,
- InGroup<IgnoredAttributes>;
def warn_attribute_sentinel_named_arguments : Warning<
"'sentinel' attribute requires named arguments">,
InGroup<IgnoredAttributes>;
@@ -2715,6 +2749,10 @@ def warn_objc_implementation_missing_designated_init_override : Warning<
// objc_bridge attribute diagnostics.
def err_objc_attr_not_id : Error<
"parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
+def err_objc_attr_typedef_not_id : Error<
+ "parameter of %0 attribute must be 'id' when used on a typedef">;
+def err_objc_attr_typedef_not_void_pointer : Error<
+ "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
def err_objc_cf_bridged_not_interface : Error<
"CF object of type %0 is bridged to %1, which is not an Objective-C class">;
def err_objc_ns_bridged_invalid_cfobject : Error<
@@ -2838,6 +2876,9 @@ def note_ovl_candidate : Note<"candidate "
"|volatile and restrict|const, volatile, and restrict}4)}2">;
def note_ovl_candidate_inherited_constructor : Note<"inherited from here">;
+def note_ovl_candidate_illegal_constructor : Note<
+ "candidate %select{constructor|template}0 ignored: "
+ "instantiation %select{takes|would take}0 its own class type by value">;
def note_ovl_candidate_bad_deduction : Note<
"candidate template ignored: failed template argument deduction">;
def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
@@ -3290,6 +3331,10 @@ def err_template_arg_wrongtype_null_constant : Error<
def err_deduced_non_type_template_arg_type_mismatch : Error<
"deduced non-type template argument does not have the same type as the "
"its corresponding template parameter%diff{ ($ vs $)|}0,1">;
+def err_non_type_template_arg_subobject : Error<
+ "non-type template argument refers to subobject '%0'">;
+def err_non_type_template_arg_addr_label_diff : Error<
+ "template argument / label address difference / what did you expect?">;
def err_template_arg_not_convertible : Error<
"non-type template argument of type %0 cannot be converted to a value "
"of type %1">;
@@ -3341,6 +3386,9 @@ def err_template_arg_not_object_or_func : Error<
"non-type template argument does not refer to an object or function">;
def err_template_arg_not_pointer_to_member_form : Error<
"non-type template argument is not a pointer to member constant">;
+def err_template_arg_member_ptr_base_derived_not_supported : Error<
+ "sorry, non-type template argument of pointer-to-member type %1 that refers "
+ "to member %q0 of a different class is not supported yet">;
def ext_template_arg_extra_parens : ExtWarn<
"address non-type template argument cannot be surrounded by parentheses">;
def warn_cxx98_compat_template_arg_extra_parens : Warning<
@@ -3876,8 +3924,8 @@ def err_static_data_member_reinitialization :
def err_redefinition : Error<"redefinition of %0">;
def err_alias_after_tentative :
Error<"alias definition of %0 after tentative definition">;
-def err_tentative_after_alias :
- Error<"tentative definition of %0 after alias definition">;
+def err_alias_is_definition :
+ Error<"definition %0 cannot also be an alias">;
def err_definition_of_implicitly_declared_member : Error<
"definition of implicitly declared %select{default constructor|copy "
"constructor|move constructor|copy assignment operator|move assignment "
@@ -4040,6 +4088,9 @@ def ext_enum_too_large : ExtWarn<
def ext_enumerator_increment_too_large : ExtWarn<
"incremented enumerator value %0 is not representable in the "
"largest integer type">, InGroup<EnumTooLarge>;
+def warn_flag_enum_constant_out_of_range : Warning<
+ "enumeration value %0 is out of range of flags in enumeration type %1">,
+ InGroup<FlagEnum>;
def warn_illegal_constant_array_size : Extension<
"size of static array must be an integer constant expression">;
@@ -4124,9 +4175,10 @@ def warn_missing_field_initializers : Warning<
"missing field %0 initializer">,
InGroup<MissingFieldInitializers>, DefaultIgnore;
def warn_braces_around_scalar_init : Warning<
- "braces around scalar initializer">;
+ "braces around scalar initializer">, InGroup<DiagGroup<"braced-scalar-init">>;
def ext_many_braces_around_scalar_init : ExtWarn<
- "too many braces around scalar initializer">;
+ "too many braces around scalar initializer">,
+ InGroup<DiagGroup<"many-braces-around-scalar-init">>;
def ext_complex_component_init : Extension<
"complex initialization specifying real and imaginary components "
"is an extension">, InGroup<DiagGroup<"complex-component-init">>;
@@ -4255,6 +4307,12 @@ def note_protected_by_cxx_try : Note<
"jump bypasses initialization of try block">;
def note_protected_by_cxx_catch : Note<
"jump bypasses initialization of catch block">;
+def note_protected_by_seh_try : Note<
+ "jump bypasses initialization of __try block">;
+def note_protected_by_seh_except : Note<
+ "jump bypasses initialization of __except block">;
+def note_protected_by_seh_finally : Note<
+ "jump bypasses initialization of __finally block">;
def note_protected_by___block : Note<
"jump bypasses setup of __block variable">;
def note_protected_by_objc_ownership : Note<
@@ -4287,6 +4345,12 @@ def note_exits_cxx_try : Note<
"jump exits try block">;
def note_exits_cxx_catch : Note<
"jump exits catch block">;
+def note_exits_seh_try : Note<
+ "jump exits __try block">;
+def note_exits_seh_except : Note<
+ "jump exits __except block">;
+def note_exits_seh_finally : Note<
+ "jump exits __finally block">;
def note_exits_objc_autoreleasepool : Note<
"jump exits autoreleasepool block">;
def note_exits_objc_ownership : Note<
@@ -4298,6 +4362,9 @@ def note_exits_block_captures_strong : Note<
def note_exits_block_captures_weak : Note<
"jump exits lifetime of block which weakly captures a variable">;
+def err_func_returning_qualified_void : ExtWarn<
+ "function cannot return qualified void type %0">,
+ InGroup<DiagGroup<"qualified-void-return-type">>;
def err_func_returning_array_function : Error<
"function cannot return %select{array|function}0 type %1">;
def err_field_declared_as_function : Error<"field %0 declared as a function">;
@@ -4679,6 +4746,9 @@ def warn_addition_in_bitshift : Warning<
def warn_self_assignment : Warning<
"explicitly assigning value of variable of type %0 to itself">,
InGroup<SelfAssignment>, DefaultIgnore;
+def warn_self_move : Warning<
+ "explicitly moving variable of type %0 to itself">,
+ InGroup<SelfMove>, DefaultIgnore;
def warn_string_plus_int : Warning<
"adding %0 to a string does not append to the string">,
@@ -4823,6 +4893,8 @@ def err_ivar_reference_type : Error<
"instance variables cannot be of reference type">;
def err_typecheck_illegal_increment_decrement : Error<
"cannot %select{decrement|increment}1 value of type %0">;
+def err_typecheck_expect_int : Error<
+ "used type %0 where integer is required">;
def err_typecheck_arithmetic_incomplete_type : Error<
"arithmetic on a pointer to an incomplete type %0">;
def err_typecheck_pointer_arith_function_type : Error<
@@ -4957,9 +5029,11 @@ def err_typecheck_comparison_of_distinct_pointers : Error<
def ext_typecheck_comparison_of_distinct_pointers_nonstandard : ExtWarn<
"comparison of distinct pointer types (%0 and %1) uses non-standard "
"composite pointer type %2">, InGroup<CompareDistinctPointerType>;
+def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
+ "%select{comparison between %diff{ ($ and $)|}0,1"
+ "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1}2"
+ " which are pointers to non-overlapping address spaces">;
def err_typecheck_assign_const : Error<"read-only variable is not assignable">;
-def err_stmtexpr_file_scope : Error<
- "statement expression not allowed at file scope">;
def warn_mixed_sign_comparison : Warning<
"comparison of integers of different signs: %0 and %1">,
InGroup<SignCompare>, DefaultIgnore;
@@ -4984,6 +5058,9 @@ def warn_null_in_comparison_operation : Warning<
"comparison between NULL and non-pointer "
"%select{(%1 and NULL)|(NULL and %1)}0">,
InGroup<NullArithmetic>;
+def err_shift_rhs_only_vector : Error<
+ "requested shift is a vector of type %0 but the first operand is not a "
+ "vector (%1)">;
def warn_logical_not_on_lhs_of_comparison : Warning<
"logical not is only applied to the left hand side of this comparison">,
@@ -5227,6 +5304,11 @@ def err_bad_cstyle_cast_overload : Error<
def err_bad_cxx_cast_generic : Error<
"%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
"functional-style cast}0 from %1 to %2 is not allowed">;
+def err_bad_cxx_cast_unrelated_class : Error<
+ "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
+ "functional-style cast}0 from %1 to %2, which are not related by "
+ "inheritance, is not allowed">;
+def note_type_incomplete : Note<"%0 is incomplete">;
def err_bad_cxx_cast_rvalue : Error<
"%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
"functional-style cast}0 from rvalue to reference type %2">;
@@ -5266,7 +5348,7 @@ def err_bad_cxx_cast_member_pointer_size : Error<
"cannot %select{||reinterpret_cast||C-style cast|}0 from member pointer "
"type %1 to member pointer type %2 of different size">;
def err_bad_reinterpret_cast_reference : Error<
- "reinterpret_cast of a %0 to %1 needs its address which is not allowed">;
+ "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
def warn_undefined_reinterpret_cast : Warning<
"reinterpret_cast from %0 to %1 has undefined behavior">,
InGroup<UndefinedReinterpretCast>, DefaultIgnore;
@@ -5300,6 +5382,7 @@ def err_uuidof_without_guid : Error<
def err_uuidof_with_multiple_guids : Error<
"cannot call operator __uuidof on a type with multiple GUIDs">;
def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
+def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
def err_static_illegal_in_new : Error<
"the 'static' modifier for the array size is not legal in new expressions">;
def err_array_new_needs_size : Error<
@@ -5397,6 +5480,12 @@ def err_exceptions_disabled : Error<
"cannot use '%0' with exceptions disabled">;
def err_objc_exceptions_disabled : Error<
"cannot use '%0' with Objective-C exceptions disabled">;
+def err_seh_try_outside_functions : Error<
+ "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
+def err_mixing_cxx_try_seh_try : Error<
+ "cannot use C++ 'try' in the same function as SEH '__try'">;
+def note_conflicting_try_here : Note<
+ "conflicting %0 here">;
def warn_non_virtual_dtor : Warning<
"%0 has virtual functions but non-virtual destructor">,
InGroup<NonVirtualDtor>, DefaultIgnore;
@@ -5438,6 +5527,12 @@ def err_conditional_ambiguous : Error<
def err_conditional_ambiguous_ovl : Error<
"conditional expression is ambiguous; %diff{$ and $|types}0,1 "
"can be converted to several common types">;
+def err_conditional_vector_size : Error<
+ "vector condition type %0 and result type %1 do not have the same number "
+ "of elements">;
+def err_conditional_vector_element_size : Error<
+ "vector condition type %0 and result type %1 do not have elements of the "
+ "same size">;
def err_throw_incomplete : Error<
"cannot throw object of incomplete type %0">;
@@ -5550,8 +5645,8 @@ def err_pseudo_dtor_type_mismatch : Error<
def err_pseudo_dtor_call_with_args : Error<
"call to pseudo-destructor cannot have any arguments">;
def err_dtor_expr_without_call : Error<
- "%select{destructor reference|pseudo-destructor expression}0 must be "
- "called immediately with '()'">;
+ "reference to %select{destructor|pseudo-destructor}0 must be called"
+ "%select{|; did you mean to call it with no arguments?}1">;
def err_pseudo_dtor_destructor_non_type : Error<
"%0 does not refer to a type name in pseudo-destructor expression; expected "
"the name of type %1">;
@@ -5573,7 +5668,7 @@ def err_typecheck_deleted_function : Error<
"invokes a deleted function">;
def err_expected_class_or_namespace : Error<"%0 is not a class"
- "%select{ or namespace|, namespace, or scoped enumeration}1">;
+ "%select{ or namespace|, namespace, or enumeration}1">;
def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
"because namespace %1 does not enclose namespace %2">;
def err_invalid_declarator_global_scope : Error<
@@ -5979,6 +6074,9 @@ def err_global_call_not_config : Error<
def err_ref_bad_target : Error<
"reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
"function %1 in %select{__device__|__global__|__host__|__host__ __device__}2 function">;
+def warn_host_calls_from_host_device : Warning<
+ "calling __host__ function %0 from __host__ __device__ function %1 can lead to runtime errors">,
+ InGroup<CudaCompat>;
def warn_non_pod_vararg_with_format_string : Warning<
"cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
@@ -6020,12 +6118,14 @@ def err_typecheck_call_invalid_ordered_compare : Error<
def err_typecheck_call_invalid_unary_fp : Error<
"floating point classification requires argument of floating point type "
"(passed in %0)">;
+def err_typecheck_cond_expect_int_float : Error<
+ "used type %0 where integer or floating point type is required">;
def err_typecheck_cond_expect_scalar : Error<
"used type %0 where arithmetic or pointer type is required">;
+def err_typecheck_cond_expect_nonfloat : Error<
+ "used type %0 where floating point type is not allowed">;
def ext_typecheck_cond_one_void : Extension<
"C99 forbids conditional expressions with only one void side">;
-def err_typecheck_cond_expect_scalar_or_vector : Error<
- "used type %0 where arithmetic, pointer, or vector type is required">;
def err_typecheck_cast_to_incomplete : Error<
"cast to incomplete type %0">;
def ext_typecheck_cast_nonscalar : Extension<
@@ -6074,13 +6174,19 @@ def warn_unused_voidptr : Warning<
InGroup<UnusedValue>;
def warn_unused_property_expr : Warning<
"property access result unused - getters should not be used for side effects">,
- InGroup<UnusedValue>;
+ InGroup<UnusedGetterReturnValue>;
def warn_unused_container_subscript_expr : Warning<
"container access result unused - container access should not be used for side effects">,
InGroup<UnusedValue>;
def warn_unused_call : Warning<
"ignoring return value of function declared with %0 attribute">,
InGroup<UnusedValue>;
+def warn_side_effects_unevaluated_context : Warning<
+ "expression with side effects has no effect in an unevaluated context">,
+ InGroup<UnevaluatedExpression>;
+def warn_side_effects_typeid : Warning<
+ "expression with side effects will be evaluated despite being used as an "
+ "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
def warn_unused_result : Warning<
"ignoring return value of function declared with warn_unused_result "
"attribute">, InGroup<DiagGroup<"unused-result">>;
@@ -6112,11 +6218,15 @@ def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
"%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
InGroup<ExternCCompat>;
+def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
+ "volatile qualifiers|const qualifier|volatile qualifier}2">,
+ InGroup<CastQual>, DefaultIgnore;
+def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
+ "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
} // End of general sema category.
// inline asm.
let CategoryName = "Inline Assembly Issue" in {
- def err_asm_wide_character : Error<"wide string is invalid in 'asm'">;
def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
def err_asm_invalid_output_constraint : Error<
"invalid output constraint '%0' in asm">;
@@ -6124,11 +6234,15 @@ let CategoryName = "Inline Assembly Issue" in {
"invalid lvalue in asm input for constraint '%0'">;
def err_asm_invalid_input_constraint : Error<
"invalid input constraint '%0' in asm">;
+ def err_asm_immediate_expected : Error<"constraint '%0' expects "
+ "an integer constant expression">;
def err_asm_invalid_type_in_input : Error<
"invalid type %0 in asm input for constraint '%1'">;
def err_asm_tying_incompatible_types : Error<
"unsupported inline asm: input with type "
"%diff{$ matching output with type $|}0,1">;
+ def err_asm_unexpected_constraint_alternatives : Error<
+ "asm constraint has an unexpected number of alternatives: %0 vs %1">;
def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
def err_asm_bad_register_type : Error<"bad type for named register variable">;
@@ -6139,6 +6253,8 @@ let CategoryName = "Inline Assembly Issue" in {
def err_invalid_asm_cast_lvalue : Error<
"invalid use of a cast in a inline asm context requiring an l-value: "
"remove the cast or build with -fheinous-gnu-extensions">;
+ def err_invalid_asm_value_for_constraint
+ : Error <"value '%0' out of range for constraint '%1'">;
def warn_asm_label_on_auto_decl : Warning<
"ignored asm label '%0' on automatic variable">;
@@ -6304,6 +6420,9 @@ def err_base_class_has_flexible_array_member : Error<
def err_incomplete_base_class : Error<"base class has incomplete type">;
def err_duplicate_base_class : Error<
"base class %0 specified more than once as a direct base class">;
+def warn_inaccessible_base_class : Warning<
+ "direct base %0 is inaccessible due to ambiguity:%1">,
+ InGroup<DiagGroup<"inaccessible-base">>;
// FIXME: better way to display derivation? Pass entire thing into diagclient?
def err_ambiguous_derived_to_base_conv : Error<
"ambiguous conversion from derived class %0 to base class %1:%2">;
@@ -6414,7 +6533,13 @@ def err_conv_function_to_array : Error<
def err_conv_function_to_function : Error<
"conversion function cannot convert to a function type">;
def err_conv_function_with_complex_decl : Error<
- "must use a typedef to declare a conversion to %0">;
+ "cannot specify any part of a return type in the "
+ "declaration of a conversion function"
+ "%select{"
+ "; put the complete type after 'operator'|"
+ "; use a typedef to declare a conversion to %1|"
+ "; use an alias template to declare a conversion to %1|"
+ "}0">;
def err_conv_function_redeclared : Error<
"conversion function cannot be redeclared">;
def warn_conv_to_self_not_used : Warning<
@@ -6891,6 +7016,17 @@ def err_convertvector_non_vector_type : Error<
def err_convertvector_incompatible_vector : Error<
"first two arguments to __builtin_convertvector must have the same number of elements">;
+def err_first_argument_to_cwsc_not_call : Error<
+ "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
+def err_first_argument_to_cwsc_block_call : Error<
+ "first argument to __builtin_call_with_static_chain must not be a block call">;
+def err_first_argument_to_cwsc_builtin_call : Error<
+ "first argument to __builtin_call_with_static_chain must not be a builtin call">;
+def err_first_argument_to_cwsc_pdtor_call : Error<
+ "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
+def err_second_argument_to_cwsc_not_pointer : Error<
+ "second argument to __builtin_call_with_static_chain must be of pointer type">;
+
def err_vector_incorrect_num_initializers : Error<
"%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
def err_altivec_empty_initializer : Error<"expected initializer">;
@@ -7102,9 +7238,14 @@ def err_filter_expression_integral : Error<
def err_non_asm_stmt_in_naked_function : Error<
"non-ASM statement in naked function is not supported">;
+def err_asm_naked_this_ref : Error<
+ "'this' pointer references not allowed in naked functions">;
def err_asm_naked_parm_ref : Error<
"parameter references not allowed in naked functions">;
+def ext_deprecated_attr_is_a_cxx14_extension : ExtWarn<
+ "use of the 'deprecated' attribute is a C++14 extension">, InGroup<CXX14>;
+
// OpenCL warnings and errors.
def err_invalid_astype_of_different_size : Error<
"invalid reinterpretation: sizes of %0 and %1 must match">;
@@ -7167,7 +7308,7 @@ def err_omp_var_scope : Error<
def err_omp_var_used : Error<
"'#pragma omp %0' must precede all references to variable %q1">;
def err_omp_var_thread_local : Error<
- "variable %0 cannot be threadprivate because it is thread-local">;
+ "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
def err_omp_private_incomplete_type : Error<
"a private variable with incomplete type %0">;
def err_omp_firstprivate_incomplete_type : Error<
@@ -7331,11 +7472,11 @@ def err_omp_parallel_reduction_in_task_firstprivate : Error<
def err_omp_atomic_read_not_expression_statement : Error<
"the statement for 'atomic read' must be an expression statement of form 'v = x;',"
" where v and x are both lvalue expressions with scalar type">;
-def note_omp_atomic_read: Note<
+def note_omp_atomic_read_write: Note<
"%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
def err_omp_atomic_write_not_expression_statement : Error<
"the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
- " where x is an l-value expression with scalar type">;
+ " where x is a lvalue expression with scalar type">;
def err_omp_atomic_update_not_expression_statement : Error<
"the statement for 'atomic%select{| update}0' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x',"
" where x is an l-value expression with scalar type">;
@@ -7357,6 +7498,10 @@ def note_omp_nested_teams_construct_here : Note<
"nested teams construct here">;
def note_omp_nested_statement_here : Note<
"%select{statement|directive}0 outside teams construct here">;
+def err_omp_single_copyprivate_with_nowait : Error<
+ "the 'copyprivate' clause must not be used with the 'nowait' clause">;
+def note_omp_nowait_clause_here : Note<
+ "'nowait' clause is here">;
} // end of OpenMP category
let CategoryName = "Related Result Type Issue" in {
diff --git a/include/clang/Basic/DiagnosticSerializationKinds.td b/include/clang/Basic/DiagnosticSerializationKinds.td
index 5de2c6acba..b0d352fc69 100644
--- a/include/clang/Basic/DiagnosticSerializationKinds.td
+++ b/include/clang/Basic/DiagnosticSerializationKinds.td
@@ -41,6 +41,8 @@ def err_pch_langopt_value_mismatch : Error<
"%0 differs in PCH file vs. current file">;
def err_pch_diagopt_mismatch : Error<"%0 is currently enabled, but was not in "
"the PCH file">;
+def err_pch_modulecache_mismatch : Error<"PCH was compiled with module cache "
+ "path '%0', but the path is currently '%1'">;
def err_pch_version_too_old : Error<
"PCH file uses an older PCH format that is no longer supported">;
@@ -58,6 +60,9 @@ def err_imported_module_not_found : Error<
def err_imported_module_modmap_changed : Error<
"module '%0' imported by AST file '%1' found in a different module map file"
" (%2) than when the importing AST file was built (%3)">, DefaultFatal;
+def err_imported_module_relocated : Error<
+ "module '%0' was built in directory '%1' but now resides in "
+ "directory '%2'">, DefaultFatal;
def err_module_different_modmap : Error<
"module '%0' %select{uses|does not use}1 additional module map '%2'"
"%select{| not}1 used when the module was built">;
diff --git a/include/clang/Basic/FileManager.h b/include/clang/Basic/FileManager.h
index 132bf37019..37e19e1e27 100644
--- a/include/clang/Basic/FileManager.h
+++ b/include/clang/Basic/FileManager.h
@@ -73,11 +73,7 @@ class FileEntry {
mutable std::unique_ptr<vfs::File> File;
friend class FileManager;
- void closeFile() const {
- File.reset(); // rely on destructor to close File
- }
-
- void operator=(const FileEntry &) LLVM_DELETED_FUNCTION;
+ void operator=(const FileEntry &) = delete;
public:
FileEntry()
@@ -109,6 +105,10 @@ public:
/// \brief Check whether the file is a named pipe (and thus can't be opened by
/// the native FileManager methods).
bool isNamedPipe() const { return IsNamedPipe; }
+
+ void closeFile() const {
+ File.reset(); // rely on destructor to close File
+ }
};
struct FileData;
@@ -274,6 +274,9 @@ public:
static void modifyFileEntry(FileEntry *File, off_t Size,
time_t ModificationTime);
+ /// \brief Remove any './' components from a path.
+ static bool removeDotPaths(SmallVectorImpl<char> &Path);
+
/// \brief Retrieve the canonical name for a given directory.
///
/// This is a very expensive operation, despite its results being cached,
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h
index ed923393c8..f540c58e5a 100644
--- a/include/clang/Basic/IdentifierTable.h
+++ b/include/clang/Basic/IdentifierTable.h
@@ -73,8 +73,8 @@ class IdentifierInfo {
void *FETokenInfo; // Managed by the language front-end.
llvm::StringMapEntry<IdentifierInfo*> *Entry;
- IdentifierInfo(const IdentifierInfo&) LLVM_DELETED_FUNCTION;
- void operator=(const IdentifierInfo&) LLVM_DELETED_FUNCTION;
+ IdentifierInfo(const IdentifierInfo&) = delete;
+ void operator=(const IdentifierInfo&) = delete;
friend class IdentifierTable;
@@ -249,6 +249,9 @@ public:
}
bool isCPlusPlusOperatorKeyword() const { return IsCPPOperatorKeyword; }
+ /// \brief Return true if this token is a keyword in the specified language.
+ bool isKeyword(const LangOptions &LangOpts);
+
/// getFETokenInfo/setFETokenInfo - The language front-end is allowed to
/// associate arbitrary metadata with this token.
template<typename T>
@@ -353,8 +356,8 @@ public:
/// actual functionality.
class IdentifierIterator {
private:
- IdentifierIterator(const IdentifierIterator &) LLVM_DELETED_FUNCTION;
- void operator=(const IdentifierIterator &) LLVM_DELETED_FUNCTION;
+ IdentifierIterator(const IdentifierIterator &) = delete;
+ void operator=(const IdentifierIterator &) = delete;
protected:
IdentifierIterator() { }
@@ -724,8 +727,8 @@ public:
/// multi-keyword caching.
class SelectorTable {
void *Impl; // Actually a SelectorTableImpl
- SelectorTable(const SelectorTable &) LLVM_DELETED_FUNCTION;
- void operator=(const SelectorTable &) LLVM_DELETED_FUNCTION;
+ SelectorTable(const SelectorTable &) = delete;
+ void operator=(const SelectorTable &) = delete;
public:
SelectorTable();
~SelectorTable();
diff --git a/include/clang/Basic/LangOptions.def b/include/clang/Basic/LangOptions.def
index 82dba18acc..3c1505739f 100644
--- a/include/clang/Basic/LangOptions.def
+++ b/include/clang/Basic/LangOptions.def
@@ -114,6 +114,7 @@ LANGOPT(MSBitfields , 1, 0, "Microsoft-compatible structure layout")
LANGOPT(Freestanding, 1, 0, "freestanding implementation")
LANGOPT(NoBuiltin , 1, 0, "disable builtin functions")
LANGOPT(NoMathBuiltin , 1, 0, "disable math builtin functions")
+LANGOPT(GNUAsm , 1, 1, "GNU-style inline assembly")
BENIGN_LANGOPT(ThreadsafeStatics , 1, 1, "thread-safe static initializers")
LANGOPT(POSIXThreads , 1, 0, "POSIX thread support")
@@ -122,10 +123,12 @@ BENIGN_LANGOPT(EmitAllDecls , 1, 0, "support for emitting all declarations"
LANGOPT(MathErrno , 1, 1, "errno support for math functions")
BENIGN_LANGOPT(HeinousExtensions , 1, 0, "Extensions that we really don't like and may be ripped out at any time")
LANGOPT(Modules , 1, 0, "modules extension to C")
-LANGOPT(ModulesDeclUse , 1, 0, "require declaration of module uses")
+COMPATIBLE_LANGOPT(ModulesDeclUse , 1, 0, "require declaration of module uses")
LANGOPT(ModulesSearchAll , 1, 1, "search even non-imported modules to find unresolved references")
-LANGOPT(ModulesStrictDeclUse, 1, 0, "require declaration of module uses and all headers to be in modules")
+COMPATIBLE_LANGOPT(ModulesStrictDeclUse, 1, 0, "require declaration of module uses and all headers to be in modules")
LANGOPT(ModulesErrorRecovery, 1, 1, "automatically import modules as needed when performing error recovery")
+BENIGN_LANGOPT(ModulesImplicitMaps, 1, 1, "use files called module.modulemap implicitly as module maps")
+BENIGN_LANGOPT(ImplicitModules, 1, 1, "build modules that are not specified via -fmodule-file")
COMPATIBLE_LANGOPT(Optimize , 1, 0, "__OPTIMIZE__ predefined macro")
COMPATIBLE_LANGOPT(OptimizeSize , 1, 0, "__OPTIMIZE_SIZE__ predefined macro")
LANGOPT(Static , 1, 0, "__STATIC__ predefined macro (as opposed to __DYNAMIC__)")
@@ -157,9 +160,12 @@ LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
LANGOPT(CUDA , 1, 0, "CUDA")
LANGOPT(OpenMP , 1, 0, "OpenMP support")
LANGOPT(Renderscript , 1, 0, "RenderScript")
+LANGOPT(CUDAIsDevice , 1, 0, "Compiling for CUDA device")
+LANGOPT(CUDAAllowHostCallsFromHostDevice, 1, 0, "Allow host device functions to call host functions")
LANGOPT(AssumeSaneOperatorNew , 1, 1, "implicit __attribute__((malloc)) for C++'s new operators")
LANGOPT(SizedDeallocation , 1, 0, "enable sized deallocation functions")
+LANGOPT(DefineSizedDeallocation , 1, 0, "generate weak definitions of sized delete")
BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision")
BENIGN_LANGOPT(DumpRecordLayouts , 1, 0, "dumping the layout of IRgen'd records")
BENIGN_LANGOPT(DumpRecordLayoutsSimple , 1, 0, "dumping the layout of IRgen'd records in a simple form")
diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h
index 5ac96c5198..8edfa4bfac 100644
--- a/include/clang/Basic/LangOptions.h
+++ b/include/clang/Basic/LangOptions.h
@@ -21,6 +21,7 @@
#include "clang/Basic/Sanitizers.h"
#include "clang/Basic/Visibility.h"
#include <string>
+#include <vector>
namespace clang {
@@ -70,9 +71,9 @@ public:
/// \brief Set of enabled sanitizers.
SanitizerSet Sanitize;
- /// \brief Path to blacklist file specifying which objects
+ /// \brief Paths to blacklist files specifying which objects
/// (files, functions, variables) should not be instrumented.
- std::string SanitizerBlacklistFile;
+ std::vector<std::string> SanitizerBlacklistFiles;
clang::ObjCRuntime ObjCRuntime;
@@ -92,6 +93,10 @@ public:
/// treat this as the CurrentModule.
std::string ImplementationOfModule;
+ /// \brief The names of any features to enable in module 'requires' decls
+ /// in addition to the hard-coded list in Module.cpp and the target features.
+ std::vector<std::string> ModuleFeatures;
+
/// \brief Options for parsing comments.
CommentOptions CommentOpts;
diff --git a/include/clang/Basic/Module.h b/include/clang/Basic/Module.h
index e46be9edca..e3953a4571 100644
--- a/include/clang/Basic/Module.h
+++ b/include/clang/Basic/Module.h
@@ -55,7 +55,12 @@ public:
/// \brief The parent of this module. This will be NULL for the top-level
/// module.
Module *Parent;
-
+
+ /// \brief The build directory of this module. This is the directory in
+ /// which the module is notionally built, and relative to which its headers
+ /// are found.
+ const DirectoryEntry *Directory;
+
/// \brief The umbrella header or directory.
llvm::PointerUnion<const DirectoryEntry *, const FileEntry *> Umbrella;
@@ -81,26 +86,28 @@ private:
mutable llvm::DenseSet<const Module*> VisibleModulesCache;
public:
- /// \brief The headers that are part of this module.
- SmallVector<const FileEntry *, 2> NormalHeaders;
-
- /// \brief The headers that are logically part of this module but
- /// must be textually included.
- SmallVector<const FileEntry *, 2> TextualHeaders;
-
- /// \brief The headers that are private to this module.
- SmallVector<const FileEntry *, 2> PrivateHeaders;
-
- /// \brief The headers that are private to this module and are to be
- /// included textually.
- SmallVector<const FileEntry *, 2> PrivateTextualHeaders;
-
- /// \brief The headers that are explicitly excluded from this module.
- SmallVector<const FileEntry *, 2> ExcludedHeaders;
+ enum HeaderKind {
+ HK_Normal,
+ HK_Textual,
+ HK_Private,
+ HK_PrivateTextual,
+ HK_Excluded
+ };
+ static const int NumHeaderKinds = HK_Excluded + 1;
/// \brief Information about a header directive as found in the module map
/// file.
- struct HeaderDirective {
+ struct Header {
+ std::string NameAsWritten;
+ const FileEntry *Entry;
+ };
+
+ /// \brief The headers that are part of this module.
+ SmallVector<Header, 2> Headers[5];
+
+ /// \brief Stored information about a header directive that was found in the
+ /// module map file but has not been resolved to a file.
+ struct UnresolvedHeaderDirective {
SourceLocation FileNameLoc;
std::string FileName;
bool IsUmbrella;
@@ -108,7 +115,7 @@ public:
/// \brief Headers that are mentioned in the module map file but could not be
/// found on the file system.
- SmallVector<HeaderDirective, 1> MissingHeaders;
+ SmallVector<UnresolvedHeaderDirective, 1> MissingHeaders;
/// \brief An individual requirement: a feature name and a flag indicating
/// the required state of that feature.
@@ -303,7 +310,7 @@ public:
bool isAvailable(const LangOptions &LangOpts,
const TargetInfo &Target,
Requirement &Req,
- HeaderDirective &MissingHeader) const;
+ UnresolvedHeaderDirective &MissingHeader) const;
/// \brief Determine whether this module is a submodule.
bool isSubModule() const { return Parent != nullptr; }
diff --git a/include/clang/Basic/PlistSupport.h b/include/clang/Basic/PlistSupport.h
index 081f22d48d..84dd29138a 100644
--- a/include/clang/Basic/PlistSupport.h
+++ b/include/clang/Basic/PlistSupport.h
@@ -12,7 +12,6 @@
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
-#include "clang/Lex/Lexer.h"
#include "llvm/Support/raw_ostream.h"
namespace clang {
@@ -89,31 +88,29 @@ inline raw_ostream &EmitString(raw_ostream &o, StringRef s) {
}
inline void EmitLocation(raw_ostream &o, const SourceManager &SM,
- const LangOptions &LangOpts, SourceLocation L,
- const FIDMap &FM, unsigned indent,
- bool extend = false) {
- FullSourceLoc Loc(SM.getExpansionLoc(L), const_cast<SourceManager &>(SM));
+ SourceLocation L, const FIDMap &FM, unsigned indent) {
+ if (L.isInvalid()) return;
- // Add in the length of the token, so that we cover multi-char tokens.
- unsigned offset =
- extend ? Lexer::MeasureTokenLength(Loc, SM, LangOpts) - 1 : 0;
+ FullSourceLoc Loc(SM.getExpansionLoc(L), const_cast<SourceManager &>(SM));
Indent(o, indent) << "<dict>\n";
Indent(o, indent) << " <key>line</key>";
EmitInteger(o, Loc.getExpansionLineNumber()) << '\n';
Indent(o, indent) << " <key>col</key>";
- EmitInteger(o, Loc.getExpansionColumnNumber() + offset) << '\n';
+ EmitInteger(o, Loc.getExpansionColumnNumber()) << '\n';
Indent(o, indent) << " <key>file</key>";
EmitInteger(o, GetFID(FM, SM, Loc)) << '\n';
Indent(o, indent) << "</dict>\n";
}
inline void EmitRange(raw_ostream &o, const SourceManager &SM,
- const LangOptions &LangOpts, CharSourceRange R,
- const FIDMap &FM, unsigned indent) {
+ CharSourceRange R, const FIDMap &FM, unsigned indent) {
+ if (R.isInvalid()) return;
+
+ assert(R.isCharRange() && "cannot handle a token range");
Indent(o, indent) << "<array>\n";
- EmitLocation(o, SM, LangOpts, R.getBegin(), FM, indent + 1);
- EmitLocation(o, SM, LangOpts, R.getEnd(), FM, indent + 1, R.isTokenRange());
+ EmitLocation(o, SM, R.getBegin(), FM, indent + 1);
+ EmitLocation(o, SM, R.getEnd(), FM, indent + 1);
Indent(o, indent) << "</array>\n";
}
}
diff --git a/include/clang/Basic/SanitizerBlacklist.h b/include/clang/Basic/SanitizerBlacklist.h
index 2ce268aa0a..e651e18316 100644
--- a/include/clang/Basic/SanitizerBlacklist.h
+++ b/include/clang/Basic/SanitizerBlacklist.h
@@ -28,7 +28,8 @@ class SanitizerBlacklist {
SourceManager &SM;
public:
- SanitizerBlacklist(StringRef BlacklistPath, SourceManager &SM);
+ SanitizerBlacklist(const std::vector<std::string> &BlacklistPaths,
+ SourceManager &SM);
bool isBlacklistedGlobal(StringRef GlobalName,
StringRef Category = StringRef()) const;
bool isBlacklistedType(StringRef MangledTypeName,
diff --git a/include/clang/Basic/Sanitizers.def b/include/clang/Basic/Sanitizers.def
index adb9b04072..a0acce967f 100644
--- a/include/clang/Basic/Sanitizers.def
+++ b/include/clang/Basic/Sanitizers.def
@@ -76,6 +76,10 @@ SANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow)
// DataFlowSanitizer
SANITIZER("dataflow", DataFlow)
+// Control Flow Integrity
+SANITIZER("cfi-vptr", CFIVptr)
+SANITIZER_GROUP("cfi", CFI, CFIVptr)
+
// -fsanitize=undefined includes all the sanitizers which have low overhead, no
// ABI or address space layout implications, and only catch undefined behavior.
SANITIZER_GROUP("undefined", Undefined,
@@ -102,5 +106,9 @@ SANITIZER_GROUP("integer", Integer,
SANITIZER("local-bounds", LocalBounds)
SANITIZER_GROUP("bounds", Bounds, ArrayBounds | LocalBounds)
+// Magic group, containing all sanitizers. For example, "-fno-sanitize=all"
+// can be used to disable all the sanitizers.
+SANITIZER_GROUP("all", All, ~0)
+
#undef SANITIZER
#undef SANITIZER_GROUP
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index 717258ddcf..4fa95c59a1 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -231,7 +231,7 @@ namespace SrcMgr {
private:
// Disable assignments.
- ContentCache &operator=(const ContentCache& RHS) LLVM_DELETED_FUNCTION;
+ ContentCache &operator=(const ContentCache& RHS) = delete;
};
// Assert that the \c ContentCache objects will always be 8-byte aligned so
@@ -705,8 +705,8 @@ class SourceManager : public RefCountedBase<SourceManager> {
SmallVector<std::pair<std::string, FullSourceLoc>, 2> StoredModuleBuildStack;
// SourceManager doesn't support copy construction.
- explicit SourceManager(const SourceManager&) LLVM_DELETED_FUNCTION;
- void operator=(const SourceManager&) LLVM_DELETED_FUNCTION;
+ explicit SourceManager(const SourceManager&) = delete;
+ void operator=(const SourceManager&) = delete;
public:
SourceManager(DiagnosticsEngine &Diag, FileManager &FileMgr,
bool UserFilesAreVolatile = false);
@@ -1057,10 +1057,16 @@ public:
getImmediateExpansionRange(SourceLocation Loc) const;
/// \brief Given a SourceLocation object, return the range of
- /// tokens covered by the expansion the ultimate file.
+ /// tokens covered by the expansion in the ultimate file.
std::pair<SourceLocation,SourceLocation>
getExpansionRange(SourceLocation Loc) const;
+ /// \brief Given a SourceRange object, return the range of
+ /// tokens covered by the expansion in the ultimate file.
+ SourceRange getExpansionRange(SourceRange Range) const {
+ return SourceRange(getExpansionRange(Range.getBegin()).first,
+ getExpansionRange(Range.getEnd()).second);
+ }
/// \brief Given a SourceLocation object, return the spelling
/// location referenced by the ID.
diff --git a/include/clang/Basic/Specifiers.h b/include/clang/Basic/Specifiers.h
index a968d00d20..7569c16412 100644
--- a/include/clang/Basic/Specifiers.h
+++ b/include/clang/Basic/Specifiers.h
@@ -209,8 +209,9 @@ namespace clang {
CC_X86_64SysV, // __attribute__((sysv_abi))
CC_AAPCS, // __attribute__((pcs("aapcs")))
CC_AAPCS_VFP, // __attribute__((pcs("aapcs-vfp")))
- CC_PnaclCall, // __attribute__((pnaclcall))
- CC_IntelOclBicc // __attribute__((intel_ocl_bicc))
+ CC_IntelOclBicc, // __attribute__((intel_ocl_bicc))
+ CC_SpirFunction, // default for OpenCL functions on SPIR target
+ CC_SpirKernel // inferred for OpenCL kernels on SPIR target
};
/// \brief Checks whether the given calling convention supports variadic
@@ -222,6 +223,8 @@ namespace clang {
case CC_X86ThisCall:
case CC_X86Pascal:
case CC_X86VectorCall:
+ case CC_SpirFunction:
+ case CC_SpirKernel:
return false;
default:
return true;
diff --git a/include/clang/Basic/TargetCXXABI.h b/include/clang/Basic/TargetCXXABI.h
index 5669d2a559..42a976b3af 100644
--- a/include/clang/Basic/TargetCXXABI.h
+++ b/include/clang/Basic/TargetCXXABI.h
@@ -79,6 +79,12 @@ public:
/// - guard variables are smaller.
GenericAArch64,
+ /// The generic Mips ABI is a modified version of the Itanium ABI.
+ ///
+ /// At the moment, only change from the generic ABI in this case is:
+ /// - representation of member function pointers adjusted as in ARM.
+ GenericMIPS,
+
/// The Microsoft ABI is the ABI used by Microsoft Visual Studio (and
/// compatible compilers).
///
@@ -114,6 +120,7 @@ public:
case GenericARM:
case iOS:
case iOS64:
+ case GenericMIPS:
return true;
case Microsoft:
@@ -130,6 +137,7 @@ public:
case GenericARM:
case iOS:
case iOS64:
+ case GenericMIPS:
return false;
case Microsoft:
@@ -212,6 +220,7 @@ public:
case GenericItanium:
case iOS: // old iOS compilers did not follow this rule
case Microsoft:
+ case GenericMIPS:
return true;
}
llvm_unreachable("bad ABI kind");
@@ -257,6 +266,7 @@ public:
case GenericAArch64:
case GenericARM:
case iOS:
+ case GenericMIPS:
return UseTailPaddingUnlessPOD03;
// iOS on ARM64 uses the C++11 POD rules. It does not honor the
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index 8c2b89c736..bda132e499 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -370,6 +370,15 @@ public:
/// \brief Return the maximum width lock-free atomic operation which can be
/// inlined given the supported features of the given target.
unsigned getMaxAtomicInlineWidth() const { return MaxAtomicInlineWidth; }
+ /// \brief Returns true if the given target supports lock-free atomic
+ /// operations at the specified width and alignment.
+ virtual bool hasBuiltinAtomic(uint64_t AtomicSizeInBits,
+ uint64_t AlignmentInBits) const {
+ return AtomicSizeInBits <= AlignmentInBits &&
+ AtomicSizeInBits <= getMaxAtomicInlineWidth() &&
+ (AtomicSizeInBits <= getCharWidth() ||
+ llvm::isPowerOf2_64(AtomicSizeInBits / getCharWidth()));
+ }
/// \brief Return the maximum vector alignment supported for the given target.
unsigned getMaxVectorAlign() const { return MaxVectorAlign; }
@@ -519,22 +528,31 @@ public:
CI_None = 0x00,
CI_AllowsMemory = 0x01,
CI_AllowsRegister = 0x02,
- CI_ReadWrite = 0x04, // "+r" output constraint (read and write).
- CI_HasMatchingInput = 0x08 // This output operand has a matching input.
+ CI_ReadWrite = 0x04, // "+r" output constraint (read and write).
+ CI_HasMatchingInput = 0x08, // This output operand has a matching input.
+ CI_ImmediateConstant = 0x10, // This operand must be an immediate constant
+ CI_EarlyClobber = 0x20, // "&" output constraint (early clobber).
};
unsigned Flags;
int TiedOperand;
+ struct {
+ int Min;
+ int Max;
+ } ImmRange;
std::string ConstraintStr; // constraint: "=rm"
std::string Name; // Operand name: [foo] with no []'s.
public:
ConstraintInfo(StringRef ConstraintStr, StringRef Name)
- : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()),
- Name(Name.str()) {}
+ : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()),
+ Name(Name.str()) {
+ ImmRange.Min = ImmRange.Max = 0;
+ }
const std::string &getConstraintStr() const { return ConstraintStr; }
const std::string &getName() const { return Name; }
bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; }
+ bool earlyClobber() { return (Flags & CI_EarlyClobber) != 0; }
bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; }
bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; }
@@ -553,10 +571,22 @@ public:
return (unsigned)TiedOperand;
}
+ bool requiresImmediateConstant() const {
+ return (Flags & CI_ImmediateConstant) != 0;
+ }
+ int getImmConstantMin() const { return ImmRange.Min; }
+ int getImmConstantMax() const { return ImmRange.Max; }
+
void setIsReadWrite() { Flags |= CI_ReadWrite; }
+ void setEarlyClobber() { Flags |= CI_EarlyClobber; }
void setAllowsMemory() { Flags |= CI_AllowsMemory; }
void setAllowsRegister() { Flags |= CI_AllowsRegister; }
void setHasMatchingInput() { Flags |= CI_HasMatchingInput; }
+ void setRequiresImmediate(int Min, int Max) {
+ Flags |= CI_ImmediateConstant;
+ ImmRange.Min = Min;
+ ImmRange.Max = Max;
+ }
/// \brief Indicate that this is an input operand that is tied to
/// the specified output operand.
@@ -608,6 +638,12 @@ public:
return std::string(1, *Constraint);
}
+ /// \brief Returns true if NaN encoding is IEEE 754-2008.
+ /// Only MIPS allows a different encoding.
+ virtual bool isNan2008() const {
+ return true;
+ }
+
/// \brief Returns a string of target-specific clobbers, in LLVM format.
virtual const char *getClobbers() const = 0;
@@ -806,7 +842,8 @@ public:
enum CallingConvCheckResult {
CCCR_OK,
- CCCR_Warning
+ CCCR_Warning,
+ CCCR_Ignore,
};
/// \brief Determines whether a given calling convention is valid for the
diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def
index c63dea0fa5..3319d4ed35 100644
--- a/include/clang/Basic/TokenKinds.def
+++ b/include/clang/Basic/TokenKinds.def
@@ -116,8 +116,6 @@ TOK(eof) // End of file.
TOK(eod) // End of preprocessing directive (end of line inside a
// directive).
TOK(code_completion) // Code completion marker
-TOK(cxx_defaultarg_end) // C++ default argument end marker
-TOK(cxx_exceptspec_end) // C++ exception-specification end marker
// C99 6.4.9: Comments.
TOK(comment) // Comment (only in -E -C[C] mode)
@@ -471,10 +469,12 @@ KEYWORD(__global , KEYOPENCL)
KEYWORD(__local , KEYOPENCL)
KEYWORD(__constant , KEYOPENCL)
KEYWORD(__private , KEYOPENCL)
+KEYWORD(__generic , KEYOPENCL)
ALIAS("global", __global , KEYOPENCL)
ALIAS("local", __local , KEYOPENCL)
ALIAS("constant", __constant , KEYOPENCL)
ALIAS("private", __private , KEYOPENCL)
+ALIAS("generic", __generic , KEYOPENCL)
// OpenCL function qualifiers
KEYWORD(__kernel , KEYOPENCL)
ALIAS("kernel", __kernel , KEYOPENCL)
@@ -495,6 +495,7 @@ KEYWORD(__pascal , KEYALL)
// Altivec Extension.
KEYWORD(__vector , KEYALTIVEC)
KEYWORD(__pixel , KEYALTIVEC)
+KEYWORD(__bool , KEYALTIVEC)
// ARM NEON extensions.
ALIAS("__fp16", half , KEYALL)
diff --git a/include/clang/Basic/VirtualFileSystem.h b/include/clang/Basic/VirtualFileSystem.h
index 708659634d..1c65fb5eac 100644
--- a/include/clang/Basic/VirtualFileSystem.h
+++ b/include/clang/Basic/VirtualFileSystem.h
@@ -18,8 +18,8 @@
#include "llvm/ADT/Optional.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/SourceMgr.h"
+#include "llvm/Support/raw_ostream.h"
namespace llvm {
class MemoryBuffer;
diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
index 8aea6c3708..e32fb14585 100644
--- a/include/clang/CodeGen/CGFunctionInfo.h
+++ b/include/clang/CodeGen/CGFunctionInfo.h
@@ -63,10 +63,10 @@ public:
Expand,
/// InAlloca - Pass the argument directly using the LLVM inalloca attribute.
- /// This is similar to 'direct', except it only applies to arguments stored
- /// in memory and forbids any implicit copies. When applied to a return
- /// type, it means the value is returned indirectly via an implicit sret
- /// parameter stored in the argument struct.
+ /// This is similar to indirect with byval, except it only applies to
+ /// arguments stored in memory and forbids any implicit copies. When
+ /// applied to a return type, it means the value is returned indirectly via
+ /// an implicit sret parameter stored in the argument struct.
InAlloca,
KindFirst = Direct,
KindLast = InAlloca
@@ -352,6 +352,9 @@ class CGFunctionInfo : public llvm::FoldingSetNode {
/// Whether this is an instance method.
unsigned InstanceMethod : 1;
+ /// Whether this is a chain call.
+ unsigned ChainCall : 1;
+
/// Whether this function is noreturn.
unsigned NoReturn : 1;
@@ -360,7 +363,7 @@ class CGFunctionInfo : public llvm::FoldingSetNode {
/// How many arguments to pass inreg.
unsigned HasRegParm : 1;
- unsigned RegParm : 4;
+ unsigned RegParm : 3;
RequiredArgs Required;
@@ -380,7 +383,8 @@ class CGFunctionInfo : public llvm::FoldingSetNode {
public:
static CGFunctionInfo *create(unsigned llvmCC,
- bool InstanceMethod,
+ bool instanceMethod,
+ bool chainCall,
const FunctionType::ExtInfo &extInfo,
CanQualType resultType,
ArrayRef<CanQualType> argTypes,
@@ -412,6 +416,8 @@ public:
bool isInstanceMethod() const { return InstanceMethod; }
+ bool isChainCall() const { return ChainCall; }
+
bool isNoReturn() const { return NoReturn; }
/// In ARC, whether this function retains its return value. This
@@ -462,6 +468,7 @@ public:
void Profile(llvm::FoldingSetNodeID &ID) {
ID.AddInteger(getASTCallingConvention());
ID.AddBoolean(InstanceMethod);
+ ID.AddBoolean(ChainCall);
ID.AddBoolean(NoReturn);
ID.AddBoolean(ReturnsRetained);
ID.AddBoolean(HasRegParm);
@@ -473,12 +480,14 @@ public:
}
static void Profile(llvm::FoldingSetNodeID &ID,
bool InstanceMethod,
+ bool ChainCall,
const FunctionType::ExtInfo &info,
RequiredArgs required,
CanQualType resultType,
ArrayRef<CanQualType> argTypes) {
ID.AddInteger(info.getCC());
ID.AddBoolean(InstanceMethod);
+ ID.AddBoolean(ChainCall);
ID.AddBoolean(info.getNoReturn());
ID.AddBoolean(info.getProducesResult());
ID.AddBoolean(info.getHasRegParm());
diff --git a/include/clang/CodeGen/ModuleBuilder.h b/include/clang/CodeGen/ModuleBuilder.h
index f4c31074e9..8facc3c830 100644
--- a/include/clang/CodeGen/ModuleBuilder.h
+++ b/include/clang/CodeGen/ModuleBuilder.h
@@ -27,7 +27,6 @@ namespace clang {
class CoverageSourceInfo;
class LangOptions;
class CodeGenOptions;
- class TargetOptions;
class Decl;
class CodeGenerator : public ASTConsumer {
@@ -44,7 +43,6 @@ namespace clang {
CodeGenerator *CreateLLVMCodeGen(DiagnosticsEngine &Diags,
const std::string &ModuleName,
const CodeGenOptions &CGO,
- const TargetOptions &TO,
llvm::LLVMContext& C,
CoverageSourceInfo *CoverageInfo = nullptr);
}
diff --git a/include/clang/Config/config.h b/include/clang/Config/config.h
index e106019b14..8e6047a82a 100644
--- a/include/clang/Config/config.h
+++ b/include/clang/Config/config.h
@@ -7,15 +7,15 @@
/* Bug report URL. */
#define BUG_REPORT_URL "http://llvm.org/bugs/"
+/* Multilib suffix for libdir. */
+#define CLANG_LIBDIR_SUFFIX ""
+
/* Relative directory for resource files */
#define CLANG_RESOURCE_DIR ""
/* Directories clang will search for headers */
#define C_INCLUDE_DIRS ""
-/* Linker version detected at compile time. */
-#define HOST_LINK_VERSION "2.22"
-
/* Default <path> to all compiler invocations for --sysroot=<path>. */
#define DEFAULT_SYSROOT ""
@@ -30,4 +30,7 @@
/* The LLVM product name and version */
#define BACKEND_PACKAGE_STRING PACKAGE_STRING
+/* Linker version detected at compile time. */
+#define HOST_LINK_VERSION "2.24"
+
#endif
diff --git a/include/clang/Config/config.h.cmake b/include/clang/Config/config.h.cmake
index 38b398cffd..5d89b1aaa1 100644
--- a/include/clang/Config/config.h.cmake
+++ b/include/clang/Config/config.h.cmake
@@ -8,6 +8,9 @@
/* Bug report URL. */
#define BUG_REPORT_URL "${BUG_REPORT_URL}"
+/* Multilib suffix for libdir. */
+#define CLANG_LIBDIR_SUFFIX "${CLANG_LIBDIR_SUFFIX}"
+
/* Relative directory for resource files */
#define CLANG_RESOURCE_DIR "${CLANG_RESOURCE_DIR}"
diff --git a/include/clang/Config/config.h.in b/include/clang/Config/config.h.in
index 3c2cb075ef..dba05db2b9 100644
--- a/include/clang/Config/config.h.in
+++ b/include/clang/Config/config.h.in
@@ -8,6 +8,9 @@
/* Bug report URL. */
#undef BUG_REPORT_URL
+/* Multilib suffix for libdir. */
+#undef CLANG_LIBDIR_SUFFIX
+
/* Relative directory for resource files */
#undef CLANG_RESOURCE_DIR
diff --git a/include/clang/Driver/Action.h b/include/clang/Driver/Action.h
index 2739d4934d..dd0261c2f3 100644
--- a/include/clang/Driver/Action.h
+++ b/include/clang/Driver/Action.h
@@ -46,6 +46,7 @@ public:
AnalyzeJobClass,
MigrateJobClass,
CompileJobClass,
+ BackendJobClass,
AssembleJobClass,
LinkJobClass,
LipoJobClass,
@@ -195,6 +196,16 @@ public:
}
};
+class BackendJobAction : public JobAction {
+ void anchor() override;
+public:
+ BackendJobAction(std::unique_ptr<Action> Input, types::ID OutputType);
+
+ static bool classof(const Action *A) {
+ return A->getKind() == BackendJobClass;
+ }
+};
+
class AssembleJobAction : public JobAction {
void anchor() override;
public:
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td
index fbab14b51b..f60fb4e4ab 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/include/clang/Driver/CC1Options.td
@@ -279,6 +279,8 @@ def ftemplate_backtrace_limit : Separate<["-"], "ftemplate-backtrace-limit">, Me
HelpText<"Set the maximum number of entries to print in a template instantiation backtrace (0 = no limit).">;
def fconstexpr_backtrace_limit : Separate<["-"], "fconstexpr-backtrace-limit">, MetaVarName<"<N>">,
HelpText<"Set the maximum number of entries to print in a constexpr evaluation backtrace (0 = no limit).">;
+def fspell_checking_limit : Separate<["-"], "fspell-checking-limit">, MetaVarName<"<N>">,
+ HelpText<"Set the maximum number of times to perform spell checking on unrecognized identifiers (0 = no limit).">;
def fmessage_length : Separate<["-"], "fmessage-length">, MetaVarName<"<N>">,
HelpText<"Format message diagnostics so that they fit within N columns or fewer, when possible.">;
def verify : Flag<["-"], "verify">,
@@ -337,6 +339,12 @@ def fno_modules_error_recovery : Flag<["-"], "fno-modules-error-recovery">,
def fmodule_implementation_of : Separate<["-"], "fmodule-implementation-of">,
MetaVarName<"<name>">,
HelpText<"Specify the name of the module whose implementation file this is">;
+def fmodule_map_file_home_is_cwd : Flag<["-"], "fmodule-map-file-home-is-cwd">,
+ HelpText<"Use the current working directory as the home directory of "
+ "module maps specified by -fmodule-map-file=<FILE>">;
+def fmodule_feature : Separate<["-"], "fmodule-feature">,
+ MetaVarName<"<feature>">,
+ HelpText<"Enable <feature> in module map requires declarations">;
let Group = Action_Group in {
@@ -510,6 +518,10 @@ def fno_deprecated_macro : Flag<["-"], "fno-deprecated-macro">,
HelpText<"Undefines the __DEPRECATED macro">;
def fsized_deallocation : Flag<["-"], "fsized-deallocation">,
HelpText<"Enable C++14 sized global deallocation functions">;
+def fno_sized_deallocation: Flag<["-"], "fno-sized-deallocation">,
+ HelpText<"Disable sized deallocation functions">;
+def fdefine_sized_deallocation: Flag<["-"], "fdefine-sized-deallocation">,
+ HelpText<"Allow compiler-generated definition of sized deallocation functions">;
def fobjc_subscripting_legacy_runtime : Flag<["-"], "fobjc-subscripting-legacy-runtime">,
HelpText<"Allow Objective-C array and dictionary subscripting in legacy runtime">;
def vtordisp_mode_EQ : Joined<["-"], "vtordisp-mode=">,
@@ -569,12 +581,16 @@ def detailed_preprocessing_record : Flag<["-"], "detailed-preprocessing-record">
def cl_opt_disable : Flag<["-"], "cl-opt-disable">,
HelpText<"OpenCL only. This option disables all optimizations. The default is optimizations are enabled.">;
+def cl_strict_aliasing : Flag<["-"], "cl-strict-aliasing">,
+ HelpText<"OpenCL only. This option does nothing and is for compatibility with OpenCL 1.0">;
def cl_single_precision_constant : Flag<["-"], "cl-single-precision-constant">,
HelpText<"OpenCL only. Treat double precision floating-point constant as single precision constant.">;
def cl_finite_math_only : Flag<["-"], "cl-finite-math-only">,
HelpText<"OpenCL only. Allow floating-point optimizations that assume arguments and results are not NaNs or +-Inf.">;
def cl_kernel_arg_info : Flag<["-"], "cl-kernel-arg-info">,
HelpText<"OpenCL only. Generate kernel argument metadata.">;
+def : Flag<["-"], "cl-no-signed-zeros">, Alias<fno_signed_zeros>,
+ HelpText<"OpenCL only. Allow optimizations to ignore the signedness of the floating-point zero.">;
def cl_unsafe_math_optimizations : Flag<["-"], "cl-unsafe-math-optimizations">,
HelpText<"OpenCL only. Allow unsafe floating-point optimizations. Also implies -cl-no-signed-zeros and -cl-mad-enable">;
def cl_fast_relaxed_math : Flag<["-"], "cl-fast-relaxed-math">,
@@ -592,6 +608,9 @@ def cl_denorms_are_zero : Flag<["-"], "cl-denorms-are-zero">,
def fcuda_is_device : Flag<["-"], "fcuda-is-device">,
HelpText<"Generate code for CUDA device">;
+def fcuda_allow_host_calls_from_host_device : Flag<["-"],
+ "fcuda-allow-host-calls-from-host-device">,
+ HelpText<"Allow host device functions to call host functions">;
} // let Flags = [CC1Option]
diff --git a/include/clang/Driver/CLCompatOptions.td b/include/clang/Driver/CLCompatOptions.td
index e05d68700e..80630fcefa 100644
--- a/include/clang/Driver/CLCompatOptions.td
+++ b/include/clang/Driver/CLCompatOptions.td
@@ -62,6 +62,8 @@ def _SLASH_GR : CLFlag<"GR">, HelpText<"Enable emission of RTTI data">;
def _SLASH_GR_ : CLFlag<"GR-">, HelpText<"Disable emission of RTTI data">;
def _SLASH_GF_ : CLFlag<"GF-">, HelpText<"Disable string pooling">,
Alias<fwritable_strings>;
+def _SLASH_Gs : CLJoined<"Gs">, HelpText<"Set stack probe size">,
+ Alias<mstack_probe_size>;
def _SLASH_Gy : CLFlag<"Gy">, HelpText<"Put each function in its own section">,
Alias<ffunction_sections>;
def _SLASH_Gy_ : CLFlag<"Gy-">, HelpText<"Don't put each function in its own section">,
@@ -78,6 +80,7 @@ def _SLASH_I : CLJoinedOrSeparate<"I">,
Alias<I>;
def _SLASH_J : CLFlag<"J">, HelpText<"Make char type unsigned">,
Alias<funsigned_char>;
+def _SLASH_O0 : CLFlag<"O0">, Alias<O0>;
def _SLASH_O : CLJoined<"O">, HelpText<"Optimization level">,
MetaVarName<"<n>">, Alias<O>;
def _SLASH_Ob0 : CLFlag<"Ob0">, HelpText<"Disable inlining">,
@@ -127,8 +130,17 @@ def _SLASH_WX_ : CLFlag<"WX-">, HelpText<"Do not treat warnings as errors">,
def _SLASH_w_flag : CLFlag<"w">, HelpText<"Disable all warnings">, Alias<w>;
def _SLASH_wd4005 : CLFlag<"wd4005">, Alias<W_Joined>,
AliasArgs<["no-macro-redefined"]>;
+def _SLASH_wd4996 : CLFlag<"wd4996">, Alias<W_Joined>,
+ AliasArgs<["no-deprecated-declarations"]>;
def _SLASH_vd : CLJoined<"vd">, HelpText<"Control vtordisp placement">,
Alias<vtordisp_mode_EQ>;
+def _SLASH_Zc_strictStrings : CLFlag<"Zc:strictStrings">,
+ HelpText<"Treat string literals as const">, Alias<W_Joined>,
+ AliasArgs<["error=c++11-compat-deprecated-writable-strings"]>;
+def _SLASH_Zc_trigraphs : CLFlag<"Zc:trigraphs">,
+ HelpText<"Enable trigraphs">, Alias<ftrigraphs>;
+def _SLASH_Zc_trigraphs_off : CLFlag<"Zc:trigraphs-">,
+ HelpText<"Disable trigraphs (default)">, Alias<fno_trigraphs>;
def _SLASH_Z7 : CLFlag<"Z7">, Alias<gline_tables_only>;
def _SLASH_Zi : CLFlag<"Zi">, HelpText<"Enable debug information">,
Alias<gline_tables_only>;
@@ -148,6 +160,7 @@ def _SLASH_arch : CLCompileJoined<"arch:">,
HelpText<"Set architecture for code generation">;
def _SLASH_M_Group : OptionGroup<"</M group>">, Group<cl_compile_Group>;
+def _SLASH_volatile_Group : OptionGroup<"</volatile group>">, Group<cl_compile_Group>;
def _SLASH_EH : CLJoined<"EH">, HelpText<"Exception handling model">;
def _SLASH_EP : CLFlag<"EP">,
@@ -192,14 +205,20 @@ def _SLASH_TC : CLCompileFlag<"TC">, HelpText<"Treat all source files as C">;
def _SLASH_Tp : CLCompileJoinedOrSeparate<"Tp">,
HelpText<"Specify a C++ source file">, MetaVarName<"<filename>">;
def _SLASH_TP : CLCompileFlag<"TP">, HelpText<"Treat all source files as C++">;
-
+def _SLASH_volatile_iso : Option<["/", "-"], "volatile:iso", KIND_FLAG>, Group<_SLASH_volatile_Group>,
+ Flags<[CLOption, DriverOption]>, HelpText<"Volatile loads and stores have standard semantics">;
+def _SLASH_volatile_ms : Option<["/", "-"], "volatile:ms", KIND_FLAG>, Group<_SLASH_volatile_Group>,
+ Flags<[CLOption, DriverOption]>, HelpText<"Volatile loads and stores have acquire and release semantics">;
// Ignored:
def _SLASH_analyze_ : CLIgnoredFlag<"analyze-">;
+def _SLASH_cgthreads : CLIgnoredJoined<"cgthreads">;
def _SLASH_d2Zi_PLUS : CLIgnoredFlag<"d2Zi+">;
def _SLASH_errorReport : CLIgnoredJoined<"errorReport">;
+def _SLASH_Fd : CLIgnoredJoined<"Fd">;
def _SLASH_FS : CLIgnoredFlag<"FS">, HelpText<"Force synchronous PDB writes">;
+def _SLASH_Gd : CLIgnoredFlag<"Gd">;
def _SLASH_GF : CLIgnoredFlag<"GF">;
def _SLASH_GS_ : CLIgnoredFlag<"GS-">;
def _SLASH_kernel_ : CLIgnoredFlag<"kernel-">;
@@ -210,6 +229,7 @@ def _SLASH_RTC : CLIgnoredJoined<"RTC">;
def _SLASH_sdl : CLIgnoredFlag<"sdl">;
def _SLASH_sdl_ : CLIgnoredFlag<"sdl-">;
def _SLASH_w : CLIgnoredJoined<"w">;
+def _SLASH_Zc_auto : CLIgnoredFlag<"Zc:auto">;
def _SLASH_Zc_forScope : CLIgnoredFlag<"Zc:forScope">;
def _SLASH_Zc_inline : CLIgnoredFlag<"Zc:inline">;
def _SLASH_Zc_rvalueCast : CLIgnoredFlag<"Zc:rvalueCast">;
@@ -229,7 +249,6 @@ def _SLASH_FA_joined : CLJoined<"FA">;
def _SLASH_favor : CLJoined<"favor">;
def _SLASH_FC : CLFlag<"FC">;
def _SLASH_F : CLFlag<"F">;
-def _SLASH_Fd : CLJoined<"Fd">;
def _SLASH_Fm : CLJoined<"Fm">;
def _SLASH_fp : CLJoined<"fp">;
def _SLASH_Fp : CLJoined<"Fp">;
@@ -240,7 +259,6 @@ def _SLASH_Fx : CLFlag<"Fx">;
def _SLASH_G1 : CLFlag<"G1">;
def _SLASH_G2 : CLFlag<"G2">;
def _SLASH_GA : CLFlag<"GA">;
-def _SLASH_Gd : CLFlag<"Gd">;
def _SLASH_Ge : CLFlag<"Ge">;
def _SLASH_Gh : CLFlag<"Gh">;
def _SLASH_GH : CLFlag<"GH">;
@@ -250,9 +268,9 @@ def _SLASH_Gm : CLFlag<"Gm">;
def _SLASH_Gm_ : CLFlag<"Gm-">;
def _SLASH_Gr : CLFlag<"Gr">;
def _SLASH_GS : CLFlag<"GS">;
-def _SLASH_Gs : CLJoined<"Gs">;
def _SLASH_GT : CLFlag<"GT">;
def _SLASH_GX : CLFlag<"GX">;
+def _SLASH_Gv : CLFlag<"Gv">;
def _SLASH_Gz : CLFlag<"Gz">;
def _SLASH_GZ : CLFlag<"GZ">;
def _SLASH_H : CLFlag<"H">;
@@ -269,7 +287,6 @@ def _SLASH_Qpar : CLFlag<"Qpar">;
def _SLASH_Qvec_report : CLJoined<"Qvec-report">;
def _SLASH_u : CLFlag<"u">;
def _SLASH_V : CLFlag<"V">;
-def _SLASH_volatile : CLFlag<"volatile">;
def _SLASH_WL : CLFlag<"WL">;
def _SLASH_Wp64 : CLFlag<"Wp64">;
def _SLASH_X : CLFlag<"X">;
diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h
index 020966f8cd..09521c2bae 100644
--- a/include/clang/Driver/Driver.h
+++ b/include/clang/Driver/Driver.h
@@ -61,6 +61,12 @@ class Driver {
CLMode
} Mode;
+ enum SaveTempsMode {
+ SaveTempsNone,
+ SaveTempsCwd,
+ SaveTempsObj
+ } SaveTemps;
+
public:
// Diag - Forwarding function for diagnostics.
DiagnosticBuilder Diag(unsigned DiagID) const {
@@ -104,9 +110,6 @@ public:
/// Default target triple.
std::string DefaultTargetTriple;
- /// Default name for linked images (e.g., "a.out").
- std::string DefaultImageName;
-
/// Driver title to use with help.
std::string DriverTitle;
@@ -235,6 +238,9 @@ public:
InstalledDir = Value;
}
+ bool isSaveTempsEnabled() const { return SaveTemps != SaveTempsNone; }
+ bool isSaveTempsObj() const { return SaveTemps == SaveTempsObj; }
+
/// @}
/// @name Primary Functionality
/// @{
@@ -351,8 +357,8 @@ public:
/// \p Phase on the \p Input, taking in to account arguments
/// like -fsyntax-only or --analyze.
std::unique_ptr<Action>
- ConstructPhaseAction(const llvm::opt::ArgList &Args, phases::ID Phase,
- std::unique_ptr<Action> Input) const;
+ ConstructPhaseAction(const ToolChain &TC, const llvm::opt::ArgList &Args,
+ phases::ID Phase, std::unique_ptr<Action> Input) const;
/// BuildJobsForAction - Construct the jobs to perform for the
/// action \p A.
@@ -365,6 +371,9 @@ public:
const char *LinkingOutput,
InputInfo &Result) const;
+ /// Returns the default name for linked images (e.g., "a.out").
+ const char *getDefaultImageName() const;
+
/// GetNamedOutputPath - Return the name to use for the output of
/// the action \p JA. The result is appended to the compilation's
/// list of temporary or result files, as appropriate.
@@ -393,7 +402,7 @@ public:
/// handle this action.
bool ShouldUseClangCompiler(const JobAction &JA) const;
- bool IsUsingLTO(const llvm::opt::ArgList &Args) const;
+ bool IsUsingLTO(const ToolChain &TC, const llvm::opt::ArgList &Args) const;
private:
/// \brief Retrieves a ToolChain for a particular target triple.
diff --git a/include/clang/Driver/Job.h b/include/clang/Driver/Job.h
index 685088d24a..b510676c09 100644
--- a/include/clang/Driver/Job.h
+++ b/include/clang/Driver/Job.h
@@ -12,8 +12,8 @@
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/SmallVector.h"
-#include "llvm/Option/Option.h"
#include "llvm/ADT/iterator.h"
+#include "llvm/Option/Option.h"
#include <memory>
namespace llvm {
diff --git a/include/clang/Driver/Multilib.h b/include/clang/Driver/Multilib.h
index 501ffe5177..dcf609ab99 100644
--- a/include/clang/Driver/Multilib.h
+++ b/include/clang/Driver/Multilib.h
@@ -13,7 +13,6 @@
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Option/Option.h"
-
#include <functional>
#include <string>
#include <vector>
diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
index b42d3484fb..6b7a47c1bb 100644
--- a/include/clang/Driver/Options.td
+++ b/include/clang/Driver/Options.td
@@ -404,6 +404,11 @@ def fno_autolink : Flag <["-"], "fno-autolink">, Group<f_Group>,
Flags<[DriverOption, CC1Option]>,
HelpText<"Disable generation of linker directives for automatic library linking">;
+def fgnu_inline_asm : Flag<["-"], "fgnu-inline-asm">, Group<f_Group>, Flags<[DriverOption]>;
+def fno_gnu_inline_asm : Flag<["-"], "fno-gnu-inline-asm">, Group<f_Group>,
+ Flags<[DriverOption, CC1Option]>,
+ HelpText<"Disable GNU style inline asm">;
+
def fprofile_sample_use_EQ : Joined<["-"], "fprofile-sample-use=">,
Group<f_Group>, Flags<[DriverOption, CC1Option]>,
HelpText<"Enable sample-based profile guided optimizations">;
@@ -428,12 +433,12 @@ def fborland_extensions : Flag<["-"], "fborland-extensions">, Group<f_Group>, Fl
def fbuiltin : Flag<["-"], "fbuiltin">, Group<f_Group>;
def fcaret_diagnostics : Flag<["-"], "fcaret-diagnostics">, Group<f_Group>;
def fclasspath_EQ : Joined<["-"], "fclasspath=">, Group<f_Group>;
-def fcolor_diagnostics : Flag<["-"], "fcolor-diagnostics">, Group<f_Group>, Flags<[CC1Option]>,
- HelpText<"Use colors in diagnostics">;
+def fcolor_diagnostics : Flag<["-"], "fcolor-diagnostics">, Group<f_Group>,
+ Flags<[CoreOption, CC1Option]>, HelpText<"Use colors in diagnostics">;
def fdiagnostics_color : Flag<["-"], "fdiagnostics-color">, Group<f_Group>;
def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group<f_Group>;
-def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group<f_Group>, Flags<[CC1Option]>,
- HelpText<"Use ANSI escape codes for diagnostics">;
+def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group<f_Group>,
+ Flags<[CoreOption, CC1Option]>, HelpText<"Use ANSI escape codes for diagnostics">;
def fcomment_block_commands : CommaJoined<["-"], "fcomment-block-commands=">, Group<f_clang_Group>, Flags<[CC1Option]>,
HelpText<"Treat each comma separated argument in <arg> as a documentation comment block command">,
MetaVarName<"<arg>">;
@@ -509,9 +514,8 @@ def fsignaling_math : Flag<["-"], "fsignaling-math">, Group<f_Group>;
def fno_signaling_math : Flag<["-"], "fno-signaling-math">, Group<f_Group>;
def fsanitize_EQ : CommaJoined<["-"], "fsanitize=">, Group<f_clang_Group>,
Flags<[CC1Option, CoreOption]>, MetaVarName<"<check>">,
- HelpText<"Enable runtime instrumentation for bug detection: "
- "address (memory errors) | thread (race detection) | "
- "undefined (miscellaneous undefined behavior)">;
+ HelpText<"Turn on runtime checks for various forms of undefined "
+ "or suspicious behavior. See user manual for available checks ">;
def fno_sanitize_EQ : CommaJoined<["-"], "fno-sanitize=">, Group<f_clang_Group>;
def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">,
Group<f_clang_Group>, Flags<[CC1Option, CoreOption]>,
@@ -534,11 +538,17 @@ def fno_sanitize_memory_track_origins : Flag<["-"], "fno-sanitize-memory-track-o
def fsanitize_address_field_padding : Joined<["-"], "fsanitize-address-field-padding=">,
Group<f_clang_Group>, Flags<[CC1Option]>,
HelpText<"Level of field padding for AddressSanitizer">;
-def fsanitize_recover : Flag<["-"], "fsanitize-recover">,
- Group<f_clang_Group>;
+def fsanitize_recover : Flag<["-"], "fsanitize-recover">, Group<f_clang_Group>;
def fno_sanitize_recover : Flag<["-"], "fno-sanitize-recover">,
- Group<f_clang_Group>, Flags<[CC1Option]>,
- HelpText<"Disable sanitizer check recovery">;
+ Group<f_clang_Group>;
+def fsanitize_recover_EQ : CommaJoined<["-"], "fsanitize-recover=">,
+ Group<f_clang_Group>,
+ Flags<[CC1Option]>,
+ HelpText<"Enable recovery for specified sanitizers">;
+def fno_sanitize_recover_EQ
+ : CommaJoined<["-"], "fno-sanitize-recover=">,
+ Group<f_clang_Group>,
+ HelpText<"Disable recovery for specified sanitizers">;
def fsanitize_undefined_trap_on_error : Flag<["-"], "fsanitize-undefined-trap-on-error">,
Group<f_clang_Group>, Flags<[CC1Option]>;
def fno_sanitize_undefined_trap_on_error : Flag<["-"], "fno-sanitize-undefined-trap-on-error">,
@@ -556,7 +566,9 @@ def fno_reciprocal_math : Flag<["-"], "fno-reciprocal-math">, Group<f_Group>;
def ffinite_math_only : Flag<["-"], "ffinite-math-only">, Group<f_Group>, Flags<[CC1Option]>;
def fno_finite_math_only : Flag<["-"], "fno-finite-math-only">, Group<f_Group>;
def fsigned_zeros : Flag<["-"], "fsigned-zeros">, Group<f_Group>;
-def fno_signed_zeros : Flag<["-"], "fno-signed-zeros">, Group<f_Group>;
+def fno_signed_zeros :
+ Flag<["-"], "fno-signed-zeros">, Group<f_Group>, Flags<[CC1Option]>,
+ HelpText<"Allow optimizations that ignore the sign of floating point zeros">;
def fhonor_nans : Flag<["-"], "fhonor-nans">, Group<f_Group>;
def fno_honor_nans : Flag<["-"], "fno-honor-nans">, Group<f_Group>;
def fhonor_infinities : Flag<["-"], "fhonor-infinities">, Group<f_Group>;
@@ -577,6 +589,17 @@ def frewrite_includes : Flag<["-"], "frewrite-includes">, Group<f_Group>,
Flags<[CC1Option]>;
def fno_rewrite_includes : Flag<["-"], "fno-rewrite-includes">, Group<f_Group>;
+def frewrite_map_file : Separate<["-"], "frewrite-map-file">,
+ Group<f_Group>,
+ Flags<[ DriverOption, CC1Option ]>;
+def frewrite_map_file_EQ : Joined<["-"], "frewrite-map-file=">,
+ Group<f_Group>,
+ Flags<[DriverOption]>;
+
+def fuse_line_directives : Flag<["-"], "fuse-line-directives">, Group<f_Group>,
+ Flags<[CC1Option]>;
+def fno_use_line_directives : Flag<["-"], "fno-use-line-directives">, Group<f_Group>;
+
def ffreestanding : Flag<["-"], "ffreestanding">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Assert that the compilation takes place in a freestanding environment">;
def fgnu_keywords : Flag<["-"], "fgnu-keywords">, Group<f_Group>, Flags<[CC1Option]>,
@@ -609,6 +632,7 @@ def fms_extensions : Flag<["-"], "fms-extensions">, Group<f_Group>, Flags<[CC1Op
HelpText<"Accept some non-standard constructs supported by the Microsoft compiler">;
def fms_compatibility : Flag<["-"], "fms-compatibility">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Enable full Microsoft Visual C++ compatibility">;
+def fms_volatile : Joined<["-"], "fms-volatile">, Group<f_Group>, Flags<[CC1Option]>;
def fmsc_version : Joined<["-"], "fmsc-version=">, Group<f_Group>, Flags<[DriverOption, CoreOption]>,
HelpText<"Microsoft compiler version number to report in _MSC_VER (0 = don't define it (default))">;
def fms_compatibility_version
@@ -675,6 +699,15 @@ def fmodules_strict_decluse : Flag <["-"], "fmodules-strict-decluse">, Group<f_G
HelpText<"Like -fmodules-decluse but requires all headers to be in modules">;
def fno_modules_search_all : Flag <["-"], "fno-modules-search-all">, Group<f_Group>,
Flags<[DriverOption, CC1Option]>;
+def fmodules_implicit_maps :
+ Flag <["-"], "fmodules-implicit-maps">,
+ Group<f_Group>, Flags<[DriverOption, CC1Option]>;
+def fno_modules_implicit_maps :
+ Flag <["-"], "fno-modules-implicit-maps">,
+ Group<f_Group>, Flags<[DriverOption, CC1Option]>;
+def fno_implicit_modules :
+ Flag <["-"], "fno-implicit-modules">,
+ Group<f_Group>, Flags<[DriverOption, CC1Option]>;
def fretain_comments_from_system_headers : Flag<["-"], "fretain-comments-from-system-headers">, Group<f_Group>, Flags<[CC1Option]>;
def fmudflapth : Flag<["-"], "fmudflapth">, Group<f_Group>;
@@ -735,6 +768,8 @@ def fno_modules_decluse : Flag <["-"], "fno-modules-decluse">, Group<f_Group>,
Flags<[DriverOption]>;
def fno_modules_strict_decluse : Flag <["-"], "fno-strict-modules-decluse">, Group<f_Group>,
Flags<[DriverOption]>;
+def fimplicit_modules : Flag <["-"], "fimplicit-modules">, Group<f_Group>,
+ Flags<[DriverOption]>;
def fno_ms_extensions : Flag<["-"], "fno-ms-extensions">, Group<f_Group>;
def fno_ms_compatibility : Flag<["-"], "fno-ms-compatibility">, Group<f_Group>;
def fno_delayed_template_parsing : Flag<["-"], "fno-delayed-template-parsing">, Group<f_Group>;
@@ -856,6 +891,7 @@ def fshow_overloads_EQ : Joined<["-"], "fshow-overloads=">, Group<f_Group>, Flag
def fshow_column : Flag<["-"], "fshow-column">, Group<f_Group>, Flags<[CC1Option]>;
def fshow_source_location : Flag<["-"], "fshow-source-location">, Group<f_Group>;
def fspell_checking : Flag<["-"], "fspell-checking">, Group<f_Group>;
+def fspell_checking_limit_EQ : Joined<["-"], "fspell-checking-limit=">, Group<f_Group>;
def fsigned_bitfields : Flag<["-"], "fsigned-bitfields">, Group<f_Group>;
def fsigned_char : Flag<["-"], "fsigned-char">, Group<f_Group>;
def fno_signed_char : Flag<["-"], "fno-signed-char">, Flags<[CC1Option]>,
@@ -933,6 +969,10 @@ def freroll_loops : Flag<["-"], "freroll-loops">, Group<f_Group>,
HelpText<"Turn on loop reroller">, Flags<[CC1Option]>;
def fno_reroll_loops : Flag<["-"], "fno-reroll-loops">, Group<f_Group>,
HelpText<"Turn off loop reroller">;
+def ftrigraphs : Flag<["-"], "ftrigraphs">, Group<f_Group>,
+ HelpText<"Process trigraph sequences">, Flags<[CC1Option]>;
+def fno_trigraphs : Flag<["-"], "fno-trigraphs">, Group<f_Group>,
+ HelpText<"Do not process trigraph sequences">, Flags<[CC1Option]>;
def funsigned_bitfields : Flag<["-"], "funsigned-bitfields">, Group<f_Group>;
def funsigned_char : Flag<["-"], "funsigned-char">, Group<f_Group>;
def fno_unsigned_char : Flag<["-"], "fno-unsigned-char">, Group<clang_ignored_f_Group>;
@@ -964,6 +1004,14 @@ def fdata_sections : Flag <["-"], "fdata-sections">, Group<f_Group>,
Flags<[CC1Option]>, HelpText<"Place each data in its own section (ELF Only)">;
def fno_data_sections : Flag <["-"], "fno-data-sections">, Group<f_Group>,
Flags<[CC1Option]>;
+
+def funique_section_names : Flag <["-"], "funique-section-names">,
+ Group<f_Group>, Flags<[CC1Option]>,
+ HelpText<"Use unique names for text and data sections (ELF Only)">;
+def fno_unique_section_names : Flag <["-"], "fno-unique-section-names">,
+ Group<f_Group>, Flags<[CC1Option]>;
+
+
def fdebug_types_section: Flag <["-"], "fdebug-types-section">, Group<f_Group>,
Flags<[CC1Option]>, HelpText<"Place debug types in their own section (ELF Only)">;
def fno_debug_types_section: Flag<["-"], "fno-debug-types-section">, Group<f_Group>,
@@ -1085,20 +1133,24 @@ def mhwdiv_EQ : Joined<["-"], "mhwdiv=">, Group<m_Group>;
def mglobal_merge : Flag<["-"], "mglobal-merge">, Group<m_Group>;
def mhard_float : Flag<["-"], "mhard-float">, Group<m_Group>;
def miphoneos_version_min_EQ : Joined<["-"], "miphoneos-version-min=">, Group<m_Group>;
-def mios_version_min_EQ : Joined<["-"], "mios-version-min=">, Alias<miphoneos_version_min_EQ>;
+def mios_version_min_EQ : Joined<["-"], "mios-version-min=">,
+ Alias<miphoneos_version_min_EQ>, HelpText<"Set iOS deployment target">;
def mios_simulator_version_min_EQ : Joined<["-"], "mios-simulator-version-min=">, Alias<miphoneos_version_min_EQ>;
def mkernel : Flag<["-"], "mkernel">, Group<m_Group>;
def mlinker_version_EQ : Joined<["-"], "mlinker-version=">,
Flags<[DriverOption]>;
def mllvm : Separate<["-"], "mllvm">, Flags<[CC1Option,CC1AsOption,CoreOption]>,
HelpText<"Additional arguments to forward to LLVM's option processing">;
-def mmacosx_version_min_EQ : Joined<["-"], "mmacosx-version-min=">, Group<m_Group>;
+def mmacosx_version_min_EQ : Joined<["-"], "mmacosx-version-min=">,
+ Group<m_Group>, HelpText<"Set Mac OS X deployment target">;
def mms_bitfields : Flag<["-"], "mms-bitfields">, Group<m_Group>, Flags<[CC1Option]>,
HelpText<"Set the default structure layout to be compatible with the Microsoft compiler standard">;
def mstackrealign : Flag<["-"], "mstackrealign">, Group<m_Group>, Flags<[CC1Option]>,
HelpText<"Force realign the stack at entry to every function">;
def mstack_alignment : Joined<["-"], "mstack-alignment=">, Group<m_Group>, Flags<[CC1Option]>,
HelpText<"Set the stack alignment">;
+def mstack_probe_size : Joined<["-"], "mstack-probe-size=">, Group<m_Group>, Flags<[CC1Option]>,
+ HelpText<"Set the stack probe size">;
def mthread_model : Separate<["-"], "mthread-model">, Group<m_Group>, Flags<[CC1Option]>,
HelpText<"The thread model to use, e.g. posix, single (posix by default)">;
@@ -1178,6 +1230,15 @@ def mno_long_calls : Flag<["-"], "mno-long-calls">, Group<m_arm_Features_Group>,
def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, Group<m_aarch64_Features_Group>,
HelpText<"Generate code which only uses the general purpose registers (AArch64 only)">;
+def mfix_cortex_a53_835769 : Flag<["-"], "mfix-cortex-a53-835769">,
+ Group<m_aarch64_Features_Group>,
+ HelpText<"Workaround Cortex-A53 erratum 835769 (AArch64 only)">;
+def mno_fix_cortex_a53_835769 : Flag<["-"], "mno-fix-cortex-a53-835769">,
+ Group<m_aarch64_Features_Group>,
+ HelpText<"Don't workaround Cortex-A53 erratum 835769 (AArch64 only)">;
+def ffixed_x18 : Flag<["-"], "ffixed-x18">, Group<m_aarch64_Features_Group>,
+ HelpText<"Reserve the x18 register (AArch64 only)">;
+
def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>;
def mno_vsx : Flag<["-"], "mno-vsx">, Group<m_ppc_Features_Group>;
def mpower8_vector : Flag<["-"], "mpower8-vector">,
@@ -1186,6 +1247,8 @@ def mno_power8_vector : Flag<["-"], "mno-power8-vector">,
Group<m_ppc_Features_Group>;
def mfprnd : Flag<["-"], "mfprnd">, Group<m_ppc_Features_Group>;
def mno_fprnd : Flag<["-"], "mno-fprnd">, Group<m_ppc_Features_Group>;
+def mcmpb : Flag<["-"], "mcmpb">, Group<m_ppc_Features_Group>;
+def mno_cmpb : Flag<["-"], "mno-cmpb">, Group<m_ppc_Features_Group>;
def mmfcrf : Flag<["-"], "mmfcrf">, Group<m_ppc_Features_Group>;
def mno_mfcrf : Flag<["-"], "mno-mfcrf">, Group<m_ppc_Features_Group>;
def mpopcntd : Flag<["-"], "mpopcntd">, Group<m_ppc_Features_Group>;
@@ -1194,6 +1257,11 @@ def mqpx : Flag<["-"], "mqpx">, Group<m_ppc_Features_Group>;
def mno_qpx : Flag<["-"], "mno-qpx">, Group<m_ppc_Features_Group>;
def mcrbits : Flag<["-"], "mcrbits">, Group<m_ppc_Features_Group>;
def mno_crbits : Flag<["-"], "mno-crbits">, Group<m_ppc_Features_Group>;
+def minvariant_function_descriptors :
+ Flag<["-"], "minvariant-function-descriptors">, Group<m_ppc_Features_Group>;
+def mno_invariant_function_descriptors :
+ Flag<["-"], "mno-invariant-function-descriptors">,
+ Group<m_ppc_Features_Group>;
def faltivec : Flag<["-"], "faltivec">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Enable AltiVec vector initializer syntax">;
@@ -1306,6 +1374,12 @@ def mips32 : Flag<["-"], "mips32">,
def mips32r2 : Flag<["-"], "mips32r2">,
Alias<march_EQ>, AliasArgs<["mips32r2"]>,
HelpText<"Equivalent to -march=mips32r2">, Flags<[HelpHidden]>;
+def mips32r3 : Flag<["-"], "mips32r3">,
+ Alias<march_EQ>, AliasArgs<["mips32r3"]>,
+ HelpText<"Equivalent to -march=mips32r3">, Flags<[HelpHidden]>;
+def mips32r5 : Flag<["-"], "mips32r5">,
+ Alias<march_EQ>, AliasArgs<["mips32r5"]>,
+ HelpText<"Equivalent to -march=mips32r5">, Flags<[HelpHidden]>;
def mips32r6 : Flag<["-"], "mips32r6">,
Alias<march_EQ>, AliasArgs<["mips32r6"]>,
HelpText<"Equivalent to -march=mips32r6">, Flags<[HelpHidden]>;
@@ -1315,6 +1389,12 @@ def mips64 : Flag<["-"], "mips64">,
def mips64r2 : Flag<["-"], "mips64r2">,
Alias<march_EQ>, AliasArgs<["mips64r2"]>,
HelpText<"Equivalent to -march=mips64r2">, Flags<[HelpHidden]>;
+def mips64r3 : Flag<["-"], "mips64r3">,
+ Alias<march_EQ>, AliasArgs<["mips64r3"]>,
+ HelpText<"Equivalent to -march=mips64r3">, Flags<[HelpHidden]>;
+def mips64r5 : Flag<["-"], "mips64r5">,
+ Alias<march_EQ>, AliasArgs<["mips64r5"]>,
+ HelpText<"Equivalent to -march=mips64r5">, Flags<[HelpHidden]>;
def mips64r6 : Flag<["-"], "mips64r6">,
Alias<march_EQ>, AliasArgs<["mips64r6"]>,
HelpText<"Equivalent to -march=mips64r6">, Flags<[HelpHidden]>;
@@ -1404,7 +1484,10 @@ def resource_dir_EQ : Joined<["-"], "resource-dir=">, Flags<[DriverOption]>,
def rpath : Separate<["-"], "rpath">, Flags<[LinkerInput]>;
def rtlib_EQ : Joined<["-", "--"], "rtlib=">;
def r : Flag<["-"], "r">;
+def save_temps_EQ : Joined<["-", "--"], "save-temps=">, Flags<[DriverOption]>,
+ HelpText<"Save intermediate compilation results.">;
def save_temps : Flag<["-", "--"], "save-temps">, Flags<[DriverOption]>,
+ Alias<save_temps_EQ>, AliasArgs<["cwd"]>,
HelpText<"Save intermediate compilation results">;
def via_file_asm : Flag<["-", "--"], "via-file-asm">, InternalDebugOpt,
HelpText<"Write assembly to file for input to assemble jobs">;
@@ -1457,7 +1540,7 @@ def time : Flag<["-"], "time">,
def traditional_cpp : Flag<["-", "--"], "traditional-cpp">, Flags<[CC1Option]>,
HelpText<"Enable some traditional CPP emulation">;
def traditional : Flag<["-", "--"], "traditional">;
-def trigraphs : Flag<["-", "--"], "trigraphs">, Flags<[CC1Option]>,
+def trigraphs : Flag<["-", "--"], "trigraphs">, Alias<ftrigraphs>,
HelpText<"Process trigraph sequences">;
def twolevel__namespace__hints : Flag<["-"], "twolevel_namespace_hints">;
def twolevel__namespace : Flag<["-"], "twolevel_namespace">;
diff --git a/include/clang/Driver/Phases.h b/include/clang/Driver/Phases.h
index e2160e6531..cd6b5b5c9f 100644
--- a/include/clang/Driver/Phases.h
+++ b/include/clang/Driver/Phases.h
@@ -19,6 +19,7 @@ namespace phases {
Preprocess,
Precompile,
Compile,
+ Backend,
Assemble,
Link
};
diff --git a/include/clang/Driver/SanitizerArgs.h b/include/clang/Driver/SanitizerArgs.h
index 32b2e8935e..5874c26b8c 100644
--- a/include/clang/Driver/SanitizerArgs.h
+++ b/include/clang/Driver/SanitizerArgs.h
@@ -13,6 +13,7 @@
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include <string>
+#include <vector>
namespace clang {
namespace driver {
@@ -22,9 +23,9 @@ class ToolChain;
class SanitizerArgs {
SanitizerSet Sanitizers;
- bool SanitizeRecover;
+ SanitizerSet RecoverableSanitizers;
- std::string BlacklistFile;
+ std::vector<std::string> BlacklistFiles;
int SanitizeCoverage;
int MsanTrackOrigins;
int AsanFieldPadding;
@@ -48,9 +49,9 @@ class SanitizerArgs {
bool needsUbsanRt() const;
bool needsDfsanRt() const { return Sanitizers.has(SanitizerKind::DataFlow); }
- bool sanitizesVptr() const { return Sanitizers.has(SanitizerKind::Vptr); }
- bool hasZeroBaseShadow() const;
+ bool requiresPIE() const;
bool needsUnwindTables() const;
+ bool needsLTO() const;
bool linkCXXRuntimes() const { return LinkCXXRuntimes; }
void addArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const;
diff --git a/include/clang/Driver/Tool.h b/include/clang/Driver/Tool.h
index aa895d0ba6..b9eac1cad6 100644
--- a/include/clang/Driver/Tool.h
+++ b/include/clang/Driver/Tool.h
@@ -84,6 +84,7 @@ public:
const ToolChain &getToolChain() const { return TheToolChain; }
virtual bool hasIntegratedAssembler() const { return false; }
+ virtual bool canEmitIR() const { return false; }
virtual bool hasIntegratedCPP() const = 0;
virtual bool isLinkJob() const { return false; }
virtual bool isDsymutilJob() const { return false; }
diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h
index 7279951c73..560df19e25 100644
--- a/include/clang/Driver/ToolChain.h
+++ b/include/clang/Driver/ToolChain.h
@@ -53,10 +53,20 @@ public:
RLT_Libgcc
};
+ enum RTTIMode {
+ RM_EnabledExplicitly,
+ RM_EnabledImplicitly,
+ RM_DisabledExplicitly,
+ RM_DisabledImplicitly
+ };
+
private:
const Driver &D;
const llvm::Triple Triple;
const llvm::opt::ArgList &Args;
+ // We need to initialize CachedRTTIArg before CachedRTTIMode
+ const llvm::opt::Arg *const CachedRTTIArg;
+ const RTTIMode CachedRTTIMode;
/// The list of toolchain specific path prefixes to search for
/// files.
@@ -134,6 +144,12 @@ public:
const SanitizerArgs& getSanitizerArgs() const;
+ // Returns the Arg * that explicitly turned on/off rtti, or nullptr.
+ const llvm::opt::Arg *getRTTIArg() const { return CachedRTTIArg; }
+
+ // Returns the RTTIMode for the toolchain with the current arguments.
+ RTTIMode getRTTIMode() const { return CachedRTTIMode; }
+
// Tool access.
/// TranslateArgs - Create a new derived argument list for any argument
@@ -251,7 +267,7 @@ public:
/// getThreadModel() - Which thread model does this target use?
virtual std::string getThreadModel() const { return "posix"; }
- /// supportsThreadModel() - Does this target support a thread model?
+ /// isThreadModelSupported() - Does this target support a thread model?
virtual bool isThreadModelSupported(const StringRef Model) const;
/// ComputeLLVMTriple - Return the LLVM target triple to use, after taking
diff --git a/include/clang/Format/Format.h b/include/clang/Format/Format.h
index a04705c36d..60c54abd1a 100644
--- a/include/clang/Format/Format.h
+++ b/include/clang/Format/Format.h
@@ -212,6 +212,8 @@ struct FormatStyle {
SFS_None,
/// \brief Only merge functions defined inside a class.
SFS_Inline,
+ /// \brief Only merge empty functions.
+ SFS_Empty,
/// \brief Merge all functions fitting on a single line.
SFS_All,
};
@@ -238,6 +240,10 @@ struct FormatStyle {
/// \endcode
bool AlignAfterOpenBracket;
+ /// \brief If \c true, horizontally align operands of binary and ternary
+ /// expressions.
+ bool AlignOperands;
+
/// \brief If \c true, aligns trailing comments.
bool AlignTrailingComments;
@@ -405,6 +411,7 @@ struct FormatStyle {
bool operator==(const FormatStyle &R) const {
return AccessModifierOffset == R.AccessModifierOffset &&
AlignAfterOpenBracket == R.AlignAfterOpenBracket &&
+ AlignOperands == R.AlignOperands &&
AlignEscapedNewlinesLeft == R.AlignEscapedNewlinesLeft &&
AlignTrailingComments == R.AlignTrailingComments &&
AllowAllParametersOfDeclarationOnNextLine ==
diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h
index 54e06efefd..757fcae988 100644
--- a/include/clang/Frontend/ASTConsumers.h
+++ b/include/clang/Frontend/ASTConsumers.h
@@ -15,7 +15,6 @@
#define LLVM_CLANG_FRONTEND_ASTCONSUMERS_H
#include "clang/Basic/LLVM.h"
-
#include <memory>
namespace clang {
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index 634224d08b..79adf5946d 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -416,8 +416,8 @@ private:
/// \brief Clear out and deallocate
void ClearCachedCompletionResults();
- ASTUnit(const ASTUnit &) LLVM_DELETED_FUNCTION;
- void operator=(const ASTUnit &) LLVM_DELETED_FUNCTION;
+ ASTUnit(const ASTUnit &) = delete;
+ void operator=(const ASTUnit &) = delete;
explicit ASTUnit(bool MainFileIsAST);
@@ -675,8 +675,8 @@ public:
/// \brief Returns an iterator range for the local preprocessing entities
/// of the local Preprocessor, if this is a parsed source file, or the loaded
/// preprocessing entities of the primary module if this is an AST file.
- std::pair<PreprocessingRecord::iterator, PreprocessingRecord::iterator>
- getLocalPreprocessingEntities() const;
+ llvm::iterator_range<PreprocessingRecord::iterator>
+ getLocalPreprocessingEntities() const;
/// \brief Type for a function iterating over a number of declarations.
/// \returns true to continue iteration and false to abort.
diff --git a/include/clang/Frontend/CodeGenOptions.def b/include/clang/Frontend/CodeGenOptions.def
index 8e0c78a7bd..f14898fd18 100644
--- a/include/clang/Frontend/CodeGenOptions.def
+++ b/include/clang/Frontend/CodeGenOptions.def
@@ -40,6 +40,7 @@ CODEGENOPT(CXAAtExit , 1, 1) ///< Use __cxa_atexit for calling destructo
CODEGENOPT(CXXCtorDtorAliases, 1, 0) ///< Emit complete ctors/dtors as linker
///< aliases to base ctors when possible.
CODEGENOPT(DataSections , 1, 0) ///< Set when -fdata-sections is enabled.
+CODEGENOPT(UniqueSectionNames, 1, 1) ///< Set for -funique-section-names.
CODEGENOPT(DisableFPElim , 1, 0) ///< Set when -fomit-frame-pointer is enabled.
CODEGENOPT(DisableFree , 1, 0) ///< Don't free memory.
CODEGENOPT(DisableGCov , 1, 0) ///< Don't run the GCov pass, for testing.
@@ -68,6 +69,7 @@ CODEGENOPT(LessPreciseFPMAD , 1, 0) ///< Enable less precise MAD instructions t
///< be generated.
CODEGENOPT(MergeAllConstants , 1, 1) ///< Merge identical constants.
CODEGENOPT(MergeFunctions , 1, 0) ///< Set when -fmerge-functions is enabled.
+CODEGENOPT(MSVolatile , 1, 0) ///< Set when /volatile:ms is enabled.
CODEGENOPT(NoCommon , 1, 0) ///< Set when -fno-common or C++ is enabled.
CODEGENOPT(NoDwarfDirectoryAsm , 1, 0) ///< Set when -fno-dwarf-directory-asm is
///< enabled.
@@ -78,6 +80,7 @@ CODEGENOPT(EnableSegmentedStacks , 1, 0) ///< Set when -fsplit-stack is enabled.
CODEGENOPT(NoGlobalMerge , 1, 0) ///< Set when -mno-global-merge is enabled.
CODEGENOPT(NoImplicitFloat , 1, 0) ///< Set when -mno-implicit-float is enabled.
CODEGENOPT(NoInfsFPMath , 1, 0) ///< Assume FP arguments, results not +-Inf.
+CODEGENOPT(NoSignedZeros , 1, 0) ///< Allow ignoring the signedness of FP zero
CODEGENOPT(NoInline , 1, 0) ///< Set when -fno-inline is enabled.
///< Disables use of the inline keyword.
CODEGENOPT(NoNaNsFPMath , 1, 0) ///< Assume FP arguments, results not NaN.
@@ -86,7 +89,7 @@ CODEGENOPT(NoZeroInitializedInBSS , 1, 0) ///< -fno-zero-initialized-in-bss.
ENUM_CODEGENOPT(ObjCDispatchMethod, ObjCDispatchMethodKind, 2, Legacy)
CODEGENOPT(OmitLeafFramePointer , 1, 0) ///< Set when -momit-leaf-frame-pointer is
///< enabled.
-VALUE_CODEGENOPT(OptimizationLevel, 3, 0) ///< The -O[0-4] option specified.
+VALUE_CODEGENOPT(OptimizationLevel, 2, 0) ///< The -O[0-3] option specified.
VALUE_CODEGENOPT(OptimizeSize, 2, 0) ///< If -Os (==1) or -Oz (==2) is specified.
CODEGENOPT(ProfileInstrGenerate , 1, 0) ///< Instrument code to generate
@@ -137,6 +140,8 @@ CODEGENOPT(UseInitArray , 1, 0) ///< Control whether to use .init_array or
///< .ctors.
VALUE_CODEGENOPT(StackAlignment , 32, 0) ///< Overrides default stack
///< alignment, if not 0.
+VALUE_CODEGENOPT(StackProbeSize , 32, 4096) ///< Overrides default stack
+ ///< probe size, even if 0.
CODEGENOPT(DebugColumnInfo, 1, 0) ///< Whether or not to use column information
///< in debug info.
@@ -159,9 +164,6 @@ ENUM_CODEGENOPT(Inlining, InliningMethod, 2, NoInlining)
/// The default TLS model to use.
ENUM_CODEGENOPT(DefaultTLSModel, TLSModel, 2, GeneralDynamicTLSModel)
-CODEGENOPT(SanitizeRecover, 1, 1) ///< Attempt to recover from sanitizer checks
- ///< by continuing execution when possible
-
#undef CODEGENOPT
#undef ENUM_CODEGENOPT
#undef VALUE_CODEGENOPT
diff --git a/include/clang/Frontend/CodeGenOptions.h b/include/clang/Frontend/CodeGenOptions.h
index 4e6171fbfe..819606429e 100644
--- a/include/clang/Frontend/CodeGenOptions.h
+++ b/include/clang/Frontend/CodeGenOptions.h
@@ -14,10 +14,11 @@
#ifndef LLVM_CLANG_FRONTEND_CODEGENOPTIONS_H
#define LLVM_CLANG_FRONTEND_CODEGENOPTIONS_H
+#include "clang/Basic/Sanitizers.h"
+#include "llvm/Support/Regex.h"
#include <memory>
#include <string>
#include <vector>
-#include "llvm/Support/Regex.h"
namespace clang {
@@ -176,6 +177,13 @@ public:
/// flag.
std::shared_ptr<llvm::Regex> OptimizationRemarkAnalysisPattern;
+ /// Set of files definining the rules for the symbol rewriting.
+ std::vector<std::string> RewriteMapFiles;
+
+ /// Set of sanitizer checks that are non-fatal (i.e. execution should be
+ /// continued when possible).
+ SanitizerSet SanitizeRecover;
+
public:
// Define accessors/mutators for code generation options of enumeration type.
#define CODEGENOPT(Name, Bits, Default)
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h
index 31a0d098a2..ed013290e8 100644
--- a/include/clang/Frontend/CompilerInstance.h
+++ b/include/clang/Frontend/CompilerInstance.h
@@ -10,11 +10,11 @@
#ifndef LLVM_CLANG_FRONTEND_COMPILERINSTANCE_H_
#define LLVM_CLANG_FRONTEND_COMPILERINSTANCE_H_
+#include "clang/AST/ASTConsumer.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Frontend/CompilerInvocation.h"
#include "clang/Frontend/Utils.h"
-#include "clang/AST/ASTConsumer.h"
#include "clang/Lex/ModuleLoader.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
@@ -121,6 +121,10 @@ class CompilerInstance : public ModuleLoader {
/// \brief Module names that have an override for the target file.
llvm::StringMap<std::string> ModuleFileOverrides;
+ /// \brief Module files that we've explicitly loaded via \ref loadModuleFile,
+ /// and their dependencies.
+ llvm::StringSet<> ExplicitlyLoadedModuleFiles;
+
/// \brief The location of the module-import keyword for the last module
/// import.
SourceLocation LastModuleImportLoc;
@@ -157,8 +161,8 @@ class CompilerInstance : public ModuleLoader {
/// The list of active output files.
std::list<OutputFile> OutputFiles;
- CompilerInstance(const CompilerInstance &) LLVM_DELETED_FUNCTION;
- void operator=(const CompilerInstance &) LLVM_DELETED_FUNCTION;
+ CompilerInstance(const CompilerInstance &) = delete;
+ void operator=(const CompilerInstance &) = delete;
public:
explicit CompilerInstance(bool BuildingModule = false);
~CompilerInstance();
@@ -250,6 +254,9 @@ public:
return Invocation->getDiagnosticOpts();
}
+ FileSystemOptions &getFileSystemOpts() {
+ return Invocation->getFileSystemOpts();
+ }
const FileSystemOptions &getFileSystemOpts() const {
return Invocation->getFileSystemOpts();
}
@@ -572,6 +579,8 @@ public:
/// and replace any existing one with it.
void createPreprocessor(TranslationUnitKind TUKind);
+ std::string getSpecificModuleCachePath();
+
/// Create the AST context.
void createASTContext();
@@ -585,7 +594,7 @@ public:
/// Create an external AST source to read a PCH file.
///
/// \return - The new object on success, or null on failure.
- static ExternalASTSource *createPCHExternalASTSource(
+ static IntrusiveRefCntPtr<ASTReader> createPCHExternalASTSource(
StringRef Path, const std::string &Sysroot, bool DisablePCHValidation,
bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context,
void *DeserializationListener, bool OwnDeserializationListener,
diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h
index f05ab80c8d..7d12548043 100644
--- a/include/clang/Frontend/CompilerInvocation.h
+++ b/include/clang/Frontend/CompilerInvocation.h
@@ -50,7 +50,7 @@ bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args,
DiagnosticsEngine *Diags = nullptr);
class CompilerInvocationBase : public RefCountedBase<CompilerInvocation> {
- void operator=(const CompilerInvocationBase &) LLVM_DELETED_FUNCTION;
+ void operator=(const CompilerInvocationBase &) = delete;
public:
/// Options controlling the language variant.
diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h
index 4e93b4ee10..71c5aa47af 100644
--- a/include/clang/Frontend/FrontendOptions.h
+++ b/include/clang/Frontend/FrontendOptions.h
@@ -233,6 +233,9 @@ public:
/// The list of plugins to load.
std::vector<std::string> Plugins;
+ /// \brief The list of module map files to load before processing the input.
+ std::vector<std::string> ModuleMapFiles;
+
/// \brief The list of additional prebuilt module files to load before
/// processing the input.
std::vector<std::string> ModuleFiles;
diff --git a/include/clang/Frontend/MultiplexConsumer.h b/include/clang/Frontend/MultiplexConsumer.h
index c9122dacb8..2553275dac 100644
--- a/include/clang/Frontend/MultiplexConsumer.h
+++ b/include/clang/Frontend/MultiplexConsumer.h
@@ -49,7 +49,7 @@ public:
llvm::StringRef Value) override;
void HandleDependentLibrary(llvm::StringRef Lib) override;
void CompleteTentativeDefinition(VarDecl *D) override;
- void HandleVTable(CXXRecordDecl *RD, bool DefinitionRequired) override;
+ void HandleVTable(CXXRecordDecl *RD) override;
ASTMutationListener *GetASTMutationListener() override;
ASTDeserializationListener *GetASTDeserializationListener() override;
void PrintStats() override;
diff --git a/include/clang/Frontend/PreprocessorOutputOptions.h b/include/clang/Frontend/PreprocessorOutputOptions.h
index e273dd613d..f86c49039e 100644
--- a/include/clang/Frontend/PreprocessorOutputOptions.h
+++ b/include/clang/Frontend/PreprocessorOutputOptions.h
@@ -19,6 +19,7 @@ public:
unsigned ShowCPP : 1; ///< Print normal preprocessed output.
unsigned ShowComments : 1; ///< Show comments.
unsigned ShowLineMarkers : 1; ///< Show \#line markers.
+ unsigned UseLineDirectives : 1; ///< Use \#line instead of GCC-style \# N.
unsigned ShowMacroComments : 1; ///< Show comments, even in macros.
unsigned ShowMacros : 1; ///< Print macro definitions.
unsigned RewriteIncludes : 1; ///< Preprocess include directives only.
@@ -28,6 +29,7 @@ public:
ShowCPP = 0;
ShowComments = 0;
ShowLineMarkers = 1;
+ UseLineDirectives = 0;
ShowMacroComments = 0;
ShowMacros = 0;
RewriteIncludes = 0;
diff --git a/include/clang/Frontend/VerifyDiagnosticConsumer.h b/include/clang/Frontend/VerifyDiagnosticConsumer.h
index 80e140bc50..aa0bcc9319 100644
--- a/include/clang/Frontend/VerifyDiagnosticConsumer.h
+++ b/include/clang/Frontend/VerifyDiagnosticConsumer.h
@@ -180,8 +180,8 @@ public:
}
private:
- Directive(const Directive &) LLVM_DELETED_FUNCTION;
- void operator=(const Directive &) LLVM_DELETED_FUNCTION;
+ Directive(const Directive &) = delete;
+ void operator=(const Directive &) = delete;
};
typedef std::vector<std::unique_ptr<Directive>> DirectiveList;
diff --git a/include/clang/Lex/HeaderMap.h b/include/clang/Lex/HeaderMap.h
index 5dac9b7c35..183361e4f8 100644
--- a/include/clang/Lex/HeaderMap.h
+++ b/include/clang/Lex/HeaderMap.h
@@ -16,7 +16,6 @@
#include "clang/Basic/LLVM.h"
#include "llvm/Support/Compiler.h"
-
#include <memory>
namespace llvm {
@@ -33,8 +32,8 @@ namespace clang {
/// symlinks to files. Its advantages are that it is dense and more efficient
/// to create and process than a directory of symlinks.
class HeaderMap {
- HeaderMap(const HeaderMap &) LLVM_DELETED_FUNCTION;
- void operator=(const HeaderMap &) LLVM_DELETED_FUNCTION;
+ HeaderMap(const HeaderMap &) = delete;
+ void operator=(const HeaderMap &) = delete;
std::unique_ptr<const llvm::MemoryBuffer> FileBuffer;
bool NeedsBSwap;
diff --git a/include/clang/Lex/HeaderSearch.h b/include/clang/Lex/HeaderSearch.h
index 47e3313320..28e7da37fd 100644
--- a/include/clang/Lex/HeaderSearch.h
+++ b/include/clang/Lex/HeaderSearch.h
@@ -252,11 +252,11 @@ class HeaderSearch {
unsigned NumMultiIncludeFileOptzn;
unsigned NumFrameworkLookups, NumSubFrameworkLookups;
- bool EnabledModules;
+ const LangOptions &LangOpts;
// HeaderSearch doesn't support default or copy construction.
- HeaderSearch(const HeaderSearch&) LLVM_DELETED_FUNCTION;
- void operator=(const HeaderSearch&) LLVM_DELETED_FUNCTION;
+ HeaderSearch(const HeaderSearch&) = delete;
+ void operator=(const HeaderSearch&) = delete;
friend class DirectoryLookup;
@@ -479,7 +479,7 @@ public:
const HeaderMap *CreateHeaderMap(const FileEntry *FE);
/// Returns true if modules are enabled.
- bool enabledModules() const { return EnabledModules; }
+ bool enabledModules() const { return LangOpts.Modules; }
/// \brief Retrieve the name of the module file that should be used to
/// load the given module.
@@ -640,7 +640,8 @@ private:
};
LoadModuleMapResult loadModuleMapFileImpl(const FileEntry *File,
- bool IsSystem);
+ bool IsSystem,
+ const DirectoryEntry *Dir);
/// \brief Try to load the module map file in the given directory.
///
diff --git a/include/clang/Lex/HeaderSearchOptions.h b/include/clang/Lex/HeaderSearchOptions.h
index 06024b2e90..775943de81 100644
--- a/include/clang/Lex/HeaderSearchOptions.h
+++ b/include/clang/Lex/HeaderSearchOptions.h
@@ -101,6 +101,15 @@ public:
/// \brief Interpret module maps. This option is implied by full modules.
unsigned ModuleMaps : 1;
+ /// \brief Set the 'home directory' of a module map file to the current
+ /// working directory (or the home directory of the module map file that
+ /// contained the 'extern module' directive importing this module map file
+ /// if any) rather than the directory containing the module map file.
+ //
+ /// The home directory is where we look for files named in the module map
+ /// file.
+ unsigned ModuleMapFileHomeIsCwd : 1;
+
/// \brief The interval (in seconds) between pruning operations.
///
/// This operation is expensive, because it requires Clang to walk through
@@ -129,9 +138,6 @@ public:
/// of computing the module hash.
llvm::SetVector<std::string> ModulesIgnoreMacros;
- /// \brief The set of user-provided module-map-files.
- llvm::SetVector<std::string> ModuleMapFiles;
-
/// \brief The set of user-provided virtual filesystem overlay files.
std::vector<std::string> VFSOverlayFiles;
@@ -161,6 +167,7 @@ public:
public:
HeaderSearchOptions(StringRef _Sysroot = "/")
: Sysroot(_Sysroot), DisableModuleHash(0), ModuleMaps(0),
+ ModuleMapFileHomeIsCwd(0),
ModuleCachePruneInterval(7*24*60*60),
ModuleCachePruneAfter(31*24*60*60),
BuildSessionTimestamp(0),
diff --git a/include/clang/Lex/Lexer.h b/include/clang/Lex/Lexer.h
index c1f968be55..07564b9de7 100644
--- a/include/clang/Lex/Lexer.h
+++ b/include/clang/Lex/Lexer.h
@@ -89,8 +89,8 @@ class Lexer : public PreprocessorLexer {
// CurrentConflictMarkerState - The kind of conflict marker we are handling.
ConflictMarkerKind CurrentConflictMarkerState;
- Lexer(const Lexer &) LLVM_DELETED_FUNCTION;
- void operator=(const Lexer &) LLVM_DELETED_FUNCTION;
+ Lexer(const Lexer &) = delete;
+ void operator=(const Lexer &) = delete;
friend class Preprocessor;
void InitLexer(const char *BufStart, const char *BufPtr, const char *BufEnd);
@@ -323,6 +323,26 @@ public:
const SourceManager &SM,
const LangOptions &LangOpts);
+ /// \brief Given a token range, produce a corresponding CharSourceRange that
+ /// is not a token range. This allows the source range to be used by
+ /// components that don't have access to the lexer and thus can't find the
+ /// end of the range for themselves.
+ static CharSourceRange getAsCharRange(SourceRange Range,
+ const SourceManager &SM,
+ const LangOptions &LangOpts) {
+ SourceLocation End = getLocForEndOfToken(Range.getEnd(), 0, SM, LangOpts);
+ return End.isInvalid() ? CharSourceRange()
+ : CharSourceRange::getCharRange(
+ Range.getBegin(), End.getLocWithOffset(-1));
+ }
+ static CharSourceRange getAsCharRange(CharSourceRange Range,
+ const SourceManager &SM,
+ const LangOptions &LangOpts) {
+ return Range.isTokenRange()
+ ? getAsCharRange(Range.getAsRange(), SM, LangOpts)
+ : Range;
+ }
+
/// \brief Returns true if the given MacroID location points at the first
/// token of the macro expansion.
///
diff --git a/include/clang/Lex/MacroInfo.h b/include/clang/Lex/MacroInfo.h
index ca5d497048..8a113cbbe7 100644
--- a/include/clang/Lex/MacroInfo.h
+++ b/include/clang/Lex/MacroInfo.h
@@ -444,7 +444,7 @@ public:
bool isValid() const { return DefDirective != nullptr; }
bool isInvalid() const { return !isValid(); }
- LLVM_EXPLICIT operator bool() const { return isValid(); }
+ explicit operator bool() const { return isValid(); }
inline DefInfo getPreviousDefinition();
const DefInfo getPreviousDefinition() const {
diff --git a/include/clang/Lex/ModuleMap.h b/include/clang/Lex/ModuleMap.h
index 553716b8f6..d281421ee0 100644
--- a/include/clang/Lex/ModuleMap.h
+++ b/include/clang/Lex/ModuleMap.h
@@ -104,7 +104,7 @@ public:
// \brief Whether this known header is valid (i.e., it has an
// associated module).
- LLVM_EXPLICIT operator bool() const {
+ explicit operator bool() const {
return Storage.getPointer() != nullptr;
}
};
@@ -127,15 +127,29 @@ private:
/// header.
llvm::DenseMap<const DirectoryEntry *, Module *> UmbrellaDirs;
+ /// \brief The set of attributes that can be attached to a module.
+ struct Attributes {
+ Attributes() : IsSystem(), IsExternC(), IsExhaustive() {}
+
+ /// \brief Whether this is a system module.
+ unsigned IsSystem : 1;
+
+ /// \brief Whether this is an extern "C" module.
+ unsigned IsExternC : 1;
+
+ /// \brief Whether this is an exhaustive set of configuration macros.
+ unsigned IsExhaustive : 1;
+ };
+
/// \brief A directory for which framework modules can be inferred.
struct InferredDirectory {
- InferredDirectory() : InferModules(), InferSystemModules() { }
+ InferredDirectory() : InferModules() {}
/// \brief Whether to infer modules from this directory.
unsigned InferModules : 1;
- /// \brief Whether the modules we infer are [system] modules.
- unsigned InferSystemModules : 1;
+ /// \brief The attributes to use for inferred modules.
+ Attributes Attrs;
/// \brief If \c InferModules is non-zero, the module map file that allowed
/// inferred modules. Otherwise, nullptr.
@@ -214,6 +228,10 @@ private:
return static_cast<bool>(findHeaderInUmbrellaDirs(File, IntermediateDirs));
}
+ Module *inferFrameworkModule(StringRef ModuleName,
+ const DirectoryEntry *FrameworkDir,
+ Attributes Attrs, Module *Parent);
+
public:
/// \brief Construct a new module map.
///
@@ -331,22 +349,6 @@ public:
bool IsFramework,
bool IsExplicit);
- /// \brief Determine whether we can infer a framework module a framework
- /// with the given name in the given
- ///
- /// \param ParentDir The directory that is the parent of the framework
- /// directory.
- ///
- /// \param Name The name of the module.
- ///
- /// \param IsSystem Will be set to 'true' if the inferred module must be a
- /// system module.
- ///
- /// \returns true if we are allowed to infer a framework module, and false
- /// otherwise.
- bool canInferFrameworkModule(const DirectoryEntry *ParentDir,
- StringRef Name, bool &IsSystem) const;
-
/// \brief Infer the contents of a framework module map from the given
/// framework directory.
Module *inferFrameworkModule(StringRef ModuleName,
@@ -440,11 +442,11 @@ public:
/// \brief Adds this header to the given module.
/// \param Role The role of the header wrt the module.
- void addHeader(Module *Mod, const FileEntry *Header,
+ void addHeader(Module *Mod, Module::Header Header,
ModuleHeaderRole Role);
/// \brief Marks this header as being excluded from the given module.
- void excludeHeader(Module *Mod, const FileEntry *Header);
+ void excludeHeader(Module *Mod, Module::Header Header);
/// \brief Parse the given module map file, and record any modules we
/// encounter.
@@ -454,8 +456,12 @@ public:
/// \param IsSystem Whether this module map file is in a system header
/// directory, and therefore should be considered a system module.
///
+ /// \param HomeDir The directory in which relative paths within this module
+ /// map file will be resolved.
+ ///
/// \returns true if an error occurred, false otherwise.
- bool parseModuleMapFile(const FileEntry *File, bool IsSystem);
+ bool parseModuleMapFile(const FileEntry *File, bool IsSystem,
+ const DirectoryEntry *HomeDir);
/// \brief Dump the contents of the module map, for debugging purposes.
void dump();
diff --git a/include/clang/Lex/PTHLexer.h b/include/clang/Lex/PTHLexer.h
index 54c91f6b08..75abf6bf70 100644
--- a/include/clang/Lex/PTHLexer.h
+++ b/include/clang/Lex/PTHLexer.h
@@ -44,8 +44,8 @@ class PTHLexer : public PreprocessorLexer {
/// to process when doing quick skipping of preprocessor blocks.
const unsigned char* CurPPCondPtr;
- PTHLexer(const PTHLexer &) LLVM_DELETED_FUNCTION;
- void operator=(const PTHLexer &) LLVM_DELETED_FUNCTION;
+ PTHLexer(const PTHLexer &) = delete;
+ void operator=(const PTHLexer &) = delete;
/// ReadToken - Used by PTHLexer to read tokens TokBuf.
void ReadToken(Token& T);
diff --git a/include/clang/Lex/PTHManager.h b/include/clang/Lex/PTHManager.h
index 64ecf5f575..e09afefe35 100644
--- a/include/clang/Lex/PTHManager.h
+++ b/include/clang/Lex/PTHManager.h
@@ -91,8 +91,8 @@ class PTHManager : public IdentifierInfoLookup {
std::unique_ptr<PTHStringIdLookup> stringIdLookup, unsigned numIds,
const unsigned char *spellingBase, const char *originalSourceFile);
- PTHManager(const PTHManager &) LLVM_DELETED_FUNCTION;
- void operator=(const PTHManager &) LLVM_DELETED_FUNCTION;
+ PTHManager(const PTHManager &) = delete;
+ void operator=(const PTHManager &) = delete;
/// getSpellingAtPTHOffset - Used by PTHLexer classes to get the cached
/// spelling for a token.
diff --git a/include/clang/Lex/PreprocessingRecord.h b/include/clang/Lex/PreprocessingRecord.h
index 4609fe3c68..3f9679c77c 100644
--- a/include/clang/Lex/PreprocessingRecord.h
+++ b/include/clang/Lex/PreprocessingRecord.h
@@ -518,23 +518,24 @@ namespace clang {
return iterator(this, PreprocessedEntities.size());
}
- /// \brief begin/end iterator pair for the given range of loaded
+ /// \brief iterator range for the given range of loaded
/// preprocessed entities.
- std::pair<iterator, iterator>
- getIteratorsForLoadedRange(unsigned start, unsigned count) {
+ llvm::iterator_range<iterator> getIteratorsForLoadedRange(unsigned start,
+ unsigned count) {
unsigned end = start + count;
assert(end <= LoadedPreprocessedEntities.size());
- return std::make_pair(
- iterator(this, int(start)-LoadedPreprocessedEntities.size()),
- iterator(this, int(end)-LoadedPreprocessedEntities.size()));
+ return llvm::make_range(
+ iterator(this, int(start) - LoadedPreprocessedEntities.size()),
+ iterator(this, int(end) - LoadedPreprocessedEntities.size()));
}
- /// \brief Returns a pair of [Begin, End) iterators of preprocessed entities
- /// that source range \p R encompasses.
+ /// \brief Returns a range of preprocessed entities that source range \p R
+ /// encompasses.
///
/// \param R the range to look for preprocessed entities.
///
- std::pair<iterator, iterator> getPreprocessedEntitiesInRange(SourceRange R);
+ llvm::iterator_range<iterator>
+ getPreprocessedEntitiesInRange(SourceRange R);
/// \brief Returns true if the preprocessed entity that \p PPEI iterator
/// points to is coming from the file \p FID.
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index d16f212816..326f519e91 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -136,6 +136,7 @@ class Preprocessor : public RefCountedBase<Preprocessor> {
IdentifierInfo *Ident__building_module; // __building_module
IdentifierInfo *Ident__MODULE__; // __MODULE__
IdentifierInfo *Ident__has_cpp_attribute; // __has_cpp_attribute
+ IdentifierInfo *Ident__has_declspec; // __has_declspec_attribute
SourceLocation DATELoc, TIMELoc;
unsigned CounterValue; // Next __COUNTER__ value.
@@ -257,6 +258,11 @@ class Preprocessor : public RefCountedBase<Preprocessor> {
/// \brief True if we hit the code-completion point.
bool CodeCompletionReached;
+ /// \brief The directory that the main file should be considered to occupy,
+ /// if it does not correspond to a real file (as happens when building a
+ /// module).
+ const DirectoryEntry *MainFileDir;
+
/// \brief The number of bytes that we will initially skip when entering the
/// main file, along with a flag that indicates whether skipping this number
/// of bytes will place the lexer at the start of a line.
@@ -1014,6 +1020,12 @@ public:
PragmaARCCFCodeAuditedLoc = Loc;
}
+ /// \brief Set the directory in which the main file should be considered
+ /// to have been found, if it is not a real file.
+ void setMainFileDir(const DirectoryEntry *Dir) {
+ MainFileDir = Dir;
+ }
+
/// \brief Instruct the preprocessor to skip part of the main source file.
///
/// \param Bytes The number of bytes in the preamble to skip.
@@ -1368,7 +1380,8 @@ public:
/// followed by EOD. Return true if the token is not a valid on-off-switch.
bool LexOnOffSwitch(tok::OnOffSwitch &OOS);
- bool CheckMacroName(Token &MacroNameTok, MacroUse isDefineUndef);
+ bool CheckMacroName(Token &MacroNameTok, MacroUse isDefineUndef,
+ bool *ShadowFlag = nullptr);
private:
@@ -1408,11 +1421,17 @@ private:
bool isPublic);
/// \brief Lex and validate a macro name, which occurs after a
- /// \#define or \#undef.
+ /// \#define or \#undef.
+ ///
+ /// \param MacroNameTok Token that represents the name defined or undefined.
+ /// \param IsDefineUndef Kind if preprocessor directive.
+ /// \param ShadowFlag Points to flag that is set if macro name shadows
+ /// a keyword.
///
/// This emits a diagnostic, sets the token kind to eod,
/// and discards the rest of the macro line if the macro name is invalid.
- void ReadMacroName(Token &MacroNameTok, MacroUse isDefineUndef = MU_Other);
+ void ReadMacroName(Token &MacroNameTok, MacroUse IsDefineUndef = MU_Other,
+ bool *ShadowFlag = nullptr);
/// The ( starting an argument list of a macro definition has just been read.
/// Lex the rest of the arguments and the closing ), updating \p MI with
diff --git a/include/clang/Lex/PreprocessorLexer.h b/include/clang/Lex/PreprocessorLexer.h
index 3a91fa72f2..6d6cf05a96 100644
--- a/include/clang/Lex/PreprocessorLexer.h
+++ b/include/clang/Lex/PreprocessorLexer.h
@@ -69,8 +69,8 @@ protected:
/// we are currently in.
SmallVector<PPConditionalInfo, 4> ConditionalStack;
- PreprocessorLexer(const PreprocessorLexer &) LLVM_DELETED_FUNCTION;
- void operator=(const PreprocessorLexer &) LLVM_DELETED_FUNCTION;
+ PreprocessorLexer(const PreprocessorLexer &) = delete;
+ void operator=(const PreprocessorLexer &) = delete;
friend class Preprocessor;
PreprocessorLexer(Preprocessor *pp, FileID fid);
diff --git a/include/clang/Lex/Token.h b/include/clang/Lex/Token.h
index a58c0c583f..4a53c9c1bb 100644
--- a/include/clang/Lex/Token.h
+++ b/include/clang/Lex/Token.h
@@ -58,6 +58,8 @@ class Token {
/// may be dirty (have trigraphs / escaped newlines).
/// Annotations (resolved type names, C++ scopes, etc): isAnnotation().
/// This is a pointer to sema-specific data for the annotation token.
+ /// Eof:
+ // This is a pointer to a Decl.
/// Other:
/// This is null.
void *PtrData;
@@ -66,7 +68,7 @@ class Token {
tok::TokenKind Kind;
/// Flags - Bits we track about this token, members of the TokenFlags enum.
- unsigned char Flags;
+ unsigned short Flags;
public:
// Various flags set per token:
@@ -80,7 +82,9 @@ public:
LeadingEmptyMacro = 0x10, // Empty macro exists before this token.
HasUDSuffix = 0x20, // This string or character literal has a ud-suffix.
HasUCN = 0x40, // This identifier contains a UCN.
- IgnoredComma = 0x80 // This comma is not a macro argument separator (MS).
+ IgnoredComma = 0x80, // This comma is not a macro argument separator (MS).
+ StringifiedInMacro = 0x100, // This string or character literal is formed by
+ // macro stringizing or charizing operator.
};
tok::TokenKind getKind() const { return Kind; }
@@ -162,12 +166,23 @@ public:
assert(!isAnnotation() &&
"getIdentifierInfo() on an annotation token!");
if (isLiteral()) return nullptr;
+ if (is(tok::eof)) return nullptr;
return (IdentifierInfo*) PtrData;
}
void setIdentifierInfo(IdentifierInfo *II) {
PtrData = (void*) II;
}
+ const void *getEofData() const {
+ assert(is(tok::eof));
+ return reinterpret_cast<const void *>(PtrData);
+ }
+ void setEofData(const void *D) {
+ assert(is(tok::eof));
+ assert(!PtrData);
+ PtrData = const_cast<void *>(D);
+ }
+
/// getRawIdentifier - For a raw identifier token (i.e., an identifier
/// lexed in raw mode), returns a reference to the text substring in the
/// buffer if known.
@@ -262,6 +277,12 @@ public:
/// Returns true if this token contains a universal character name.
bool hasUCN() const { return (Flags & HasUCN) ? true : false; }
+
+ /// Returns true if this token is formed by macro by stringizing or charizing
+ /// operator.
+ bool stringifiedInMacro() const {
+ return (Flags & StringifiedInMacro) ? true : false;
+ }
};
/// \brief Information about the conditional stack (\#if directives)
diff --git a/include/clang/Lex/TokenLexer.h b/include/clang/Lex/TokenLexer.h
index 306f98e260..31197367c4 100644
--- a/include/clang/Lex/TokenLexer.h
+++ b/include/clang/Lex/TokenLexer.h
@@ -99,8 +99,8 @@ class TokenLexer {
/// should not be subject to further macro expansion.
bool DisableMacroExpansion : 1;
- TokenLexer(const TokenLexer &) LLVM_DELETED_FUNCTION;
- void operator=(const TokenLexer &) LLVM_DELETED_FUNCTION;
+ TokenLexer(const TokenLexer &) = delete;
+ void operator=(const TokenLexer &) = delete;
public:
/// Create a TokenLexer for the specified macro with the specified actual
/// arguments. Note that this ctor takes ownership of the ActualArgs pointer.
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index 38073c37c7..bb23b74a4b 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -339,7 +339,7 @@ private:
void UnconsumeToken(Token &Consumed) {
Token Next = Tok;
PP.EnterToken(Consumed);
- ConsumeToken();
+ PP.Lex(Tok);
PP.EnterToken(Next);
}
@@ -745,8 +745,8 @@ public:
/// the parser will exit the scope.
class ParseScope {
Parser *Self;
- ParseScope(const ParseScope &) LLVM_DELETED_FUNCTION;
- void operator=(const ParseScope &) LLVM_DELETED_FUNCTION;
+ ParseScope(const ParseScope &) = delete;
+ void operator=(const ParseScope &) = delete;
public:
// ParseScope - Construct a new object to manage a scope in the
@@ -790,8 +790,8 @@ private:
class ParseScopeFlags {
Scope *CurScope;
unsigned OldFlags;
- ParseScopeFlags(const ParseScopeFlags &) LLVM_DELETED_FUNCTION;
- void operator=(const ParseScopeFlags &) LLVM_DELETED_FUNCTION;
+ ParseScopeFlags(const ParseScopeFlags &) = delete;
+ void operator=(const ParseScopeFlags &) = delete;
public:
ParseScopeFlags(Parser *Self, unsigned ScopeFlags, bool ManageFlags = true);
@@ -1362,12 +1362,9 @@ private:
typedef SmallVector<SourceLocation, 20> CommaLocsTy;
/// ParseExpressionList - Used for C/C++ (argument-)expression-list.
- bool
- ParseExpressionList(SmallVectorImpl<Expr *> &Exprs,
- SmallVectorImpl<SourceLocation> &CommaLocs,
- void (Sema::*Completer)(Scope *S, Expr *Data,
- ArrayRef<Expr *> Args) = nullptr,
- Expr *Data = nullptr);
+ bool ParseExpressionList(SmallVectorImpl<Expr *> &Exprs,
+ SmallVectorImpl<SourceLocation> &CommaLocs,
+ std::function<void()> Completer = nullptr);
/// ParseSimpleExpressionList - A simple comma-separated list of expressions,
/// used for misc language extensions.
@@ -1661,7 +1658,6 @@ private:
// MS: SEH Statements and Blocks
StmtResult ParseSEHTryBlock();
- StmtResult ParseSEHTryBlockCommon(SourceLocation Loc);
StmtResult ParseSEHExceptBlock(SourceLocation Loc);
StmtResult ParseSEHFinallyBlock(SourceLocation Loc);
StmtResult ParseSEHLeaveStatement();
@@ -1728,7 +1724,6 @@ private:
ForRangeInit *FRI = nullptr);
bool MightBeDeclarator(unsigned Context);
DeclGroupPtrTy ParseDeclGroup(ParsingDeclSpec &DS, unsigned Context,
- bool AllowFunctionDefinitions,
SourceLocation *DeclEnd = nullptr,
ForRangeInit *FRI = nullptr);
Decl *ParseDeclarationAfterDeclarator(Declarator &D,
@@ -2094,6 +2089,8 @@ private:
SourceLocation AttrNameLoc,
ParsedAttributes &Attrs);
void ParseMicrosoftTypeAttributes(ParsedAttributes &attrs);
+ void DiagnoseAndSkipExtendedMicrosoftTypeAttributes();
+ SourceLocation SkipExtendedMicrosoftTypeAttributes();
void ParseMicrosoftInheritanceClassAttributes(ParsedAttributes &attrs);
void ParseBorlandTypeAttributes(ParsedAttributes &attrs);
void ParseOpenCLAttributes(ParsedAttributes &attrs);
@@ -2293,7 +2290,7 @@ private:
Decl *TagDecl);
ExprResult ParseCXXMemberInitializer(Decl *D, bool IsFunction,
SourceLocation &EqualLoc);
- void ParseCXXMemberDeclaratorBeforeInitializer(Declarator &DeclaratorInfo,
+ bool ParseCXXMemberDeclaratorBeforeInitializer(Declarator &DeclaratorInfo,
VirtSpecifiers &VS,
ExprResult &BitfieldSize,
LateParsedAttrList &LateAttrs);
diff --git a/include/clang/Rewrite/Core/DeltaTree.h b/include/clang/Rewrite/Core/DeltaTree.h
index 248f2a07ea..fbffb38e37 100644
--- a/include/clang/Rewrite/Core/DeltaTree.h
+++ b/include/clang/Rewrite/Core/DeltaTree.h
@@ -27,7 +27,7 @@ namespace clang {
/// as well, without traversing the whole tree.
class DeltaTree {
void *Root; // "DeltaTreeNode *"
- void operator=(const DeltaTree &) LLVM_DELETED_FUNCTION;
+ void operator=(const DeltaTree &) = delete;
public:
DeltaTree();
diff --git a/include/clang/Rewrite/Core/RewriteRope.h b/include/clang/Rewrite/Core/RewriteRope.h
index 1c6f3eb952..5002554485 100644
--- a/include/clang/Rewrite/Core/RewriteRope.h
+++ b/include/clang/Rewrite/Core/RewriteRope.h
@@ -136,7 +136,7 @@ namespace clang {
class RopePieceBTree {
void /*RopePieceBTreeNode*/ *Root;
- void operator=(const RopePieceBTree &) LLVM_DELETED_FUNCTION;
+ void operator=(const RopePieceBTree &) = delete;
public:
RopePieceBTree();
RopePieceBTree(const RopePieceBTree &RHS);
diff --git a/include/clang/Rewrite/Core/TokenRewriter.h b/include/clang/Rewrite/Core/TokenRewriter.h
index 598477f318..0f71e81c31 100644
--- a/include/clang/Rewrite/Core/TokenRewriter.h
+++ b/include/clang/Rewrite/Core/TokenRewriter.h
@@ -43,8 +43,8 @@ namespace clang {
///
std::unique_ptr<ScratchBuffer> ScratchBuf;
- TokenRewriter(const TokenRewriter &) LLVM_DELETED_FUNCTION;
- void operator=(const TokenRewriter &) LLVM_DELETED_FUNCTION;
+ TokenRewriter(const TokenRewriter &) = delete;
+ void operator=(const TokenRewriter &) = delete;
public:
/// TokenRewriter - This creates a TokenRewriter for the file with the
/// specified FileID.
diff --git a/include/clang/Rewrite/Frontend/ASTConsumers.h b/include/clang/Rewrite/Frontend/ASTConsumers.h
index 8a822edfb7..c9df889504 100644
--- a/include/clang/Rewrite/Frontend/ASTConsumers.h
+++ b/include/clang/Rewrite/Frontend/ASTConsumers.h
@@ -15,7 +15,6 @@
#define LLVM_CLANG_REWRITE_FRONTEND_ASTCONSUMERS_H
#include "clang/Basic/LLVM.h"
-
#include <memory>
#include <string>
diff --git a/include/clang/Sema/AttributeList.h b/include/clang/Sema/AttributeList.h
index c8e8625b0c..58b1b9ee24 100644
--- a/include/clang/Sema/AttributeList.h
+++ b/include/clang/Sema/AttributeList.h
@@ -204,10 +204,10 @@ private:
return *reinterpret_cast<const PropertyData*>(this + 1);
}
- AttributeList(const AttributeList &) LLVM_DELETED_FUNCTION;
- void operator=(const AttributeList &) LLVM_DELETED_FUNCTION;
- void operator delete(void *) LLVM_DELETED_FUNCTION;
- ~AttributeList() LLVM_DELETED_FUNCTION;
+ AttributeList(const AttributeList &) = delete;
+ void operator=(const AttributeList &) = delete;
+ void operator delete(void *) = delete;
+ ~AttributeList() = delete;
size_t allocated_size() const;
@@ -670,7 +670,7 @@ public:
: pool(factory), list(nullptr) {
}
- ParsedAttributes(const ParsedAttributes &) LLVM_DELETED_FUNCTION;
+ ParsedAttributes(const ParsedAttributes &) = delete;
AttributePool &getPool() const { return pool; }
@@ -822,6 +822,7 @@ enum AttributeDeclKind {
ExpectedFunctionMethodOrClass,
ExpectedFunctionMethodOrParameter,
ExpectedClass,
+ ExpectedEnum,
ExpectedVariable,
ExpectedMethod,
ExpectedVariableFunctionOrLabel,
@@ -842,8 +843,10 @@ enum AttributeDeclKind {
ExpectedFunctionVariableOrClass,
ExpectedObjectiveCProtocol,
ExpectedFunctionGlobalVarMethodOrProperty,
+ ExpectedStructOrUnionOrTypedef,
ExpectedStructOrTypedef,
- ExpectedObjectiveCInterfaceOrProtocol
+ ExpectedObjectiveCInterfaceOrProtocol,
+ ExpectedKernelFunction
};
} // end namespace clang
diff --git a/include/clang/Sema/CodeCompleteConsumer.h b/include/clang/Sema/CodeCompleteConsumer.h
index 92a4e9a42f..647eb8b380 100644
--- a/include/clang/Sema/CodeCompleteConsumer.h
+++ b/include/clang/Sema/CodeCompleteConsumer.h
@@ -17,6 +17,7 @@
#include "clang/AST/CanonicalType.h"
#include "clang/AST/Type.h"
#include "clang/Sema/CodeCompleteOptions.h"
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Allocator.h"
@@ -440,8 +441,8 @@ private:
/// entity being completed by this result.
const char *BriefComment;
- CodeCompletionString(const CodeCompletionString &) LLVM_DELETED_FUNCTION;
- void operator=(const CodeCompletionString &) LLVM_DELETED_FUNCTION;
+ CodeCompletionString(const CodeCompletionString &) = delete;
+ void operator=(const CodeCompletionString &) = delete;
CodeCompletionString(const Chunk *Chunks, unsigned NumChunks,
unsigned Priority, CXAvailabilityKind Availability,
@@ -885,7 +886,8 @@ public:
CodeCompletionString *CreateSignatureString(unsigned CurrentArg,
Sema &S,
CodeCompletionAllocator &Allocator,
- CodeCompletionTUInfo &CCTUInfo) const;
+ CodeCompletionTUInfo &CCTUInfo,
+ bool IncludeBriefComments) const;
};
CodeCompleteConsumer(const CodeCompleteOptions &CodeCompleteOpts,
diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h
index 43fcde1abf..76ccb1d23a 100644
--- a/include/clang/Sema/DeclSpec.h
+++ b/include/clang/Sema/DeclSpec.h
@@ -57,7 +57,7 @@ namespace clang {
/// These can be in 3 states:
/// 1) Not present, identified by isEmpty()
/// 2) Present, identified by isNotEmpty()
-/// 2.a) Valid, idenified by isValid()
+/// 2.a) Valid, identified by isValid()
/// 2.b) Invalid, identified by isInvalid().
///
/// isSet() is deprecated because it mostly corresponded to "valid" but was
@@ -407,8 +407,8 @@ private:
return (T == TST_typeofExpr || T == TST_decltype);
}
- DeclSpec(const DeclSpec &) LLVM_DELETED_FUNCTION;
- void operator=(const DeclSpec &) LLVM_DELETED_FUNCTION;
+ DeclSpec(const DeclSpec &) = delete;
+ void operator=(const DeclSpec &) = delete;
public:
static bool isDeclRep(TST T) {
return (T == TST_enum || T == TST_struct ||
@@ -845,8 +845,8 @@ private:
/// \brief Represents a C++ unqualified-id that has been parsed.
class UnqualifiedId {
private:
- UnqualifiedId(const UnqualifiedId &Other) LLVM_DELETED_FUNCTION;
- const UnqualifiedId &operator=(const UnqualifiedId &) LLVM_DELETED_FUNCTION;
+ UnqualifiedId(const UnqualifiedId &Other) = delete;
+ const UnqualifiedId &operator=(const UnqualifiedId &) = delete;
public:
/// \brief Describes the kind of unqualified-id parsed.
@@ -1070,6 +1070,12 @@ struct DeclaratorChunk {
/// EndLoc - If valid, the place where this chunck ends.
SourceLocation EndLoc;
+ SourceRange getSourceRange() const {
+ if (EndLoc.isInvalid())
+ return SourceRange(Loc, Loc);
+ return SourceRange(Loc, EndLoc);
+ }
+
struct TypeInfoCommon {
AttributeList *AttrList;
};
@@ -1493,7 +1499,8 @@ struct DeclaratorChunk {
SourceLocation Loc) {
DeclaratorChunk I;
I.Kind = MemberPointer;
- I.Loc = Loc;
+ I.Loc = SS.getBeginLoc();
+ I.EndLoc = Loc;
I.Mem.TypeQuals = TypeQuals;
I.Mem.AttrList = nullptr;
new (I.Mem.ScopeMem.Mem) CXXScopeSpec(SS);
@@ -1916,6 +1923,14 @@ public:
return DeclTypeInfo[i];
}
+ typedef SmallVectorImpl<DeclaratorChunk>::const_iterator type_object_iterator;
+ typedef llvm::iterator_range<type_object_iterator> type_object_range;
+
+ /// Returns the range of type objects, from the identifier outwards.
+ type_object_range type_objects() const {
+ return type_object_range(DeclTypeInfo.begin(), DeclTypeInfo.end());
+ }
+
void DropFirstTypeObject() {
assert(!DeclTypeInfo.empty() && "No type chunks to drop.");
DeclTypeInfo.front().destroy();
diff --git a/include/clang/Sema/DelayedDiagnostic.h b/include/clang/Sema/DelayedDiagnostic.h
index 7fd6779f34..e19d1115f0 100644
--- a/include/clang/Sema/DelayedDiagnostic.h
+++ b/include/clang/Sema/DelayedDiagnostic.h
@@ -240,8 +240,8 @@ class DelayedDiagnosticPool {
const DelayedDiagnosticPool *Parent;
SmallVector<DelayedDiagnostic, 4> Diagnostics;
- DelayedDiagnosticPool(const DelayedDiagnosticPool &) LLVM_DELETED_FUNCTION;
- void operator=(const DelayedDiagnosticPool &) LLVM_DELETED_FUNCTION;
+ DelayedDiagnosticPool(const DelayedDiagnosticPool &) = delete;
+ void operator=(const DelayedDiagnosticPool &) = delete;
public:
DelayedDiagnosticPool(const DelayedDiagnosticPool *parent) : Parent(parent) {}
~DelayedDiagnosticPool() {
diff --git a/include/clang/Sema/Initialization.h b/include/clang/Sema/Initialization.h
index 9f342b2407..6110d22bb9 100644
--- a/include/clang/Sema/Initialization.h
+++ b/include/clang/Sema/Initialization.h
@@ -921,7 +921,7 @@ public:
void setSequenceKind(enum SequenceKind SK) { SequenceKind = SK; }
/// \brief Determine whether the initialization sequence is valid.
- LLVM_EXPLICIT operator bool() const { return !Failed(); }
+ explicit operator bool() const { return !Failed(); }
/// \brief Determine whether the initialization sequence is invalid.
bool Failed() const { return SequenceKind == FailedSequence; }
diff --git a/include/clang/Sema/Lookup.h b/include/clang/Sema/Lookup.h
index 1c6c7bbbd9..8ba78bea59 100644
--- a/include/clang/Sema/Lookup.h
+++ b/include/clang/Sema/Lookup.h
@@ -735,22 +735,18 @@ public:
}
class iterator
- : public std::iterator<std::forward_iterator_tag, NamedDecl *> {
- typedef llvm::DenseMap<NamedDecl*,NamedDecl*>::iterator inner_iterator;
- inner_iterator iter;
-
+ : public llvm::iterator_adaptor_base<
+ iterator, llvm::DenseMap<NamedDecl *, NamedDecl *>::iterator,
+ std::forward_iterator_tag, NamedDecl *> {
friend class ADLResult;
- iterator(const inner_iterator &iter) : iter(iter) {}
- public:
- iterator() {}
- iterator &operator++() { ++iter; return *this; }
- iterator operator++(int) { return iterator(iter++); }
+ iterator(llvm::DenseMap<NamedDecl *, NamedDecl *>::iterator Iter)
+ : iterator_adaptor_base(std::move(Iter)) {}
- value_type operator*() const { return iter->second; }
+ public:
+ iterator() {}
- bool operator==(const iterator &other) const { return iter == other.iter; }
- bool operator!=(const iterator &other) const { return iter != other.iter; }
+ value_type operator*() const { return I->second; }
};
iterator begin() { return iterator(Decls.begin()); }
diff --git a/include/clang/Sema/ObjCMethodList.h b/include/clang/Sema/ObjCMethodList.h
index 956e0882c5..b618e38f88 100644
--- a/include/clang/Sema/ObjCMethodList.h
+++ b/include/clang/Sema/ObjCMethodList.h
@@ -20,22 +20,37 @@ namespace clang {
class ObjCMethodDecl;
-/// ObjCMethodList - a linked list of methods with different signatures.
+/// \brief a linked list of methods with the same selector name but different
+/// signatures.
struct ObjCMethodList {
- ObjCMethodDecl *Method;
- /// \brief count of methods with same signature.
- unsigned Count;
+ // NOTE: If you add any members to this struct, make sure to serialize them.
+ /// \brief If there is more than one decl with this signature.
+ llvm::PointerIntPair<ObjCMethodDecl *, 1> MethodAndHasMoreThanOneDecl;
/// \brief The next list object and 2 bits for extra info.
llvm::PointerIntPair<ObjCMethodList *, 2> NextAndExtraBits;
- ObjCMethodList() : Method(nullptr), Count(0) { }
- ObjCMethodList(ObjCMethodDecl *M, unsigned count, ObjCMethodList *C)
- : Method(M), Count(count), NextAndExtraBits(C, 0) { }
+ ObjCMethodList() { }
+ ObjCMethodList(ObjCMethodDecl *M)
+ : MethodAndHasMoreThanOneDecl(M, 0) {}
ObjCMethodList *getNext() const { return NextAndExtraBits.getPointer(); }
unsigned getBits() const { return NextAndExtraBits.getInt(); }
void setNext(ObjCMethodList *L) { NextAndExtraBits.setPointer(L); }
void setBits(unsigned B) { NextAndExtraBits.setInt(B); }
+
+ ObjCMethodDecl *getMethod() const {
+ return MethodAndHasMoreThanOneDecl.getPointer();
+ }
+ void setMethod(ObjCMethodDecl *M) {
+ return MethodAndHasMoreThanOneDecl.setPointer(M);
+ }
+
+ bool hasMoreThanOneDecl() const {
+ return MethodAndHasMoreThanOneDecl.getInt();
+ }
+ void setHasMoreThanOneDecl(bool B) {
+ return MethodAndHasMoreThanOneDecl.setInt(B);
+ }
};
}
diff --git a/include/clang/Sema/Overload.h b/include/clang/Sema/Overload.h
index 41dcf974e5..2007dcb59a 100644
--- a/include/clang/Sema/Overload.h
+++ b/include/clang/Sema/Overload.h
@@ -553,6 +553,17 @@ namespace clang {
/// conversion.
ovl_fail_trivial_conversion,
+ /// This conversion candidate was not considered because it is
+ /// an illegal instantiation of a constructor temploid: it is
+ /// callable with one argument, we only have one argument, and
+ /// its first parameter type is exactly the type of the class.
+ ///
+ /// Defining such a constructor directly is illegal, and
+ /// template-argument deduction is supposed to ignore such
+ /// instantiations, but we can still get one with the right
+ /// kind of implicit instantiation.
+ ovl_fail_illegal_constructor,
+
/// This conversion candidate is not viable because its result
/// type is not implicitly convertible to the desired type.
ovl_fail_bad_final_conversion,
@@ -707,8 +718,8 @@ namespace clang {
llvm::AlignedCharArray<llvm::AlignOf<ImplicitConversionSequence>::Alignment,
16 * sizeof(ImplicitConversionSequence)> InlineSpace;
- OverloadCandidateSet(const OverloadCandidateSet &) LLVM_DELETED_FUNCTION;
- void operator=(const OverloadCandidateSet &) LLVM_DELETED_FUNCTION;
+ OverloadCandidateSet(const OverloadCandidateSet &) = delete;
+ void operator=(const OverloadCandidateSet &) = delete;
void destroyCandidates();
diff --git a/include/clang/Sema/Ownership.h b/include/clang/Sema/Ownership.h
index 8031562e0e..8acf9e82bf 100644
--- a/include/clang/Sema/Ownership.h
+++ b/include/clang/Sema/Ownership.h
@@ -79,7 +79,7 @@ namespace clang {
Ptr = Traits::getAsVoidPointer(P);
}
- LLVM_EXPLICIT operator bool() const { return Ptr != nullptr; }
+ explicit operator bool() const { return Ptr != nullptr; }
void *getAsOpaquePtr() const { return Ptr; }
static OpaquePtr getFromOpaquePtr(void *P) { return OpaquePtr(P); }
diff --git a/include/clang/Sema/Scope.h b/include/clang/Sema/Scope.h
index 97e447d1fd..cc6d9cca5b 100644
--- a/include/clang/Sema/Scope.h
+++ b/include/clang/Sema/Scope.h
@@ -115,8 +115,14 @@ public:
/// This scope corresponds to an enum.
EnumScope = 0x40000,
- /// This scope corresponds to a SEH try.
+ /// This scope corresponds to an SEH try.
SEHTryScope = 0x80000,
+
+ /// This scope corresponds to an SEH except.
+ SEHExceptScope = 0x100000,
+
+ /// We are currently in the filter expression of an SEH except block.
+ SEHFilterScope = 0x200000,
};
private:
/// The parent scope for this scope. This is null for the translation-unit
@@ -407,6 +413,9 @@ public:
/// \brief Determine whether this scope is a SEH '__try' block.
bool isSEHTryScope() const { return getFlags() & Scope::SEHTryScope; }
+ /// \brief Determine whether this scope is a SEH '__except' block.
+ bool isSEHExceptScope() const { return getFlags() & Scope::SEHExceptScope; }
+
/// containedInPrototypeScope - Return true if this or a parent scope
/// is a FunctionPrototypeScope.
bool containedInPrototypeScope() const;
diff --git a/include/clang/Sema/ScopeInfo.h b/include/clang/Sema/ScopeInfo.h
index d63b734a8d..ec8e56be87 100644
--- a/include/clang/Sema/ScopeInfo.h
+++ b/include/clang/Sema/ScopeInfo.h
@@ -124,6 +124,12 @@ public:
/// false if there is an invocation of an initializer on 'self'.
bool ObjCWarnForNoInitDelegation;
+ /// First C++ 'try' statement in the current function.
+ SourceLocation FirstCXXTryLoc;
+
+ /// First SEH '__try' statement in the current function.
+ SourceLocation FirstSEHTryLoc;
+
/// \brief Used to determine if errors occurred in this function or block.
DiagnosticErrorTrap ErrorTrap;
@@ -321,6 +327,16 @@ public:
HasDroppedStmt = true;
}
+ void setHasCXXTry(SourceLocation TryLoc) {
+ setHasBranchProtectedScope();
+ FirstCXXTryLoc = TryLoc;
+ }
+
+ void setHasSEHTry(SourceLocation TryLoc) {
+ setHasBranchProtectedScope();
+ FirstSEHTryLoc = TryLoc;
+ }
+
bool NeedsScopeChecking() const {
return !HasDroppedStmt &&
(HasIndirectGoto ||
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 8b13b9d32a..712e0cedba 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -199,6 +199,11 @@ namespace sema {
class TemplateDeductionInfo;
}
+namespace threadSafety {
+ class BeforeSet;
+ void threadSafetyCleanup(BeforeSet* Cache);
+}
+
// FIXME: No way to easily map from TemplateTypeParmTypes to
// TemplateTypeParmDecls, so we have this horrible PointerUnion.
typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType*, NamedDecl*>,
@@ -206,8 +211,8 @@ typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType*, NamedDecl*>,
/// Sema - This implements semantic analysis and AST building for C.
class Sema {
- Sema(const Sema &) LLVM_DELETED_FUNCTION;
- void operator=(const Sema &) LLVM_DELETED_FUNCTION;
+ Sema(const Sema &) = delete;
+ void operator=(const Sema &) = delete;
///\brief Source of additional semantic information.
ExternalSemaSource *ExternalSource;
@@ -458,12 +463,11 @@ public:
/// cycle detection at the end of the TU.
DelegatingCtorDeclsType DelegatingCtorDecls;
- /// \brief All the overriding destructors seen during a class definition
- /// (there could be multiple due to nested classes) that had their exception
- /// spec checks delayed, plus the overridden destructor.
- SmallVector<std::pair<const CXXDestructorDecl*,
- const CXXDestructorDecl*>, 2>
- DelayedDestructorExceptionSpecChecks;
+ /// \brief All the overriding functions seen during a class definition
+ /// that had their exception spec checks delayed, plus the overridden
+ /// function.
+ SmallVector<std::pair<const CXXMethodDecl*, const CXXMethodDecl*>, 2>
+ DelayedExceptionSpecChecks;
/// \brief All the members seen during a class definition which were both
/// explicitly defaulted and had explicitly-specified exception
@@ -1252,7 +1256,7 @@ public:
static QualType getPrintable(QualType T) { return T; }
static SourceRange getPrintable(SourceRange R) { return R; }
static SourceRange getPrintable(SourceLocation L) { return L; }
- static SourceRange getPrintable(Expr *E) { return E->getSourceRange(); }
+ static SourceRange getPrintable(const Expr *E) { return E->getSourceRange(); }
static SourceRange getPrintable(TypeLoc TL) { return TL.getSourceRange();}
template<typename T1>
@@ -1400,7 +1404,10 @@ public:
const CXXScopeSpec &SS, QualType T);
QualType BuildTypeofExprType(Expr *E, SourceLocation Loc);
- QualType BuildDecltypeType(Expr *E, SourceLocation Loc);
+ /// If AsUnevaluated is false, E is treated as though it were an evaluated
+ /// context, such as when building a type for decltype(auto).
+ QualType BuildDecltypeType(Expr *E, SourceLocation Loc,
+ bool AsUnevaluated = true);
QualType BuildUnaryTransformType(QualType BaseType,
UnaryTransformType::UTTKind UKind,
SourceLocation Loc);
@@ -2006,6 +2013,13 @@ public:
int FirstArg, unsigned AttrSpellingListIndex);
SectionAttr *mergeSectionAttr(Decl *D, SourceRange Range, StringRef Name,
unsigned AttrSpellingListIndex);
+ AlwaysInlineAttr *mergeAlwaysInlineAttr(Decl *D, SourceRange Range,
+ IdentifierInfo *Ident,
+ unsigned AttrSpellingListIndex);
+ MinSizeAttr *mergeMinSizeAttr(Decl *D, SourceRange Range,
+ unsigned AttrSpellingListIndex);
+ OptimizeNoneAttr *mergeOptimizeNoneAttr(Decl *D, SourceRange Range,
+ unsigned AttrSpellingListIndex);
/// \brief Describes the kind of merge to perform for availability
/// attributes (including "deprecated", "unavailable", and "availability").
@@ -2149,6 +2163,8 @@ public:
};
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T,
llvm::APSInt &Value, CCEKind CCE);
+ ExprResult CheckConvertedConstantExpression(Expr *From, QualType T,
+ APValue &Value, CCEKind CCE);
/// \brief Abstract base class used to perform a contextual implicit
/// conversion from an expression to any type passing a filter.
@@ -2268,8 +2284,9 @@ public:
void AddFunctionCandidates(const UnresolvedSetImpl &Functions,
ArrayRef<Expr *> Args,
OverloadCandidateSet &CandidateSet,
+ TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
bool SuppressUserConversions = false,
- TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
+ bool PartialOverloading = false);
void AddMethodCandidate(DeclAccessPair FoundDecl,
QualType ObjectType,
Expr::Classification ObjectClassification,
@@ -2282,7 +2299,8 @@ public:
Expr::Classification ObjectClassification,
ArrayRef<Expr *> Args,
OverloadCandidateSet& CandidateSet,
- bool SuppressUserConversions = false);
+ bool SuppressUserConversions = false,
+ bool PartialOverloading = false);
void AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl,
DeclAccessPair FoundDecl,
CXXRecordDecl *ActingContext,
@@ -2291,13 +2309,15 @@ public:
Expr::Classification ObjectClassification,
ArrayRef<Expr *> Args,
OverloadCandidateSet& CandidateSet,
- bool SuppressUserConversions = false);
+ bool SuppressUserConversions = false,
+ bool PartialOverloading = false);
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate,
DeclAccessPair FoundDecl,
TemplateArgumentListInfo *ExplicitTemplateArgs,
ArrayRef<Expr *> Args,
OverloadCandidateSet& CandidateSet,
- bool SuppressUserConversions = false);
+ bool SuppressUserConversions = false,
+ bool PartialOverloading = false);
void AddConversionCandidate(CXXConversionDecl *Conversion,
DeclAccessPair FoundDecl,
CXXRecordDecl *ActingContext,
@@ -2623,7 +2643,7 @@ private:
std::unique_ptr<CorrectionCandidateCallback> CCC,
DeclContext *MemberContext, bool EnteringContext,
const ObjCObjectPointerType *OPT,
- bool ErrorRecovery, bool &IsUnqualifiedLookup);
+ bool ErrorRecovery);
public:
const TypoExprState &getTypoExprState(TypoExpr *TE) const;
@@ -2645,6 +2665,8 @@ public:
bool AllowBuiltinCreation = false);
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
bool InUnqualifiedLookup = false);
+ bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
+ CXXScopeSpec &SS);
bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS,
bool AllowBuiltinCreation = false,
bool EnteringContext = false);
@@ -2976,10 +2998,7 @@ private:
/// \brief Record the typo correction failure and return an empty correction.
TypoCorrection FailedCorrection(IdentifierInfo *Typo, SourceLocation TypoLoc,
- bool RecordFailure = true,
- bool IsUnqualifiedLookup = false) {
- if (IsUnqualifiedLookup)
- (void)UnqualifiedTyposCorrected[Typo];
+ bool RecordFailure = true) {
if (RecordFailure)
TypoCorrectionFailures[Typo].insert(TypoLoc);
return TypoCorrection();
@@ -3098,6 +3117,18 @@ public:
Sema &S;
};
+ /// An RAII helper that pops function a function scope on exit.
+ struct FunctionScopeRAII {
+ Sema &S;
+ bool Active;
+ FunctionScopeRAII(Sema &S) : S(S), Active(true) {}
+ ~FunctionScopeRAII() {
+ if (Active)
+ S.PopFunctionScopeInfo();
+ }
+ void disable() { Active = false; }
+ };
+
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl,
SourceLocation StartLoc,
SourceLocation EndLoc);
@@ -3305,6 +3336,10 @@ public:
void DiagnoseEmptyLoopBody(const Stmt *S,
const Stmt *PossibleBody);
+ /// Warn if a value is moved to itself.
+ void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr,
+ SourceLocation OpLoc);
+
ParsingDeclState PushParsingDeclaration(sema::DelayedDiagnosticPool &pool) {
return DelayedDiagnostics.push(pool);
}
@@ -3427,6 +3462,9 @@ public:
TryCaptureKind Kind = TryCapture_Implicit,
SourceLocation EllipsisLoc = SourceLocation());
+ /// \brief Checks if the variable must be captured.
+ bool NeedToCaptureVariable(VarDecl *Var, SourceLocation Loc);
+
/// \brief Given a variable, determine the type that a reference to that
/// variable will have in the given scope.
QualType getCapturedDeclRefType(VarDecl *Var, SourceLocation Loc);
@@ -3627,7 +3665,6 @@ public:
Scope *S;
UnqualifiedId &Id;
Decl *ObjCImpDecl;
- bool HasTrailingLParen;
};
ExprResult BuildMemberReferenceExpr(
@@ -3666,8 +3703,7 @@ public:
CXXScopeSpec &SS,
SourceLocation TemplateKWLoc,
UnqualifiedId &Member,
- Decl *ObjCImpDecl,
- bool HasTrailingLParen);
+ Decl *ObjCImpDecl);
void ActOnDefaultCtorInitializers(Decl *CDtorDecl);
bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
@@ -4460,7 +4496,7 @@ public:
void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return,
QualType Param1,
QualType Param2 = QualType(),
- bool addMallocAttr = false);
+ bool addRestrictAttr = false);
bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD,
DeclarationName Name, FunctionDecl* &Operator,
@@ -4525,8 +4561,6 @@ public:
ParsedType &ObjectType,
bool &MayBePseudoDestructor);
- ExprResult DiagnoseDtorReference(SourceLocation NameLoc, Expr *MemExpr);
-
ExprResult BuildPseudoDestructorExpr(Expr *Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
@@ -4534,8 +4568,7 @@ public:
TypeSourceInfo *ScopeType,
SourceLocation CCLoc,
SourceLocation TildeLoc,
- PseudoDestructorTypeStorage DestroyedType,
- bool HasTrailingLParen);
+ PseudoDestructorTypeStorage DestroyedType);
ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base,
SourceLocation OpLoc,
@@ -4544,15 +4577,13 @@ public:
UnqualifiedId &FirstTypeName,
SourceLocation CCLoc,
SourceLocation TildeLoc,
- UnqualifiedId &SecondTypeName,
- bool HasTrailingLParen);
+ UnqualifiedId &SecondTypeName);
ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
SourceLocation TildeLoc,
- const DeclSpec& DS,
- bool HasTrailingLParen);
+ const DeclSpec& DS);
/// MaybeCreateExprWithCleanups - If the current full-expression
/// requires any cleanups, surround it with a ExprWithCleanups node.
@@ -4603,7 +4634,8 @@ public:
bool ActOnSuperScopeSpecifier(SourceLocation SuperLoc,
SourceLocation ColonColonLoc, CXXScopeSpec &SS);
- bool isAcceptableNestedNameSpecifier(const NamedDecl *SD);
+ bool isAcceptableNestedNameSpecifier(const NamedDecl *SD,
+ bool *CanCorrect = nullptr);
NamedDecl *FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS);
bool isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS,
@@ -5148,8 +5180,6 @@ public:
// FIXME: I don't like this name.
void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath);
- bool BasePathInvolvesVirtualBase(const CXXCastPath &BasePath);
-
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base,
SourceLocation Loc, SourceRange Range,
CXXCastPath *BasePath = nullptr,
@@ -6152,14 +6182,16 @@ public:
unsigned NumExplicitlySpecified,
FunctionDecl *&Specialization,
sema::TemplateDeductionInfo &Info,
- SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs = nullptr);
+ SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs = nullptr,
+ bool PartialOverloading = false);
TemplateDeductionResult
DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
TemplateArgumentListInfo *ExplicitTemplateArgs,
ArrayRef<Expr *> Args,
FunctionDecl *&Specialization,
- sema::TemplateDeductionInfo &Info);
+ sema::TemplateDeductionInfo &Info,
+ bool PartialOverloading = false);
TemplateDeductionResult
DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
@@ -6573,10 +6605,10 @@ public:
ArrayRef<TemplateArgument> TemplateArgs = ArrayRef<TemplateArgument>(),
sema::TemplateDeductionInfo *DeductionInfo = nullptr);
- InstantiatingTemplate(const InstantiatingTemplate&) LLVM_DELETED_FUNCTION;
+ InstantiatingTemplate(const InstantiatingTemplate&) = delete;
InstantiatingTemplate&
- operator=(const InstantiatingTemplate&) LLVM_DELETED_FUNCTION;
+ operator=(const InstantiatingTemplate&) = delete;
};
void PrintInstantiationStack();
@@ -6664,17 +6696,6 @@ public:
/// \brief The number of typos corrected by CorrectTypo.
unsigned TyposCorrected;
- typedef llvm::DenseMap<IdentifierInfo *, TypoCorrection>
- UnqualifiedTyposCorrectedMap;
-
- /// \brief A cache containing the results of typo correction for unqualified
- /// name lookup.
- ///
- /// The string is the string that we corrected to (which may be empty, if
- /// there was no correction), while the boolean will be true when the
- /// string represents a keyword.
- UnqualifiedTyposCorrectedMap UnqualifiedTyposCorrected;
-
typedef llvm::SmallSet<SourceLocation, 2> SrcLocSet;
typedef llvm::DenseMap<IdentifierInfo *, SrcLocSet> IdentifierSourceLocations;
@@ -6685,6 +6706,7 @@ public:
/// \brief Worker object for performing CFG-based warnings.
sema::AnalysisBasedWarnings AnalysisWarnings;
+ threadSafety::BeforeSet *ThreadSafetyDeclCache;
/// \brief An entity for which implicit template instantiation is required.
///
@@ -6702,12 +6724,17 @@ public:
class SavePendingInstantiationsAndVTableUsesRAII {
public:
- SavePendingInstantiationsAndVTableUsesRAII(Sema &S): S(S) {
+ SavePendingInstantiationsAndVTableUsesRAII(Sema &S, bool Enabled)
+ : S(S), Enabled(Enabled) {
+ if (!Enabled) return;
+
SavedPendingInstantiations.swap(S.PendingInstantiations);
SavedVTableUses.swap(S.VTableUses);
}
~SavePendingInstantiationsAndVTableUsesRAII() {
+ if (!Enabled) return;
+
// Restore the set of pending vtables.
assert(S.VTableUses.empty() &&
"VTableUses should be empty before it is discarded.");
@@ -6723,6 +6750,7 @@ public:
Sema &S;
SmallVector<VTableUse, 16> SavedVTableUses;
std::deque<PendingImplicitInstantiation> SavedPendingInstantiations;
+ bool Enabled;
};
/// \brief The queue of implicit template instantiations that are required
@@ -7461,6 +7489,10 @@ private:
void DestroyDataSharingAttributesStack();
ExprResult VerifyPositiveIntegerConstantInClause(Expr *Op,
OpenMPClauseKind CKind);
+ /// \brief Checks if the specified variable is used in one of the private
+ /// clauses in OpenMP constructs.
+ bool IsOpenMPCapturedVar(VarDecl *VD);
+
public:
ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc,
Expr *Op);
@@ -7949,6 +7981,12 @@ public:
Expr *SrcExpr, AssignmentAction Action,
bool *Complained = nullptr);
+ /// IsValueInFlagEnum - Determine if a value is allowed as part of a flag
+ /// enum. If AllowMask is true, then we also allow the complement of a valid
+ /// value, to be used as a mask.
+ bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val,
+ bool AllowMask) const;
+
/// DiagnoseAssignmentEnum - Warn if assignment to enum is a constant
/// integer not in the range of enum values.
void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType,
@@ -8291,9 +8329,6 @@ public:
CUDAFunctionTarget IdentifyCUDATarget(const FunctionDecl *D);
- bool CheckCUDATarget(CUDAFunctionTarget CallerTarget,
- CUDAFunctionTarget CalleeTarget);
-
bool CheckCUDATarget(const FunctionDecl *Caller, const FunctionDecl *Callee);
/// Given a implicit special member, infer its CUDA target from the
@@ -8379,6 +8414,8 @@ public:
void CodeCompleteTypeQualifiers(DeclSpec &DS);
void CodeCompleteCase(Scope *S);
void CodeCompleteCall(Scope *S, Expr *Fn, ArrayRef<Expr *> Args);
+ void CodeCompleteConstructor(Scope *S, QualType Type, SourceLocation Loc,
+ ArrayRef<Expr *> Args);
void CodeCompleteInitializer(Scope *S, Decl *D);
void CodeCompleteReturn(Scope *S);
void CodeCompleteAfterIf(Scope *S);
@@ -8547,6 +8584,8 @@ public:
FST_Strftime,
FST_Strfmon,
FST_Kprintf,
+ FST_FreeBSDKPrintf,
+ FST_OSTrace,
FST_Unknown
};
static FormatStringType GetFormatStringType(const FormatAttr *Format);
@@ -8697,6 +8736,16 @@ public:
DC = CatD->getClassInterface();
return DC;
}
+
+ /// \brief To be used for checking whether the arguments being passed to
+ /// function exceeds the number of parameters expected for it.
+ static bool TooManyArguments(size_t NumParams, size_t NumArgs,
+ bool PartialOverloading = false) {
+ // We check whether we're just after a comma in code-completion.
+ if (NumArgs > 0 && PartialOverloading)
+ return NumArgs + 1 > NumParams; // If so, we view as an extra argument.
+ return NumArgs > NumParams;
+ }
};
/// \brief RAII object that enters a new expression evaluation context.
diff --git a/include/clang/Sema/SemaInternal.h b/include/clang/Sema/SemaInternal.h
index 045bacf213..005d882c34 100644
--- a/include/clang/Sema/SemaInternal.h
+++ b/include/clang/Sema/SemaInternal.h
@@ -101,7 +101,7 @@ public:
DeclContext *MemberContext,
bool EnteringContext)
: Typo(TypoName.getName().getAsIdentifierInfo()), CurrentTCIndex(0),
- SemaRef(SemaRef), S(S),
+ SavedTCIndex(0), SemaRef(SemaRef), S(S),
SS(SS ? llvm::make_unique<CXXScopeSpec>(*SS) : nullptr),
CorrectionValidator(std::move(CCC)), MemberContext(MemberContext),
Result(SemaRef, TypoName, LookupKind),
@@ -187,6 +187,17 @@ public:
CurrentTCIndex >= ValidatedCorrections.size();
}
+ /// \brief Save the current position in the correction stream (overwriting any
+ /// previously saved position).
+ void saveCurrentPosition() {
+ SavedTCIndex = CurrentTCIndex;
+ }
+
+ /// \brief Restore the saved position in the correction stream.
+ void restoreSavedPosition() {
+ CurrentTCIndex = SavedTCIndex;
+ }
+
ASTContext &getContext() const { return SemaRef.Context; }
const LookupResult &getLookupResult() const { return Result; }
@@ -267,6 +278,7 @@ private:
SmallVector<TypoCorrection, 4> ValidatedCorrections;
size_t CurrentTCIndex;
+ size_t SavedTCIndex;
Sema &SemaRef;
Scope *S;
diff --git a/include/clang/Sema/Template.h b/include/clang/Sema/Template.h
index c08a5df00b..6c34e5862f 100644
--- a/include/clang/Sema/Template.h
+++ b/include/clang/Sema/Template.h
@@ -239,8 +239,8 @@ namespace clang {
// This class is non-copyable
LocalInstantiationScope(
- const LocalInstantiationScope &) LLVM_DELETED_FUNCTION;
- void operator=(const LocalInstantiationScope &) LLVM_DELETED_FUNCTION;
+ const LocalInstantiationScope &) = delete;
+ void operator=(const LocalInstantiationScope &) = delete;
public:
LocalInstantiationScope(Sema &SemaRef, bool CombineWithOuterScope = false)
diff --git a/include/clang/Sema/TemplateDeduction.h b/include/clang/Sema/TemplateDeduction.h
index 8338d97575..229eb71cab 100644
--- a/include/clang/Sema/TemplateDeduction.h
+++ b/include/clang/Sema/TemplateDeduction.h
@@ -44,8 +44,8 @@ class TemplateDeductionInfo {
/// SFINAE while performing template argument deduction.
SmallVector<PartialDiagnosticAt, 4> SuppressedDiagnostics;
- TemplateDeductionInfo(const TemplateDeductionInfo &) LLVM_DELETED_FUNCTION;
- void operator=(const TemplateDeductionInfo &) LLVM_DELETED_FUNCTION;
+ TemplateDeductionInfo(const TemplateDeductionInfo &) = delete;
+ void operator=(const TemplateDeductionInfo &) = delete;
public:
TemplateDeductionInfo(SourceLocation Loc)
@@ -91,9 +91,7 @@ public:
if (HasSFINAEDiagnostic)
return;
SuppressedDiagnostics.clear();
- SuppressedDiagnostics.push_back(
- std::make_pair(Loc, PartialDiagnostic::NullDiagnostic()));
- SuppressedDiagnostics.back().second.swap(PD);
+ SuppressedDiagnostics.emplace_back(Loc, std::move(PD));
HasSFINAEDiagnostic = true;
}
@@ -102,9 +100,7 @@ public:
PartialDiagnostic PD) {
if (HasSFINAEDiagnostic)
return;
- SuppressedDiagnostics.push_back(
- std::make_pair(Loc, PartialDiagnostic::NullDiagnostic()));
- SuppressedDiagnostics.back().second.swap(PD);
+ SuppressedDiagnostics.emplace_back(Loc, std::move(PD));
}
/// \brief Iterator over the set of suppressed diagnostics.
@@ -252,8 +248,8 @@ class TemplateSpecCandidateSet {
SourceLocation Loc;
TemplateSpecCandidateSet(
- const TemplateSpecCandidateSet &) LLVM_DELETED_FUNCTION;
- void operator=(const TemplateSpecCandidateSet &) LLVM_DELETED_FUNCTION;
+ const TemplateSpecCandidateSet &) = delete;
+ void operator=(const TemplateSpecCandidateSet &) = delete;
void destroyCandidates();
@@ -277,7 +273,7 @@ public:
/// \brief Add a new candidate with NumConversions conversion sequence slots
/// to the overload set.
TemplateSpecCandidate &addCandidate() {
- Candidates.push_back(TemplateSpecCandidate());
+ Candidates.emplace_back();
return Candidates.back();
}
diff --git a/include/clang/Sema/TypoCorrection.h b/include/clang/Sema/TypoCorrection.h
index 922d0ffa11..958aab0fce 100644
--- a/include/clang/Sema/TypoCorrection.h
+++ b/include/clang/Sema/TypoCorrection.h
@@ -165,7 +165,7 @@ public:
}
/// \brief Returns whether this TypoCorrection has a non-empty DeclarationName
- LLVM_EXPLICIT operator bool() const { return bool(CorrectionName); }
+ explicit operator bool() const { return bool(CorrectionName); }
/// \brief Mark this TypoCorrection as being a keyword.
/// Since addCorrectionDeclsand setCorrectionDecl don't allow NULL to be
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h
index 85495839d3..ef5f1dd184 100644
--- a/include/clang/Serialization/ASTBitCodes.h
+++ b/include/clang/Serialization/ASTBitCodes.h
@@ -35,7 +35,7 @@ namespace clang {
/// Version 4 of AST files also requires that the version control branch and
/// revision match exactly, since there is no backward compatibility of
/// AST files at this time.
- const unsigned VERSION_MAJOR = 5;
+ const unsigned VERSION_MAJOR = 6;
/// \brief AST file minor version number supported by this version of
/// Clang.
@@ -291,7 +291,10 @@ namespace clang {
MODULE_MAP_FILE = 14,
/// \brief Record code for the signature that identifiers this AST file.
- SIGNATURE = 15
+ SIGNATURE = 15,
+
+ /// \brief Record code for the module build directory.
+ MODULE_DIRECTORY = 16,
};
/// \brief Record types that occur within the input-files block
@@ -1091,13 +1094,13 @@ namespace clang {
///
/// These constants describe the records that describe statements
/// or expressions. These records occur within type and declarations
- /// block, so they begin with record values of 100. Each constant
+ /// block, so they begin with record values of 128. Each constant
/// describes a record for a specific statement or expression class in the
/// AST.
enum StmtCode {
/// \brief A marker record that indicates that we are at the end
/// of an expression.
- STMT_STOP = 100,
+ STMT_STOP = 128,
/// \brief A NULL expression.
STMT_NULL_PTR,
/// \brief A reference to a previously [de]serialized Stmt record.
diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h
index 1b0347e91f..27af9995aa 100644
--- a/include/clang/Serialization/ASTReader.h
+++ b/include/clang/Serialization/ASTReader.h
@@ -153,6 +153,7 @@ public:
/// \returns true to indicate the header search options are invalid, or false
/// otherwise.
virtual bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
+ StringRef SpecificModuleCachePath,
bool Complain) {
return false;
}
@@ -230,6 +231,7 @@ public:
bool Complain) override;
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
+ StringRef SpecificModuleCachePath,
bool Complain) override;
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
bool Complain,
@@ -261,6 +263,9 @@ public:
bool Complain) override;
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain,
std::string &SuggestedPredefines) override;
+ bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
+ StringRef SpecificModuleCachePath,
+ bool Complain) override;
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override;
private:
@@ -435,6 +440,12 @@ private:
llvm::SmallVector<std::pair<serialization::GlobalDeclID, Decl*>, 16>
PendingUpdateRecords;
+ enum class PendingFakeDefinitionKind { NotFake, Fake, FakeLoaded };
+
+ /// \brief The DefinitionData pointers that we faked up for class definitions
+ /// that we needed but hadn't loaded yet.
+ llvm::DenseMap<void *, PendingFakeDefinitionKind> PendingFakeDefinitionData;
+
struct ReplacedDeclInfo {
ModuleFile *Mod;
uint64_t Offset;
@@ -1071,8 +1082,8 @@ private:
ASTReader &Reader;
enum ReadingKind PrevKind;
- ReadingKindTracker(const ReadingKindTracker &) LLVM_DELETED_FUNCTION;
- void operator=(const ReadingKindTracker &) LLVM_DELETED_FUNCTION;
+ ReadingKindTracker(const ReadingKindTracker &) = delete;
+ void operator=(const ReadingKindTracker &) = delete;
public:
ReadingKindTracker(enum ReadingKind newKind, ASTReader &reader)
@@ -1113,12 +1124,11 @@ private:
serialization::InputFile getInputFile(ModuleFile &F, unsigned ID,
bool Complain = true);
- /// \brief Get a FileEntry out of stored-in-PCH filename, making sure we take
- /// into account all the necessary relocations.
- const FileEntry *getFileEntry(StringRef filename);
-
- void MaybeAddSystemRootToFilename(ModuleFile &M, std::string &Filename);
+public:
+ void ResolveImportedPath(ModuleFile &M, std::string &Filename);
+ static void ResolveImportedPath(std::string &Filename, StringRef Prefix);
+private:
struct ImportedModule {
ModuleFile *Mod;
ModuleFile *ImportedBy;
@@ -1141,7 +1151,7 @@ private:
const ModuleFile *ImportedBy,
unsigned ClientLoadCapabilities);
ASTReadResult ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities);
- bool ParseLineTable(ModuleFile &F, SmallVectorImpl<uint64_t> &Record);
+ bool ParseLineTable(ModuleFile &F, const RecordData &Record);
bool ReadSourceManagerBlock(ModuleFile &F);
llvm::BitstreamCursor &SLocCursorForID(int ID);
SourceLocation getImportLocation(ModuleFile *F);
@@ -1213,66 +1223,38 @@ private:
/// \brief Returns (begin, end) pair for the preprocessed entities of a
/// particular module.
- std::pair<PreprocessingRecord::iterator, PreprocessingRecord::iterator>
- getModulePreprocessedEntities(ModuleFile &Mod) const;
-
- class ModuleDeclIterator {
+ llvm::iterator_range<PreprocessingRecord::iterator>
+ getModulePreprocessedEntities(ModuleFile &Mod) const;
+
+ class ModuleDeclIterator
+ : public llvm::iterator_adaptor_base<
+ ModuleDeclIterator, const serialization::LocalDeclID *,
+ std::random_access_iterator_tag, const Decl *, ptrdiff_t,
+ const Decl *, const Decl *> {
ASTReader *Reader;
ModuleFile *Mod;
- const serialization::LocalDeclID *Pos;
public:
- typedef const Decl *value_type;
- typedef value_type& reference;
- typedef value_type* pointer;
-
- ModuleDeclIterator() : Reader(nullptr), Mod(nullptr), Pos(nullptr) { }
+ ModuleDeclIterator()
+ : iterator_adaptor_base(nullptr), Reader(nullptr), Mod(nullptr) {}
ModuleDeclIterator(ASTReader *Reader, ModuleFile *Mod,
const serialization::LocalDeclID *Pos)
- : Reader(Reader), Mod(Mod), Pos(Pos) { }
+ : iterator_adaptor_base(Pos), Reader(Reader), Mod(Mod) {}
value_type operator*() const {
- return Reader->GetDecl(Reader->getGlobalDeclID(*Mod, *Pos));
- }
-
- ModuleDeclIterator &operator++() {
- ++Pos;
- return *this;
- }
-
- ModuleDeclIterator operator++(int) {
- ModuleDeclIterator Prev(*this);
- ++Pos;
- return Prev;
- }
-
- ModuleDeclIterator &operator--() {
- --Pos;
- return *this;
+ return Reader->GetDecl(Reader->getGlobalDeclID(*Mod, *I));
}
+ value_type operator->() const { return **this; }
- ModuleDeclIterator operator--(int) {
- ModuleDeclIterator Prev(*this);
- --Pos;
- return Prev;
- }
-
- friend bool operator==(const ModuleDeclIterator &LHS,
- const ModuleDeclIterator &RHS) {
- assert(LHS.Reader == RHS.Reader && LHS.Mod == RHS.Mod);
- return LHS.Pos == RHS.Pos;
- }
-
- friend bool operator!=(const ModuleDeclIterator &LHS,
- const ModuleDeclIterator &RHS) {
- assert(LHS.Reader == RHS.Reader && LHS.Mod == RHS.Mod);
- return LHS.Pos != RHS.Pos;
+ bool operator==(const ModuleDeclIterator &RHS) const {
+ assert(Reader == RHS.Reader && Mod == RHS.Mod);
+ return I == RHS.I;
}
};
- std::pair<ModuleDeclIterator, ModuleDeclIterator>
- getModuleFileLevelDecls(ModuleFile &Mod);
+ llvm::iterator_range<ModuleDeclIterator>
+ getModuleFileLevelDecls(ModuleFile &Mod);
void PassInterestingDeclsToConsumer();
void PassInterestingDeclToConsumer(Decl *D);
@@ -1298,8 +1280,8 @@ private:
void Error(unsigned DiagID, StringRef Arg1 = StringRef(),
StringRef Arg2 = StringRef());
- ASTReader(const ASTReader &) LLVM_DELETED_FUNCTION;
- void operator=(const ASTReader &) LLVM_DELETED_FUNCTION;
+ ASTReader(const ASTReader &) = delete;
+ void operator=(const ASTReader &) = delete;
public:
/// \brief Load the AST file and validate its contents against the given
/// Preprocessor.
@@ -1519,7 +1501,8 @@ public:
FileManager &FileMgr,
const LangOptions &LangOpts,
const TargetOptions &TargetOpts,
- const PreprocessorOptions &PPOpts);
+ const PreprocessorOptions &PPOpts,
+ std::string ExistingModuleCachePath);
/// \brief Returns the suggested contents of the predefines buffer,
/// which contains a (typically-empty) subset of the predefines
@@ -2045,6 +2028,9 @@ public:
// \brief Read a string
static std::string ReadString(const RecordData &Record, unsigned &Idx);
+ // \brief Read a path
+ std::string ReadPath(ModuleFile &F, const RecordData &Record, unsigned &Idx);
+
/// \brief Read a version tuple.
static VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx);
diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h
index 20e9935c0c..1d2fa556e2 100644
--- a/include/clang/Serialization/ASTWriter.h
+++ b/include/clang/Serialization/ASTWriter.h
@@ -111,7 +111,10 @@ private:
/// \brief The module we're currently writing, if any.
Module *WritingModule;
-
+
+ /// \brief The base directory for any relative paths we emit.
+ std::string BaseDirectory;
+
/// \brief Indicates when the AST writing is actively performing
/// serialization, rather than just queueing updates.
bool WritingAST;
@@ -457,13 +460,11 @@ private:
StringRef isysroot, const std::string &OutputFile);
void WriteInputFiles(SourceManager &SourceMgr,
HeaderSearchOptions &HSOpts,
- StringRef isysroot,
bool Modules);
void WriteSourceManagerBlock(SourceManager &SourceMgr,
- const Preprocessor &PP,
- StringRef isysroot);
+ const Preprocessor &PP);
void WritePreprocessor(const Preprocessor &PP, bool IsModule);
- void WriteHeaderSearch(const HeaderSearch &HS, StringRef isysroot);
+ void WriteHeaderSearch(const HeaderSearch &HS);
void WritePreprocessorDetail(PreprocessingRecord &PPRec);
void WriteSubmodules(Module *WritingModule);
@@ -530,6 +531,8 @@ public:
ASTWriter(llvm::BitstreamWriter &Stream);
~ASTWriter();
+ const LangOptions &getLangOpts() const;
+
/// \brief Write a precompiled header for the given semantic analysis.
///
/// \param SemaRef a reference to the semantic analysis object that processed
@@ -539,7 +542,8 @@ public:
/// writing a precompiled header.
///
/// \param isysroot if non-empty, write a relocatable file whose headers
- /// are relative to the given system root.
+ /// are relative to the given system root. If we're writing a module, its
+ /// build directory will be used in preference to this if both are available.
void WriteAST(Sema &SemaRef,
const std::string &OutputFile,
Module *WritingModule, StringRef isysroot,
@@ -686,6 +690,17 @@ public:
/// \brief Add a string to the given record.
void AddString(StringRef Str, RecordDataImpl &Record);
+ /// \brief Convert a path from this build process into one that is appropriate
+ /// for emission in the module file.
+ bool PreparePathForOutput(SmallVectorImpl<char> &Path);
+
+ /// \brief Add a path to the given record.
+ void AddPath(StringRef Path, RecordDataImpl &Record);
+
+ /// \brief Emit the current record with the given path as a blob.
+ void EmitRecordWithPath(unsigned Abbrev, RecordDataImpl &Record,
+ StringRef Path);
+
/// \brief Add a version tuple to the given record
void AddVersionTuple(const VersionTuple &Version, RecordDataImpl &Record);
diff --git a/include/clang/Serialization/ContinuousRangeMap.h b/include/clang/Serialization/ContinuousRangeMap.h
index 5f8ae1fe7b..244b01b22a 100644
--- a/include/clang/Serialization/ContinuousRangeMap.h
+++ b/include/clang/Serialization/ContinuousRangeMap.h
@@ -109,8 +109,8 @@ public:
class Builder {
ContinuousRangeMap &Self;
- Builder(const Builder&) LLVM_DELETED_FUNCTION;
- Builder &operator=(const Builder&) LLVM_DELETED_FUNCTION;
+ Builder(const Builder&) = delete;
+ Builder &operator=(const Builder&) = delete;
public:
explicit Builder(ContinuousRangeMap &Self) : Self(Self) { }
diff --git a/include/clang/Serialization/GlobalModuleIndex.h b/include/clang/Serialization/GlobalModuleIndex.h
index d8a57be84a..640c7bb344 100644
--- a/include/clang/Serialization/GlobalModuleIndex.h
+++ b/include/clang/Serialization/GlobalModuleIndex.h
@@ -118,8 +118,8 @@ class GlobalModuleIndex {
explicit GlobalModuleIndex(std::unique_ptr<llvm::MemoryBuffer> Buffer,
llvm::BitstreamCursor Cursor);
- GlobalModuleIndex(const GlobalModuleIndex &) LLVM_DELETED_FUNCTION;
- GlobalModuleIndex &operator=(const GlobalModuleIndex &) LLVM_DELETED_FUNCTION;
+ GlobalModuleIndex(const GlobalModuleIndex &) = delete;
+ GlobalModuleIndex &operator=(const GlobalModuleIndex &) = delete;
public:
~GlobalModuleIndex();
diff --git a/include/clang/Serialization/Module.h b/include/clang/Serialization/Module.h
index f6889cfe8e..3eec83ca72 100644
--- a/include/clang/Serialization/Module.h
+++ b/include/clang/Serialization/Module.h
@@ -125,6 +125,9 @@ public:
/// \brief The name of the module.
std::string ModuleName;
+ /// \brief The base directory of the module.
+ std::string BaseDirectory;
+
std::string getTimestampFilename() const {
return FileName + ".timestamp";
}
@@ -203,7 +206,7 @@ public:
llvm::BitstreamCursor InputFilesCursor;
/// \brief Offsets for all of the input file entries in the AST file.
- const uint32_t *InputFileOffsets;
+ const uint64_t *InputFileOffsets;
/// \brief The input files that have been loaded from this AST file.
std::vector<InputFile> InputFilesLoaded;
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
index b03371ccee..8f8036e98f 100644
--- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
+++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
@@ -290,7 +290,7 @@ public:
}
/// \brief Get the SourceRanges associated with the report.
- virtual std::pair<ranges_iterator, ranges_iterator> getRanges();
+ virtual llvm::iterator_range<ranges_iterator> getRanges();
/// \brief Add custom or predefined bug report visitors to this report.
///
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
index b4ab1ea785..ce4dfb248f 100644
--- a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
+++ b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
@@ -352,9 +352,9 @@ private:
std::vector<SourceRange> ranges;
- PathDiagnosticPiece() LLVM_DELETED_FUNCTION;
- PathDiagnosticPiece(const PathDiagnosticPiece &P) LLVM_DELETED_FUNCTION;
- void operator=(const PathDiagnosticPiece &P) LLVM_DELETED_FUNCTION;
+ PathDiagnosticPiece() = delete;
+ PathDiagnosticPiece(const PathDiagnosticPiece &P) = delete;
+ void operator=(const PathDiagnosticPiece &P) = delete;
protected:
PathDiagnosticPiece(StringRef s, Kind k, DisplayHint hint = Below);
@@ -730,7 +730,7 @@ class PathDiagnostic : public llvm::FoldingSetNode {
PathDiagnosticLocation UniqueingLoc;
const Decl *UniqueingDecl;
- PathDiagnostic() LLVM_DELETED_FUNCTION;
+ PathDiagnostic() = delete;
public:
PathDiagnostic(StringRef CheckName, const Decl *DeclWithIssue,
StringRef bugtype, StringRef verboseDesc, StringRef shortDesc,
diff --git a/include/clang/StaticAnalyzer/Core/Checker.h b/include/clang/StaticAnalyzer/Core/Checker.h
index 8cc35148e0..099d76311f 100644
--- a/include/clang/StaticAnalyzer/Core/Checker.h
+++ b/include/clang/StaticAnalyzer/Core/Checker.h
@@ -25,10 +25,6 @@ namespace ento {
namespace check {
-struct _VoidCheck {
- static void _register(void *checker, CheckerManager &mgr) { }
-};
-
template <typename DECL>
class ASTDecl {
template <typename CHECKER>
@@ -476,49 +472,22 @@ public:
CheckerProgramPointTag(const CheckerBase *Checker, StringRef Msg);
};
-template <typename CHECK1, typename CHECK2=check::_VoidCheck,
- typename CHECK3=check::_VoidCheck, typename CHECK4=check::_VoidCheck,
- typename CHECK5=check::_VoidCheck, typename CHECK6=check::_VoidCheck,
- typename CHECK7=check::_VoidCheck, typename CHECK8=check::_VoidCheck,
- typename CHECK9=check::_VoidCheck, typename CHECK10=check::_VoidCheck,
- typename CHECK11=check::_VoidCheck,typename CHECK12=check::_VoidCheck,
- typename CHECK13=check::_VoidCheck,typename CHECK14=check::_VoidCheck,
- typename CHECK15=check::_VoidCheck,typename CHECK16=check::_VoidCheck,
- typename CHECK17=check::_VoidCheck,typename CHECK18=check::_VoidCheck,
- typename CHECK19=check::_VoidCheck,typename CHECK20=check::_VoidCheck,
- typename CHECK21=check::_VoidCheck,typename CHECK22=check::_VoidCheck,
- typename CHECK23=check::_VoidCheck,typename CHECK24=check::_VoidCheck>
-class Checker;
-
-template <>
-class Checker<check::_VoidCheck>
- : public CheckerBase
-{
- virtual void anchor();
+template <typename CHECK1, typename... CHECKs>
+class Checker : public CHECK1, public CHECKs..., public CheckerBase {
public:
- static void _register(void *checker, CheckerManager &mgr) { }
+ template <typename CHECKER>
+ static void _register(CHECKER *checker, CheckerManager &mgr) {
+ CHECK1::_register(checker, mgr);
+ Checker<CHECKs...>::_register(checker, mgr);
+ }
};
-template <typename CHECK1, typename CHECK2, typename CHECK3, typename CHECK4,
- typename CHECK5, typename CHECK6, typename CHECK7, typename CHECK8,
- typename CHECK9, typename CHECK10,typename CHECK11,typename CHECK12,
- typename CHECK13,typename CHECK14,typename CHECK15,typename CHECK16,
- typename CHECK17,typename CHECK18,typename CHECK19,typename CHECK20,
- typename CHECK21,typename CHECK22,typename CHECK23,typename CHECK24>
-class Checker
- : public CHECK1,
- public Checker<CHECK2, CHECK3, CHECK4, CHECK5, CHECK6, CHECK7,
- CHECK8, CHECK9, CHECK10,CHECK11,CHECK12,CHECK13,
- CHECK14,CHECK15,CHECK16,CHECK17,CHECK18,CHECK19,
- CHECK20,CHECK21,CHECK22,CHECK23,CHECK24> {
+template <typename CHECK1>
+class Checker<CHECK1> : public CHECK1, public CheckerBase {
public:
template <typename CHECKER>
static void _register(CHECKER *checker, CheckerManager &mgr) {
CHECK1::_register(checker, mgr);
- Checker<CHECK2, CHECK3, CHECK4, CHECK5, CHECK6, CHECK7,
- CHECK8, CHECK9, CHECK10,CHECK11,CHECK12,CHECK13,
- CHECK14,CHECK15,CHECK16,CHECK17,CHECK18,CHECK19,
- CHECK20,CHECK21,CHECK22,CHECK23,CHECK24>::_register(checker, mgr);
}
};
diff --git a/include/clang/StaticAnalyzer/Core/CheckerManager.h b/include/clang/StaticAnalyzer/Core/CheckerManager.h
index 30b0480235..8a1a82b342 100644
--- a/include/clang/StaticAnalyzer/Core/CheckerManager.h
+++ b/include/clang/StaticAnalyzer/Core/CheckerManager.h
@@ -47,71 +47,18 @@ namespace ento {
template <typename T> class CheckerFn;
-template <typename RET, typename P1, typename P2, typename P3, typename P4,
- typename P5>
-class CheckerFn<RET(P1, P2, P3, P4, P5)> {
- typedef RET (*Func)(void *, P1, P2, P3, P4, P5);
+template <typename RET, typename... Ps>
+class CheckerFn<RET(Ps...)> {
+ typedef RET (*Func)(void *, Ps...);
Func Fn;
public:
CheckerBase *Checker;
CheckerFn(CheckerBase *checker, Func fn) : Fn(fn), Checker(checker) { }
- RET operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) const {
- return Fn(Checker, p1, p2, p3, p4, p5);
+ RET operator()(Ps... ps) const {
+ return Fn(Checker, ps...);
}
};
-template <typename RET, typename P1, typename P2, typename P3, typename P4>
-class CheckerFn<RET(P1, P2, P3, P4)> {
- typedef RET (*Func)(void *, P1, P2, P3, P4);
- Func Fn;
-public:
- CheckerBase *Checker;
- CheckerFn(CheckerBase *checker, Func fn) : Fn(fn), Checker(checker) { }
- RET operator()(P1 p1, P2 p2, P3 p3, P4 p4) const {
- return Fn(Checker, p1, p2, p3, p4);
- }
-};
-
-template <typename RET, typename P1, typename P2, typename P3>
-class CheckerFn<RET(P1, P2, P3)> {
- typedef RET (*Func)(void *, P1, P2, P3);
- Func Fn;
-public:
- CheckerBase *Checker;
- CheckerFn(CheckerBase *checker, Func fn) : Fn(fn), Checker(checker) { }
- RET operator()(P1 p1, P2 p2, P3 p3) const { return Fn(Checker, p1, p2, p3); }
-};
-
-template <typename RET, typename P1, typename P2>
-class CheckerFn<RET(P1, P2)> {
- typedef RET (*Func)(void *, P1, P2);
- Func Fn;
-public:
- CheckerBase *Checker;
- CheckerFn(CheckerBase *checker, Func fn) : Fn(fn), Checker(checker) { }
- RET operator()(P1 p1, P2 p2) const { return Fn(Checker, p1, p2); }
-};
-
-template <typename RET, typename P1>
-class CheckerFn<RET(P1)> {
- typedef RET (*Func)(void *, P1);
- Func Fn;
-public:
- CheckerBase *Checker;
- CheckerFn(CheckerBase *checker, Func fn) : Fn(fn), Checker(checker) { }
- RET operator()(P1 p1) const { return Fn(Checker, p1); }
-};
-
-template <typename RET>
-class CheckerFn<RET()> {
- typedef RET (*Func)(void *);
- Func Fn;
-public:
- CheckerBase *Checker;
- CheckerFn(CheckerBase *checker, Func fn) : Fn(fn), Checker(checker) { }
- RET operator()() const { return Fn(Checker); }
-};
-
/// \brief Describes the different reasons a pointer escapes
/// during analysis.
enum PointerEscapeKind {
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
index 00deaa6c19..63b8631665 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
@@ -119,7 +119,7 @@ private:
const LocationContext *LCtx;
llvm::PointerUnion<const Expr *, const Decl *> Origin;
- void operator=(const CallEvent &) LLVM_DELETED_FUNCTION;
+ void operator=(const CallEvent &) = delete;
protected:
// This is user data for subclasses.
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
index 0dafd5f3bd..77b8f2a1bf 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
@@ -103,8 +103,8 @@ private:
ExplodedNode *Pred);
private:
- CoreEngine(const CoreEngine &) LLVM_DELETED_FUNCTION;
- void operator=(const CoreEngine &) LLVM_DELETED_FUNCTION;
+ CoreEngine(const CoreEngine &) = delete;
+ void operator=(const CoreEngine &) = delete;
ExplodedNode *generateCallExitBeginNode(ExplodedNode *N);
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
index e819b88911..ac4e452c02 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
@@ -76,7 +76,7 @@ public:
typedef llvm::ImmutableMap<void*, void*> GenericDataMap;
private:
- void operator=(const ProgramState& R) LLVM_DELETED_FUNCTION;
+ void operator=(const ProgramState& R) = delete;
friend class ProgramStateManager;
friend class ExplodedGraph;
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
index ef43fe0eea..642e11af0e 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
@@ -203,8 +203,8 @@ class DefinedOrUnknownSVal : public SVal {
private:
// We want calling these methods to be a compiler error since they are
// tautologically false.
- bool isUndef() const LLVM_DELETED_FUNCTION;
- bool isValid() const LLVM_DELETED_FUNCTION;
+ bool isUndef() const = delete;
+ bool isValid() const = delete;
protected:
DefinedOrUnknownSVal() {}
@@ -236,9 +236,9 @@ class DefinedSVal : public DefinedOrUnknownSVal {
private:
// We want calling these methods to be a compiler error since they are
// tautologically true/false.
- bool isUnknown() const LLVM_DELETED_FUNCTION;
- bool isUnknownOrUndef() const LLVM_DELETED_FUNCTION;
- bool isValid() const LLVM_DELETED_FUNCTION;
+ bool isUnknown() const = delete;
+ bool isUnknownOrUndef() const = delete;
+ bool isValid() const = delete;
protected:
DefinedSVal() {}
explicit DefinedSVal(const void *d, bool isLoc, unsigned ValKind)
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h b/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
index 5500c3c9ef..a03b6306a0 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
@@ -225,7 +225,7 @@ public:
bool HandleBinding(StoreManager& SMgr, Store store, const MemRegion* R,
SVal val) override;
- LLVM_EXPLICIT operator bool() { return First && Binding; }
+ explicit operator bool() { return First && Binding; }
const MemRegion *getRegion() { return Binding; }
};
diff --git a/include/clang/StaticAnalyzer/Frontend/FrontendActions.h b/include/clang/StaticAnalyzer/Frontend/FrontendActions.h
index f18b8ccc8b..36afb4bc5d 100644
--- a/include/clang/StaticAnalyzer/Frontend/FrontendActions.h
+++ b/include/clang/StaticAnalyzer/Frontend/FrontendActions.h
@@ -11,8 +11,8 @@
#define LLVM_CLANG_STATICANALYZER_FRONTEND_FRONTENDACTIONS_H
#include "clang/Frontend/FrontendAction.h"
-#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
namespace clang {
diff --git a/include/clang/Tooling/ArgumentsAdjusters.h b/include/clang/Tooling/ArgumentsAdjusters.h
index 30bca9bb41..a92e021420 100644
--- a/include/clang/Tooling/ArgumentsAdjusters.h
+++ b/include/clang/Tooling/ArgumentsAdjusters.h
@@ -7,74 +7,61 @@
//
//===----------------------------------------------------------------------===//
//
-// This file declares base abstract class ArgumentsAdjuster and its descendants.
-// These classes are intended to modify command line arguments obtained from
-// a compilation database before they are used to run a frontend action.
+// This file declares typedef ArgumentsAdjuster and functions to create several
+// useful argument adjusters.
+// ArgumentsAdjusters modify command line arguments obtained from a compilation
+// database before they are used to run a frontend action.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_TOOLING_ARGUMENTSADJUSTERS_H
#define LLVM_CLANG_TOOLING_ARGUMENTSADJUSTERS_H
+#include <functional>
#include <string>
#include <vector>
namespace clang {
-
namespace tooling {
/// \brief A sequence of command line arguments.
typedef std::vector<std::string> CommandLineArguments;
-/// \brief Abstract interface for a command line adjusters.
+/// \brief A prototype of a command line adjuster.
///
-/// This abstract interface describes a command line argument adjuster,
-/// which is responsible for command line arguments modification before
-/// the arguments are used to run a frontend action.
-class ArgumentsAdjuster {
- virtual void anchor();
-public:
- /// \brief Returns adjusted command line arguments.
- ///
- /// \param Args Input sequence of command line arguments.
- ///
- /// \returns Modified sequence of command line arguments.
- virtual CommandLineArguments Adjust(const CommandLineArguments &Args) = 0;
- virtual ~ArgumentsAdjuster() {}
-};
+/// Command line argument adjuster is responsible for command line arguments
+/// modification before the arguments are used to run a frontend action.
+typedef std::function<CommandLineArguments(const CommandLineArguments &)>
+ ArgumentsAdjuster;
-/// \brief Syntax check only command line adjuster.
-///
-/// This class implements ArgumentsAdjuster interface and converts input
-/// command line arguments to the "syntax check only" variant.
-class ClangSyntaxOnlyAdjuster : public ArgumentsAdjuster {
- CommandLineArguments Adjust(const CommandLineArguments &Args) override;
-};
+/// \brief Gets an argument adjuster that converts input command line arguments
+/// to the "syntax check only" variant.
+ArgumentsAdjuster getClangSyntaxOnlyAdjuster();
-/// \brief An argument adjuster which removes output-related command line
+/// \brief Gets an argument adjuster which removes output-related command line
/// arguments.
-class ClangStripOutputAdjuster : public ArgumentsAdjuster {
- CommandLineArguments Adjust(const CommandLineArguments &Args) override;
-};
+ArgumentsAdjuster getClangStripOutputAdjuster();
-class InsertArgumentAdjuster : public ArgumentsAdjuster {
-public:
- enum Position { BEGIN, END };
+enum class ArgumentInsertPosition { BEGIN, END };
- InsertArgumentAdjuster(const CommandLineArguments &Extra, Position Pos)
- : Extra(Extra), Pos(Pos) {}
+/// \brief Gets an argument adjuster which inserts \p Extra arguments in the
+/// specified position.
+ArgumentsAdjuster getInsertArgumentAdjuster(const CommandLineArguments &Extra,
+ ArgumentInsertPosition Pos);
- InsertArgumentAdjuster(const char *Extra, Position Pos)
- : Extra(1, std::string(Extra)), Pos(Pos) {}
+/// \brief Gets an argument adjuster which inserts an \p Extra argument in the
+/// specified position.
+ArgumentsAdjuster getInsertArgumentAdjuster(
+ const char *Extra,
+ ArgumentInsertPosition Pos = ArgumentInsertPosition::END);
- CommandLineArguments Adjust(const CommandLineArguments &Args) override;
+/// \brief Gets an argument adjuster which adjusts the arguments in sequence
+/// with the \p First adjuster and then with the \p Second one.
+ArgumentsAdjuster combineAdjusters(ArgumentsAdjuster First,
+ ArgumentsAdjuster Second);
-private:
- const CommandLineArguments Extra;
- const Position Pos;
-};
-} // end namespace tooling
-} // end namespace clang
+} // namespace tooling
+} // namespace clang
#endif // LLVM_CLANG_TOOLING_ARGUMENTSADJUSTERS_H
diff --git a/include/clang/Tooling/Tooling.h b/include/clang/Tooling/Tooling.h
index 89a4798b8c..393cc1deac 100644
--- a/include/clang/Tooling/Tooling.h
+++ b/include/clang/Tooling/Tooling.h
@@ -143,6 +143,10 @@ inline std::unique_ptr<FrontendActionFactory> newFrontendActionFactory(
bool runToolOnCode(clang::FrontendAction *ToolAction, const Twine &Code,
const Twine &FileName = "input.cc");
+/// The first part of the pair is the filename, the second part the
+/// file-content.
+typedef std::vector<std::pair<std::string, std::string>> FileContentMappings;
+
/// \brief Runs (and deletes) the tool on 'Code' with the -fsyntax-only flag and
/// with additional other flags.
///
@@ -152,9 +156,10 @@ bool runToolOnCode(clang::FrontendAction *ToolAction, const Twine &Code,
/// \param FileName The file name which 'Code' will be mapped as.
///
/// \return - True if 'ToolAction' was successfully executed.
-bool runToolOnCodeWithArgs(clang::FrontendAction *ToolAction, const Twine &Code,
- const std::vector<std::string> &Args,
- const Twine &FileName = "input.cc");
+bool runToolOnCodeWithArgs(
+ clang::FrontendAction *ToolAction, const Twine &Code,
+ const std::vector<std::string> &Args, const Twine &FileName = "input.cc",
+ const FileContentMappings &VirtualMappedFiles = FileContentMappings());
/// \brief Builds an AST for 'Code'.
///
@@ -269,7 +274,7 @@ class ClangTool {
///
/// \param Adjuster An argument adjuster, which will be run on the output of
/// previous argument adjusters.
- void appendArgumentsAdjuster(ArgumentsAdjuster *Adjuster);
+ void appendArgumentsAdjuster(ArgumentsAdjuster Adjuster);
/// \brief Clear the command line arguments adjuster chain.
void clearArgumentsAdjusters();
@@ -296,7 +301,7 @@ class ClangTool {
// Contains a list of pairs (<file name>, <file content>).
std::vector< std::pair<StringRef, StringRef> > MappedFileContents;
- SmallVector<std::unique_ptr<ArgumentsAdjuster>, 2> ArgsAdjusters;
+ ArgumentsAdjuster ArgsAdjuster;
DiagnosticConsumer *DiagConsumer;
};
diff --git a/include/clang/module.modulemap b/include/clang/module.modulemap
index 5058d15025..29fa008448 100644
--- a/include/clang/module.modulemap
+++ b/include/clang/module.modulemap
@@ -2,8 +2,7 @@ module Clang_Analysis {
requires cplusplus
umbrella "Analysis"
- // This file is intended for repeated textual inclusion.
- exclude header "Analysis/Analyses/ThreadSafetyOps.def"
+ textual header "Analysis/Analyses/ThreadSafetyOps.def"
module * { export * }
}
@@ -12,10 +11,9 @@ module Clang_AST {
requires cplusplus
umbrella "AST"
- // These files are intended for repeated textual inclusion.
- exclude header "AST/BuiltinTypes.def"
- exclude header "AST/TypeLocNodes.def"
- exclude header "AST/TypeNodes.def"
+ textual header "AST/BuiltinTypes.def"
+ textual header "AST/TypeLocNodes.def"
+ textual header "AST/TypeNodes.def"
module * { export * }
}
@@ -26,33 +24,25 @@ module Clang_Basic {
requires cplusplus
umbrella "Basic"
- // These files are intended for repeated textual inclusion.
- exclude header "Basic/BuiltinsAArch64.def"
- exclude header "Basic/BuiltinsARM64.def"
- exclude header "Basic/BuiltinsARM.def"
- exclude header "Basic/Builtins.def"
- exclude header "Basic/BuiltinsHexagon.def"
- exclude header "Basic/BuiltinsMips.def"
- exclude header "Basic/BuiltinsNEON.def"
- exclude header "Basic/BuiltinsNVPTX.def"
- exclude header "Basic/BuiltinsPPC.def"
- exclude header "Basic/BuiltinsR600.def"
- exclude header "Basic/BuiltinsX86.def"
- exclude header "Basic/BuiltinsXCore.def"
- exclude header "Basic/BuiltinsLe64.def"
- exclude header "Basic/DiagnosticOptions.def"
- exclude header "Basic/LangOptions.def"
- exclude header "Basic/OpenCLExtensions.def"
- exclude header "Basic/OpenMPKinds.def"
- exclude header "Basic/OperatorKinds.def"
- exclude header "Basic/Sanitizers.def"
- exclude header "Basic/TokenKinds.def"
-
- // This file includes a header from Lex.
- exclude header "Basic/PlistSupport.h"
-
- // FIXME: This is logically a part of Basic, but has been put in the wrong place.
- header "StaticAnalyzer/Core/AnalyzerOptions.h"
+ textual header "Basic/BuiltinsAArch64.def"
+ textual header "Basic/BuiltinsARM.def"
+ textual header "Basic/Builtins.def"
+ textual header "Basic/BuiltinsHexagon.def"
+ textual header "Basic/BuiltinsLe64.def"
+ textual header "Basic/BuiltinsMips.def"
+ textual header "Basic/BuiltinsNEON.def"
+ textual header "Basic/BuiltinsNVPTX.def"
+ textual header "Basic/BuiltinsPPC.def"
+ textual header "Basic/BuiltinsR600.def"
+ textual header "Basic/BuiltinsX86.def"
+ textual header "Basic/BuiltinsXCore.def"
+ textual header "Basic/DiagnosticOptions.def"
+ textual header "Basic/LangOptions.def"
+ textual header "Basic/OpenCLExtensions.def"
+ textual header "Basic/OpenMPKinds.def"
+ textual header "Basic/OperatorKinds.def"
+ textual header "Basic/Sanitizers.def"
+ textual header "Basic/TokenKinds.def"
module * { export * }
}
@@ -82,8 +72,7 @@ module Clang_Driver {
requires cplusplus
umbrella "Driver"
- // This file is intended for repeated textual inclusion.
- exclude header "Driver/Types.def"
+ textual header "Driver/Types.def"
module * { export * }
}
@@ -95,9 +84,8 @@ module Clang_Frontend {
requires cplusplus
umbrella "Frontend"
- // These files are intended for repeated textual inclusion.
- exclude header "Frontend/CodeGenOptions.def"
- exclude header "Frontend/LangStandards.def"
+ textual header "Frontend/CodeGenOptions.def"
+ textual header "Frontend/LangStandards.def"
module * { export * }
}
@@ -110,14 +98,25 @@ module Clang_Rewrite { requires cplusplus umbrella "Rewrite" module * { export *
module Clang_Sema { requires cplusplus umbrella "Sema" module * { export * } }
module Clang_Serialization { requires cplusplus umbrella "Serialization" module * { export * } }
-module Clang_StaticAnalyzer {
+module Clang_StaticAnalyzer_Core {
requires cplusplus
- umbrella "StaticAnalyzer"
+ umbrella "StaticAnalyzer/Core"
- // This file is intended for repeated textual inclusion.
- exclude header "StaticAnalyzer/Core/Analyses.def"
+ textual header "StaticAnalyzer/Core/Analyses.def"
module * { export * }
}
+module Clang_StaticAnalyzer_Checkers {
+ requires cplusplus
+ umbrella "StaticAnalyzer/Checkers"
+ module * { export * }
+}
+
+module Clang_StaticAnalyzer_Frontend {
+ requires cplusplus
+ umbrella "StaticAnalyzer/Frontend"
+ module * { export * }
+}
+
module Clang_Tooling { requires cplusplus umbrella "Tooling" module * { export * } }