Avoid using the 'index' namespace as scope.

This should fix the bogus ambiguous reference errors reported by gcc 4.2.1 that the FreeBSD bot is using.

llvm-svn: 188850
This commit is contained in:
Argyrios Kyrtzidis 2013-08-21 00:49:25 +00:00
parent 707f601fa5
commit 5234b49854
2 changed files with 28 additions and 24 deletions

View File

@ -16,6 +16,7 @@
#include "llvm/Support/raw_ostream.h"
using namespace clang;
using namespace clang::index;
//===----------------------------------------------------------------------===//
// USR generation.
@ -40,7 +41,7 @@ public:
generatedLoc(false)
{
// Add the USR space prefix.
Out << index::getUSRSpacePrefix();
Out << getUSRSpacePrefix();
}
bool ignoreResults() const { return IgnoreResults; }
@ -92,29 +93,29 @@ public:
/// Generate a USR for an Objective-C class.
void GenObjCClass(StringRef cls) {
index::generateUSRForObjCClass(cls, Out);
generateUSRForObjCClass(cls, Out);
}
/// Generate a USR for an Objective-C class category.
void GenObjCCategory(StringRef cls, StringRef cat) {
index::generateUSRForObjCCategory(cls, cat, Out);
generateUSRForObjCCategory(cls, cat, Out);
}
/// Generate a USR fragment for an Objective-C instance variable. The
/// complete USR can be created by concatenating the USR for the
/// encompassing class with this USR fragment.
void GenObjCIvar(StringRef ivar) {
index::generateUSRForObjCIvar(ivar, Out);
generateUSRForObjCIvar(ivar, Out);
}
/// Generate a USR fragment for an Objective-C method.
void GenObjCMethod(StringRef sel, bool isInstanceMethod) {
index::generateUSRForObjCMethod(sel, isInstanceMethod, Out);
generateUSRForObjCMethod(sel, isInstanceMethod, Out);
}
/// Generate a USR fragment for an Objective-C property.
void GenObjCProperty(StringRef prop) {
index::generateUSRForObjCProperty(prop, Out);
generateUSRForObjCProperty(prop, Out);
}
/// Generate a USR for an Objective-C protocol.
void GenObjCProtocol(StringRef prot) {
index::generateUSRForObjCProtocol(prot, Out);
generateUSRForObjCProtocol(prot, Out);
}
void VisitType(QualType T);
@ -763,33 +764,35 @@ void USRGenerator::VisitTemplateArgument(const TemplateArgument &Arg) {
// USR generation functions.
//===----------------------------------------------------------------------===//
void index::generateUSRForObjCClass(StringRef Cls, raw_ostream &OS) {
void clang::index::generateUSRForObjCClass(StringRef Cls, raw_ostream &OS) {
OS << "objc(cs)" << Cls;
}
void index::generateUSRForObjCCategory(StringRef Cls, StringRef Cat,
raw_ostream &OS) {
void clang::index::generateUSRForObjCCategory(StringRef Cls, StringRef Cat,
raw_ostream &OS) {
OS << "objc(cy)" << Cls << '@' << Cat;
}
void index::generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS) {
void clang::index::generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS) {
OS << '@' << Ivar;
}
void index::generateUSRForObjCMethod(StringRef Sel, bool IsInstanceMethod,
raw_ostream &OS) {
void clang::index::generateUSRForObjCMethod(StringRef Sel,
bool IsInstanceMethod,
raw_ostream &OS) {
OS << (IsInstanceMethod ? "(im)" : "(cm)") << Sel;
}
void index::generateUSRForObjCProperty(StringRef Prop, raw_ostream &OS) {
void clang::index::generateUSRForObjCProperty(StringRef Prop, raw_ostream &OS) {
OS << "(py)" << Prop;
}
void index::generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS) {
void clang::index::generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS) {
OS << "objc(pl)" << Prot;
}
bool index::generateUSRForDecl(const Decl *D, SmallVectorImpl<char> &Buf) {
bool clang::index::generateUSRForDecl(const Decl *D,
SmallVectorImpl<char> &Buf) {
// Don't generate USRs for things with invalid locations.
if (!D || D->getLocStart().isInvalid())
return true;

View File

@ -20,6 +20,7 @@
#include "llvm/Support/raw_ostream.h"
using namespace clang;
using namespace clang::index;
//===----------------------------------------------------------------------===//
// API hooks.
@ -30,7 +31,7 @@ static inline StringRef extractUSRSuffix(StringRef s) {
}
bool cxcursor::getDeclCursorUSR(const Decl *D, SmallVectorImpl<char> &Buf) {
return index::generateUSRForDecl(D, Buf);
return generateUSRForDecl(D, Buf);
}
extern "C" {
@ -72,7 +73,7 @@ CXString clang_getCursorUSR(CXCursor C) {
if (!buf)
return cxstring::createEmpty();
buf->Data += index::getUSRSpacePrefix();
buf->Data += getUSRSpacePrefix();
buf->Data += "macro@";
buf->Data +=
cxcursor::getCursorMacroDefinition(C)->getName()->getNameStart();
@ -87,7 +88,7 @@ CXString clang_constructUSR_ObjCIvar(const char *name, CXString classUSR) {
SmallString<128> Buf(index::getUSRSpacePrefix());
llvm::raw_svector_ostream OS(Buf);
OS << extractUSRSuffix(clang_getCString(classUSR));
index::generateUSRForObjCIvar(name, OS);
generateUSRForObjCIvar(name, OS);
return cxstring::createDup(OS.str());
}
@ -97,21 +98,21 @@ CXString clang_constructUSR_ObjCMethod(const char *name,
SmallString<128> Buf(index::getUSRSpacePrefix());
llvm::raw_svector_ostream OS(Buf);
OS << extractUSRSuffix(clang_getCString(classUSR));
index::generateUSRForObjCMethod(name, isInstanceMethod, OS);
generateUSRForObjCMethod(name, isInstanceMethod, OS);
return cxstring::createDup(OS.str());
}
CXString clang_constructUSR_ObjCClass(const char *name) {
SmallString<128> Buf(index::getUSRSpacePrefix());
llvm::raw_svector_ostream OS(Buf);
index::generateUSRForObjCClass(name, OS);
generateUSRForObjCClass(name, OS);
return cxstring::createDup(OS.str());
}
CXString clang_constructUSR_ObjCProtocol(const char *name) {
SmallString<128> Buf(index::getUSRSpacePrefix());
llvm::raw_svector_ostream OS(Buf);
index::generateUSRForObjCProtocol(name, OS);
generateUSRForObjCProtocol(name, OS);
return cxstring::createDup(OS.str());
}
@ -119,7 +120,7 @@ CXString clang_constructUSR_ObjCCategory(const char *class_name,
const char *category_name) {
SmallString<128> Buf(index::getUSRSpacePrefix());
llvm::raw_svector_ostream OS(Buf);
index::generateUSRForObjCCategory(class_name, category_name, OS);
generateUSRForObjCCategory(class_name, category_name, OS);
return cxstring::createDup(OS.str());
}
@ -128,7 +129,7 @@ CXString clang_constructUSR_ObjCProperty(const char *property,
SmallString<128> Buf(index::getUSRSpacePrefix());
llvm::raw_svector_ostream OS(Buf);
OS << extractUSRSuffix(clang_getCString(classUSR));
index::generateUSRForObjCProperty(property, OS);
generateUSRForObjCProperty(property, OS);
return cxstring::createDup(OS.str());
}