r347630 - Revert r347627 "[MS] Push fewer DeclContexts for delayed template parsing"

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 26 18:54:17 PST 2018


Author: rnk
Date: Mon Nov 26 18:54:17 2018
New Revision: 347630

URL: http://llvm.org/viewvc/llvm-project?rev=347630&view=rev
Log:
Revert r347627 "[MS] Push fewer DeclContexts for delayed template parsing"

It broke the Windows self-host:
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/1799/steps/stage%202%20build/logs/stdio

I can build
lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/MachinePostDominators.cpp.obj to
repro.

Modified:
    cfe/trunk/lib/Parse/ParseTemplate.cpp
    cfe/trunk/test/Parser/DelayedTemplateParsing.cpp

Modified: cfe/trunk/lib/Parse/ParseTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTemplate.cpp?rev=347630&r1=347629&r2=347630&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTemplate.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTemplate.cpp Mon Nov 26 18:54:17 2018
@@ -1382,7 +1382,7 @@ void Parser::ParseLateTemplatedFuncDef(L
   SmallVector<ParseScope*, 4> TemplateParamScopeStack;
 
   // Get the list of DeclContexts to reenter.
-  SmallVector<DeclContext *, 4> DeclContextsToReenter;
+  SmallVector<DeclContext*, 4> DeclContextsToReenter;
   DeclContext *DD = FunD;
   while (DD && !DD->isTranslationUnit()) {
     DeclContextsToReenter.push_back(DD);
@@ -1398,12 +1398,7 @@ void Parser::ParseLateTemplatedFuncDef(L
     unsigned NumParamLists =
       Actions.ActOnReenterTemplateScope(getCurScope(), cast<Decl>(*II));
     CurTemplateDepthTracker.addDepth(NumParamLists);
-    // If we find a class in a class, we need to push the context of the
-    // outermost class to match up with how we would parse a regular C++ class
-    // inline method.
-    if (*II != FunD &&
-        !(isa<CXXRecordDecl>(*II) && isa<CXXRecordDecl>(Actions.CurContext) &&
-          Actions.CurContext == (*II)->getLexicalParent())) {
+    if (*II != FunD) {
       TemplateParamScopeStack.push_back(new ParseScope(this, Scope::DeclScope));
       Actions.PushDeclContext(Actions.getCurScope(), *II);
     }

Modified: cfe/trunk/test/Parser/DelayedTemplateParsing.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/DelayedTemplateParsing.cpp?rev=347630&r1=347629&r2=347630&view=diff
==============================================================================
--- cfe/trunk/test/Parser/DelayedTemplateParsing.cpp (original)
+++ cfe/trunk/test/Parser/DelayedTemplateParsing.cpp Mon Nov 26 18:54:17 2018
@@ -181,20 +181,3 @@ static void h() {
 }
 
 }
-
-struct PR38460 {
-  template <typename>
-  struct T {
-    static void foo() {
-      struct U {
-        void dummy() {
-          use_delayed_identifier();
-        }
-      };
-    }
-  };
-};
-void use_delayed_identifier();
-void trigger_PR38460() {
-  PR38460::T<int>::foo();
-}




More information about the cfe-commits mailing list