mirror of
https://github.com/intel/llvm.git
synced 2026-01-31 07:27:33 +08:00
Track IntrusiveRefCntPtr::get() changes from LLVM r212366
llvm-svn: 212369
This commit is contained in:
@@ -816,7 +816,7 @@ public:
|
||||
/// \brief Retrieve a pointer to the external AST source associated
|
||||
/// with this AST context, if any.
|
||||
ExternalASTSource *getExternalSource() const {
|
||||
return ExternalSource.getPtr();
|
||||
return ExternalSource.get();
|
||||
}
|
||||
|
||||
/// \brief Attach an AST mutation listener to the AST context.
|
||||
|
||||
@@ -250,7 +250,7 @@ public:
|
||||
uint64_t getID() const {
|
||||
/// FIXME: Document the requirements this imposes on matcher
|
||||
/// implementations (no new() implementation_ during a Matches()).
|
||||
return reinterpret_cast<uint64_t>(Implementation.getPtr());
|
||||
return reinterpret_cast<uint64_t>(Implementation.get());
|
||||
}
|
||||
|
||||
/// \brief Allows the conversion of a \c Matcher<Type> to a \c
|
||||
|
||||
@@ -360,7 +360,7 @@ public:
|
||||
}
|
||||
|
||||
void resetAndLeakFileManager() {
|
||||
BuryPointer(FileMgr.getPtr());
|
||||
BuryPointer(FileMgr.get());
|
||||
FileMgr.resetWithoutRelease();
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ public:
|
||||
}
|
||||
|
||||
void resetAndLeakSourceManager() {
|
||||
BuryPointer(SourceMgr.getPtr());
|
||||
BuryPointer(SourceMgr.get());
|
||||
SourceMgr.resetWithoutRelease();
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ public:
|
||||
}
|
||||
|
||||
void resetAndLeakPreprocessor() {
|
||||
BuryPointer(PP.getPtr());
|
||||
BuryPointer(PP.get());
|
||||
PP.resetWithoutRelease();
|
||||
}
|
||||
|
||||
@@ -419,7 +419,7 @@ public:
|
||||
}
|
||||
|
||||
void resetAndLeakASTContext() {
|
||||
BuryPointer(Context.getPtr());
|
||||
BuryPointer(Context.get());
|
||||
Context.resetWithoutRelease();
|
||||
}
|
||||
|
||||
|
||||
@@ -74,12 +74,12 @@ public:
|
||||
|
||||
CompilerInvocationBase(const CompilerInvocationBase &X);
|
||||
|
||||
LangOptions *getLangOpts() { return LangOpts.getPtr(); }
|
||||
const LangOptions *getLangOpts() const { return LangOpts.getPtr(); }
|
||||
LangOptions *getLangOpts() { return LangOpts.get(); }
|
||||
const LangOptions *getLangOpts() const { return LangOpts.get(); }
|
||||
|
||||
TargetOptions &getTargetOpts() { return *TargetOpts.getPtr(); }
|
||||
TargetOptions &getTargetOpts() { return *TargetOpts.get(); }
|
||||
const TargetOptions &getTargetOpts() const {
|
||||
return *TargetOpts.getPtr();
|
||||
return *TargetOpts.get();
|
||||
}
|
||||
|
||||
DiagnosticOptions &getDiagnosticOpts() const { return *DiagnosticOpts; }
|
||||
|
||||
@@ -56,14 +56,14 @@ public:
|
||||
CallEventRef(const CallEventRef &Orig) : IntrusiveRefCntPtr<const T>(Orig) {}
|
||||
|
||||
CallEventRef<T> cloneWithState(ProgramStateRef State) const {
|
||||
return this->getPtr()->template cloneWithState<T>(State);
|
||||
return this->get()->template cloneWithState<T>(State);
|
||||
}
|
||||
|
||||
// Allow implicit conversions to a superclass type, since CallEventRef
|
||||
// behaves like a pointer-to-const.
|
||||
template <typename SuperT>
|
||||
operator CallEventRef<SuperT> () const {
|
||||
return this->getPtr();
|
||||
return this->get();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1024,7 +1024,7 @@ namespace llvm {
|
||||
|
||||
static SimpleType
|
||||
getSimplifiedValue(clang::ento::CallEventRef<T> Val) {
|
||||
return Val.getPtr();
|
||||
return Val.get();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
const ProgramStateRef &state,
|
||||
bool IsSink) {
|
||||
ID.Add(Loc);
|
||||
ID.AddPointer(state.getPtr());
|
||||
ID.AddPointer(state.get());
|
||||
ID.AddBoolean(IsSink);
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ ASTUnit::~ASTUnit() {
|
||||
// perform this operation here because we explicitly request that the
|
||||
// compiler instance *not* free these buffers for each invocation of the
|
||||
// parser.
|
||||
if (Invocation.getPtr() && OwnsRemappedFileBuffers) {
|
||||
if (Invocation.get() && OwnsRemappedFileBuffers) {
|
||||
PreprocessorOptions &PPOpts = Invocation->getPreprocessorOpts();
|
||||
for (PreprocessorOptions::remapped_file_buffer_iterator
|
||||
FB = PPOpts.remapped_file_buffer_begin(),
|
||||
@@ -656,7 +656,7 @@ llvm::MemoryBuffer *ASTUnit::getBufferForFile(StringRef Filename,
|
||||
void ASTUnit::ConfigureDiags(IntrusiveRefCntPtr<DiagnosticsEngine> &Diags,
|
||||
const char **ArgBegin, const char **ArgEnd,
|
||||
ASTUnit &AST, bool CaptureDiagnostics) {
|
||||
if (!Diags.getPtr()) {
|
||||
if (!Diags.get()) {
|
||||
// No diagnostics engine was provided, so create our own diagnostics object
|
||||
// with the default options.
|
||||
DiagnosticConsumer *Client = nullptr;
|
||||
@@ -685,7 +685,7 @@ ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename,
|
||||
ASTUnitCleanup(AST.get());
|
||||
llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,
|
||||
llvm::CrashRecoveryContextReleaseRefCleanup<DiagnosticsEngine> >
|
||||
DiagCleanup(Diags.getPtr());
|
||||
DiagCleanup(Diags.get());
|
||||
|
||||
ConfigureDiags(Diags, nullptr, nullptr, *AST, CaptureDiagnostics);
|
||||
|
||||
@@ -1058,7 +1058,7 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) {
|
||||
IntrusiveRefCntPtr<CompilerInvocation>
|
||||
CCInvocation(new CompilerInvocation(*Invocation));
|
||||
|
||||
Clang->setInvocation(CCInvocation.getPtr());
|
||||
Clang->setInvocation(CCInvocation.get());
|
||||
OriginalSourceFile = Clang->getFrontendOpts().Inputs[0].getFile();
|
||||
|
||||
// Set up diagnostics, capturing any diagnostics that would
|
||||
@@ -1810,7 +1810,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(
|
||||
ASTUnitCleanup(OwnAST.get());
|
||||
llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,
|
||||
llvm::CrashRecoveryContextReleaseRefCleanup<DiagnosticsEngine> >
|
||||
DiagCleanup(Diags.getPtr());
|
||||
DiagCleanup(Diags.get());
|
||||
|
||||
// We'll manage file buffers ourselves.
|
||||
CI->getPreprocessorOpts().RetainRemappedFileBuffers = true;
|
||||
@@ -1966,7 +1966,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromCompilerInvocation(
|
||||
ASTUnitCleanup(AST.get());
|
||||
llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,
|
||||
llvm::CrashRecoveryContextReleaseRefCleanup<DiagnosticsEngine> >
|
||||
DiagCleanup(Diags.getPtr());
|
||||
DiagCleanup(Diags.get());
|
||||
|
||||
if (AST->LoadFromCompilerInvocation(PrecompilePreamble))
|
||||
return nullptr;
|
||||
@@ -1983,7 +1983,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine(
|
||||
bool AllowPCHWithCompilerErrors, bool SkipFunctionBodies,
|
||||
bool UserFilesAreVolatile, bool ForSerialization,
|
||||
std::unique_ptr<ASTUnit> *ErrAST) {
|
||||
if (!Diags.getPtr()) {
|
||||
if (!Diags.get()) {
|
||||
// No diagnostics engine was provided, so create our own diagnostics object
|
||||
// with the default options.
|
||||
Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions());
|
||||
|
||||
@@ -99,7 +99,7 @@ ChainedIncludesSource::create(CompilerInstance &CI) {
|
||||
|
||||
std::unique_ptr<CompilerInstance> Clang(new CompilerInstance());
|
||||
Clang->setInvocation(CInvok.release());
|
||||
Clang->setDiagnostics(Diags.getPtr());
|
||||
Clang->setDiagnostics(Diags.get());
|
||||
Clang->setTarget(TargetInfo::CreateTargetInfo(Clang->getDiagnostics(),
|
||||
&Clang->getTargetOpts()));
|
||||
Clang->createFileManager();
|
||||
|
||||
@@ -336,7 +336,7 @@ void CompilerInstance::createPCHExternalASTSource(
|
||||
AllowPCHWithCompilerErrors, getPreprocessor(), getASTContext(),
|
||||
DeserializationListener, OwnDeserializationListener, Preamble,
|
||||
getFrontendOpts().UseGlobalModuleIndex);
|
||||
ModuleManager = static_cast<ASTReader*>(Source.getPtr());
|
||||
ModuleManager = static_cast<ASTReader*>(Source.get());
|
||||
getASTContext().setExternalSource(Source);
|
||||
}
|
||||
|
||||
|
||||
@@ -2039,7 +2039,7 @@ createVFSFromCompilerInvocation(const CompilerInvocation &CI,
|
||||
|
||||
IntrusiveRefCntPtr<vfs::FileSystem> FS =
|
||||
vfs::getVFSFromYAML(Buffer.release(), /*DiagHandler*/nullptr);
|
||||
if (!FS.getPtr()) {
|
||||
if (!FS.get()) {
|
||||
Diags.Report(diag::err_invalid_vfs_overlay) << File;
|
||||
return IntrusiveRefCntPtr<vfs::FileSystem>();
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ using namespace llvm::opt;
|
||||
CompilerInvocation *
|
||||
clang::createInvocationFromCommandLine(ArrayRef<const char *> ArgList,
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> Diags) {
|
||||
if (!Diags.getPtr()) {
|
||||
if (!Diags.get()) {
|
||||
// No diagnostics engine was provided, so create our own diagnostics object
|
||||
// with the default options.
|
||||
Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions);
|
||||
|
||||
@@ -1130,7 +1130,7 @@ void TextDiagnostic::emitSnippetAndCaret(
|
||||
std::string FixItInsertionLine = buildFixItInsertionLine(LineNo,
|
||||
sourceColMap,
|
||||
Hints, SM,
|
||||
DiagOpts.getPtr());
|
||||
DiagOpts.get());
|
||||
|
||||
// If the source line is too long for our terminal, select only the
|
||||
// "interesting" source region within that line.
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
SimpleFormatContext(LangOptions Options)
|
||||
: DiagOpts(new DiagnosticOptions()),
|
||||
Diagnostics(new DiagnosticsEngine(new DiagnosticIDs,
|
||||
DiagOpts.getPtr())),
|
||||
DiagOpts.get())),
|
||||
Files((FileSystemOptions())),
|
||||
Sources(*Diagnostics, Files),
|
||||
Rewrite(Sources, Options) {
|
||||
|
||||
@@ -378,7 +378,7 @@ bool PCHValidator::ReadDiagnosticOptions(
|
||||
DiagnosticsEngine &ExistingDiags = PP.getDiagnostics();
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagIDs(ExistingDiags.getDiagnosticIDs());
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
|
||||
new DiagnosticsEngine(DiagIDs, DiagOpts.getPtr()));
|
||||
new DiagnosticsEngine(DiagIDs, DiagOpts.get()));
|
||||
// This should never fail, because we would have processed these options
|
||||
// before writing them to an ASTFile.
|
||||
ProcessWarningOptions(*Diags, *DiagOpts, /*Report*/false);
|
||||
|
||||
@@ -126,7 +126,7 @@ void DereferenceChecker::reportBug(ProgramStateRef State, const Stmt *S,
|
||||
os << "Array access";
|
||||
const ArraySubscriptExpr *AE = cast<ArraySubscriptExpr>(S);
|
||||
AddDerefSource(os, Ranges, AE->getBase()->IgnoreParenCasts(),
|
||||
State.getPtr(), N->getLocationContext());
|
||||
State.get(), N->getLocationContext());
|
||||
os << " results in a null pointer dereference";
|
||||
break;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ void DereferenceChecker::reportBug(ProgramStateRef State, const Stmt *S,
|
||||
os << "Dereference of null pointer";
|
||||
const UnaryOperator *U = cast<UnaryOperator>(S);
|
||||
AddDerefSource(os, Ranges, U->getSubExpr()->IgnoreParens(),
|
||||
State.getPtr(), N->getLocationContext(), true);
|
||||
State.get(), N->getLocationContext(), true);
|
||||
break;
|
||||
}
|
||||
case Stmt::MemberExprClass: {
|
||||
@@ -143,7 +143,7 @@ void DereferenceChecker::reportBug(ProgramStateRef State, const Stmt *S,
|
||||
os << "Access to field '" << M->getMemberNameInfo()
|
||||
<< "' results in a dereference of a null pointer";
|
||||
AddDerefSource(os, Ranges, M->getBase()->IgnoreParenCasts(),
|
||||
State.getPtr(), N->getLocationContext(), true);
|
||||
State.get(), N->getLocationContext(), true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -152,7 +152,7 @@ void DereferenceChecker::reportBug(ProgramStateRef State, const Stmt *S,
|
||||
os << "Access to instance variable '" << *IV->getDecl()
|
||||
<< "' results in a dereference of a null pointer";
|
||||
AddDerefSource(os, Ranges, IV->getBase()->IgnoreParenCasts(),
|
||||
State.getPtr(), N->getLocationContext(), true);
|
||||
State.get(), N->getLocationContext(), true);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -125,7 +125,7 @@ static void removeRedundantMsgs(PathPieces &path) {
|
||||
break;
|
||||
|
||||
if (PathDiagnosticEventPiece *nextEvent =
|
||||
dyn_cast<PathDiagnosticEventPiece>(path.front().getPtr())) {
|
||||
dyn_cast<PathDiagnosticEventPiece>(path.front().get())) {
|
||||
PathDiagnosticEventPiece *event =
|
||||
cast<PathDiagnosticEventPiece>(piece);
|
||||
// Check to see if we should keep one of the two pieces. If we
|
||||
@@ -1412,7 +1412,7 @@ static bool GenerateExtensivePathDiagnostic(PathDiagnostic& PD,
|
||||
if (Optional<PostStmt> PS = P.getAs<PostStmt>()) {
|
||||
if (const Expr *Ex = PS->getStmtAs<Expr>())
|
||||
reversePropagateIntererstingSymbols(*PDB.getBugReport(), IE,
|
||||
N->getState().getPtr(), Ex,
|
||||
N->getState().get(), Ex,
|
||||
N->getLocationContext());
|
||||
}
|
||||
|
||||
@@ -1420,7 +1420,7 @@ static bool GenerateExtensivePathDiagnostic(PathDiagnostic& PD,
|
||||
const Stmt *S = CE->getCalleeContext()->getCallSite();
|
||||
if (const Expr *Ex = dyn_cast_or_null<Expr>(S)) {
|
||||
reversePropagateIntererstingSymbols(*PDB.getBugReport(), IE,
|
||||
N->getState().getPtr(), Ex,
|
||||
N->getState().get(), Ex,
|
||||
N->getLocationContext());
|
||||
}
|
||||
|
||||
@@ -1491,7 +1491,7 @@ static bool GenerateExtensivePathDiagnostic(PathDiagnostic& PD,
|
||||
const LocationContext *CalleeCtx = PDB.LC;
|
||||
if (CallerCtx != CalleeCtx) {
|
||||
reversePropagateInterestingSymbols(*PDB.getBugReport(), IE,
|
||||
N->getState().getPtr(),
|
||||
N->getState().get(),
|
||||
CalleeCtx, CallerCtx);
|
||||
}
|
||||
}
|
||||
@@ -1674,7 +1674,7 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD,
|
||||
|
||||
PathDiagnosticCallPiece *C;
|
||||
if (VisitedEntireCall) {
|
||||
PathDiagnosticPiece *P = PD.getActivePath().front().getPtr();
|
||||
PathDiagnosticPiece *P = PD.getActivePath().front().get();
|
||||
C = cast<PathDiagnosticCallPiece>(P);
|
||||
} else {
|
||||
const Decl *Caller = CE->getLocationContext()->getDecl();
|
||||
@@ -1728,7 +1728,7 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD,
|
||||
// Propagate the interesting symbols accordingly.
|
||||
if (const Expr *Ex = dyn_cast_or_null<Expr>(S)) {
|
||||
reversePropagateIntererstingSymbols(*PDB.getBugReport(), IE,
|
||||
N->getState().getPtr(), Ex,
|
||||
N->getState().get(), Ex,
|
||||
N->getLocationContext());
|
||||
}
|
||||
|
||||
@@ -1756,7 +1756,7 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD,
|
||||
// interesting symbols correctly.
|
||||
if (const Expr *Ex = PS->getStmtAs<Expr>())
|
||||
reversePropagateIntererstingSymbols(*PDB.getBugReport(), IE,
|
||||
N->getState().getPtr(), Ex,
|
||||
N->getState().get(), Ex,
|
||||
N->getLocationContext());
|
||||
|
||||
// Add an edge. If this is an ObjCForCollectionStmt do
|
||||
@@ -1779,7 +1779,7 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD,
|
||||
const LocationContext *CalleeCtx = PDB.LC;
|
||||
if (CallerCtx != CalleeCtx) {
|
||||
reversePropagateInterestingSymbols(*PDB.getBugReport(), IE,
|
||||
N->getState().getPtr(),
|
||||
N->getState().get(),
|
||||
CalleeCtx, CallerCtx);
|
||||
}
|
||||
}
|
||||
@@ -2995,7 +2995,7 @@ static void CompactPathDiagnostic(PathPieces &path, const SourceManager& SM) {
|
||||
for (PathPieces::const_iterator I = path.begin(), E = path.end();
|
||||
I!=E; ++I) {
|
||||
|
||||
PathDiagnosticPiece *piece = I->getPtr();
|
||||
PathDiagnosticPiece *piece = I->get();
|
||||
|
||||
// Recursively compact calls.
|
||||
if (PathDiagnosticCallPiece *call=dyn_cast<PathDiagnosticCallPiece>(piece)){
|
||||
|
||||
@@ -1285,13 +1285,13 @@ bool ConditionBRVisitor::patternMatch(const Expr *Ex, raw_ostream &Out,
|
||||
if (quotes) {
|
||||
Out << '\'';
|
||||
const LocationContext *LCtx = N->getLocationContext();
|
||||
const ProgramState *state = N->getState().getPtr();
|
||||
const ProgramState *state = N->getState().get();
|
||||
if (const MemRegion *R = state->getLValue(cast<VarDecl>(DR->getDecl()),
|
||||
LCtx).getAsRegion()) {
|
||||
if (report.isInteresting(R))
|
||||
prunable = false;
|
||||
else {
|
||||
const ProgramState *state = N->getState().getPtr();
|
||||
const ProgramState *state = N->getState().get();
|
||||
SVal V = state->getSVal(R);
|
||||
if (report.isInteresting(V))
|
||||
prunable = false;
|
||||
@@ -1446,7 +1446,7 @@ ConditionBRVisitor::VisitConditionVariable(StringRef LhsString,
|
||||
|
||||
if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(CondVarExpr)) {
|
||||
if (const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl())) {
|
||||
const ProgramState *state = N->getState().getPtr();
|
||||
const ProgramState *state = N->getState().get();
|
||||
if (const MemRegion *R = state->getLValue(VD, LCtx).getAsRegion()) {
|
||||
if (report.isInteresting(R))
|
||||
event->setPrunable(false);
|
||||
@@ -1490,7 +1490,7 @@ ConditionBRVisitor::VisitTrueTest(const Expr *Cond,
|
||||
PathDiagnosticEventPiece *event =
|
||||
new PathDiagnosticEventPiece(Loc, Out.str());
|
||||
|
||||
const ProgramState *state = N->getState().getPtr();
|
||||
const ProgramState *state = N->getState().get();
|
||||
if (const MemRegion *R = state->getLValue(VD, LCtx).getAsRegion()) {
|
||||
if (report.isInteresting(R))
|
||||
event->setPrunable(false);
|
||||
|
||||
@@ -2517,7 +2517,7 @@ struct DOTGraphTraits<ExplodedNode*> :
|
||||
}
|
||||
|
||||
ProgramStateRef state = N->getState();
|
||||
Out << "\\|StateID: " << (const void*) state.getPtr()
|
||||
Out << "\\|StateID: " << (const void*) state.get()
|
||||
<< " NodeID: " << (const void*) N << "\\|";
|
||||
state->printDOT(Out);
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ PathPieces::~PathPieces() {}
|
||||
void PathPieces::flattenTo(PathPieces &Primary, PathPieces &Current,
|
||||
bool ShouldFlattenMacros) const {
|
||||
for (PathPieces::const_iterator I = begin(), E = end(); I != E; ++I) {
|
||||
PathDiagnosticPiece *Piece = I->getPtr();
|
||||
PathDiagnosticPiece *Piece = I->get();
|
||||
|
||||
switch (Piece->getKind()) {
|
||||
case PathDiagnosticPiece::Call: {
|
||||
@@ -157,7 +157,7 @@ void PathDiagnostic::resetDiagnosticLocationToMainFile() {
|
||||
if (path.empty())
|
||||
return;
|
||||
|
||||
PathDiagnosticPiece *LastP = path.back().getPtr();
|
||||
PathDiagnosticPiece *LastP = path.back().get();
|
||||
assert(LastP);
|
||||
const SourceManager &SMgr = LastP->getLocation().getManager();
|
||||
|
||||
@@ -222,7 +222,7 @@ void PathDiagnosticConsumer::HandlePathDiagnostic(PathDiagnostic *D) {
|
||||
|
||||
for (PathPieces::const_iterator I = path.begin(), E = path.end(); I != E;
|
||||
++I) {
|
||||
const PathDiagnosticPiece *piece = I->getPtr();
|
||||
const PathDiagnosticPiece *piece = I->get();
|
||||
FullSourceLoc L = piece->getLocation().asLocation().getExpansionLoc();
|
||||
|
||||
if (FID.isInvalid()) {
|
||||
@@ -1037,7 +1037,7 @@ PathDiagnosticCallPiece::getCallExitEvent() const {
|
||||
static void compute_path_size(const PathPieces &pieces, unsigned &size) {
|
||||
for (PathPieces::const_iterator it = pieces.begin(),
|
||||
et = pieces.end(); it != et; ++it) {
|
||||
const PathDiagnosticPiece *piece = it->getPtr();
|
||||
const PathDiagnosticPiece *piece = it->get();
|
||||
if (const PathDiagnosticCallPiece *cp =
|
||||
dyn_cast<PathDiagnosticCallPiece>(piece)) {
|
||||
compute_path_size(cp->path, size);
|
||||
|
||||
@@ -311,7 +311,7 @@ void PlistDiagnostics::FlushDiagnosticsImpl(
|
||||
|
||||
for (PathPieces::const_iterator I = path.begin(), E = path.end(); I != E;
|
||||
++I) {
|
||||
const PathDiagnosticPiece *piece = I->getPtr();
|
||||
const PathDiagnosticPiece *piece = I->get();
|
||||
AddFID(FM, Fids, *SM, piece->getLocation().asLocation());
|
||||
ArrayRef<SourceRange> Ranges = piece->getRanges();
|
||||
for (ArrayRef<SourceRange>::iterator I = Ranges.begin(),
|
||||
|
||||
@@ -214,7 +214,7 @@ public:
|
||||
default:
|
||||
#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN) \
|
||||
case PD_##NAME: \
|
||||
CREATEFN(*Opts.getPtr(), PathConsumers, OutDir, PP); \
|
||||
CREATEFN(*Opts.get(), PathConsumers, OutDir, PP); \
|
||||
break;
|
||||
#include "clang/StaticAnalyzer/Core/Analyses.def"
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ bool runToolOnCodeWithArgs(clang::FrontendAction *ToolAction, const Twine &Code,
|
||||
llvm::IntrusiveRefCntPtr<FileManager> Files(
|
||||
new FileManager(FileSystemOptions()));
|
||||
ToolInvocation Invocation(getSyntaxOnlyToolArgs(Args, FileNameRef), ToolAction,
|
||||
Files.getPtr());
|
||||
Files.get());
|
||||
|
||||
SmallString<1024> CodeStorage;
|
||||
Invocation.mapVirtualFile(FileNameRef,
|
||||
@@ -352,7 +352,7 @@ int ClangTool::run(ToolAction *Action) {
|
||||
DEBUG({
|
||||
llvm::dbgs() << "Processing: " << Command.first << ".\n";
|
||||
});
|
||||
ToolInvocation Invocation(std::move(CommandLine), Action, Files.getPtr());
|
||||
ToolInvocation Invocation(std::move(CommandLine), Action, Files.get());
|
||||
Invocation.setDiagnosticConsumer(DiagConsumer);
|
||||
for (const auto &MappedFile : MappedFileContents) {
|
||||
Invocation.mapVirtualFile(MappedFile.first, MappedFile.second);
|
||||
|
||||
@@ -2776,7 +2776,7 @@ static void clang_parseTranslationUnit_Impl(void *UserData) {
|
||||
// Recover resources if we crash before exiting this function.
|
||||
llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,
|
||||
llvm::CrashRecoveryContextReleaseRefCleanup<DiagnosticsEngine> >
|
||||
DiagCleanup(Diags.getPtr());
|
||||
DiagCleanup(Diags.get());
|
||||
|
||||
std::unique_ptr<std::vector<ASTUnit::RemappedFile>> RemappedFiles(
|
||||
new std::vector<ASTUnit::RemappedFile>());
|
||||
@@ -6640,7 +6640,7 @@ CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU) {
|
||||
// How much memory is used for caching global code completion results?
|
||||
unsigned long completionBytes = 0;
|
||||
if (GlobalCodeCompletionAllocator *completionAllocator =
|
||||
astUnit->getCachedCompletionAllocator().getPtr()) {
|
||||
astUnit->getCachedCompletionAllocator().get()) {
|
||||
completionBytes = completionAllocator->getTotalMemory();
|
||||
}
|
||||
createCXTUResourceUsageEntry(*entries,
|
||||
|
||||
@@ -550,7 +550,7 @@ static void clang_indexSourceFile_Impl(void *UserData) {
|
||||
// Recover resources if we crash before exiting this function.
|
||||
llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,
|
||||
llvm::CrashRecoveryContextReleaseRefCleanup<DiagnosticsEngine> >
|
||||
DiagCleanup(Diags.getPtr());
|
||||
DiagCleanup(Diags.get());
|
||||
|
||||
std::unique_ptr<std::vector<const char *>> Args(
|
||||
new std::vector<const char *>());
|
||||
@@ -579,7 +579,7 @@ static void clang_indexSourceFile_Impl(void *UserData) {
|
||||
// Recover resources if we crash before exiting this function.
|
||||
llvm::CrashRecoveryContextCleanupRegistrar<CompilerInvocation,
|
||||
llvm::CrashRecoveryContextReleaseRefCleanup<CompilerInvocation> >
|
||||
CInvokCleanup(CInvok.getPtr());
|
||||
CInvokCleanup(CInvok.get());
|
||||
|
||||
if (CInvok->getFrontendOpts().Inputs.empty())
|
||||
return;
|
||||
@@ -607,7 +607,7 @@ static void clang_indexSourceFile_Impl(void *UserData) {
|
||||
if (index_options & CXIndexOpt_SuppressWarnings)
|
||||
CInvok->getDiagnosticOpts().IgnoreWarnings = true;
|
||||
|
||||
ASTUnit *Unit = ASTUnit::create(CInvok.getPtr(), Diags,
|
||||
ASTUnit *Unit = ASTUnit::create(CInvok.get(), Diags,
|
||||
CaptureDiagnostics,
|
||||
/*UserFilesAreVolatile=*/true);
|
||||
if (!Unit) {
|
||||
@@ -661,7 +661,7 @@ static void clang_indexSourceFile_Impl(void *UserData) {
|
||||
PPOpts.DetailedRecord = false;
|
||||
|
||||
DiagnosticErrorTrap DiagTrap(*Diags);
|
||||
bool Success = ASTUnit::LoadFromCompilerInvocationAction(CInvok.getPtr(), Diags,
|
||||
bool Success = ASTUnit::LoadFromCompilerInvocationAction(CInvok.get(), Diags,
|
||||
IndexAction.get(),
|
||||
Unit,
|
||||
Persistent,
|
||||
|
||||
@@ -555,11 +555,11 @@ public:
|
||||
TEST_F(VFSFromYAMLTest, BasicVFSFromYAML) {
|
||||
IntrusiveRefCntPtr<vfs::FileSystem> FS;
|
||||
FS = getFromYAMLString("");
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLString("[]");
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLString("'string'");
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
EXPECT_EQ(3, NumDiagnostics);
|
||||
}
|
||||
|
||||
@@ -586,7 +586,7 @@ TEST_F(VFSFromYAMLTest, MappedFiles) {
|
||||
"]\n"
|
||||
"}",
|
||||
Lower);
|
||||
ASSERT_TRUE(FS.getPtr() != nullptr);
|
||||
ASSERT_TRUE(FS.get() != nullptr);
|
||||
|
||||
IntrusiveRefCntPtr<vfs::OverlayFileSystem> O(
|
||||
new vfs::OverlayFileSystem(Lower));
|
||||
@@ -630,7 +630,7 @@ TEST_F(VFSFromYAMLTest, CaseInsensitive) {
|
||||
" ]\n"
|
||||
"}]}",
|
||||
Lower);
|
||||
ASSERT_TRUE(FS.getPtr() != nullptr);
|
||||
ASSERT_TRUE(FS.get() != nullptr);
|
||||
|
||||
IntrusiveRefCntPtr<vfs::OverlayFileSystem> O(
|
||||
new vfs::OverlayFileSystem(Lower));
|
||||
@@ -666,7 +666,7 @@ TEST_F(VFSFromYAMLTest, CaseSensitive) {
|
||||
" ]\n"
|
||||
"}]}",
|
||||
Lower);
|
||||
ASSERT_TRUE(FS.getPtr() != nullptr);
|
||||
ASSERT_TRUE(FS.get() != nullptr);
|
||||
|
||||
IntrusiveRefCntPtr<vfs::OverlayFileSystem> O(
|
||||
new vfs::OverlayFileSystem(Lower));
|
||||
@@ -686,89 +686,89 @@ TEST_F(VFSFromYAMLTest, IllegalVFSFile) {
|
||||
|
||||
// invalid YAML at top-level
|
||||
IntrusiveRefCntPtr<vfs::FileSystem> FS = getFromYAMLString("{]", Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
// invalid YAML in roots
|
||||
FS = getFromYAMLString("{ 'roots':[}", Lower);
|
||||
// invalid YAML in directory
|
||||
FS = getFromYAMLString(
|
||||
"{ 'roots':[ { 'name': 'foo', 'type': 'directory', 'contents': [}",
|
||||
Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
|
||||
// invalid configuration
|
||||
FS = getFromYAMLString("{ 'knobular': 'true', 'roots':[] }", Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLString("{ 'case-sensitive': 'maybe', 'roots':[] }", Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
|
||||
// invalid roots
|
||||
FS = getFromYAMLString("{ 'roots':'' }", Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLString("{ 'roots':{} }", Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
|
||||
// invalid entries
|
||||
FS = getFromYAMLString(
|
||||
"{ 'roots':[ { 'type': 'other', 'name': 'me', 'contents': '' }", Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLString("{ 'roots':[ { 'type': 'file', 'name': [], "
|
||||
"'external-contents': 'other' }",
|
||||
Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLString(
|
||||
"{ 'roots':[ { 'type': 'file', 'name': 'me', 'external-contents': [] }",
|
||||
Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLString(
|
||||
"{ 'roots':[ { 'type': 'file', 'name': 'me', 'external-contents': {} }",
|
||||
Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLString(
|
||||
"{ 'roots':[ { 'type': 'directory', 'name': 'me', 'contents': {} }",
|
||||
Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLString(
|
||||
"{ 'roots':[ { 'type': 'directory', 'name': 'me', 'contents': '' }",
|
||||
Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLString(
|
||||
"{ 'roots':[ { 'thingy': 'directory', 'name': 'me', 'contents': [] }",
|
||||
Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
|
||||
// missing mandatory fields
|
||||
FS = getFromYAMLString("{ 'roots':[ { 'type': 'file', 'name': 'me' }", Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLString(
|
||||
"{ 'roots':[ { 'type': 'file', 'external-contents': 'other' }", Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLString("{ 'roots':[ { 'name': 'me', 'contents': [] }", Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
|
||||
// duplicate keys
|
||||
FS = getFromYAMLString("{ 'roots':[], 'roots':[] }", Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLString(
|
||||
"{ 'case-sensitive':'true', 'case-sensitive':'true', 'roots':[] }",
|
||||
Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS =
|
||||
getFromYAMLString("{ 'roots':[{'name':'me', 'name':'you', 'type':'file', "
|
||||
"'external-contents':'blah' } ] }",
|
||||
Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
|
||||
// missing version
|
||||
FS = getFromYAMLRawString("{ 'roots':[] }", Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
|
||||
// bad version number
|
||||
FS = getFromYAMLRawString("{ 'version':'foo', 'roots':[] }", Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLRawString("{ 'version':-1, 'roots':[] }", Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
FS = getFromYAMLRawString("{ 'version':100000, 'roots':[] }", Lower);
|
||||
EXPECT_EQ(nullptr, FS.getPtr());
|
||||
EXPECT_EQ(nullptr, FS.get());
|
||||
EXPECT_EQ(24, NumDiagnostics);
|
||||
}
|
||||
|
||||
@@ -790,7 +790,7 @@ TEST_F(VFSFromYAMLTest, UseExternalName) {
|
||||
" 'external-contents': '//root/external/file'\n"
|
||||
" }\n"
|
||||
"] }", Lower);
|
||||
ASSERT_TRUE(nullptr != FS.getPtr());
|
||||
ASSERT_TRUE(nullptr != FS.get());
|
||||
|
||||
// default true
|
||||
EXPECT_EQ("//root/external/file", FS->status("//root/A")->getName());
|
||||
@@ -814,7 +814,7 @@ TEST_F(VFSFromYAMLTest, UseExternalName) {
|
||||
" 'external-contents': '//root/external/file'\n"
|
||||
" }\n"
|
||||
"] }", Lower);
|
||||
ASSERT_TRUE(nullptr != FS.getPtr());
|
||||
ASSERT_TRUE(nullptr != FS.get());
|
||||
|
||||
// default
|
||||
EXPECT_EQ("//root/A", FS->status("//root/A")->getName());
|
||||
@@ -833,7 +833,7 @@ TEST_F(VFSFromYAMLTest, MultiComponentPath) {
|
||||
" { 'type': 'file', 'name': '//root/path/to/file',\n"
|
||||
" 'external-contents': '//root/other' }]\n"
|
||||
"}", Lower);
|
||||
ASSERT_TRUE(nullptr != FS.getPtr());
|
||||
ASSERT_TRUE(nullptr != FS.get());
|
||||
EXPECT_FALSE(FS->status("//root/path/to/file").getError());
|
||||
EXPECT_FALSE(FS->status("//root/path/to").getError());
|
||||
EXPECT_FALSE(FS->status("//root/path").getError());
|
||||
@@ -846,7 +846,7 @@ TEST_F(VFSFromYAMLTest, MultiComponentPath) {
|
||||
" 'contents': [ { 'type': 'file', 'name': 'file',\n"
|
||||
" 'external-contents': '//root/other' }]}]\n"
|
||||
"}", Lower);
|
||||
ASSERT_TRUE(nullptr != FS.getPtr());
|
||||
ASSERT_TRUE(nullptr != FS.get());
|
||||
EXPECT_FALSE(FS->status("//root/path/to/file").getError());
|
||||
EXPECT_FALSE(FS->status("//root/path/to").getError());
|
||||
EXPECT_FALSE(FS->status("//root/path").getError());
|
||||
@@ -859,7 +859,7 @@ TEST_F(VFSFromYAMLTest, MultiComponentPath) {
|
||||
" 'contents': [ { 'type': 'file', 'name': 'path/to/file',\n"
|
||||
" 'external-contents': '//root/other' }]}]\n"
|
||||
"}", Lower);
|
||||
ASSERT_TRUE(nullptr != FS.getPtr());
|
||||
ASSERT_TRUE(nullptr != FS.get());
|
||||
EXPECT_FALSE(FS->status("//root/path/to/file").getError());
|
||||
EXPECT_FALSE(FS->status("//root/path/to").getError());
|
||||
EXPECT_FALSE(FS->status("//root/path").getError());
|
||||
@@ -877,7 +877,7 @@ TEST_F(VFSFromYAMLTest, TrailingSlashes) {
|
||||
" 'contents': [ { 'type': 'file', 'name': 'file',\n"
|
||||
" 'external-contents': '//root/other' }]}]\n"
|
||||
"}", Lower);
|
||||
ASSERT_TRUE(nullptr != FS.getPtr());
|
||||
ASSERT_TRUE(nullptr != FS.get());
|
||||
EXPECT_FALSE(FS->status("//root/path/to/file").getError());
|
||||
EXPECT_FALSE(FS->status("//root/path/to").getError());
|
||||
EXPECT_FALSE(FS->status("//root/path").getError());
|
||||
@@ -913,7 +913,7 @@ TEST_F(VFSFromYAMLTest, DirectoryIteration) {
|
||||
"]\n"
|
||||
"}",
|
||||
Lower);
|
||||
ASSERT_TRUE(FS.getPtr() != NULL);
|
||||
ASSERT_TRUE(FS.get() != NULL);
|
||||
|
||||
IntrusiveRefCntPtr<vfs::OverlayFileSystem> O(
|
||||
new vfs::OverlayFileSystem(Lower));
|
||||
|
||||
@@ -67,7 +67,7 @@ protected:
|
||||
|
||||
VoidModuleLoader ModLoader;
|
||||
HeaderSearch HeaderInfo(new HeaderSearchOptions, SourceMgr, Diags, LangOpts,
|
||||
Target.getPtr());
|
||||
Target.get());
|
||||
Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts, SourceMgr,
|
||||
HeaderInfo, ModLoader, /*IILookup =*/nullptr,
|
||||
/*OwnsHeaderSearch =*/false);
|
||||
|
||||
@@ -119,7 +119,7 @@ protected:
|
||||
: FileMgr(FileMgrOpts),
|
||||
DiagID(new DiagnosticIDs()),
|
||||
DiagOpts(new DiagnosticOptions()),
|
||||
Diags(DiagID, DiagOpts.getPtr(), new IgnoringDiagConsumer()),
|
||||
Diags(DiagID, DiagOpts.get(), new IgnoringDiagConsumer()),
|
||||
SourceMgr(Diags, FileMgr) {
|
||||
TargetOpts = new TargetOptions();
|
||||
TargetOpts->Triple = "x86_64-apple-darwin11.1.0";
|
||||
@@ -169,7 +169,7 @@ protected:
|
||||
|
||||
IntrusiveRefCntPtr<HeaderSearchOptions> HSOpts = new HeaderSearchOptions();
|
||||
HeaderSearch HeaderInfo(HSOpts, SourceMgr, Diags, LangOpts,
|
||||
Target.getPtr());
|
||||
Target.get());
|
||||
AddFakeHeader(HeaderInfo, HeaderPath, SystemHeader);
|
||||
|
||||
IntrusiveRefCntPtr<PreprocessorOptions> PPOpts = new PreprocessorOptions();
|
||||
@@ -204,7 +204,7 @@ protected:
|
||||
|
||||
VoidModuleLoader ModLoader;
|
||||
HeaderSearch HeaderInfo(new HeaderSearchOptions, SourceMgr, Diags,
|
||||
OpenCLLangOpts, Target.getPtr());
|
||||
OpenCLLangOpts, Target.get());
|
||||
|
||||
Preprocessor PP(new PreprocessorOptions(), Diags, OpenCLLangOpts, SourceMgr,
|
||||
HeaderInfo, ModLoader, /*IILookup =*/nullptr,
|
||||
|
||||
@@ -95,7 +95,7 @@ TEST_F(PPConditionalDirectiveRecordTest, PPRecAPI) {
|
||||
|
||||
VoidModuleLoader ModLoader;
|
||||
HeaderSearch HeaderInfo(new HeaderSearchOptions, SourceMgr, Diags, LangOpts,
|
||||
Target.getPtr());
|
||||
Target.get());
|
||||
Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts, SourceMgr,
|
||||
HeaderInfo, ModLoader,
|
||||
/*IILookup =*/nullptr,
|
||||
|
||||
@@ -147,7 +147,7 @@ TEST(ToolInvocation, TestMapVirtualFile) {
|
||||
Args.push_back("-fsyntax-only");
|
||||
Args.push_back("test.cpp");
|
||||
clang::tooling::ToolInvocation Invocation(Args, new SyntaxOnlyAction,
|
||||
Files.getPtr());
|
||||
Files.get());
|
||||
Invocation.mapVirtualFile("test.cpp", "#include <abc>\n");
|
||||
Invocation.mapVirtualFile("def/abc", "\n");
|
||||
EXPECT_TRUE(Invocation.run());
|
||||
@@ -166,7 +166,7 @@ TEST(ToolInvocation, TestVirtualModulesCompilation) {
|
||||
Args.push_back("-fsyntax-only");
|
||||
Args.push_back("test.cpp");
|
||||
clang::tooling::ToolInvocation Invocation(Args, new SyntaxOnlyAction,
|
||||
Files.getPtr());
|
||||
Files.get());
|
||||
Invocation.mapVirtualFile("test.cpp", "#include <abc>\n");
|
||||
Invocation.mapVirtualFile("def/abc", "\n");
|
||||
// Add a module.map file in the include directory of our header, so we trigger
|
||||
|
||||
Reference in New Issue
Block a user