[PATCH] [OPENMP] Codegen for 'private' clause in 'parallel' directive

Ajay Jayaraj ajayj at ti.com
Wed Aug 27 11:46:37 PDT 2014


Alexey,

I have a question on the code sequence from SemaOpenMP.cpp, ActOnOpenMPPrivateClause:

` auto VDPrivate =
 VarDecl::Create(Context, CurContext, DE->getLocStart(),
 DE->getExprLoc(), VD->getIdentifier(), VD->getType(),
 VD->getTypeSourceInfo(), /*S*/ SC_Auto);
 ActOnUninitializedDecl(VDPrivate, /*TypeMayContainAuto*/ false);
 if (VD->isInvalidDecl())
 continue;

 CurContext->addDecl(VDPrivate);`

Should the VD->isInvalidDecl() check be moved before the VarDecl::Create(...)? It appears that there is no need to create VDPrivate if the declaration is invalid and we don't add it via addDecl.

Ajay

http://reviews.llvm.org/D4752






More information about the cfe-commits mailing list