From c556f81241cf74850840c2e0df7a8f213674074d Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Sat, 5 Jul 2014 03:08:06 +0000 Subject: [PATCH] Track IntrusiveRefCntPtr::get() changes from LLVM r212366 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212369 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/ASTContext.h | 2 +- .../clang/ASTMatchers/ASTMatchersInternal.h | 2 +- include/clang/Frontend/CompilerInstance.h | 8 +-- include/clang/Frontend/CompilerInvocation.h | 8 +-- .../Core/PathSensitive/CallEvent.h | 6 +- .../Core/PathSensitive/ExplodedGraph.h | 2 +- lib/Frontend/ASTUnit.cpp | 14 ++-- lib/Frontend/ChainedIncludesSource.cpp | 2 +- lib/Frontend/CompilerInstance.cpp | 2 +- lib/Frontend/CompilerInvocation.cpp | 2 +- .../CreateInvocationFromCommandLine.cpp | 2 +- lib/Frontend/TextDiagnostic.cpp | 2 +- lib/Index/SimpleFormatContext.h | 2 +- lib/Serialization/ASTReader.cpp | 2 +- .../Checkers/DereferenceChecker.cpp | 8 +-- lib/StaticAnalyzer/Core/BugReporter.cpp | 18 ++--- .../Core/BugReporterVisitors.cpp | 8 +-- lib/StaticAnalyzer/Core/ExprEngine.cpp | 2 +- lib/StaticAnalyzer/Core/PathDiagnostic.cpp | 8 +-- lib/StaticAnalyzer/Core/PlistDiagnostics.cpp | 2 +- .../Frontend/AnalysisConsumer.cpp | 2 +- lib/Tooling/Tooling.cpp | 4 +- tools/libclang/CIndex.cpp | 4 +- tools/libclang/Indexing.cpp | 8 +-- unittests/Basic/VirtualFileSystemTest.cpp | 72 +++++++++---------- unittests/Lex/LexerTest.cpp | 2 +- unittests/Lex/PPCallbacksTest.cpp | 6 +- .../Lex/PPConditionalDirectiveRecordTest.cpp | 2 +- unittests/Tooling/ToolingTest.cpp | 4 +- 29 files changed, 103 insertions(+), 103 deletions(-) diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index b0de90c5f6..40ccf8484e 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -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. diff --git a/include/clang/ASTMatchers/ASTMatchersInternal.h b/include/clang/ASTMatchers/ASTMatchersInternal.h index 7e634e2d63..12680cfe2c 100644 --- a/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -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(Implementation.getPtr()); + return reinterpret_cast(Implementation.get()); } /// \brief Allows the conversion of a \c Matcher to a \c diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index e089726525..44e91026ac 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -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(); } diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h index 3d7467cb14..4b3b9be55f 100644 --- a/include/clang/Frontend/CompilerInvocation.h +++ b/include/clang/Frontend/CompilerInvocation.h @@ -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; } diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h index 028875d327..4a5426b274 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h @@ -56,14 +56,14 @@ public: CallEventRef(const CallEventRef &Orig) : IntrusiveRefCntPtr(Orig) {} CallEventRef cloneWithState(ProgramStateRef State) const { - return this->getPtr()->template cloneWithState(State); + return this->get()->template cloneWithState(State); } // Allow implicit conversions to a superclass type, since CallEventRef // behaves like a pointer-to-const. template operator CallEventRef () const { - return this->getPtr(); + return this->get(); } }; @@ -1024,7 +1024,7 @@ namespace llvm { static SimpleType getSimplifiedValue(clang::ento::CallEventRef Val) { - return Val.getPtr(); + return Val.get(); } }; } diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h index d0a2780d25..98092ef00d 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h @@ -164,7 +164,7 @@ public: const ProgramStateRef &state, bool IsSink) { ID.Add(Loc); - ID.AddPointer(state.getPtr()); + ID.AddPointer(state.get()); ID.AddBoolean(IsSink); } diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 3c2b423501..055537b46f 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -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 &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 > - DiagCleanup(Diags.getPtr()); + DiagCleanup(Diags.get()); ConfigureDiags(Diags, nullptr, nullptr, *AST, CaptureDiagnostics); @@ -1058,7 +1058,7 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) { IntrusiveRefCntPtr 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 > - DiagCleanup(Diags.getPtr()); + DiagCleanup(Diags.get()); // We'll manage file buffers ourselves. CI->getPreprocessorOpts().RetainRemappedFileBuffers = true; @@ -1966,7 +1966,7 @@ std::unique_ptr ASTUnit::LoadFromCompilerInvocation( ASTUnitCleanup(AST.get()); llvm::CrashRecoveryContextCleanupRegistrar > - 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 *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()); diff --git a/lib/Frontend/ChainedIncludesSource.cpp b/lib/Frontend/ChainedIncludesSource.cpp index 6dc3fd450f..45851a0d60 100644 --- a/lib/Frontend/ChainedIncludesSource.cpp +++ b/lib/Frontend/ChainedIncludesSource.cpp @@ -99,7 +99,7 @@ ChainedIncludesSource::create(CompilerInstance &CI) { std::unique_ptr 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(); diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 60f8ae8fdf..3b69fa2791 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -336,7 +336,7 @@ void CompilerInstance::createPCHExternalASTSource( AllowPCHWithCompilerErrors, getPreprocessor(), getASTContext(), DeserializationListener, OwnDeserializationListener, Preamble, getFrontendOpts().UseGlobalModuleIndex); - ModuleManager = static_cast(Source.getPtr()); + ModuleManager = static_cast(Source.get()); getASTContext().setExternalSource(Source); } diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index a5cdb8caae..d04d8291a4 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -2039,7 +2039,7 @@ createVFSFromCompilerInvocation(const CompilerInvocation &CI, IntrusiveRefCntPtr FS = vfs::getVFSFromYAML(Buffer.release(), /*DiagHandler*/nullptr); - if (!FS.getPtr()) { + if (!FS.get()) { Diags.Report(diag::err_invalid_vfs_overlay) << File; return IntrusiveRefCntPtr(); } diff --git a/lib/Frontend/CreateInvocationFromCommandLine.cpp b/lib/Frontend/CreateInvocationFromCommandLine.cpp index 45f7aa3acd..f2f36e4cac 100644 --- a/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -32,7 +32,7 @@ using namespace llvm::opt; CompilerInvocation * clang::createInvocationFromCommandLine(ArrayRef ArgList, IntrusiveRefCntPtr 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); diff --git a/lib/Frontend/TextDiagnostic.cpp b/lib/Frontend/TextDiagnostic.cpp index 847acf114e..dc67d6809e 100644 --- a/lib/Frontend/TextDiagnostic.cpp +++ b/lib/Frontend/TextDiagnostic.cpp @@ -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. diff --git a/lib/Index/SimpleFormatContext.h b/lib/Index/SimpleFormatContext.h index de1665f3b6..a460863f80 100644 --- a/lib/Index/SimpleFormatContext.h +++ b/lib/Index/SimpleFormatContext.h @@ -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) { diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 7f7fc1ce99..f18122dd94 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -378,7 +378,7 @@ bool PCHValidator::ReadDiagnosticOptions( DiagnosticsEngine &ExistingDiags = PP.getDiagnostics(); IntrusiveRefCntPtr DiagIDs(ExistingDiags.getDiagnosticIDs()); IntrusiveRefCntPtr 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); diff --git a/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp b/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp index efdc213ac8..4ee0223064 100644 --- a/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp @@ -126,7 +126,7 @@ void DereferenceChecker::reportBug(ProgramStateRef State, const Stmt *S, os << "Array access"; const ArraySubscriptExpr *AE = cast(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(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: diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp index 6c7cb23cf5..141a48ba10 100644 --- a/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -125,7 +125,7 @@ static void removeRedundantMsgs(PathPieces &path) { break; if (PathDiagnosticEventPiece *nextEvent = - dyn_cast(path.front().getPtr())) { + dyn_cast(path.front().get())) { PathDiagnosticEventPiece *event = cast(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 PS = P.getAs()) { if (const Expr *Ex = PS->getStmtAs()) 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(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(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(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()) 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(piece)){ diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index 1fdcdbaf6a..0503acec05 100644 --- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -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(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(CondVarExpr)) { if (const VarDecl *VD = dyn_cast(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); diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp index ba30c5c360..999507aedb 100644 --- a/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -2517,7 +2517,7 @@ struct DOTGraphTraits : } ProgramStateRef state = N->getState(); - Out << "\\|StateID: " << (const void*) state.getPtr() + Out << "\\|StateID: " << (const void*) state.get() << " NodeID: " << (const void*) N << "\\|"; state->printDOT(Out); diff --git a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index a9527debc2..fd25bd8e3a 100644 --- a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -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(piece)) { compute_path_size(cp->path, size); diff --git a/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp b/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp index 2585e543f7..538a750c20 100644 --- a/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp +++ b/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp @@ -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 Ranges = piece->getRanges(); for (ArrayRef::iterator I = Ranges.begin(), diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index ccaa8b6168..12e514b322 100644 --- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -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" } diff --git a/lib/Tooling/Tooling.cpp b/lib/Tooling/Tooling.cpp index 5d3de8aa56..0db38db3c9 100644 --- a/lib/Tooling/Tooling.cpp +++ b/lib/Tooling/Tooling.cpp @@ -129,7 +129,7 @@ bool runToolOnCodeWithArgs(clang::FrontendAction *ToolAction, const Twine &Code, llvm::IntrusiveRefCntPtr 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); diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 8683ae62b0..57ebb8a1e7 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -2776,7 +2776,7 @@ static void clang_parseTranslationUnit_Impl(void *UserData) { // Recover resources if we crash before exiting this function. llvm::CrashRecoveryContextCleanupRegistrar > - DiagCleanup(Diags.getPtr()); + DiagCleanup(Diags.get()); std::unique_ptr> RemappedFiles( new std::vector()); @@ -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, diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp index 24ab7b206c..e4f886b269 100644 --- a/tools/libclang/Indexing.cpp +++ b/tools/libclang/Indexing.cpp @@ -550,7 +550,7 @@ static void clang_indexSourceFile_Impl(void *UserData) { // Recover resources if we crash before exiting this function. llvm::CrashRecoveryContextCleanupRegistrar > - DiagCleanup(Diags.getPtr()); + DiagCleanup(Diags.get()); std::unique_ptr> Args( new std::vector()); @@ -579,7 +579,7 @@ static void clang_indexSourceFile_Impl(void *UserData) { // Recover resources if we crash before exiting this function. llvm::CrashRecoveryContextCleanupRegistrar > - 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, diff --git a/unittests/Basic/VirtualFileSystemTest.cpp b/unittests/Basic/VirtualFileSystemTest.cpp index 9289b22f8e..e7d361e252 100644 --- a/unittests/Basic/VirtualFileSystemTest.cpp +++ b/unittests/Basic/VirtualFileSystemTest.cpp @@ -555,11 +555,11 @@ public: TEST_F(VFSFromYAMLTest, BasicVFSFromYAML) { IntrusiveRefCntPtr 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 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 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 O( new vfs::OverlayFileSystem(Lower)); @@ -686,89 +686,89 @@ TEST_F(VFSFromYAMLTest, IllegalVFSFile) { // invalid YAML at top-level IntrusiveRefCntPtr 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 O( new vfs::OverlayFileSystem(Lower)); diff --git a/unittests/Lex/LexerTest.cpp b/unittests/Lex/LexerTest.cpp index 2981de7e25..938ad4d26e 100644 --- a/unittests/Lex/LexerTest.cpp +++ b/unittests/Lex/LexerTest.cpp @@ -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); diff --git a/unittests/Lex/PPCallbacksTest.cpp b/unittests/Lex/PPCallbacksTest.cpp index 5ca2013cd6..c5fd5702ea 100644 --- a/unittests/Lex/PPCallbacksTest.cpp +++ b/unittests/Lex/PPCallbacksTest.cpp @@ -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 HSOpts = new HeaderSearchOptions(); HeaderSearch HeaderInfo(HSOpts, SourceMgr, Diags, LangOpts, - Target.getPtr()); + Target.get()); AddFakeHeader(HeaderInfo, HeaderPath, SystemHeader); IntrusiveRefCntPtr 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, diff --git a/unittests/Lex/PPConditionalDirectiveRecordTest.cpp b/unittests/Lex/PPConditionalDirectiveRecordTest.cpp index 49f9d1c132..8659f0fc93 100644 --- a/unittests/Lex/PPConditionalDirectiveRecordTest.cpp +++ b/unittests/Lex/PPConditionalDirectiveRecordTest.cpp @@ -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, diff --git a/unittests/Tooling/ToolingTest.cpp b/unittests/Tooling/ToolingTest.cpp index 2b57c16ac5..9aede044f6 100644 --- a/unittests/Tooling/ToolingTest.cpp +++ b/unittests/Tooling/ToolingTest.cpp @@ -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 \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 \n"); Invocation.mapVirtualFile("def/abc", "\n"); // Add a module.map file in the include directory of our header, so we trigger -- 2.40.0