summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData/CoverageMapping.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2015-02-20 07:28:28 +0000
committerJustin Bogner <mail@justinbogner.com>2015-02-20 07:28:28 +0000
commitc4f5a5e8637543f16d4b3b191b1aba32c650f1f3 (patch)
tree9e49a56f9743cbfc952676d3d0287023ca4c6b02 /llvm/lib/ProfileData/CoverageMapping.cpp
parentb73c0410050aabeefd44249d6e1d458d75c68055 (diff)
downloadbcm5719-llvm-c4f5a5e8637543f16d4b3b191b1aba32c650f1f3.tar.gz
bcm5719-llvm-c4f5a5e8637543f16d4b3b191b1aba32c650f1f3.zip
Disallow implicit conversions from None to integer types
This fixes an error introduced in r228934 where None was converted to an int instead of the int being converted to an Optional as intended. We make that sort of mistake a compile error by changing NoneType into a scoped enum. Finally, provide a static NoneType called None to avoid forcing all users to spell it NoneType::None. llvm-svn: 229980
Diffstat (limited to 'llvm/lib/ProfileData/CoverageMapping.cpp')
-rw-r--r--llvm/lib/ProfileData/CoverageMapping.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/ProfileData/CoverageMapping.cpp b/llvm/lib/ProfileData/CoverageMapping.cpp
index a124d792e87..da619e1bf9f 100644
--- a/llvm/lib/ProfileData/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/CoverageMapping.cpp
@@ -361,7 +361,9 @@ static Optional<unsigned> findMainViewFileID(StringRef SourceFile,
IsNotExpandedFile[CR.ExpandedFileID] = false;
IsNotExpandedFile &= FilenameEquivalence;
int I = IsNotExpandedFile.find_first();
- return I != -1 ? I : None;
+ if (I == -1)
+ return None;
+ return I;
}
static Optional<unsigned> findMainViewFileID(const FunctionRecord &Function) {
@@ -370,7 +372,9 @@ static Optional<unsigned> findMainViewFileID(const FunctionRecord &Function) {
if (CR.Kind == CounterMappingRegion::ExpansionRegion)
IsNotExpandedFile[CR.ExpandedFileID] = false;
int I = IsNotExpandedFile.find_first();
- return I != -1 ? I : None;
+ if (I == -1)
+ return None;
+ return I;
}
/// Sort a nested sequence of regions from a single file.
OpenPOWER on IntegriCloud