[llvm-branch-commits] [cfe-branch] r214741 - Merging r214471:
Bill Wendling
isanbard at gmail.com
Mon Aug 4 11:18:41 PDT 2014
Author: void
Date: Mon Aug 4 13:18:40 2014
New Revision: 214741
URL: http://llvm.org/viewvc/llvm-project?rev=214741&view=rev
Log:
Merging r214471:
------------------------------------------------------------------------
r214471 | rtrieu | 2014-07-31 18:42:01 -0700 (Thu, 31 Jul 2014) | 5 lines
Remove this pointer that is converted to bool. In well-defined contexts, the
this pointer is always non-null. If the this pointer is null, it is undefined
and the compiler may optimize it away by assuming it is non-null. The null
checks are pushed into the callers.
------------------------------------------------------------------------
Modified:
cfe/branches/release_35/ (props changed)
cfe/branches/release_35/lib/Basic/DiagnosticIDs.cpp
Propchange: cfe/branches/release_35/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug 4 13:18:40 2014
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:213609,213611,213613,213741,213840,213902,213912,213993,213998,214008,214208
+/cfe/trunk:213609,213611,213613,213741,213840,213902,213912,213993,213998,214008,214208,214471
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_35/lib/Basic/DiagnosticIDs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_35/lib/Basic/DiagnosticIDs.cpp?rev=214741&r1=214740&r2=214741&view=diff
==============================================================================
--- cfe/branches/release_35/lib/Basic/DiagnosticIDs.cpp (original)
+++ cfe/branches/release_35/lib/Basic/DiagnosticIDs.cpp Mon Aug 4 13:18:40 2014
@@ -259,14 +259,14 @@ namespace clang {
/// getDescription - Return the description of the specified custom
/// diagnostic.
StringRef getDescription(unsigned DiagID) const {
- assert(this && DiagID-DIAG_UPPER_LIMIT < DiagInfo.size() &&
+ assert(DiagID - DIAG_UPPER_LIMIT < DiagInfo.size() &&
"Invalid diagnostic ID");
return DiagInfo[DiagID-DIAG_UPPER_LIMIT].second;
}
/// getLevel - Return the level of the specified custom diagnostic.
DiagnosticIDs::Level getLevel(unsigned DiagID) const {
- assert(this && DiagID-DIAG_UPPER_LIMIT < DiagInfo.size() &&
+ assert(DiagID - DIAG_UPPER_LIMIT < DiagInfo.size() &&
"Invalid diagnostic ID");
return DiagInfo[DiagID-DIAG_UPPER_LIMIT].first;
}
@@ -358,6 +358,7 @@ bool DiagnosticIDs::isDefaultMappingAsEr
StringRef DiagnosticIDs::getDescription(unsigned DiagID) const {
if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID))
return Info->getDescription();
+ assert(CustomDiagInfo && "Invalid CustomDiagInfo");
return CustomDiagInfo->getDescription(DiagID);
}
@@ -384,8 +385,10 @@ DiagnosticIDs::Level
DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, SourceLocation Loc,
const DiagnosticsEngine &Diag) const {
// Handle custom diagnostics, which cannot be mapped.
- if (DiagID >= diag::DIAG_UPPER_LIMIT)
+ if (DiagID >= diag::DIAG_UPPER_LIMIT) {
+ assert(CustomDiagInfo && "Invalid CustomDiagInfo");
return CustomDiagInfo->getLevel(DiagID);
+ }
unsigned DiagClass = getBuiltinDiagClass(DiagID);
if (DiagClass == CLASS_NOTE) return DiagnosticIDs::Note;
@@ -669,6 +672,7 @@ void DiagnosticIDs::EmitDiag(Diagnostics
bool DiagnosticIDs::isUnrecoverable(unsigned DiagID) const {
if (DiagID >= diag::DIAG_UPPER_LIMIT) {
+ assert(CustomDiagInfo && "Invalid CustomDiagInfo");
// Custom diagnostics.
return CustomDiagInfo->getLevel(DiagID) >= DiagnosticIDs::Error;
}
More information about the llvm-branch-commits
mailing list