[LLVMbugs] [Bug 10655] New: TypeDecl::TypeForDecl set to 0 for regular TypedefDecl

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Aug 14 05:23:55 PDT 2011


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

           Summary: TypeDecl::TypeForDecl set to 0 for regular TypedefDecl
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: bugzilla-clang at sogetthis.com
                CC: llvmbugs at cs.uiuc.edu


For any regular TypedefDecl its TypeDecl::TypeForDecl is set to 0.
For builtin typedefs however it seems to be set correctly.


example code (run inside a plugin):
-----------------------------------
for (clang::DeclContext::decl_iterator declIte =
  context.getTranslationUnitDecl()->decls_begin(),
  dEnd = context.getTranslationUnitDecl()->decls_end();
  declIte != dEnd; ++declIte) {

    if (const clang::TypedefDecl* tdD =
llvm::dyn_cast<clang::TypedefDecl>(*declIte)) {
        tdD->print(llvm::errs());
        llvm::errs() << "\n";
        llvm::errs() << tdD->getTypeForDecl() << "\n\n";
    }
}

yields this output:
-------------------
$ cat test.cpp
typedef int test;

$ clang -cc1 -load ./plugin.so -plugin test test.cpp
typedef char *__builtin_va_list
0xc7adc70

typedef int test
0x0

-- 
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