<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: 'Calibri'; COLOR: #000000">
<DIV> </DIV>
<DIV
style="BORDER-TOP-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 4px solid; BORDER-RIGHT-COLOR: #000000">
<DIV style="TEXT-DECORATION: ; FONT-FAMILY: ; COLOR: ; DISPLAY: inline">
<DIV>"Tim Halloran via cfe-dev"
<cfe-dev@lists.llvm.org> wrote in message
news:CAFdkBy6St8R7p1cw0cUk_NCmJaq=+x719KuAk81cCgNTw0q49Q@mail.gmail.com...</DIV></DIV></DIV>
<DIV style="TEXT-DECORATION: ; FONT-FAMILY: ; COLOR: ; DISPLAY: inline">
<DIV
style="BORDER-TOP-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 4px solid; BORDER-RIGHT-COLOR: #000000"
dir=ltr>I'm trying to refactor in C++:
<DIV> </DIV>
<DIV> using namespace std;</DIV>
<DIV> string sp = " ";<BR></DIV>
<DIV> </DIV>
<DIV>into</DIV>
<DIV> </DIV>
<DIV> std::string sp = " ";</DIV>
<DIV> </DIV>
<DIV>However when I examine the VarDecl node it is not obvious how to get to the
namespace the "typedef <snip> sting" is declared in.</DIV></DIV></DIV>
<DIV>
<DIV
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'> </DIV></DIV>
<DIV>
<DIV
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'>This
worked for me: </DIV></DIV>
<DIV>
<DIV
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'> </DIV></DIV>
<DIV>
<DIV>auto ty = varDecl->getType().getTypePtr();</DIV>
<DIV>if (ty->getTypeClass() == clang::Type::TypeClass::Typedef)</DIV>
<DIV>{</DIV>
<DIV> auto tdty =
ty->getAs<clang::TypedefType>();</DIV>
<DIV> std::cout <<
tdty->getDecl()->getQualifiedNameAsString() << " " <<
varDecl->getNameAsString();</DIV>
<DIV>}</DIV>
<DIV> </DIV>
<DIV>HTH, </DIV>
<DIV>Boris </DIV></DIV></DIV></DIV></BODY></HTML>