diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-02-20 22:23:23 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-02-20 22:23:23 +0000 |
commit | dc84cd5efdd3430efb22546b4ac656aa0540b210 (patch) | |
tree | 665bcfc03575e55f8d053acf20ff6d8979b3bd14 /include/clang | |
parent | 9e85b29dd17fd3878134216f9abaf5ec4774b2a5 (diff) |
Include llvm::Optional in clang/Basic/LLVM.h
Post-commit CR feedback from Jordan Rose regarding r175594.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175679 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
20 files changed, 63 insertions, 63 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 1c505295a4..b483535205 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -1023,7 +1023,7 @@ public: const TemplateArgument *Args) const; QualType getPackExpansionType(QualType Pattern, - llvm::Optional<unsigned> NumExpansions); + Optional<unsigned> NumExpansions); QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl = 0) const; diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index f6c912a38b..614b2762e6 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -308,7 +308,7 @@ public: /// \brief If visibility was explicitly specified for this /// declaration, return that visibility. - llvm::Optional<Visibility> + Optional<Visibility> getExplicitVisibility(ExplicitVisibilityKind kind) const; /// \brief Clear the linkage cache in response to a change diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h index 9958218e1a..7665dbce4c 100644 --- a/include/clang/AST/ExprCXX.h +++ b/include/clang/AST/ExprCXX.h @@ -3346,7 +3346,7 @@ class PackExpansionExpr : public Expr { public: PackExpansionExpr(QualType T, Expr *Pattern, SourceLocation EllipsisLoc, - llvm::Optional<unsigned> NumExpansions) + Optional<unsigned> NumExpansions) : Expr(PackExpansionExprClass, T, Pattern->getValueKind(), Pattern->getObjectKind(), /*TypeDependent=*/true, /*ValueDependent=*/true, /*InstantiationDependent=*/true, @@ -3369,11 +3369,11 @@ public: /// \brief Determine the number of expansions that will be produced when /// this pack expansion is instantiated, if already known. - llvm::Optional<unsigned> getNumExpansions() const { + Optional<unsigned> getNumExpansions() const { if (NumExpansions) return NumExpansions - 1; - return llvm::Optional<unsigned>(); + return Optional<unsigned>(); } SourceLocation getLocStart() const LLVM_READONLY { diff --git a/include/clang/AST/ExprObjC.h b/include/clang/AST/ExprObjC.h index 798b0423cb..2b88dfdcb2 100644 --- a/include/clang/AST/ExprObjC.h +++ b/include/clang/AST/ExprObjC.h @@ -206,7 +206,7 @@ struct ObjCDictionaryElement { /// \brief The number of elements this pack expansion will expand to, if /// this is a pack expansion and is known. - llvm::Optional<unsigned> NumExpansions; + Optional<unsigned> NumExpansions; /// \brief Determines whether this dictionary element is a pack expansion. bool isPackExpansion() const { return EllipsisLoc.isValid(); } @@ -301,7 +301,7 @@ public: assert((Index < NumElements) && "Arg access out of range!"); const KeyValuePair &KV = getKeyValues()[Index]; ObjCDictionaryElement Result = { KV.Key, KV.Value, SourceLocation(), - llvm::Optional<unsigned>() }; + Optional<unsigned>() }; if (HasPackExpansions) { const ExpansionData &Expansion = getExpansionData()[Index]; Result.EllipsisLoc = Expansion.EllipsisLoc; diff --git a/include/clang/AST/NSAPI.h b/include/clang/AST/NSAPI.h index 47797d0346..0b21b03348 100644 --- a/include/clang/AST/NSAPI.h +++ b/include/clang/AST/NSAPI.h @@ -52,7 +52,7 @@ public: Selector getNSStringSelector(NSStringMethodKind MK) const; /// \brief Return NSStringMethodKind if \param Sel is such a selector. - llvm::Optional<NSStringMethodKind> getNSStringMethodKind(Selector Sel) const; + Optional<NSStringMethodKind> getNSStringMethodKind(Selector Sel) const; /// \brief Returns true if the expression \param E is a reference of /// "NSUTF8StringEncoding" enum constant. @@ -84,7 +84,7 @@ public: Selector getNSArraySelector(NSArrayMethodKind MK) const; /// \brief Return NSArrayMethodKind if \p Sel is such a selector. - llvm::Optional<NSArrayMethodKind> getNSArrayMethodKind(Selector Sel); + Optional<NSArrayMethodKind> getNSArrayMethodKind(Selector Sel); /// \brief Enumerates the NSDictionary methods used to generate literals. enum NSDictionaryMethodKind { @@ -106,8 +106,7 @@ public: Selector getNSDictionarySelector(NSDictionaryMethodKind MK) const; /// \brief Return NSDictionaryMethodKind if \p Sel is such a selector. - llvm::Optional<NSDictionaryMethodKind> - getNSDictionaryMethodKind(Selector Sel); + Optional<NSDictionaryMethodKind> getNSDictionaryMethodKind(Selector Sel); /// \brief Returns selector for "objectForKeyedSubscript:". Selector getObjectForKeyedSubscriptSelector() const { @@ -171,12 +170,12 @@ public: } /// \brief Return NSNumberLiteralMethodKind if \p Sel is such a selector. - llvm::Optional<NSNumberLiteralMethodKind> + Optional<NSNumberLiteralMethodKind> getNSNumberLiteralMethodKind(Selector Sel) const; /// \brief Determine the appropriate NSNumber factory method kind for a /// literal of the given type. - llvm::Optional<NSNumberLiteralMethodKind> + Optional<NSNumberLiteralMethodKind> getNSNumberFactoryMethodKind(QualType T) const; /// \brief Returns true if \param T is a typedef of "BOOL" in objective-c. diff --git a/include/clang/AST/TemplateBase.h b/include/clang/AST/TemplateBase.h index da57293b08..c2dddf6461 100644 --- a/include/clang/AST/TemplateBase.h +++ b/include/clang/AST/TemplateBase.h @@ -158,7 +158,7 @@ public: /// /// \param NumExpansions The number of expansions that will be generated by /// instantiating - TemplateArgument(TemplateName Name, llvm::Optional<unsigned> NumExpansions) + TemplateArgument(TemplateName Name, Optional<unsigned> NumExpansions) : Kind(TemplateExpansion) { TemplateArg.Name = Name.getAsVoidPointer(); @@ -261,7 +261,7 @@ public: /// \brief Retrieve the number of expansions that a template template argument /// expansion will produce, if known. - llvm::Optional<unsigned> getNumTemplateExpansions() const; + Optional<unsigned> getNumTemplateExpansions() const; /// \brief Retrieve the template argument as an integral value. // FIXME: Provide a way to read the integral data without copying the value. @@ -496,7 +496,7 @@ public: /// \param NumExpansions Will be set to the number of expansions that will /// be generated from this pack expansion, if known a priori. TemplateArgumentLoc getPackExpansionPattern(SourceLocation &Ellipsis, - llvm::Optional<unsigned> &NumExpansions, + Optional<unsigned> &NumExpansions, ASTContext &Context) const; }; diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index 3e6297aeb8..f0a7ae888d 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -4133,7 +4133,7 @@ class PackExpansionType : public Type, public llvm::FoldingSetNode { unsigned NumExpansions; PackExpansionType(QualType Pattern, QualType Canon, - llvm::Optional<unsigned> NumExpansions) + Optional<unsigned> NumExpansions) : Type(PackExpansion, Canon, /*Dependent=*/Pattern->isDependentType(), /*InstantiationDependent=*/true, /*VariableModified=*/Pattern->isVariablyModifiedType(), @@ -4151,11 +4151,11 @@ public: /// \brief Retrieve the number of expansions that this pack expansion will /// generate, if known. - llvm::Optional<unsigned> getNumExpansions() const { + Optional<unsigned> getNumExpansions() const { if (NumExpansions) return NumExpansions - 1; - return llvm::Optional<unsigned>(); + return Optional<unsigned>(); } bool isSugared() const { return false; } @@ -4166,7 +4166,7 @@ public: } static void Profile(llvm::FoldingSetNodeID &ID, QualType Pattern, - llvm::Optional<unsigned> NumExpansions) { + Optional<unsigned> NumExpansions) { ID.AddPointer(Pattern.getAsOpaquePtr()); ID.AddBoolean(NumExpansions); if (NumExpansions) diff --git a/include/clang/Analysis/Analyses/FormatString.h b/include/clang/Analysis/Analyses/FormatString.h index 5cb973122d..4bd989cf4e 100644 --- a/include/clang/Analysis/Analyses/FormatString.h +++ b/include/clang/Analysis/Analyses/FormatString.h @@ -201,7 +201,7 @@ public: bool isPrintfKind() const { return IsPrintf; } - llvm::Optional<ConversionSpecifier> getStandardSpecifier() const; + Optional<ConversionSpecifier> getStandardSpecifier() const; protected: bool IsPrintf; @@ -361,7 +361,7 @@ public: bool hasStandardLengthModifier() const; - llvm::Optional<LengthModifier> getCorrectedLengthModifier() const; + Optional<LengthModifier> getCorrectedLengthModifier() const; bool hasStandardConversionSpecifier(const LangOptions &LangOpt) const; diff --git a/include/clang/Basic/LLVM.h b/include/clang/Basic/LLVM.h index 13c5b445b8..abeec15741 100644 --- a/include/clang/Basic/LLVM.h +++ b/include/clang/Basic/LLVM.h @@ -25,10 +25,11 @@ namespace llvm { class StringRef; class Twine; template<typename T> class ArrayRef; - template<class T> class OwningPtr; + template<typename T> class OwningPtr; template<unsigned InternalLen> class SmallString; template<typename T, unsigned N> class SmallVector; template<typename T> class SmallVectorImpl; + template<typename T> class Optional; template<typename T> struct SaveAndRestore; @@ -53,6 +54,7 @@ namespace clang { using llvm::cast_or_null; // ADT's. + using llvm::Optional; using llvm::StringRef; using llvm::Twine; using llvm::ArrayRef; diff --git a/include/clang/Basic/VersionTuple.h b/include/clang/Basic/VersionTuple.h index a94f76c182..059b7f7239 100644 --- a/include/clang/Basic/VersionTuple.h +++ b/include/clang/Basic/VersionTuple.h @@ -55,16 +55,16 @@ public: unsigned getMajor() const { return Major; } /// \brief Retrieve the minor version number, if provided. - llvm::Optional<unsigned> getMinor() const { + Optional<unsigned> getMinor() const { if (!HasMinor) - return llvm::Optional<unsigned>(); + return Optional<unsigned>(); return Minor; } /// \brief Retrieve the subminor version number, if provided. - llvm::Optional<unsigned> getSubminor() const { + Optional<unsigned> getSubminor() const { if (!HasSubminor) - return llvm::Optional<unsigned>(); + return Optional<unsigned>(); return Subminor; } diff --git a/include/clang/Lex/PreprocessingRecord.h b/include/clang/Lex/PreprocessingRecord.h index 74a430cb77..926da52675 100644 --- a/include/clang/Lex/PreprocessingRecord.h +++ b/include/clang/Lex/PreprocessingRecord.h @@ -277,9 +277,9 @@ namespace clang { /// \brief Optionally returns true or false if the preallocated preprocessed /// entity with index \p Index came from file \p FID. - virtual llvm::Optional<bool> isPreprocessedEntityInFileID(unsigned Index, - FileID FID) { - return llvm::Optional<bool>(); + virtual Optional<bool> isPreprocessedEntityInFileID(unsigned Index, + FileID FID) { + return Optional<bool>(); } }; diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index c0044cbba0..8e69b64c1a 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -1298,7 +1298,7 @@ private: // [...] () -> type {...} ExprResult ParseLambdaExpression(); ExprResult TryParseLambdaExpression(); - llvm::Optional<unsigned> ParseLambdaIntroducer(LambdaIntroducer &Intro); + Optional<unsigned> ParseLambdaIntroducer(LambdaIntroducer &Intro); bool TryParseLambdaIntroducer(LambdaIntroducer &Intro); ExprResult ParseLambdaExpressionAfterIntroducer( LambdaIntroducer &Intro); diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 4d37c89edb..2d86787494 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -5335,14 +5335,14 @@ public: /// expansion. TypeSourceInfo *CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, - llvm::Optional<unsigned> NumExpansions); + Optional<unsigned> NumExpansions); /// \brief Construct a pack expansion type from the pattern of the pack /// expansion. QualType CheckPackExpansion(QualType Pattern, SourceRange PatternRange, SourceLocation EllipsisLoc, - llvm::Optional<unsigned> NumExpansions); + Optional<unsigned> NumExpansions); /// \brief Invoked when parsing an expression followed by an ellipsis, which /// creates a pack expansion. @@ -5361,7 +5361,7 @@ public: /// /// \param EllipsisLoc The location of the ellipsis. ExprResult CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc, - llvm::Optional<unsigned> NumExpansions); + Optional<unsigned> NumExpansions); /// \brief Determine whether we could expand a pack expansion with the /// given set of parameter packs into separate arguments by repeatedly @@ -5403,7 +5403,7 @@ public: const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand, bool &RetainExpansion, - llvm::Optional<unsigned> &NumExpansions); + Optional<unsigned> &NumExpansions); /// \brief Determine the number of arguments in the given pack expansion /// type. @@ -5412,8 +5412,8 @@ public: /// consistent across all of the unexpanded parameter packs in its pattern. /// /// Returns an empty Optional if the type can't be expanded. - llvm::Optional<unsigned> getNumArgumentsInExpansion(QualType T, - const MultiLevelTemplateArgumentList &TemplateArgs); + Optional<unsigned> getNumArgumentsInExpansion(QualType T, + const MultiLevelTemplateArgumentList &TemplateArgs); /// \brief Determine whether the given declarator contains any unexpanded /// parameter packs. @@ -5898,11 +5898,11 @@ public: /// template argument substitution failures are not considered /// errors. /// - /// \returns An empty \c llvm::Optional if we're not in a SFINAE context. + /// \returns An empty \c Optional if we're not in a SFINAE context. /// Otherwise, contains a pointer that, if non-NULL, contains the nearest /// template-deduction context object, which can be used to capture /// diagnostics that will be suppressed. - llvm::Optional<sema::TemplateDeductionInfo *> isSFINAEContext() const; + Optional<sema::TemplateDeductionInfo *> isSFINAEContext() const; /// \brief Determines whether we are currently in a context that /// is not evaluated as per C++ [expr] p5. @@ -6013,7 +6013,7 @@ public: ParmVarDecl *SubstParmVarDecl(ParmVarDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, int indexAdjustment, - llvm::Optional<unsigned> NumExpansions, + Optional<unsigned> NumExpansions, bool ExpectParameterPack); bool SubstParmTypes(SourceLocation Loc, ParmVarDecl **Params, unsigned NumParams, diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index 68f7720771..df3c74c98f 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -1274,8 +1274,8 @@ public: /// \brief Optionally returns true or false if the preallocated preprocessed /// entity with index \p Index came from file \p FID. - virtual llvm::Optional<bool> isPreprocessedEntityInFileID(unsigned Index, - FileID FID); + virtual Optional<bool> isPreprocessedEntityInFileID(unsigned Index, + FileID FID); /// \brief Read the header file information for the given file entry. virtual HeaderFileInfo GetHeaderFileInfo(const FileEntry *FE); diff --git a/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h b/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h index e1fe082049..0a869e05f3 100644 --- a/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h +++ b/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h @@ -190,38 +190,38 @@ private: CXXInlineableMemberKind CXXMemberInliningMode; /// \sa includeTemporaryDtorsInCFG - llvm::Optional<bool> IncludeTemporaryDtorsInCFG; + Optional<bool> IncludeTemporaryDtorsInCFG; /// \sa mayInlineCXXStandardLibrary - llvm::Optional<bool> InlineCXXStandardLibrary; + Optional<bool> InlineCXXStandardLibrary; /// \sa mayInlineTemplateFunctions - llvm::Optional<bool> InlineTemplateFunctions; + Optional<bool> InlineTemplateFunctions; /// \sa mayInlineObjCMethod - llvm::Optional<bool> ObjCInliningMode; + Optional<bool> ObjCInliningMode; // Cache of the "ipa-always-inline-size" setting. // \sa getAlwaysInlineSize - llvm::Optional<unsigned> AlwaysInlineSize; + Optional<unsigned> AlwaysInlineSize; /// \sa shouldSuppressNullReturnPaths - llvm::Optional<bool> SuppressNullReturnPaths; + Optional<bool> SuppressNullReturnPaths; // \sa getMaxInlinableSize - llvm::Optional<unsigned> MaxInlinableSize; + Optional<unsigned> MaxInlinableSize; /// \sa shouldAvoidSuppressingNullArgumentPaths - llvm::Optional<bool> AvoidSuppressingNullArgumentPaths; + Optional<bool> AvoidSuppressingNullArgumentPaths; /// \sa getGraphTrimInterval - llvm::Optional<unsigned> GraphTrimInterval; + Optional<unsigned> GraphTrimInterval; /// \sa getMaxTimesInlineLarge - llvm::Optional<unsigned> MaxTimesInlineLarge; + Optional<unsigned> MaxTimesInlineLarge; /// \sa getMaxNodesPerTopLevelFunction - llvm::Optional<unsigned> MaxNodesPerTopLevelFunction; + Optional<unsigned> MaxNodesPerTopLevelFunction; /// Interprets an option's string value as a boolean. /// @@ -230,9 +230,8 @@ private: bool getBooleanOption(StringRef Name, bool DefaultVal); /// Variant that accepts a Optional value to cache the result. - bool getBooleanOption(llvm::Optional<bool> &V, StringRef Name, - bool DefaultVal); - + bool getBooleanOption(Optional<bool> &V, StringRef Name, bool DefaultVal); + /// Interprets an option's string value as an integer value. int getOptionAsInteger(StringRef Name, int DefaultVal); diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h index 10fd445b8c..75bf9613e2 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h @@ -227,7 +227,7 @@ public: BugReporterContext &BRC, BugReport &R, const ExplodedNode *N, - llvm::Optional<bool> &prunable); + Optional<bool> &prunable); }; /// \brief Suppress reports that might lead to known false positives. diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h index fa02c88387..3f0a1b1bc1 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h @@ -461,7 +461,7 @@ public: }; class PathDiagnosticEventPiece : public PathDiagnosticSpotPiece { - llvm::Optional<bool> IsPrunable; + Optional<bool> IsPrunable; /// If the event occurs in a different frame than the final diagnostic, /// supply a message that will be used to construct an extra hint on the diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h index 3afe5e77b9..1e76ea6ed6 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h @@ -28,7 +28,7 @@ namespace ento { class SubEngine; class ConditionTruthVal { - llvm::Optional<bool> Val; + Optional<bool> Val; public: /// Construct a ConditionTruthVal indicating the constraint is constrained /// to either true or false, depending on the boolean value provided. diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h index c23cc49a21..eab248bac2 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h @@ -635,7 +635,7 @@ ProgramState::assume(DefinedOrUnknownSVal Cond) const { } inline ProgramStateRef ProgramState::bindLoc(SVal LV, SVal V) const { - if (llvm::Optional<Loc> L = LV.getAs<Loc>()) + if (Optional<Loc> L = LV.getAs<Loc>()) return bindLoc(*L, V); return this; } @@ -671,7 +671,7 @@ inline SVal ProgramState::getLValue(const IndirectFieldDecl *D, } inline SVal ProgramState::getLValue(QualType ElementType, SVal Idx, SVal Base) const{ - if (llvm::Optional<NonLoc> N = Idx.getAs<NonLoc>()) + if (Optional<NonLoc> N = Idx.getAs<NonLoc>()) return getStateManager().StoreMgr->getLValueElement(ElementType, *N, Base); return UnknownVal(); } diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h index 9b6dc53ce1..2391d49c73 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h @@ -79,9 +79,9 @@ public: } template<typename T> - llvm::Optional<T> getAs() const { + Optional<T> getAs() const { if (!T::isKind(*this)) - return llvm::Optional<T>(); + return Optional<T>(); T t; SVal& sv = t; sv = *this; |