Skip to content

Commit 6c1940b

Browse files
committed
clang-wrapper.cc: remove redundant namespace prefixes
Change-Id: If59825d1be8df53cc644814a658b1c658622549d TN: V916-015
1 parent 4849c7f commit 6c1940b

File tree

1 file changed

+30
-32
lines changed

1 file changed

+30
-32
lines changed

tools/gnatcov/clang-wrapper.cc

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ using namespace clang::cxtu;
5151
static ASTContext &
5252
getContext (CXTranslationUnit TU)
5353
{
54-
return cxtu::getASTUnit (TU)->getASTContext ();
54+
return getASTUnit (TU)->getASTContext ();
5555
}
5656

5757
/* Likewise, but starting from a cursor. */
@@ -67,7 +67,7 @@ getContext (CXCursor C)
6767
static const SourceManager &
6868
getSourceManager (CXTranslationUnit TU)
6969
{
70-
return cxtu::getASTUnit (TU)->getSourceManager ();
70+
return getASTUnit (TU)->getSourceManager ();
7171
}
7272

7373
/* Translate a source location to a cursor source location in the given
@@ -76,7 +76,7 @@ getSourceManager (CXTranslationUnit TU)
7676
static CXSourceLocation
7777
translateSLoc (CXTranslationUnit TU, SourceLocation Loc)
7878
{
79-
return cxloc::translateSourceLocation (getContext (TU), Loc);
79+
return translateSourceLocation (getContext (TU), Loc);
8080
}
8181

8282
/* Convert a clang Stmt type to a libclang CXCursor structure. The CXCursor C
@@ -112,7 +112,7 @@ extern "C" CXCursor
112112
clang_getCond (CXCursor C)
113113
{
114114
if (clang_isStatement (C.kind) || clang_isExpression (C.kind))
115-
if (const Stmt *S = cxcursor::getCursorStmt (C))
115+
if (const Stmt *S = getCursorStmt (C))
116116
switch (S->getStmtClass ())
117117
{
118118
case Stmt::IfStmtClass:
@@ -139,7 +139,7 @@ clang_getBody (CXCursor C)
139139
{
140140
if (clang_isDeclaration (C.kind))
141141
{
142-
if (const Decl *D = cxcursor::getCursorDecl (C))
142+
if (const Decl *D = getCursorDecl (C))
143143
switch (D->getKind ())
144144
{
145145
case Decl::FunctionTemplate:
@@ -164,7 +164,7 @@ clang_getBody (CXCursor C)
164164
}
165165
else if (clang_isStatement (C.kind))
166166
{
167-
if (const Stmt *S = cxcursor::getCursorStmt (C))
167+
if (const Stmt *S = getCursorStmt (C))
168168
switch (S->getStmtClass ())
169169
{
170170
case Stmt::WhileStmtClass:
@@ -183,7 +183,7 @@ clang_getBody (CXCursor C)
183183
}
184184
}
185185
else if (clang_isExpression (C.kind))
186-
if (const Expr *E = cxcursor::getCursorExpr (C))
186+
if (const Expr *E = getCursorExpr (C))
187187
switch (E->getStmtClass ())
188188
{
189189
case Expr::LambdaExprClass:
@@ -198,7 +198,7 @@ extern "C" CXCursor
198198
clang_getForInit (CXCursor C)
199199
{
200200
if (clang_isStatement (C.kind))
201-
if (const Stmt *S = cxcursor::getCursorStmt (C))
201+
if (const Stmt *S = getCursorStmt (C))
202202
switch (S->getStmtClass ())
203203
{
204204
case Stmt::ForStmtClass:
@@ -231,7 +231,7 @@ extern "C" CXCursor
231231
clang_getForInc (CXCursor C)
232232
{
233233
if (clang_isStatement (C.kind))
234-
if (const Stmt *S = cxcursor::getCursorStmt (C))
234+
if (const Stmt *S = getCursorStmt (C))
235235
switch (S->getStmtClass ())
236236
{
237237
case Stmt::ForStmtClass:
@@ -249,7 +249,7 @@ clang_getCondVar (CXCursor C)
249249
const WhileStmt *while_stmt;
250250
const VarDecl *decl;
251251

252-
if (clang_isStatement (C.kind) && (stmt = cxcursor::getCursorStmt (C))
252+
if (clang_isStatement (C.kind) && (stmt = getCursorStmt (C))
253253
&& stmt->getStmtClass () == Stmt::WhileStmtClass)
254254
{
255255
while_stmt = cast<WhileStmt> (stmt);
@@ -265,7 +265,7 @@ clang_getVarInitExpr (CXCursor C)
265265
const Decl *decl;
266266
const VarDecl *var_decl;
267267

268-
if (clang_isDeclaration (C.kind) && (decl = cxcursor::getCursorDecl (C))
268+
if (clang_isDeclaration (C.kind) && (decl = getCursorDecl (C))
269269
&& decl->getKind () == Decl::Kind::Var)
270270
{
271271
var_decl = cast<VarDecl> (decl);
@@ -278,7 +278,7 @@ extern "C" CXCursor
278278
clang_getThen (CXCursor C)
279279
{
280280
if (clang_isStatement (C.kind))
281-
if (const Stmt *S = cxcursor::getCursorStmt (C))
281+
if (const Stmt *S = getCursorStmt (C))
282282
switch (S->getStmtClass ())
283283
{
284284
case Stmt::IfStmtClass:
@@ -293,7 +293,7 @@ extern "C" CXCursor
293293
clang_getElse (CXCursor C)
294294
{
295295
if (clang_isStatement (C.kind))
296-
if (const Stmt *S = cxcursor::getCursorStmt (C))
296+
if (const Stmt *S = getCursorStmt (C))
297297
switch (S->getStmtClass ())
298298
{
299299
case Stmt::IfStmtClass:
@@ -308,7 +308,7 @@ extern "C" CXCursor
308308
clang_getSubExpr (CXCursor C)
309309
{
310310
if (clang_isExpression (C.kind))
311-
if (const Stmt *S = cxcursor::getCursorStmt (C))
311+
if (const Stmt *S = getCursorStmt (C))
312312
switch (S->getStmtClass ())
313313
{
314314
case Stmt::UnaryOperatorClass:
@@ -324,7 +324,7 @@ extern "C" CXCursor
324324
clang_getSubStmt (CXCursor C)
325325
{
326326
if (clang_isStatement (C.kind))
327-
if (const Stmt *S = cxcursor::getCursorStmt (C))
327+
if (const Stmt *S = getCursorStmt (C))
328328
switch (S->getStmtClass ())
329329
{
330330
case Stmt::CaseStmtClass:
@@ -342,7 +342,7 @@ extern "C" CXCursor
342342
clang_getRHS (CXCursor C)
343343
{
344344
if (clang_isExpression (C.kind))
345-
if (const Stmt *S = cxcursor::getCursorStmt (C))
345+
if (const Stmt *S = getCursorStmt (C))
346346
switch (S->getStmtClass ())
347347
{
348348
case Stmt::BinaryOperatorClass:
@@ -360,7 +360,7 @@ extern "C" CXCursor
360360
clang_getLHS (CXCursor C)
361361
{
362362
if (clang_isExpression (C.kind))
363-
if (const Stmt *S = cxcursor::getCursorStmt (C))
363+
if (const Stmt *S = getCursorStmt (C))
364364
switch (S->getStmtClass ())
365365
{
366366
case Stmt::BinaryOperatorClass:
@@ -381,7 +381,7 @@ extern "C" CXString
381381
clang_getOpcodeStr (CXCursor C)
382382
{
383383
if (clang_isExpression (C.kind))
384-
if (const Stmt *S = cxcursor::getCursorStmt (C))
384+
if (const Stmt *S = getCursorStmt (C))
385385
switch (S->getStmtClass ())
386386
{
387387
case Stmt::BinaryOperatorClass:
@@ -404,7 +404,7 @@ clang_getOperatorLoc (CXCursor C)
404404
CXTranslationUnit TU = getCursorTU (C);
405405
SourceLocation sloc;
406406
if (clang_isExpression (C.kind))
407-
if (const Stmt *S = cxcursor::getCursorStmt (C))
407+
if (const Stmt *S = getCursorStmt (C))
408408
switch (S->getStmtClass ())
409409
{
410410
case Stmt::BinaryOperatorClass:
@@ -427,7 +427,7 @@ extern "C" CXCursor
427427
clang_unwrap (CXCursor C)
428428
{
429429
if (clang_isExpression (C.kind))
430-
if (const Stmt *S = cxcursor::getCursorStmt (C))
430+
if (const Stmt *S = getCursorStmt (C))
431431
switch (S->getStmtClass ())
432432
{
433433
case Stmt::ParenExprClass:
@@ -458,9 +458,8 @@ extern "C" unsigned
458458
clang_visit (CXCursor parent, CXCursorVisitor visitor,
459459
CXClientData client_data)
460460
{
461-
cxcursor::CursorVisitor CursorVis (getCursorTU (parent), visitor,
462-
client_data,
463-
/*VisitPreprocessorLast=*/false);
461+
CursorVisitor CursorVis (getCursorTU (parent), visitor, client_data,
462+
/*VisitPreprocessorLast=*/false);
464463
return CursorVis.Visit (parent);
465464
}
466465

@@ -471,7 +470,7 @@ extern "C" CXCursor
471470
clang_getParent (CXCursor C)
472471
{
473472
assert (clang_isStatement (C.kind) || clang_isExpression (C.kind));
474-
if (const Stmt *S = cxcursor::getCursorStmt (C))
473+
if (const Stmt *S = getCursorStmt (C))
475474
{
476475
const auto Parents = getContext (C).getParents (*S);
477476
if (Parents.empty ())
@@ -490,26 +489,25 @@ clang_CXRewriter_insertTextAfter (CXRewriter Rew, CXSourceLocation Loc,
490489
const char *Insert)
491490
{
492491
assert (Rew);
493-
clang::Rewriter &R = *reinterpret_cast<clang::Rewriter *> (Rew);
494-
R.InsertTextAfter (clang::cxloc::translateSourceLocation (Loc), Insert);
492+
Rewriter &R = *reinterpret_cast<Rewriter *> (Rew);
493+
R.InsertTextAfter (translateSourceLocation (Loc), Insert);
495494
}
496495

497496
extern "C" void
498497
clang_CXRewriter_insertTextAfterToken (CXRewriter Rew, CXSourceLocation Loc,
499498
const char *Insert)
500499
{
501500
assert (Rew);
502-
clang::Rewriter &R = *reinterpret_cast<clang::Rewriter *> (Rew);
503-
R.InsertTextAfterToken (clang::cxloc::translateSourceLocation (Loc), Insert);
501+
Rewriter &R = *reinterpret_cast<Rewriter *> (Rew);
502+
R.InsertTextAfterToken (translateSourceLocation (Loc), Insert);
504503
}
505504

506505
/* Wrappers around source location analysis functions. */
507506

508507
extern "C" unsigned
509508
clang_isMacroLocation (CXSourceLocation Loc)
510509
{
511-
const clang::SourceLocation SLoc
512-
= clang::cxloc::translateSourceLocation (Loc);
510+
const SourceLocation SLoc = translateSourceLocation (Loc);
513511
return SLoc.isMacroID () ? 1 : 0;
514512
}
515513

@@ -567,7 +565,7 @@ clang_getExpansionEnd (CXTranslationUnit TU, CXSourceLocation Loc)
567565
extern "C" CXTranslationUnit
568566
clang_getCursorTU (CXCursor C)
569567
{
570-
return cxcursor::getCursorTU (C);
568+
return getCursorTU (C);
571569
}
572570

573571
/* Debug helpers. */
@@ -576,5 +574,5 @@ extern "C" void
576574
clang_printLocation (CXTranslationUnit TU, CXSourceLocation Loc)
577575
{
578576
const SourceManager &SM = getSourceManager (TU);
579-
clang::cxloc::translateSourceLocation (Loc).dump (SM);
577+
translateSourceLocation (Loc).dump (SM);
580578
}

0 commit comments

Comments
 (0)