r175705 - Use None rather than Optional<T>() where possible.
David Blaikie
dblaikie at gmail.com
Wed Feb 20 17:47:19 PST 2013
Author: dblaikie
Date: Wed Feb 20 19:47:18 2013
New Revision: 175705
URL: http://llvm.org/viewvc/llvm-project?rev=175705&view=rev
Log:
Use None rather than Optional<T>() where possible.
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/AST/ExprObjC.h
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/include/clang/Basic/LLVM.h
cfe/trunk/include/clang/Basic/VersionTuple.h
cfe/trunk/include/clang/Lex/PreprocessingRecord.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/AST/DeclTemplate.cpp
cfe/trunk/lib/AST/NSAPI.cpp
cfe/trunk/lib/AST/TemplateBase.cpp
cfe/trunk/lib/Analysis/FormatString.cpp
cfe/trunk/lib/Analysis/UninitializedValues.cpp
cfe/trunk/lib/Basic/SourceManager.cpp
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
cfe/trunk/tools/libclang/CIndex.cpp
Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Wed Feb 20 19:47:18 2013
@@ -3373,7 +3373,7 @@ public:
if (NumExpansions)
return NumExpansions - 1;
- return Optional<unsigned>();
+ return None;
}
SourceLocation getLocStart() const LLVM_READONLY {
Modified: cfe/trunk/include/clang/AST/ExprObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprObjC.h (original)
+++ cfe/trunk/include/clang/AST/ExprObjC.h Wed Feb 20 19:47:18 2013
@@ -300,8 +300,7 @@ public:
ObjCDictionaryElement getKeyValueElement(unsigned Index) const {
assert((Index < NumElements) && "Arg access out of range!");
const KeyValuePair &KV = getKeyValues()[Index];
- ObjCDictionaryElement Result = { KV.Key, KV.Value, SourceLocation(),
- Optional<unsigned>() };
+ ObjCDictionaryElement Result = { KV.Key, KV.Value, SourceLocation(), None };
if (HasPackExpansions) {
const ExpansionData &Expansion = getExpansionData()[Index];
Result.EllipsisLoc = Expansion.EllipsisLoc;
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Wed Feb 20 19:47:18 2013
@@ -4155,7 +4155,7 @@ public:
if (NumExpansions)
return NumExpansions - 1;
- return Optional<unsigned>();
+ return None;
}
bool isSugared() const { return false; }
Modified: cfe/trunk/include/clang/Basic/LLVM.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LLVM.h?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LLVM.h (original)
+++ cfe/trunk/include/clang/Basic/LLVM.h Wed Feb 20 19:47:18 2013
@@ -16,9 +16,13 @@
#ifndef CLANG_BASIC_LLVM_H
#define CLANG_BASIC_LLVM_H
-// This should be the only #include, force #includes of all the others on
-// clients.
+// Do not proliferate #includes here, require clients to #include their
+// dependencies.
+// Casting.h has complex templates that cannot be easily forward declared.
#include "llvm/Support/Casting.h"
+// None.h includes an enumerant that is desired & cannot be forward declared
+// without a definition of NoneType.
+#include "llvm/ADT/None.h"
namespace llvm {
// ADT's.
@@ -54,6 +58,7 @@ namespace clang {
using llvm::cast_or_null;
// ADT's.
+ using llvm::None;
using llvm::Optional;
using llvm::StringRef;
using llvm::Twine;
Modified: cfe/trunk/include/clang/Basic/VersionTuple.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VersionTuple.h?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/VersionTuple.h (original)
+++ cfe/trunk/include/clang/Basic/VersionTuple.h Wed Feb 20 19:47:18 2013
@@ -57,14 +57,14 @@ public:
/// \brief Retrieve the minor version number, if provided.
Optional<unsigned> getMinor() const {
if (!HasMinor)
- return Optional<unsigned>();
+ return None;
return Minor;
}
/// \brief Retrieve the subminor version number, if provided.
Optional<unsigned> getSubminor() const {
if (!HasSubminor)
- return Optional<unsigned>();
+ return None;
return Subminor;
}
Modified: cfe/trunk/include/clang/Lex/PreprocessingRecord.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PreprocessingRecord.h?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/PreprocessingRecord.h (original)
+++ cfe/trunk/include/clang/Lex/PreprocessingRecord.h Wed Feb 20 19:47:18 2013
@@ -279,7 +279,7 @@ namespace clang {
/// entity with index \p Index came from file \p FID.
virtual Optional<bool> isPreprocessedEntityInFileID(unsigned Index,
FileID FID) {
- return Optional<bool>();
+ return None;
}
};
Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h Wed Feb 20 19:47:18 2013
@@ -85,7 +85,7 @@ public:
template<typename T>
Optional<T> getAs() const {
if (!T::isKind(*this))
- return Optional<T>();
+ return None;
T t;
SVal& sv = t;
sv = *this;
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Wed Feb 20 19:47:18 2013
@@ -908,7 +908,7 @@ static Optional<unsigned> findAnonymousS
RecordDecl *Owner = dyn_cast<RecordDecl>(Anon->getDeclContext());
if (!Owner)
- return Optional<unsigned>();
+ return None;
unsigned Index = 0;
for (DeclContext::decl_iterator D = Owner->noload_decls_begin(),
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Wed Feb 20 19:47:18 2013
@@ -180,7 +180,7 @@ static Optional<Visibility> getVisibilit
return DefaultVisibility;
}
- return Optional<Visibility>();
+ return None;
}
static LinkageInfo getLVForType(QualType T) {
@@ -893,7 +893,7 @@ NamedDecl::getExplicitVisibility(Explici
return getVisibilityOf(InstantiatedFrom, kind);
}
- return Optional<Visibility>();
+ return None;
}
// Use the most recent declaration of a function, and also handle
// function template specializations.
@@ -914,7 +914,7 @@ NamedDecl::getExplicitVisibility(Explici
if (InstantiatedFrom)
return getVisibilityOf(InstantiatedFrom, kind);
- return Optional<Visibility>();
+ return None;
}
// Otherwise, just check the declaration itself first.
@@ -941,7 +941,7 @@ NamedDecl::getExplicitVisibility(Explici
return getVisibilityOf(InstantiatedFrom, kind);
}
- return Optional<Visibility>();
+ return None;
}
static LinkageInfo getLVForLocalDecl(const NamedDecl *D,
Modified: cfe/trunk/lib/AST/DeclTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclTemplate.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclTemplate.cpp (original)
+++ cfe/trunk/lib/AST/DeclTemplate.cpp Wed Feb 20 19:47:18 2013
@@ -184,7 +184,7 @@ static void GenerateInjectedTemplateArgs
if (TemplateTypeParmDecl *TTP = dyn_cast<TemplateTypeParmDecl>(*Param)) {
QualType ArgType = Context.getTypeDeclType(TTP);
if (TTP->isParameterPack())
- ArgType = Context.getPackExpansionType(ArgType, Optional<unsigned>());
+ ArgType = Context.getPackExpansionType(ArgType, None);
Arg = TemplateArgument(ArgType);
} else if (NonTypeTemplateParmDecl *NTTP =
@@ -195,8 +195,8 @@ static void GenerateInjectedTemplateArgs
NTTP->getLocation());
if (NTTP->isParameterPack())
- E = new (Context) PackExpansionExpr(
- Context.DependentTy, E, NTTP->getLocation(), Optional<unsigned>());
+ E = new (Context) PackExpansionExpr(Context.DependentTy, E,
+ NTTP->getLocation(), None);
Arg = TemplateArgument(E);
} else {
TemplateTemplateParmDecl *TTP = cast<TemplateTemplateParmDecl>(*Param);
Modified: cfe/trunk/lib/AST/NSAPI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/NSAPI.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/AST/NSAPI.cpp (original)
+++ cfe/trunk/lib/AST/NSAPI.cpp Wed Feb 20 19:47:18 2013
@@ -75,7 +75,7 @@ NSAPI::getNSStringMethodKind(Selector Se
return MK;
}
- return Optional<NSStringMethodKind>();
+ return None;
}
Selector NSAPI::getNSArraySelector(NSArrayMethodKind MK) const {
@@ -133,7 +133,7 @@ Optional<NSAPI::NSArrayMethodKind> NSAPI
return MK;
}
- return Optional<NSArrayMethodKind>();
+ return None;
}
Selector NSAPI::getNSDictionarySelector(
@@ -219,7 +219,7 @@ NSAPI::getNSDictionaryMethodKind(Selecto
return MK;
}
- return Optional<NSDictionaryMethodKind>();
+ return None;
}
Selector NSAPI::getNSNumberLiteralSelector(NSNumberLiteralMethodKind MK,
@@ -282,14 +282,14 @@ NSAPI::getNSNumberLiteralMethodKind(Sele
return MK;
}
- return Optional<NSNumberLiteralMethodKind>();
+ return None;
}
Optional<NSAPI::NSNumberLiteralMethodKind>
NSAPI::getNSNumberFactoryMethodKind(QualType T) const {
const BuiltinType *BT = T->getAs<BuiltinType>();
if (!BT)
- return Optional<NSAPI::NSNumberLiteralMethodKind>();
+ return None;
const TypedefType *TDT = T->getAs<TypedefType>();
if (TDT) {
@@ -363,7 +363,7 @@ NSAPI::getNSNumberFactoryMethodKind(Qual
break;
}
- return Optional<NSAPI::NSNumberLiteralMethodKind>();
+ return None;
}
/// \brief Returns true if \param T is a typedef of "BOOL" in objective-c.
Modified: cfe/trunk/lib/AST/TemplateBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TemplateBase.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TemplateBase.cpp (original)
+++ cfe/trunk/lib/AST/TemplateBase.cpp Wed Feb 20 19:47:18 2013
@@ -229,7 +229,7 @@ Optional<unsigned> TemplateArgument::get
if (TemplateArg.NumExpansions)
return TemplateArg.NumExpansions - 1;
- return Optional<unsigned>();
+ return None;
}
void TemplateArgument::Profile(llvm::FoldingSetNodeID &ID,
Modified: cfe/trunk/lib/Analysis/FormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/FormatString.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/FormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/FormatString.cpp Wed Feb 20 19:47:18 2013
@@ -533,7 +533,7 @@ ConversionSpecifier::getStandardSpecifie
switch (getKind()) {
default:
- return Optional<ConversionSpecifier>();
+ return None;
case DArg:
NewKind = dArg;
break;
@@ -766,7 +766,7 @@ Optional<LengthModifier> FormatSpecifier
}
}
- return Optional<LengthModifier>();
+ return None;
}
bool FormatSpecifier::namedTypeToLengthModifier(QualType QT,
Modified: cfe/trunk/lib/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/UninitializedValues.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/lib/Analysis/UninitializedValues.cpp Wed Feb 20 19:47:18 2013
@@ -77,7 +77,7 @@ void DeclToIndex::computeMap(const DeclC
Optional<unsigned> DeclToIndex::getValueIndex(const VarDecl *d) const {
llvm::DenseMap<const VarDecl *, unsigned>::const_iterator I = map.find(d);
if (I == map.end())
- return Optional<unsigned>();
+ return None;
return I->second;
}
Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Wed Feb 20 19:47:18 2013
@@ -1462,11 +1462,11 @@ unsigned SourceManager::getFileIDSize(Fi
/// in non-performance-critical code.
static Optional<ino_t> getActualFileInode(const FileEntry *File) {
if (!File)
- return Optional<ino_t>();
+ return None;
struct stat StatBuf;
if (::stat(File->getName(), &StatBuf))
- return Optional<ino_t>();
+ return None;
return StatBuf.st_ino;
}
Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Wed Feb 20 19:47:18 2013
@@ -2730,7 +2730,7 @@ ExprResult Parser::ParseObjCDictionaryLi
// We have a valid expression. Collect it in a vector so we can
// build the argument list.
ObjCDictionaryElement Element = {
- KeyExpr.get(), ValueExpr.get(), EllipsisLoc, Optional<unsigned>()
+ KeyExpr.get(), ValueExpr.get(), EllipsisLoc, None
};
Elements.push_back(Element);
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Wed Feb 20 19:47:18 2013
@@ -3036,7 +3036,7 @@ static Optional<unsigned> getExpandedPac
return TTP->getNumExpansionTemplateParameters();
}
- return Optional<unsigned>();
+ return None;
}
/// \brief Check that the given template argument list is well-formed
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Wed Feb 20 19:47:18 2013
@@ -628,7 +628,7 @@ Optional<TemplateDeductionInfo *> Sema::
case ActiveTemplateInstantiation::DefaultFunctionArgumentInstantiation:
case ActiveTemplateInstantiation::ExceptionSpecInstantiation:
// This is a template instantiation, so there is no SFINAE.
- return Optional<TemplateDeductionInfo *>();
+ return None;
case ActiveTemplateInstantiation::DefaultTemplateArgumentInstantiation:
case ActiveTemplateInstantiation::PriorTemplateArgumentSubstitution:
@@ -647,7 +647,7 @@ Optional<TemplateDeductionInfo *> Sema::
}
}
- return Optional<TemplateDeductionInfo *>();
+ return None;
}
/// \brief Retrieve the depth and index of a parameter pack.
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Wed Feb 20 19:47:18 2013
@@ -1638,9 +1638,8 @@ Decl *TemplateDeclInstantiator::VisitCXX
}
ParmVarDecl *TemplateDeclInstantiator::VisitParmVarDecl(ParmVarDecl *D) {
- return SemaRef.SubstParmVarDecl(D, TemplateArgs, /*indexAdjustment*/ 0,
- Optional<unsigned>(),
- /*ExpectParameterPack=*/false);
+ return SemaRef.SubstParmVarDecl(D, TemplateArgs, /*indexAdjustment*/ 0, None,
+ /*ExpectParameterPack=*/ false);
}
Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
Modified: cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp Wed Feb 20 19:47:18 2013
@@ -443,8 +443,7 @@ TypeResult Sema::ActOnPackExpansion(Pars
if (!TSInfo)
return true;
- TypeSourceInfo *TSResult =
- CheckPackExpansion(TSInfo, EllipsisLoc, Optional<unsigned>());
+ TypeSourceInfo *TSResult = CheckPackExpansion(TSInfo, EllipsisLoc, None);
if (!TSResult)
return true;
@@ -490,7 +489,7 @@ QualType Sema::CheckPackExpansion(QualTy
}
ExprResult Sema::ActOnPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc) {
- return CheckPackExpansion(Pattern, EllipsisLoc, Optional<unsigned>());
+ return CheckPackExpansion(Pattern, EllipsisLoc, None);
}
ExprResult Sema::CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc,
@@ -662,7 +661,7 @@ Optional<unsigned> Sema::getNumArguments
if (Instantiation->is<Decl*>())
// The pattern refers to an unexpanded pack. We're not ready to expand
// this pack yet.
- return Optional<unsigned>();
+ return None;
unsigned Size = Instantiation->get<DeclArgumentPack *>()->size();
assert((!Result || *Result == Size) && "inconsistent pack sizes");
@@ -676,7 +675,7 @@ Optional<unsigned> Sema::getNumArguments
!TemplateArgs.hasTemplateArgument(Depth, Index))
// The pattern refers to an unknown template argument. We're not ready to
// expand this pack yet.
- return Optional<unsigned>();
+ return None;
// Determine the size of the argument pack.
unsigned Size = TemplateArgs(Depth, Index).pack_size();
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Wed Feb 20 19:47:18 2013
@@ -2889,7 +2889,7 @@ static TypeSourceInfo *GetFullTypeForDec
<< T << D.getSourceRange();
D.setEllipsisLoc(SourceLocation());
} else {
- T = Context.getPackExpansionType(T, Optional<unsigned>());
+ T = Context.getPackExpansionType(T, None);
}
break;
@@ -2903,7 +2903,7 @@ static TypeSourceInfo *GetFullTypeForDec
// parameter packs in the type of the non-type template parameter, then
// it expands those parameter packs.
if (T->containsUnexpandedParameterPack())
- T = Context.getPackExpansionType(T, Optional<unsigned>());
+ T = Context.getPackExpansionType(T, None);
else
S.Diag(D.getEllipsisLoc(),
LangOpts.CPlusPlus11
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Wed Feb 20 19:47:18 2013
@@ -4098,8 +4098,7 @@ bool TreeTransform<Derived>::
/*ExpectParameterPack=*/true);
} else {
NewParm = getDerived().TransformFunctionTypeParam(
- OldParm, indexAdjustment, Optional<unsigned>(),
- /*ExpectParameterPack=*/ false);
+ OldParm, indexAdjustment, None, /*ExpectParameterPack=*/ false);
}
if (!NewParm)
@@ -8565,7 +8564,7 @@ TreeTransform<Derived>::TransformObjCDic
ArgChanged = true;
ObjCDictionaryElement Element = {
- Key.get(), Value.get(), SourceLocation(), Optional<unsigned>()
+ Key.get(), Value.get(), SourceLocation(), None
};
Elements.push_back(Element);
}
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp Wed Feb 20 19:47:18 2013
@@ -217,7 +217,7 @@ static Optional<uint64_t> GetCFNumberSiz
case kCFNumberCGFloatType:
// FIXME: We need a way to map from names to Type*.
default:
- return Optional<uint64_t>();
+ return None;
}
return Ctx.getTypeSize(T);
Modified: cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp Wed Feb 20 19:47:18 2013
@@ -225,7 +225,7 @@ compareControlFlow(const PathDiagnosticC
FullSourceLoc YEL = Y.getEndLocation().asLocation();
if (XEL != YEL)
return XEL.isBeforeInTranslationUnitThan(YEL);
- return Optional<bool>();
+ return None;
}
static Optional<bool> compareMacro(const PathDiagnosticMacroPiece &X,
@@ -283,7 +283,7 @@ static Optional<bool> comparePiece(const
return compareControlFlow(cast<PathDiagnosticControlFlowPiece>(X),
cast<PathDiagnosticControlFlowPiece>(Y));
case clang::ento::PathDiagnosticPiece::Event:
- return Optional<bool>();
+ return None;
case clang::ento::PathDiagnosticPiece::Macro:
return compareMacro(cast<PathDiagnosticMacroPiece>(X),
cast<PathDiagnosticMacroPiece>(Y));
@@ -302,7 +302,7 @@ static Optional<bool> comparePath(const
if (b.hasValue())
return b.getValue();
}
- return Optional<bool>();
+ return None;
}
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y) {
Modified: cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp Wed Feb 20 19:47:18 2013
@@ -227,7 +227,7 @@ typedef const RegionBindingsRef& RegionB
Optional<SVal> RegionBindingsRef::getDirectBinding(const MemRegion *R) const {
if (const SVal *V = lookup(R, BindingKey::Direct))
return *V;
- return Optional<SVal>();
+ return None;
}
Optional<SVal> RegionBindingsRef::getDefaultBinding(const MemRegion *R) const {
@@ -237,7 +237,7 @@ Optional<SVal> RegionBindingsRef::getDef
return UnknownVal();
if (const SVal *V = lookup(R, BindingKey::Default))
return *V;
- return Optional<SVal>();
+ return None;
}
RegionBindingsRef RegionBindingsRef::addBinding(BindingKey K, SVal V) const {
@@ -1448,12 +1448,12 @@ RegionStoreManager::getBindingForDerived
// Lazy bindings are handled later.
if (val.getAs<nonloc::LazyCompoundVal>())
- return Optional<SVal>();
+ return None;
llvm_unreachable("Unknown default value");
}
- return Optional<SVal>();
+ return None;
}
SVal RegionStoreManager::getLazyBinding(const SubRegion *LazyBindingRegion,
@@ -1574,11 +1574,11 @@ SVal RegionStoreManager::getBindingForOb
static Optional<SVal> getConstValue(SValBuilder &SVB, const VarDecl *VD) {
ASTContext &Ctx = SVB.getContext();
if (!VD->getType().isConstQualified())
- return Optional<SVal>();
+ return None;
const Expr *Init = VD->getInit();
if (!Init)
- return Optional<SVal>();
+ return None;
llvm::APSInt Result;
if (Init->EvaluateAsInt(Result, Ctx))
@@ -1588,7 +1588,7 @@ static Optional<SVal> getConstValue(SVal
return SVB.makeNull();
// FIXME: Handle other possible constant expressions.
- return Optional<SVal>();
+ return None;
}
SVal RegionStoreManager::getBindingForVar(RegionBindingsConstRef B,
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=175705&r1=175704&r2=175705&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Wed Feb 20 19:47:18 2013
@@ -561,12 +561,12 @@ Optional<bool> CursorVisitor::shouldVisi
if (RegionOfInterest.isValid()) {
SourceRange Range = getFullCursorExtent(Cursor, AU->getSourceManager());
if (Range.isInvalid())
- return Optional<bool>();
+ return None;
switch (CompareRegionOfInterest(Range)) {
case RangeBefore:
// This declaration comes before the region of interest; skip it.
- return Optional<bool>();
+ return None;
case RangeAfter:
// This declaration comes after the region of interest; we're done.
More information about the cfe-commits
mailing list