summaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/AST/DeclCXX.h2
-rw-r--r--include/clang/ASTMatchers/Dynamic/VariantValue.h7
-rw-r--r--include/clang/Basic/Attr.td26
-rw-r--r--include/clang/Basic/BuiltinsPPC.def3
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td6
-rw-r--r--include/clang/CodeGen/BackendUtil.h4
-rw-r--r--include/clang/Driver/ToolChain.h7
-rw-r--r--include/clang/Frontend/ASTUnit.h34
-rw-r--r--include/clang/Frontend/CompilerInstance.h18
-rw-r--r--include/clang/Frontend/CompilerInvocation.h12
-rw-r--r--include/clang/Frontend/FrontendOptions.h2
-rw-r--r--include/clang/Frontend/Utils.h6
-rw-r--r--include/clang/Lex/HeaderSearch.h4
-rw-r--r--include/clang/Lex/HeaderSearchOptions.h2
-rw-r--r--include/clang/Lex/Preprocessor.h11
-rw-r--r--include/clang/Lex/PreprocessorOptions.h6
-rw-r--r--include/clang/Sema/CodeCompleteConsumer.h17
-rw-r--r--include/clang/Sema/Ownership.h8
-rw-r--r--include/clang/Sema/Sema.h15
-rw-r--r--include/clang/Serialization/ASTReader.h62
-rw-r--r--include/clang/Serialization/ASTWriter.h99
-rw-r--r--include/clang/Serialization/ModuleFileExtension.h2
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h7
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h136
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h29
-rw-r--r--include/clang/StaticAnalyzer/Core/CheckerManager.h8
-rw-r--r--include/clang/Tooling/Tooling.h8
27 files changed, 279 insertions, 262 deletions
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h
index 06ecd3c37342f..0ca08db16299f 100644
--- a/include/clang/AST/DeclCXX.h
+++ b/include/clang/AST/DeclCXX.h
@@ -3181,7 +3181,7 @@ public:
/// Get the using declaration from which this was instantiated. This will
/// always be an UnresolvedUsingValueDecl or an UnresolvedUsingTypenameDecl
/// that is a pack expansion.
- NamedDecl *getInstantiatedFromUsingDecl() { return InstantiatedFrom; }
+ NamedDecl *getInstantiatedFromUsingDecl() const { return InstantiatedFrom; }
/// Get the set of using declarations that this pack expanded into. Note that
/// some of these may still be unresolved.
diff --git a/include/clang/ASTMatchers/Dynamic/VariantValue.h b/include/clang/ASTMatchers/Dynamic/VariantValue.h
index 9f694d0ce4343..2c80b5137320a 100644
--- a/include/clang/ASTMatchers/Dynamic/VariantValue.h
+++ b/include/clang/ASTMatchers/Dynamic/VariantValue.h
@@ -119,7 +119,7 @@ class VariantMatcher {
/// \brief Payload interface to be specialized by each matcher type.
///
/// It follows a similar interface as VariantMatcher itself.
- class Payload : public RefCountedBase<Payload> {
+ class Payload {
public:
virtual ~Payload();
virtual llvm::Optional<DynTypedMatcher> getSingleMatcher() const = 0;
@@ -208,7 +208,8 @@ public:
std::string getTypeAsString() const;
private:
- explicit VariantMatcher(Payload *Value) : Value(Value) {}
+ explicit VariantMatcher(std::shared_ptr<Payload> Value)
+ : Value(std::move(Value)) {}
template <typename T> struct TypedMatcherOps;
@@ -216,7 +217,7 @@ private:
class PolymorphicPayload;
class VariadicOpPayload;
- IntrusiveRefCntPtr<const Payload> Value;
+ std::shared_ptr<const Payload> Value;
};
template <typename T>
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td
index 107a3bdffa657..e3c2b0e45d3d2 100644
--- a/include/clang/Basic/Attr.td
+++ b/include/clang/Basic/Attr.td
@@ -601,49 +601,53 @@ def Constructor : InheritableAttr {
let Documentation = [Undocumented];
}
+// CUDA attributes are spelled __attribute__((attr)) or __declspec(__attr__).
+
def CUDAConstant : InheritableAttr {
- let Spellings = [GNU<"constant">];
+ let Spellings = [GNU<"constant">, Declspec<"__constant__">];
let Subjects = SubjectList<[Var]>;
let LangOpts = [CUDA];
let Documentation = [Undocumented];
}
def CUDACudartBuiltin : IgnoredAttr {
- let Spellings = [GNU<"cudart_builtin">];
+ let Spellings = [GNU<"cudart_builtin">, Declspec<"__cudart_builtin__">];
let LangOpts = [CUDA];
}
def CUDADevice : InheritableAttr {
- let Spellings = [GNU<"device">];
+ let Spellings = [GNU<"device">, Declspec<"__device__">];
let Subjects = SubjectList<[Function, Var]>;
let LangOpts = [CUDA];
let Documentation = [Undocumented];
}
def CUDADeviceBuiltin : IgnoredAttr {
- let Spellings = [GNU<"device_builtin">];
+ let Spellings = [GNU<"device_builtin">, Declspec<"__device_builtin__">];
let LangOpts = [CUDA];
}
def CUDADeviceBuiltinSurfaceType : IgnoredAttr {
- let Spellings = [GNU<"device_builtin_surface_type">];
+ let Spellings = [GNU<"device_builtin_surface_type">,
+ Declspec<"__device_builtin_surface_type__">];
let LangOpts = [CUDA];
}
def CUDADeviceBuiltinTextureType : IgnoredAttr {
- let Spellings = [GNU<"device_builtin_texture_type">];
+ let Spellings = [GNU<"device_builtin_texture_type">,
+ Declspec<"__device_builtin_texture_type__">];
let LangOpts = [CUDA];
}
def CUDAGlobal : InheritableAttr {
- let Spellings = [GNU<"global">];
+ let Spellings = [GNU<"global">, Declspec<"__global__">];
let Subjects = SubjectList<[Function]>;
let LangOpts = [CUDA];
let Documentation = [Undocumented];
}
def CUDAHost : InheritableAttr {
- let Spellings = [GNU<"host">];
+ let Spellings = [GNU<"host">, Declspec<"__host__">];
let Subjects = SubjectList<[Function]>;
let LangOpts = [CUDA];
let Documentation = [Undocumented];
@@ -657,7 +661,7 @@ def CUDAInvalidTarget : InheritableAttr {
}
def CUDALaunchBounds : InheritableAttr {
- let Spellings = [GNU<"launch_bounds">];
+ let Spellings = [GNU<"launch_bounds">, Declspec<"__launch_bounds__">];
let Args = [ExprArgument<"MaxThreads">, ExprArgument<"MinBlocks", 1>];
let LangOpts = [CUDA];
let Subjects = SubjectList<[ObjCMethod, FunctionLike], WarnDiag,
@@ -669,7 +673,7 @@ def CUDALaunchBounds : InheritableAttr {
}
def CUDAShared : InheritableAttr {
- let Spellings = [GNU<"shared">];
+ let Spellings = [GNU<"shared">, Declspec<"__shared__">];
let Subjects = SubjectList<[Var]>;
let LangOpts = [CUDA];
let Documentation = [Undocumented];
@@ -1195,6 +1199,8 @@ def NoThrow : InheritableAttr {
}
def NvWeak : IgnoredAttr {
+ // No Declspec spelling of this attribute; the CUDA headers use
+ // __attribute__((nv_weak)) unconditionally.
let Spellings = [GNU<"nv_weak">];
let LangOpts = [CUDA];
}
diff --git a/include/clang/Basic/BuiltinsPPC.def b/include/clang/Basic/BuiltinsPPC.def
index 657ea4225aa8e..f7cddc03131b4 100644
--- a/include/clang/Basic/BuiltinsPPC.def
+++ b/include/clang/Basic/BuiltinsPPC.def
@@ -417,6 +417,9 @@ BUILTIN(__builtin_vsx_xvcvhpsp, "V4fV8Us", "")
BUILTIN(__builtin_vsx_xvtstdcdp, "V2ULLiV2dIi", "")
BUILTIN(__builtin_vsx_xvtstdcsp, "V4UiV4fIi", "")
+BUILTIN(__builtin_vsx_insertword, "V16UcV4UiV16UcIi", "")
+BUILTIN(__builtin_vsx_extractuword, "V2ULLiV16UcIi", "")
+
// HTM builtins
BUILTIN(__builtin_tbegin, "UiUIi", "")
BUILTIN(__builtin_tend, "UiUIi", "")
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index 610fe0cb4c01b..0807bba45fc48 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3377,8 +3377,10 @@ def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
"candidate function made ineligible by enable_if">;
def note_ovl_candidate_deduced_mismatch : Note<
"candidate template ignored: deduced type "
- "%diff{$ of %ordinal0 parameter does not match adjusted type $ of argument"
- "|of %ordinal0 parameter does not match adjusted type of argument}1,2%3">;
+ "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
+ "adjusted type $ of %select{|element of }4argument"
+ "|of %select{|element of }4%ordinal0 parameter does not match "
+ "adjusted type of %select{|element of }4argument}1,2%3">;
def note_ovl_candidate_non_deduced_mismatch : Note<
"candidate template ignored: could not match %diff{$ against $|types}0,1">;
// This note is needed because the above note would sometimes print two
diff --git a/include/clang/CodeGen/BackendUtil.h b/include/clang/CodeGen/BackendUtil.h
index 01721d3220989..c6abc6e3f574b 100644
--- a/include/clang/CodeGen/BackendUtil.h
+++ b/include/clang/CodeGen/BackendUtil.h
@@ -21,6 +21,7 @@ namespace llvm {
namespace clang {
class DiagnosticsEngine;
+ class HeaderSearchOptions;
class CodeGenOptions;
class TargetOptions;
class LangOptions;
@@ -34,7 +35,8 @@ namespace clang {
Backend_EmitObj ///< Emit native object files
};
- void EmitBackendOutput(DiagnosticsEngine &Diags, const CodeGenOptions &CGOpts,
+ void EmitBackendOutput(DiagnosticsEngine &Diags, const HeaderSearchOptions &,
+ const CodeGenOptions &CGOpts,
const TargetOptions &TOpts, const LangOptions &LOpts,
const llvm::DataLayout &TDesc, llvm::Module *M,
BackendAction Action,
diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h
index cca239c4be2a6..ffb0d60a63989 100644
--- a/include/clang/Driver/ToolChain.h
+++ b/include/clang/Driver/ToolChain.h
@@ -139,6 +139,13 @@ public:
vfs::FileSystem &getVFS() const;
const llvm::Triple &getTriple() const { return Triple; }
+ /// Get the toolchain's aux triple, if it has one.
+ ///
+ /// Exactly what the aux triple represents depends on the toolchain, but for
+ /// example when compiling CUDA code for the GPU, the triple might be NVPTX,
+ /// while the aux triple is the host (CPU) toolchain, e.g. x86-linux-gnu.
+ virtual const llvm::Triple *getAuxTriple() const { return nullptr; }
+
llvm::Triple::ArchType getArch() const { return Triple.getArch(); }
StringRef getArchName() const { return Triple.getArchName(); }
StringRef getPlatform() const { return Triple.getVendorName(); }
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index cc8d4e6e3e70d..b1cdb46d505bf 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -86,10 +86,10 @@ private:
IntrusiveRefCntPtr<SourceManager> SourceMgr;
std::unique_ptr<HeaderSearch> HeaderInfo;
IntrusiveRefCntPtr<TargetInfo> Target;
- IntrusiveRefCntPtr<Preprocessor> PP;
+ std::shared_ptr<Preprocessor> PP;
IntrusiveRefCntPtr<ASTContext> Ctx;
std::shared_ptr<TargetOptions> TargetOpts;
- IntrusiveRefCntPtr<HeaderSearchOptions> HSOpts;
+ std::shared_ptr<HeaderSearchOptions> HSOpts;
IntrusiveRefCntPtr<ASTReader> Reader;
bool HadModuleLoaderFatalFailure;
@@ -108,8 +108,8 @@ private:
/// Optional owned invocation, just used to make the invocation used in
/// LoadFromCommandLine available.
- IntrusiveRefCntPtr<CompilerInvocation> Invocation;
-
+ std::shared_ptr<CompilerInvocation> Invocation;
+
// OnlyLocalDecls - when true, walking this AST should only visit declarations
// that come from the AST itself, not from included precompiled headers.
// FIXME: This is temporary; eventually, CIndex will always do this.
@@ -358,22 +358,21 @@ public:
}
/// \brief Retrieve the allocator used to cache global code completions.
- IntrusiveRefCntPtr<GlobalCodeCompletionAllocator>
+ std::shared_ptr<GlobalCodeCompletionAllocator>
getCachedCompletionAllocator() {
return CachedCompletionAllocator;
}
CodeCompletionTUInfo &getCodeCompletionTUInfo() {
if (!CCTUInfo)
- CCTUInfo.reset(new CodeCompletionTUInfo(
- new GlobalCodeCompletionAllocator));
+ CCTUInfo = llvm::make_unique<CodeCompletionTUInfo>(
+ std::make_shared<GlobalCodeCompletionAllocator>());
return *CCTUInfo;
}
private:
/// \brief Allocator used to store cached code completions.
- IntrusiveRefCntPtr<GlobalCodeCompletionAllocator>
- CachedCompletionAllocator;
+ std::shared_ptr<GlobalCodeCompletionAllocator> CachedCompletionAllocator;
std::unique_ptr<CodeCompletionTUInfo> CCTUInfo;
@@ -496,12 +495,13 @@ public:
const Preprocessor &getPreprocessor() const { return *PP; }
Preprocessor &getPreprocessor() { return *PP; }
+ std::shared_ptr<Preprocessor> getPreprocessorPtr() const { return PP; }
const ASTContext &getASTContext() const { return *Ctx; }
ASTContext &getASTContext() { return *Ctx; }
void setASTContext(ASTContext *ctx) { Ctx = ctx; }
- void setPreprocessor(Preprocessor *pp);
+ void setPreprocessor(std::shared_ptr<Preprocessor> pp);
bool hasSema() const { return (bool)TheSema; }
Sema &getSema() const {
@@ -701,11 +701,11 @@ public:
/// remapped contents of that file.
typedef std::pair<std::string, llvm::MemoryBuffer *> RemappedFile;
- /// \brief Create a ASTUnit. Gets ownership of the passed CompilerInvocation.
- static ASTUnit *create(CompilerInvocation *CI,
- IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
- bool CaptureDiagnostics,
- bool UserFilesAreVolatile);
+ /// \brief Create a ASTUnit. Gets ownership of the passed CompilerInvocation.
+ static std::unique_ptr<ASTUnit>
+ create(std::shared_ptr<CompilerInvocation> CI,
+ IntrusiveRefCntPtr<DiagnosticsEngine> Diags, bool CaptureDiagnostics,
+ bool UserFilesAreVolatile);
/// \brief Create a ASTUnit from an AST file.
///
@@ -770,7 +770,7 @@ public:
/// created ASTUnit was passed in \p Unit then the caller can check that.
///
static ASTUnit *LoadFromCompilerInvocationAction(
- CompilerInvocation *CI,
+ std::shared_ptr<CompilerInvocation> CI,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
FrontendAction *Action = nullptr, ASTUnit *Unit = nullptr,
@@ -797,7 +797,7 @@ public:
// FIXME: Move OnlyLocalDecls, UseBumpAllocator to setters on the ASTUnit, we
// shouldn't need to specify them at construction time.
static std::unique_ptr<ASTUnit> LoadFromCompilerInvocation(
- CompilerInvocation *CI,
+ std::shared_ptr<CompilerInvocation> CI,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
IntrusiveRefCntPtr<DiagnosticsEngine> Diags, FileManager *FileMgr,
bool OnlyLocalDecls = false, bool CaptureDiagnostics = false,
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h
index 3f754d9998745..3ebbc61515c66 100644
--- a/include/clang/Frontend/CompilerInstance.h
+++ b/include/clang/Frontend/CompilerInstance.h
@@ -70,7 +70,7 @@ class TargetInfo;
/// and a long form that takes explicit instances of any required objects.
class CompilerInstance : public ModuleLoader {
/// The options used in this compiler instance.
- IntrusiveRefCntPtr<CompilerInvocation> Invocation;
+ std::shared_ptr<CompilerInvocation> Invocation;
/// The diagnostics engine instance.
IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics;
@@ -91,7 +91,7 @@ class CompilerInstance : public ModuleLoader {
IntrusiveRefCntPtr<SourceManager> SourceMgr;
/// The preprocessor.
- IntrusiveRefCntPtr<Preprocessor> PP;
+ std::shared_ptr<Preprocessor> PP;
/// The AST context.
IntrusiveRefCntPtr<ASTContext> Context;
@@ -228,7 +228,7 @@ public:
}
/// setInvocation - Replace the current invocation.
- void setInvocation(CompilerInvocation *Value);
+ void setInvocation(std::shared_ptr<CompilerInvocation> Value);
/// \brief Indicates whether we should (re)build the global module index.
bool shouldBuildGlobalModuleIndex() const;
@@ -288,6 +288,9 @@ public:
const HeaderSearchOptions &getHeaderSearchOpts() const {
return Invocation->getHeaderSearchOpts();
}
+ std::shared_ptr<HeaderSearchOptions> getHeaderSearchOptsPtr() const {
+ return Invocation->getHeaderSearchOptsPtr();
+ }
LangOptions &getLangOpts() {
return *Invocation->getLangOpts();
@@ -433,13 +436,14 @@ public:
return *PP;
}
+ std::shared_ptr<Preprocessor> getPreprocessorPtr() { return PP; }
+
void resetAndLeakPreprocessor() {
- BuryPointer(PP.get());
- PP.resetWithoutRelease();
+ BuryPointer(new std::shared_ptr<Preprocessor>(PP));
}
/// Replace the current preprocessor.
- void setPreprocessor(Preprocessor *Value);
+ void setPreprocessor(std::shared_ptr<Preprocessor> Value);
/// }
/// @name ASTContext
@@ -653,7 +657,7 @@ public:
StringRef Path, StringRef Sysroot, bool DisablePCHValidation,
bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context,
const PCHContainerReader &PCHContainerRdr,
- ArrayRef<IntrusiveRefCntPtr<ModuleFileExtension>> Extensions,
+ ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
void *DeserializationListener, bool OwnDeserializationListener,
bool Preamble, bool UseGlobalModuleIndex);
diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h
index cb037c26546f1..cef7f73ecaa0f 100644
--- a/include/clang/Frontend/CompilerInvocation.h
+++ b/include/clang/Frontend/CompilerInvocation.h
@@ -51,7 +51,7 @@ bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args,
bool DefaultDiagColor = true,
bool DefaultShowOpt = true);
-class CompilerInvocationBase : public RefCountedBase<CompilerInvocation> {
+class CompilerInvocationBase {
void operator=(const CompilerInvocationBase &) = delete;
public:
@@ -65,10 +65,10 @@ public:
IntrusiveRefCntPtr<DiagnosticOptions> DiagnosticOpts;
/// Options controlling the \#include directive.
- IntrusiveRefCntPtr<HeaderSearchOptions> HeaderSearchOpts;
+ std::shared_ptr<HeaderSearchOptions> HeaderSearchOpts;
/// Options controlling the preprocessor (aside from \#include handling).
- IntrusiveRefCntPtr<PreprocessorOptions> PreprocessorOpts;
+ std::shared_ptr<PreprocessorOptions> PreprocessorOpts;
CompilerInvocationBase();
~CompilerInvocationBase();
@@ -89,7 +89,13 @@ public:
const HeaderSearchOptions &getHeaderSearchOpts() const {
return *HeaderSearchOpts;
}
+ std::shared_ptr<HeaderSearchOptions> getHeaderSearchOptsPtr() const {
+ return HeaderSearchOpts;
+ }
+ std::shared_ptr<PreprocessorOptions> getPreprocessorOptsPtr() {
+ return PreprocessorOpts;
+ }
PreprocessorOptions &getPreprocessorOpts() { return *PreprocessorOpts; }
const PreprocessorOptions &getPreprocessorOpts() const {
return *PreprocessorOpts;
diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h
index aad397526a038..9c960bb0c3053 100644
--- a/include/clang/Frontend/FrontendOptions.h
+++ b/include/clang/Frontend/FrontendOptions.h
@@ -243,7 +243,7 @@ public:
std::vector<std::string> Plugins;
/// The list of module file extensions.
- std::vector<IntrusiveRefCntPtr<ModuleFileExtension>> ModuleFileExtensions;
+ std::vector<std::shared_ptr<ModuleFileExtension>> ModuleFileExtensions;
/// \brief The list of module map files to load before processing the input.
std::vector<std::string> ModuleMapFiles;
diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h
index 60419ff9b41d6..0ee46846c804e 100644
--- a/include/clang/Frontend/Utils.h
+++ b/include/clang/Frontend/Utils.h
@@ -184,10 +184,10 @@ createChainedIncludesSource(CompilerInstance &CI,
///
/// \return A CompilerInvocation, or 0 if none was built for the given
/// argument vector.
-CompilerInvocation *
+std::unique_ptr<CompilerInvocation>
createInvocationFromCommandLine(ArrayRef<const char *> Args,
- IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
- IntrusiveRefCntPtr<DiagnosticsEngine>());
+ IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
+ IntrusiveRefCntPtr<DiagnosticsEngine>());
/// Return the value of the last argument as an integer, or a default. If Diags
/// is non-null, emits an error if the argument is given, but non-integral.
diff --git a/include/clang/Lex/HeaderSearch.h b/include/clang/Lex/HeaderSearch.h
index b145d7bae15a8..4df3e783117a3 100644
--- a/include/clang/Lex/HeaderSearch.h
+++ b/include/clang/Lex/HeaderSearch.h
@@ -147,7 +147,7 @@ class HeaderSearch {
};
/// \brief Header-search options used to initialize this header search.
- IntrusiveRefCntPtr<HeaderSearchOptions> HSOpts;
+ std::shared_ptr<HeaderSearchOptions> HSOpts;
DiagnosticsEngine &Diags;
FileManager &FileMgr;
@@ -248,7 +248,7 @@ class HeaderSearch {
friend class DirectoryLookup;
public:
- HeaderSearch(IntrusiveRefCntPtr<HeaderSearchOptions> HSOpts,
+ HeaderSearch(std::shared_ptr<HeaderSearchOptions> HSOpts,
SourceManager &SourceMgr, DiagnosticsEngine &Diags,
const LangOptions &LangOpts, const TargetInfo *Target);
~HeaderSearch();
diff --git a/include/clang/Lex/HeaderSearchOptions.h b/include/clang/Lex/HeaderSearchOptions.h
index 815b68c60e80c..e99980537348b 100644
--- a/include/clang/Lex/HeaderSearchOptions.h
+++ b/include/clang/Lex/HeaderSearchOptions.h
@@ -44,7 +44,7 @@ namespace frontend {
/// HeaderSearchOptions - Helper class for storing options related to the
/// initialization of the HeaderSearch object.
-class HeaderSearchOptions : public RefCountedBase<HeaderSearchOptions> {
+class HeaderSearchOptions {
public:
struct Entry {
std::string Path;
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index bb71f49290b4a..7ce1aad36d12a 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -94,8 +94,8 @@ enum MacroUse {
/// Lexers know only about tokens within a single source file, and don't
/// know anything about preprocessor-level issues like the \#include stack,
/// token expansion, etc.
-class Preprocessor : public RefCountedBase<Preprocessor> {
- IntrusiveRefCntPtr<PreprocessorOptions> PPOpts;
+class Preprocessor {
+ std::shared_ptr<PreprocessorOptions> PPOpts;
DiagnosticsEngine *Diags;
LangOptions &LangOpts;
const TargetInfo *Target;
@@ -650,10 +650,9 @@ class Preprocessor : public RefCountedBase<Preprocessor> {
void updateOutOfDateIdentifier(IdentifierInfo &II) const;
public:
- Preprocessor(IntrusiveRefCntPtr<PreprocessorOptions> PPOpts,
- DiagnosticsEngine &diags, LangOptions &opts,
- SourceManager &SM, HeaderSearch &Headers,
- ModuleLoader &TheModuleLoader,
+ Preprocessor(std::shared_ptr<PreprocessorOptions> PPOpts,
+ DiagnosticsEngine &diags, LangOptions &opts, SourceManager &SM,
+ HeaderSearch &Headers, ModuleLoader &TheModuleLoader,
IdentifierInfoLookup *IILookup = nullptr,
bool OwnsHeaderSearch = false,
TranslationUnitKind TUKind = TU_Complete);
diff --git a/include/clang/Lex/PreprocessorOptions.h b/include/clang/Lex/PreprocessorOptions.h
index de652cccb83ae..58d79f7ff81a6 100644
--- a/include/clang/Lex/PreprocessorOptions.h
+++ b/include/clang/Lex/PreprocessorOptions.h
@@ -40,7 +40,7 @@ enum ObjCXXARCStandardLibraryKind {
/// PreprocessorOptions - This class is used for passing the various options
/// used in preprocessor initialization to InitializePreprocessor().
-class PreprocessorOptions : public RefCountedBase<PreprocessorOptions> {
+class PreprocessorOptions {
public:
std::vector<std::pair<std::string, bool/*isUndef*/> > Macros;
std::vector<std::string> Includes;
@@ -117,7 +117,7 @@ public:
ObjCXXARCStandardLibraryKind ObjCXXARCStandardLibrary;
/// \brief Records the set of modules
- class FailedModulesSet : public RefCountedBase<FailedModulesSet> {
+ class FailedModulesSet {
llvm::StringSet<> Failed;
public:
@@ -136,7 +136,7 @@ public:
/// to (re)build modules, so that once a module fails to build anywhere,
/// other instances will see that the module has failed and won't try to
/// build it again.
- IntrusiveRefCntPtr<FailedModulesSet> FailedModules;
+ std::shared_ptr<FailedModulesSet> FailedModules;
public:
PreprocessorOptions() : UsePredefines(true), DetailedRecord(false),
diff --git a/include/clang/Sema/CodeCompleteConsumer.h b/include/clang/Sema/CodeCompleteConsumer.h
index b80924ea11fcd..dee53dc14a8ca 100644
--- a/include/clang/Sema/CodeCompleteConsumer.h
+++ b/include/clang/Sema/CodeCompleteConsumer.h
@@ -509,23 +509,18 @@ public:
};
/// \brief Allocator for a cached set of global code completions.
-class GlobalCodeCompletionAllocator
- : public CodeCompletionAllocator,
- public RefCountedBase<GlobalCodeCompletionAllocator>
-{
-
-};
+class GlobalCodeCompletionAllocator : public CodeCompletionAllocator {};
class CodeCompletionTUInfo {
llvm::DenseMap<const DeclContext *, StringRef> ParentNames;
- IntrusiveRefCntPtr<GlobalCodeCompletionAllocator> AllocatorRef;
+ std::shared_ptr<GlobalCodeCompletionAllocator> AllocatorRef;
public:
explicit CodeCompletionTUInfo(
- IntrusiveRefCntPtr<GlobalCodeCompletionAllocator> Allocator)
+ std::shared_ptr<GlobalCodeCompletionAllocator> Allocator)
: AllocatorRef(std::move(Allocator)) {}
- IntrusiveRefCntPtr<GlobalCodeCompletionAllocator> getAllocatorRef() const {
+ std::shared_ptr<GlobalCodeCompletionAllocator> getAllocatorRef() const {
return AllocatorRef;
}
CodeCompletionAllocator &getAllocator() const {
@@ -965,8 +960,8 @@ public:
/// results to the given raw output stream.
PrintingCodeCompleteConsumer(const CodeCompleteOptions &CodeCompleteOpts,
raw_ostream &OS)
- : CodeCompleteConsumer(CodeCompleteOpts, false), OS(OS),
- CCTUInfo(new GlobalCodeCompletionAllocator) {}
+ : CodeCompleteConsumer(CodeCompleteOpts, false), OS(OS),
+ CCTUInfo(std::make_shared<GlobalCodeCompletionAllocator>()) {}
/// \brief Prints the finalized code-completion results.
void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context,
diff --git a/include/clang/Sema/Ownership.h b/include/clang/Sema/Ownership.h
index 92ea5296c45b6..fd46de870fb42 100644
--- a/include/clang/Sema/Ownership.h
+++ b/include/clang/Sema/Ownership.h
@@ -153,8 +153,8 @@ namespace clang {
ActionResult(const DiagnosticBuilder &) : Val(PtrTy()), Invalid(true) {}
// These two overloads prevent void* -> bool conversions.
- ActionResult(const void *);
- ActionResult(volatile void *);
+ ActionResult(const void *) = delete;
+ ActionResult(volatile void *) = delete;
bool isInvalid() const { return Invalid; }
bool isUsable() const { return !Invalid && Val; }
@@ -192,8 +192,8 @@ namespace clang {
ActionResult(const DiagnosticBuilder &) : PtrWithInvalid(0x01) { }
// These two overloads prevent void* -> bool conversions.
- ActionResult(const void *);
- ActionResult(volatile void *);
+ ActionResult(const void *) = delete;
+ ActionResult(volatile void *) = delete;
bool isInvalid() const { return PtrWithInvalid & 0x01; }
bool isUsable() const { return PtrWithInvalid > 0x01; }
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 3762253ef1131..ca984a360a608 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -6564,6 +6564,10 @@ public:
/// \brief After substituting deduced template arguments, a dependent
/// parameter type did not match the corresponding argument.
TDK_DeducedMismatch,
+ /// \brief After substituting deduced template arguments, an element of
+ /// a dependent parameter type did not match the corresponding element
+ /// of the corresponding argument (when deducing from an initializer list).
+ TDK_DeducedMismatchNested,
/// \brief A non-depnedent component of the parameter did not match the
/// corresponding component of the argument.
TDK_NonDeducedMismatch,
@@ -6602,13 +6606,14 @@ public:
/// brief A function argument from which we performed template argument
// deduction for a call.
struct OriginalCallArg {
- OriginalCallArg(QualType OriginalParamType,
- unsigned ArgIdx,
- QualType OriginalArgType)
- : OriginalParamType(OriginalParamType), ArgIdx(ArgIdx),
- OriginalArgType(OriginalArgType) { }
+ OriginalCallArg(QualType OriginalParamType, bool DecomposedParam,
+ unsigned ArgIdx, QualType OriginalArgType)
+ : OriginalParamType(OriginalParamType),
+ DecomposedParam(DecomposedParam), ArgIdx(ArgIdx),
+ OriginalArgType(OriginalArgType) {}
QualType OriginalParamType;
+ bool DecomposedParam;
unsigned ArgIdx;
QualType OriginalArgType;
};
diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h
index 5230e2ae00131..93994e2c519c7 100644
--- a/include/clang/Serialization/ASTReader.h
+++ b/include/clang/Serialization/ASTReader.h
@@ -384,8 +384,8 @@ private:
std::unique_ptr<ASTReaderListener> Listener;
/// \brief The receiver of deserialization events.
- ASTDeserializationListener *DeserializationListener;
- bool OwnsDeserializationListener;
+ ASTDeserializationListener *DeserializationListener = nullptr;
+ bool OwnsDeserializationListener = false;
SourceManager &SourceMgr;
FileManager &FileMgr;
@@ -394,7 +394,7 @@ private:
/// \brief The semantic analysis object that will be processing the
/// AST files and the translation unit that uses it.
- Sema *SemaObj;
+ Sema *SemaObj = nullptr;
/// \brief The preprocessor that will be loading the source file.
Preprocessor &PP;
@@ -403,7 +403,7 @@ private:
ASTContext &Context;
/// \brief The AST consumer.
- ASTConsumer *Consumer;
+ ASTConsumer *Consumer = nullptr;
/// \brief The module manager which manages modules and their dependencies
ModuleManager ModuleMgr;
@@ -414,7 +414,7 @@ private:
IdentifierResolver DummyIdResolver;
/// A mapping from extension block names to module file extensions.
- llvm::StringMap<IntrusiveRefCntPtr<ModuleFileExtension>> ModuleFileExtensions;
+ llvm::StringMap<std::shared_ptr<ModuleFileExtension>> ModuleFileExtensions;
/// \brief A timer used to track the time spent deserializing.
std::unique_ptr<llvm::Timer> ReadTimer;
@@ -802,10 +802,10 @@ private:
SourceLocation OptimizeOffPragmaLocation;
/// \brief The PragmaMSStructKind pragma ms_struct state if set, or -1.
- int PragmaMSStructState;
+ int PragmaMSStructState = -1;
/// \brief The PragmaMSPointersToMembersKind pragma pointers_to_members state.
- int PragmaMSPointersToMembersState;
+ int PragmaMSPointersToMembersState = -1;
SourceLocation PointersToMembersPragmaLocation;
/// \brief The OpenCL extension settings.
@@ -870,10 +870,10 @@ private:
bool UseGlobalIndex;
/// \brief Whether we have tried loading the global module index yet.
- bool TriedLoadingGlobalIndex;
+ bool TriedLoadingGlobalIndex = false;
///\brief Whether we are currently processing update records.
- bool ProcessingUpdateRecords;
+ bool ProcessingUpdateRecords = false;
typedef llvm::DenseMap<unsigned, SwitchCase *> SwitchCaseMapTy;
/// \brief Mapping from switch-case IDs in the chain to switch-case statements
@@ -886,73 +886,73 @@ private:
/// \brief The number of source location entries de-serialized from
/// the PCH file.
- unsigned NumSLocEntriesRead;
+ unsigned NumSLocEntriesRead = 0;
/// \brief The number of source location entries in the chain.
- unsigned TotalNumSLocEntries;
+ unsigned TotalNumSLocEntries = 0;
/// \brief The number of statements (and expressions) de-serialized
/// from the chain.
- unsigned NumStatementsRead;
+ unsigned NumStatementsRead = 0;
/// \brief The total number of statements (and expressions) stored
/// in the chain.
- unsigned TotalNumStatements;
+ unsigned TotalNumStatements = 0;
/// \brief The number of macros de-serialized from the chain.
- unsigned NumMacrosRead;
+ unsigned NumMacrosRead = 0;
/// \brief The total number of macros stored in the chain.
- unsigned TotalNumMacros;
+ unsigned TotalNumMacros = 0;
/// \brief The number of lookups into identifier tables.
- unsigned NumIdentifierLookups;
+ unsigned NumIdentifierLookups = 0;
/// \brief The number of lookups into identifier tables that succeed.
- unsigned NumIdentifierLookupHits;
+ unsigned NumIdentifierLookupHits = 0;
/// \brief The number of selectors that have been read.
- unsigned NumSelectorsRead;
+ unsigned NumSelectorsRead = 0;
/// \brief The number of method pool entries that have been read.
- unsigned NumMethodPoolEntriesRead;
+ unsigned NumMethodPoolEntriesRead = 0;
/// \brief The number of times we have looked up a selector in the method
/// pool.
- unsigned NumMethodPoolLookups;
+ unsigned NumMethodPoolLookups = 0;
/// \brief The number of times we have looked up a selector in the method
/// pool and found something.
- unsigned NumMethodPoolHits;
+ unsigned NumMethodPoolHits = 0;
/// \brief The number of times we have looked up a selector in the method
/// pool within a specific module.
- unsigned NumMethodPoolTableLookups;
+ unsigned NumMethodPoolTableLookups = 0;
/// \brief The number of times we have looked up a selector in the method
/// pool within a specific module and found something.
- unsigned NumMethodPoolTableHits;
+ unsigned NumMethodPoolTableHits = 0;
/// \brief The total number of method pool entries in the selector table.
- unsigned TotalNumMethodPoolEntries;
+ unsigned TotalNumMethodPoolEntries = 0;
/// Number of lexical decl contexts read/total.
- unsigned NumLexicalDeclContextsRead, TotalLexicalDeclContexts;
+ unsigned NumLexicalDeclContextsRead = 0, TotalLexicalDeclContexts = 0;
/// Number of visible decl contexts read/total.
- unsigned NumVisibleDeclContextsRead, TotalVisibleDeclContexts;
+ unsigned NumVisibleDeclContextsRead = 0, TotalVisibleDeclContexts = 0;
/// Total size of modules, in bits, currently loaded
- uint64_t TotalModulesSizeInBits;
+ uint64_t TotalModulesSizeInBits = 0;
/// \brief Number of Decl/types that are currently deserializing.
- unsigned NumCurrentElementsDeserializing;
+ unsigned NumCurrentElementsDeserializing = 0;
/// \brief Set true while we are in the process of passing deserialized
/// "interesting" decls to consumer inside FinishedDeserializing().
/// This is used as a guard to avoid recursively repeating the process of
/// passing decls to consumer.
- bool PassingDeclsToConsumer;
+ bool PassingDeclsToConsumer = false;
/// \brief The set of identifiers that were read while the AST reader was
/// (recursively) loading declarations.
@@ -1055,7 +1055,7 @@ private:
};
/// \brief What kind of records we are reading.
- ReadingKind ReadingKind;
+ ReadingKind ReadingKind = Read_None;
/// \brief RAII object to change the reading kind.
class ReadingKindTracker {
@@ -1366,7 +1366,7 @@ public:
/// deserializing.
ASTReader(Preprocessor &PP, ASTContext &Context,
const PCHContainerReader &PCHContainerRdr,
- ArrayRef<IntrusiveRefCntPtr<ModuleFileExtension>> Extensions,
+ ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
StringRef isysroot = "", bool DisableValidation = false,
bool AllowASTWithCompilerErrors = false,
bool AllowConfigurationMismatch = false,
diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h
index 1469555ec21e6..0d6b0268109dc 100644
--- a/include/clang/Serialization/ASTWriter.h
+++ b/include/clang/Serialization/ASTWriter.h
@@ -107,16 +107,16 @@ private:
llvm::BitstreamWriter &Stream;
/// \brief The ASTContext we're writing.
- ASTContext *Context;
+ ASTContext *Context = nullptr;
/// \brief The preprocessor we're writing.
- Preprocessor *PP;
+ Preprocessor *PP = nullptr;
/// \brief The reader of existing AST files, if we're chaining.
- ASTReader *Chain;
+ ASTReader *Chain = nullptr;
/// \brief The module we're currently writing, if any.
- Module *WritingModule;
+ Module *WritingModule = nullptr;
/// \brief The base directory for any relative paths we emit.
std::string BaseDirectory;
@@ -129,14 +129,14 @@ private:
/// \brief Indicates when the AST writing is actively performing
/// serialization, rather than just queueing updates.
- bool WritingAST;
+ bool WritingAST = false;
/// \brief Indicates that we are done serializing the collection of decls
/// and types to emit.
- bool DoneWritingDeclsAndTypes;
+ bool DoneWritingDeclsAndTypes = false;
/// \brief Indicates that the AST contained compiler errors.
- bool ASTHasCompilerErrors;
+ bool ASTHasCompilerErrors = false;
/// \brief Mapping from input file entries to the index into the
/// offset table where information about that input file is stored.
@@ -170,10 +170,10 @@ private:
std::queue<DeclOrType> DeclTypesToEmit;
/// \brief The first ID number we can use for our own declarations.
- serialization::DeclID FirstDeclID;
+ serialization::DeclID FirstDeclID = serialization::NUM_PREDEF_DECL_IDS;
/// \brief The decl ID that will be assigned to the next new decl.
- serialization::DeclID NextDeclID;
+ serialization::DeclID NextDeclID = FirstDeclID;
/// \brief Map that provides the ID numbers of each declaration within
/// the output stream, as well as those deserialized from a chained PCH.
@@ -205,10 +205,10 @@ private:
void associateDeclWithFile(const Decl *D, serialization::DeclID);
/// \brief The first ID number we can use for our own types.
- serialization::TypeID FirstTypeID;
+ serialization::TypeID FirstTypeID = serialization::NUM_PREDEF_TYPE_IDS;
/// \brief The type ID that will be assigned to the next new type.
- serialization::TypeID NextTypeID;
+ serialization::TypeID NextTypeID = FirstTypeID;
/// \brief Map that provides the ID numbers of each type within the
/// output stream, plus those deserialized from a chained PCH.
@@ -226,10 +226,10 @@ private:
std::vector<uint32_t> TypeOffsets;
/// \brief The first ID number we can use for our own identifiers.
- serialization::IdentID FirstIdentID;
+ serialization::IdentID FirstIdentID = serialization::NUM_PREDEF_IDENT_IDS;
/// \brief The identifier ID that will be assigned to the next new identifier.
- serialization::IdentID NextIdentID;
+ serialization::IdentID NextIdentID = FirstIdentID;
/// \brief Map that provides the ID numbers of each identifier in
/// the output stream.
@@ -240,10 +240,10 @@ private:
llvm::MapVector<const IdentifierInfo *, serialization::IdentID> IdentifierIDs;
/// \brief The first ID number we can use for our own macros.
- serialization::MacroID FirstMacroID;
+ serialization::MacroID FirstMacroID = serialization::NUM_PREDEF_MACRO_IDS;
/// \brief The identifier ID that will be assigned to the next new identifier.
- serialization::MacroID NextMacroID;
+ serialization::MacroID NextMacroID = FirstMacroID;
/// \brief Map that provides the ID numbers of each macro.
llvm::DenseMap<MacroInfo *, serialization::MacroID> MacroIDs;
@@ -275,16 +275,18 @@ private:
std::vector<uint32_t> IdentifierOffsets;
/// \brief The first ID number we can use for our own submodules.
- serialization::SubmoduleID FirstSubmoduleID;
-
+ serialization::SubmoduleID FirstSubmoduleID =
+ serialization::NUM_PREDEF_SUBMODULE_IDS;
+
/// \brief The submodule ID that will be assigned to the next new submodule.
- serialization::SubmoduleID NextSubmoduleID;
+ serialization::SubmoduleID NextSubmoduleID = FirstSubmoduleID;
/// \brief The first ID number we can use for our own selectors.
- serialization::SelectorID FirstSelectorID;
+ serialization::SelectorID FirstSelectorID =
+ serialization::NUM_PREDEF_SELECTOR_IDS;
/// \brief The selector ID that will be assigned to the next new selector.
- serialization::SelectorID NextSelectorID;
+ serialization::SelectorID NextSelectorID = FirstSelectorID;
/// \brief Map that provides the ID numbers of each Selector.
llvm::MapVector<Selector, serialization::SelectorID> SelectorIDs;
@@ -394,18 +396,18 @@ private:
llvm::DenseMap<SwitchCase *, unsigned> SwitchCaseIDs;
/// \brief The number of statements written to the AST file.
- unsigned NumStatements;
+ unsigned NumStatements = 0;
/// \brief The number of macros written to the AST file.
- unsigned NumMacros;
+ unsigned NumMacros = 0;
/// \brief The number of lexical declcontexts written to the AST
/// file.
- unsigned NumLexicalDeclContexts;
+ unsigned NumLexicalDeclContexts = 0;
/// \brief The number of visible declcontexts written to the AST
/// file.
- unsigned NumVisibleDeclContexts;
+ unsigned NumVisibleDeclContexts = 0;
/// \brief A mapping from each known submodule to its ID number, which will
/// be a positive integer.
@@ -436,8 +438,8 @@ private:
void WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag,
bool isModule);
- unsigned TypeExtQualAbbrev;
- unsigned TypeFunctionProtoAbbrev;
+ unsigned TypeExtQualAbbrev = 0;
+ unsigned TypeFunctionProtoAbbrev = 0;
void WriteTypeAbbrevs();
void WriteType(QualType T);
@@ -470,22 +472,22 @@ private:
void WriteModuleFileExtension(Sema &SemaRef,
ModuleFileExtensionWriter &Writer);
- unsigned DeclParmVarAbbrev;
- unsigned DeclContextLexicalAbbrev;
- unsigned DeclContextVisibleLookupAbbrev;
- unsigned UpdateVisibleAbbrev;
- unsigned DeclRecordAbbrev;
- unsigned DeclTypedefAbbrev;
- unsigned DeclVarAbbrev;
- unsigned DeclFieldAbbrev;
- unsigned DeclEnumAbbrev;
- unsigned DeclObjCIvarAbbrev;
- unsigned DeclCXXMethodAbbrev;
-
- unsigned DeclRefExprAbbrev;
- unsigned CharacterLiteralAbbrev;
- unsigned IntegerLiteralAbbrev;
- unsigned ExprImplicitCastAbbrev;
+ unsigned DeclParmVarAbbrev = 0;
+ unsigned DeclContextLexicalAbbrev = 0;
+ unsigned DeclContextVisibleLookupAbbrev = 0;
+ unsigned UpdateVisibleAbbrev = 0;
+ unsigned DeclRecordAbbrev = 0;
+ unsigned DeclTypedefAbbrev = 0;
+ unsigned DeclVarAbbrev = 0;
+ unsigned DeclFieldAbbrev = 0;
+ unsigned DeclEnumAbbrev = 0;
+ unsigned DeclObjCIvarAbbrev = 0;
+ unsigned DeclCXXMethodAbbrev = 0;
+
+ unsigned DeclRefExprAbbrev = 0;
+ unsigned CharacterLiteralAbbrev = 0;
+ unsigned IntegerLiteralAbbrev = 0;
+ unsigned ExprImplicitCastAbbrev = 0;
void WriteDeclAbbrevs();
void WriteDecl(ASTContext &Context, Decl *D);
@@ -498,7 +500,7 @@ public:
/// \brief Create a new precompiled header writer that outputs to
/// the given bitstream.
ASTWriter(llvm::BitstreamWriter &Stream,
- ArrayRef<llvm::IntrusiveRefCntPtr<ModuleFileExtension>> Extensions,
+ ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
bool IncludeTimestamps = true);
~ASTWriter() override;
@@ -934,13 +936,10 @@ protected:
SmallVectorImpl<char> &getPCH() const { return Buffer->Data; }
public:
- PCHGenerator(
- const Preprocessor &PP, StringRef OutputFile,
- StringRef isysroot,
- std::shared_ptr<PCHBuffer> Buffer,
- ArrayRef<llvm::IntrusiveRefCntPtr<ModuleFileExtension>> Extensions,
- bool AllowASTWithErrors = false,
- bool IncludeTimestamps = true);
+ PCHGenerator(const Preprocessor &PP, StringRef OutputFile, StringRef isysroot,
+ std::shared_ptr<PCHBuffer> Buffer,
+ ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
+ bool AllowASTWithErrors = false, bool IncludeTimestamps = true);
~PCHGenerator() override;
void InitializeSema(Sema &S) override { SemaPtr = &S; }
void HandleTranslationUnit(ASTContext &Ctx) override;
diff --git a/include/clang/Serialization/ModuleFileExtension.h b/include/clang/Serialization/ModuleFileExtension.h
index ba2e2fd0d9f11..f7bdcec598f16 100644
--- a/include/clang/Serialization/ModuleFileExtension.h
+++ b/include/clang/Serialization/ModuleFileExtension.h
@@ -60,7 +60,7 @@ class ModuleFileExtensionWriter;
/// compiled module files (.pcm) and precompiled headers (.pch) via a
/// custom writer that can then be accessed via a custom reader when
/// the module file or precompiled header is loaded.
-class ModuleFileExtension : public llvm::RefCountedBase<ModuleFileExtension> {
+class ModuleFileExtension {
public:
virtual ~ModuleFileExtension();
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
index 73f4dd5a3e911..0f1eb096c4958 100644
--- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
+++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
@@ -66,8 +66,7 @@ public:
typedef SmallVector<std::unique_ptr<BugReporterVisitor>, 8> VisitorList;
typedef VisitorList::iterator visitor_iterator;
typedef SmallVector<StringRef, 2> ExtraTextList;
- typedef SmallVector<llvm::IntrusiveRefCntPtr<PathDiagnosticNotePiece>, 4>
- NoteList;
+ typedef SmallVector<std::shared_ptr<PathDiagnosticNotePiece>, 4> NoteList;
protected:
friend class BugReporter;
@@ -268,12 +267,12 @@ public:
/// the extra note should appear.
void addNote(StringRef Msg, const PathDiagnosticLocation &Pos,
ArrayRef<SourceRange> Ranges) {
- PathDiagnosticNotePiece *P = new PathDiagnosticNotePiece(Pos, Msg);
+ auto P = std::make_shared<PathDiagnosticNotePiece>(Pos, Msg);
for (const auto &R : Ranges)
P->addRange(R);
- Notes.push_back(P);
+ Notes.push_back(std::move(P));
}
// FIXME: Instead of making an override, we could have default-initialized
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h
index 8c3a1d0d4b408..b72bce5fc9f82 100644
--- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h
+++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h
@@ -59,10 +59,9 @@ public:
///
/// The last parameter can be used to register a new visitor with the given
/// BugReport while processing a node.
- virtual PathDiagnosticPiece *VisitNode(const ExplodedNode *Succ,
- const ExplodedNode *Pred,
- BugReporterContext &BRC,
- BugReport &BR) = 0;
+ virtual std::shared_ptr<PathDiagnosticPiece>
+ VisitNode(const ExplodedNode *Succ, const ExplodedNode *Pred,
+ BugReporterContext &BRC, BugReport &BR) = 0;
/// \brief Provide custom definition for the final diagnostic piece on the
/// path - the piece, which is displayed before the path is expanded.
@@ -121,10 +120,10 @@ public:
void Profile(llvm::FoldingSetNodeID &ID) const override;
- PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
- const ExplodedNode *PrevN,
- BugReporterContext &BRC,
- BugReport &BR) override;
+ std::shared_ptr<PathDiagnosticPiece> VisitNode(const ExplodedNode *N,
+ const ExplodedNode *PrevN,
+ BugReporterContext &BRC,
+ BugReport &BR) override;
};
class TrackConstraintBRVisitor final
@@ -150,10 +149,10 @@ public:
/// to make all PathDiagnosticPieces created by this visitor.
static const char *getTag();
- PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
- const ExplodedNode *PrevN,
- BugReporterContext &BRC,
- BugReport &BR) override;
+ std::shared_ptr<PathDiagnosticPiece> VisitNode(const ExplodedNode *N,
+ const ExplodedNode *PrevN,
+ BugReporterContext &BRC,
+ BugReport &BR) override;
private:
/// Checks if the constraint is valid in the current state.
@@ -172,10 +171,10 @@ public:
ID.AddPointer(&x);
}
- PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
- const ExplodedNode *PrevN,
- BugReporterContext &BRC,
- BugReport &BR) override;
+ std::shared_ptr<PathDiagnosticPiece> VisitNode(const ExplodedNode *N,
+ const ExplodedNode *PrevN,
+ BugReporterContext &BRC,
+ BugReport &BR) override;
/// If the statement is a message send expression with nil receiver, returns
/// the receiver expression. Returns NULL otherwise.
@@ -200,49 +199,38 @@ public:
/// to make all PathDiagnosticPieces created by this visitor.
static const char *getTag();
- PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
- const ExplodedNode *Prev,
- BugReporterContext &BRC,
- BugReport &BR) override;
+ std::shared_ptr<PathDiagnosticPiece> VisitNode(const ExplodedNode *N,
+ const ExplodedNode *Prev,
+ BugReporterContext &BRC,
+ BugReport &BR) override;
- PathDiagnosticPiece *VisitNodeImpl(const ExplodedNode *N,
- const ExplodedNode *Prev,
- BugReporterContext &BRC,
- BugReport &BR);
-
- PathDiagnosticPiece *VisitTerminator(const Stmt *Term,
- const ExplodedNode *N,
- const CFGBlock *srcBlk,
- const CFGBlock *dstBlk,
- BugReport &R,
- BugReporterContext &BRC);
-
- PathDiagnosticPiece *VisitTrueTest(const Expr *Cond,
- bool tookTrue,
- BugReporterContext &BRC,
- BugReport &R,
- const ExplodedNode *N);
-
- PathDiagnosticPiece *VisitTrueTest(const Expr *Cond,
- const DeclRefExpr *DR,
- const bool tookTrue,
- BugReporterContext &BRC,
- BugReport &R,
- const ExplodedNode *N);
-
- PathDiagnosticPiece *VisitTrueTest(const Expr *Cond,
- const BinaryOperator *BExpr,
- const bool tookTrue,
- BugReporterContext &BRC,
- BugReport &R,
- const ExplodedNode *N);
-
- PathDiagnosticPiece *VisitConditionVariable(StringRef LhsString,
- const Expr *CondVarExpr,
- const bool tookTrue,
- BugReporterContext &BRC,
- BugReport &R,
- const ExplodedNode *N);
+ std::shared_ptr<PathDiagnosticPiece> VisitNodeImpl(const ExplodedNode *N,
+ const ExplodedNode *Prev,
+ BugReporterContext &BRC,
+ BugReport &BR);
+
+ std::shared_ptr<PathDiagnosticPiece>
+ VisitTerminator(const Stmt *Term, const ExplodedNode *N,
+ const CFGBlock *srcBlk, const CFGBlock *dstBlk, BugReport &R,
+ BugReporterContext &BRC);
+
+ std::shared_ptr<PathDiagnosticPiece>
+ VisitTrueTest(const Expr *Cond, bool tookTrue, BugReporterContext &BRC,
+ BugReport &R, const ExplodedNode *N);
+
+ std::shared_ptr<PathDiagnosticPiece>
+ VisitTrueTest(const Expr *Cond, const DeclRefExpr *DR, const bool tookTrue,
+ BugReporterContext &BRC, BugReport &R, const ExplodedNode *N);
+
+ std::shared_ptr<PathDiagnosticPiece>
+ VisitTrueTest(const Expr *Cond, const BinaryOperator *BExpr,
+ const bool tookTrue, BugReporterContext &BRC, BugReport &R,
+ const ExplodedNode *N);
+
+ std::shared_ptr<PathDiagnosticPiece>
+ VisitConditionVariable(StringRef LhsString, const Expr *CondVarExpr,
+ const bool tookTrue, BugReporterContext &BRC,
+ BugReport &R, const ExplodedNode *N);
bool patternMatch(const Expr *Ex,
const Expr *ParentEx,
@@ -270,10 +258,10 @@ public:
ID.AddPointer(getTag());
}
- PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
- const ExplodedNode *Prev,
- BugReporterContext &BRC,
- BugReport &BR) override {
+ std::shared_ptr<PathDiagnosticPiece> VisitNode(const ExplodedNode *N,
+ const ExplodedNode *Prev,
+ BugReporterContext &BRC,
+ BugReport &BR) override {
return nullptr;
}
@@ -302,10 +290,10 @@ public:
ID.AddPointer(R);
}
- PathDiagnosticPiece *VisitNode(const ExplodedNode *N,
- const ExplodedNode *PrevN,
- BugReporterContext &BRC,
- BugReport &BR) override;
+ std::shared_ptr<PathDiagnosticPiece> VisitNode(const ExplodedNode *N,
+ const ExplodedNode *PrevN,
+ BugReporterContext &BRC,
+ BugReport &BR) override;
};
class SuppressInlineDefensiveChecksVisitor final
@@ -333,10 +321,10 @@ public:
/// to make all PathDiagnosticPieces created by this visitor.
static const char *getTag();
- PathDiagnosticPiece *VisitNode(const ExplodedNode *Succ,
- const ExplodedNode *Pred,
- BugReporterContext &BRC,
- BugReport &BR) override;
+ std::shared_ptr<PathDiagnosticPiece> VisitNode(const ExplodedNode *Succ,
+ const ExplodedNode *Pred,
+ BugReporterContext &BRC,
+ BugReport &BR) override;
};
class CXXSelfAssignmentBRVisitor final
@@ -349,10 +337,10 @@ public:
void Profile(llvm::FoldingSetNodeID &ID) const override {}
- PathDiagnosticPiece *VisitNode(const ExplodedNode *Succ,
- const ExplodedNode *Pred,
- BugReporterContext &BRC,
- BugReport &BR) override;
+ std::shared_ptr<PathDiagnosticPiece> VisitNode(const ExplodedNode *Succ,
+ const ExplodedNode *Pred,
+ BugReporterContext &BRC,
+ BugReport &BR) override;
};
namespace bugreporter {
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
index efe809fb19818..dc6e54a33206e 100644
--- a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
+++ b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
@@ -334,7 +334,7 @@ public:
// Path "pieces" for path-sensitive diagnostics.
//===----------------------------------------------------------------------===//
-class PathDiagnosticPiece : public RefCountedBase<PathDiagnosticPiece> {
+class PathDiagnosticPiece {
public:
enum Kind { ControlFlow, Event, Macro, Call, Note };
enum DisplayHint { Above, Below };
@@ -416,9 +416,8 @@ public:
virtual void dump() const = 0;
};
-
-
-class PathPieces : public std::list<IntrusiveRefCntPtr<PathDiagnosticPiece> > {
+
+class PathPieces : public std::list<std::shared_ptr<PathDiagnosticPiece>> {
void flattenTo(PathPieces &Primary, PathPieces &Current,
bool ShouldFlattenMacros) const;
public:
@@ -590,11 +589,11 @@ public:
PathDiagnosticLocation getLocation() const override {
return callEnter;
}
-
- IntrusiveRefCntPtr<PathDiagnosticEventPiece> getCallEnterEvent() const;
- IntrusiveRefCntPtr<PathDiagnosticEventPiece>
- getCallEnterWithinCallerEvent() const;
- IntrusiveRefCntPtr<PathDiagnosticEventPiece> getCallExitEvent() const;
+
+ std::shared_ptr<PathDiagnosticEventPiece> getCallEnterEvent() const;
+ std::shared_ptr<PathDiagnosticEventPiece>
+ getCallEnterWithinCallerEvent() const;
+ std::shared_ptr<PathDiagnosticEventPiece> getCallExitEvent() const;
void flattenLocations() override {
callEnter.flatten();
@@ -602,11 +601,11 @@ public:
for (PathPieces::iterator I = path.begin(),
E = path.end(); I != E; ++I) (*I)->flattenLocations();
}
-
- static PathDiagnosticCallPiece *construct(const ExplodedNode *N,
- const CallExitEnd &CE,
- const SourceManager &SM);
-
+
+ static std::shared_ptr<PathDiagnosticCallPiece>
+ construct(const ExplodedNode *N, const CallExitEnd &CE,
+ const SourceManager &SM);
+
static PathDiagnosticCallPiece *construct(PathPieces &pieces,
const Decl *caller);
@@ -787,7 +786,7 @@ public:
assert(!Loc.isValid() && "End location already set!");
Loc = EndPiece->getLocation();
assert(Loc.isValid() && "Invalid location for end-of-path piece");
- getActivePath().push_back(EndPiece.release());
+ getActivePath().push_back(std::move(EndPiece));
}
void appendToDesc(StringRef S) {
diff --git a/include/clang/StaticAnalyzer/Core/CheckerManager.h b/include/clang/StaticAnalyzer/Core/CheckerManager.h
index 5af717d902681..0316c8fb173ba 100644
--- a/include/clang/StaticAnalyzer/Core/CheckerManager.h
+++ b/include/clang/StaticAnalyzer/Core/CheckerManager.h
@@ -102,12 +102,12 @@ enum class ObjCMessageVisitKind {
class CheckerManager {
const LangOptions LangOpts;
- AnalyzerOptionsRef AOptions;
+ AnalyzerOptions &AOptions;
CheckName CurrentCheckName;
public:
- CheckerManager(const LangOptions &langOpts, AnalyzerOptionsRef AOptions)
- : LangOpts(langOpts), AOptions(std::move(AOptions)) {}
+ CheckerManager(const LangOptions &langOpts, AnalyzerOptions &AOptions)
+ : LangOpts(langOpts), AOptions(AOptions) {}
~CheckerManager();
@@ -119,7 +119,7 @@ public:
void finishedCheckerRegistration();
const LangOptions &getLangOpts() const { return LangOpts; }
- AnalyzerOptions &getAnalyzerOptions() { return *AOptions; }
+ AnalyzerOptions &getAnalyzerOptions() { return AOptions; }
typedef CheckerBase *CheckerRef;
typedef const void *CheckerTag;
diff --git a/include/clang/Tooling/Tooling.h b/include/clang/Tooling/Tooling.h
index ca232f4098318..10e26ac25d174 100644
--- a/include/clang/Tooling/Tooling.h
+++ b/include/clang/Tooling/Tooling.h
@@ -69,7 +69,8 @@ public:
/// \brief Perform an action for an invocation.
virtual bool
- runInvocation(clang::CompilerInvocation *Invocation, FileManager *Files,
+ runInvocation(std::shared_ptr<clang::CompilerInvocation> Invocation,
+ FileManager *Files,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
DiagnosticConsumer *DiagConsumer) = 0;
};
@@ -85,7 +86,8 @@ public:
~FrontendActionFactory() override;
/// \brief Invokes the compiler with a FrontendAction created by create().
- bool runInvocation(clang::CompilerInvocation *Invocation, FileManager *Files,
+ bool runInvocation(std::shared_ptr<clang::CompilerInvocation> Invocation,
+ FileManager *Files,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
DiagnosticConsumer *DiagConsumer) override;
@@ -261,7 +263,7 @@ public:
bool runInvocation(const char *BinaryName,
clang::driver::Compilation *Compilation,
- clang::CompilerInvocation *Invocation,
+ std::shared_ptr<clang::CompilerInvocation> Invocation,
std::shared_ptr<PCHContainerOperations> PCHContainerOps);
std::vector<std::string> CommandLine;