r283448 - Allocate after the early exit checks. NFC.

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 6 06:18:06 PDT 2016


Author: vvassilev
Date: Thu Oct  6 08:18:06 2016
New Revision: 283448

URL: http://llvm.org/viewvc/llvm-project?rev=283448&view=rev
Log:
Allocate after the early exit checks. NFC.

Modified:
    cfe/trunk/lib/Serialization/ASTReaderDecl.cpp

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=283448&r1=283447&r2=283448&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Thu Oct  6 08:18:06 2016
@@ -2320,8 +2320,6 @@ template<typename T>
 void ASTDeclReader::mergeRedeclarable(Redeclarable<T> *DBase,
                                       RedeclarableResult &Redecl,
                                       DeclID TemplatePatternID) {
-  T *D = static_cast<T*>(DBase);
-
   // If modules are not available, there is no reason to perform this merge.
   if (!Reader.getContext().getLangOpts().Modules)
     return;
@@ -2330,6 +2328,8 @@ void ASTDeclReader::mergeRedeclarable(Re
   if (!DBase->isFirstDecl())
     return;
 
+  T *D = static_cast<T*>(DBase);
+
   if (auto *Existing = Redecl.getKnownMergeTarget())
     // We already know of an existing declaration we should merge with.
     mergeRedeclarable(D, cast<T>(Existing), Redecl, TemplatePatternID);




More information about the cfe-commits mailing list