[LLVMbugs] [Bug 12943] New: Scope::TemplateParamScope or TemplateParameterDepth should be available anywhere parsing

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 24 20:24:31 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12943

             Bug #: 12943
           Summary: Scope::TemplateParamScope or TemplateParameterDepth
                    should be available anywhere parsing
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dmikurube at chromium.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Parser's ParseScope and TemporaryParamDepth seem not maintained enough.  They
look like having just partial information about template scope.

I'd like to fix it so that either of them will have enough information
anywhere.  Is it acceptable?

While I was hacking on Clang parsing, I couldn't retrieve enough information
whether I'm in a template parameter scope, or not.



1. Scope::TemplateParamScope in ParseScope

While parsing (*1) in the following code, ParseScope doesn't ahve
TemplateParamScope since it's overwritten ParseFunctionDefinition at
http://clang.llvm.org/doxygen/Parser_8cpp_source.html#l00975.

template<typename T>
Object* make(T a) {
  return new Object(&a);  // (*1)
}


2. Parser's TemporaryParamDepth

While parsing (*2) in the following code, TemporaryParamDepth is 0.  Since
class member functions are parsed lazily at Parser::ParseLexedMethodDef after
Parser::ParseSingleDeclarationAfterTemplate finished.

class Class {
  template<typename T>
  Object* make(T a) {
    return new Object(&a);  // (*2)
  }
};

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list