本文整理汇总了C++中SourceLocation::getRawEncoding方法的典型用法代码示例。如果您正苦于以下问题:C++ SourceLocation::getRawEncoding方法的具体用法?C++ SourceLocation::getRawEncoding怎么用?C++ SourceLocation::getRawEncoding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SourceLocation
的用法示例。
在下文中一共展示了SourceLocation::getRawEncoding方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkAllProps
static void checkAllProps(MigrationContext &MigrateCtx,
std::vector<ObjCPropertyDecl *> &AllProps) {
typedef llvm::TinyPtrVector<ObjCPropertyDecl *> IndivPropsTy;
llvm::DenseMap<unsigned, IndivPropsTy> AtProps;
for (unsigned i = 0, e = AllProps.size(); i != e; ++i) {
ObjCPropertyDecl *PD = AllProps[i];
if (PD->getPropertyAttributesAsWritten() &
(ObjCPropertyDecl::OBJC_PR_assign |
ObjCPropertyDecl::OBJC_PR_readonly)) {
SourceLocation AtLoc = PD->getAtLoc();
if (AtLoc.isInvalid())
continue;
unsigned RawAt = AtLoc.getRawEncoding();
AtProps[RawAt].push_back(PD);
}
}
for (llvm::DenseMap<unsigned, IndivPropsTy>::iterator
I = AtProps.begin(), E = AtProps.end(); I != E; ++I) {
SourceLocation AtLoc = SourceLocation::getFromRawEncoding(I->first);
IndivPropsTy &IndProps = I->second;
checkAllAtProps(MigrateCtx, AtLoc, IndProps);
}
}
示例2: lfort_getLocation
CXSourceLocation lfort_getLocation(CXProgram tu,
CXFile file,
unsigned line,
unsigned column) {
if (!tu || !file)
return lfort_getNullLocation();
bool Logging = ::getenv("LIBLFORT_LOGGING");
ASTUnit *CXXUnit = static_cast<ASTUnit *>(tu->PgmData);
ASTUnit::ConcurrencyCheck Check(*CXXUnit);
const FileEntry *File = static_cast<const FileEntry *>(file);
SourceLocation SLoc = CXXUnit->getLocation(File, line, column);
if (SLoc.isInvalid()) {
if (Logging)
llvm::errs() << "lfort_getLocation(\"" << File->getName()
<< "\", " << line << ", " << column << ") = invalid\n";
return lfort_getNullLocation();
}
if (Logging)
llvm::errs() << "lfort_getLocation(\"" << File->getName()
<< "\", " << line << ", " << column << ") = "
<< SLoc.getRawEncoding() << "\n";
return cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc);
}
示例3: commitInsert
bool EditedSource::commitInsert(SourceLocation OrigLoc,
FileOffset Offs, StringRef text,
bool beforePreviousInsertions) {
if (!canInsertInOffset(OrigLoc, Offs))
return false;
if (text.empty())
return true;
if (SourceMgr.isMacroArgExpansion(OrigLoc)) {
SourceLocation
DefArgLoc = SourceMgr.getImmediateExpansionRange(OrigLoc).first;
SourceLocation
ExpLoc = SourceMgr.getImmediateExpansionRange(DefArgLoc).first;
ExpansionToArgMap[ExpLoc.getRawEncoding()] = DefArgLoc;
}
FileEdit &FA = FileEdits[Offs];
if (FA.Text.empty()) {
FA.Text = copyString(text);
return true;
}
if (beforePreviousInsertions)
FA.Text = copyString(Twine(text) + FA.Text);
else
FA.Text = copyString(Twine(FA.Text) + text);
return true;
}
示例4: MakeCursorTypeRef
CXCursor cxcursor::MakeCursorTypeRef(TypeDecl *Type, SourceLocation Loc,
ASTUnit *TU) {
assert(Type && TU && "Invalid arguments!");
void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding());
CXCursor C = { CXCursor_TypeRef, { Type, RawLoc, TU } };
return C;
}
示例5: canInsertInOffset
bool EditedSource::canInsertInOffset(SourceLocation OrigLoc, FileOffset Offs) {
FileEditsTy::iterator FA = getActionForOffset(Offs);
if (FA != FileEdits.end()) {
if (FA->first != Offs)
return false; // position has been removed.
}
if (SourceMgr.isMacroArgExpansion(OrigLoc)) {
IdentifierInfo *II;
SourceLocation ExpLoc;
deconstructMacroArgLoc(OrigLoc, ExpLoc, II);
auto I = ExpansionToArgMap.find(ExpLoc.getRawEncoding());
if (I != ExpansionToArgMap.end() &&
std::find(I->second.begin(), I->second.end(), II) != I->second.end()) {
// Trying to write in a macro argument input that has already been
// written by a previous commit for another expansion of the same macro
// argument name. For example:
//
// \code
// #define MAC(x) ((x)+(x))
// MAC(a)
// \endcode
//
// A commit modified the macro argument 'a' due to the first '(x)'
// expansion inside the macro definition, and a subsequent commit tried
// to modify 'a' again for the second '(x)' expansion. The edits of the
// second commit will be rejected.
return false;
}
}
return true;
}
示例6: SaveSourceLocation
/// Save a source location to the given buffer.
static void SaveSourceLocation(SourceLocation Loc, char *&Buffer,
unsigned &BufferSize, unsigned &BufferCapacity) {
unsigned Raw = Loc.getRawEncoding();
Append(reinterpret_cast<char *>(&Raw),
reinterpret_cast<char *>(&Raw) + sizeof(unsigned),
Buffer, BufferSize, BufferCapacity);
}
示例7: MakeCursorObjCSuperClassRef
CXCursor cxcursor::MakeCursorObjCSuperClassRef(ObjCInterfaceDecl *Super,
SourceLocation Loc,
CXTranslationUnit TU) {
assert(Super && TU && "Invalid arguments!");
void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding());
CXCursor C = { CXCursor_ObjCSuperClassRef, { Super, RawLoc, TU } };
return C;
}
示例8: MakeCursorObjCProtocolRef
CXCursor cxcursor::MakeCursorObjCProtocolRef(const ObjCProtocolDecl *Proto,
SourceLocation Loc,
CXTranslationUnit TU) {
assert(Proto && TU && "Invalid arguments!");
void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding());
CXCursor C = { CXCursor_ObjCProtocolRef, 0, { (void*)Proto, RawLoc, TU } };
return C;
}
示例9: MakeCursorLabelRef
CXCursor cxcursor::MakeCursorLabelRef(LabelStmt *Label, SourceLocation Loc,
CXTranslationUnit TU) {
assert(Label && TU && "Invalid arguments!");
void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding());
CXCursor C = { CXCursor_LabelRef, { Label, RawLoc, TU } };
return C;
}
示例10: MakeCursorTemplateRef
CXCursor cxcursor::MakeCursorTemplateRef(TemplateDecl *Template,
SourceLocation Loc,
CXTranslationUnit TU) {
assert(Template && TU && "Invalid arguments!");
void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding());
CXCursor C = { CXCursor_TemplateRef, { Template, RawLoc, TU } };
return C;
}
示例11: MakeCursorObjCProtocolRef
CXCursor cxcursor::MakeCursorObjCProtocolRef(ObjCProtocolDecl *Super,
SourceLocation Loc,
ASTUnit *TU) {
assert(Super && TU && "Invalid arguments!");
void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding());
CXCursor C = { CXCursor_ObjCProtocolRef, { Super, RawLoc, TU } };
return C;
}
示例12: MakeCursorObjCClassRef
CXCursor cxcursor::MakeCursorObjCClassRef(ObjCInterfaceDecl *Class,
SourceLocation Loc,
ASTUnit *TU) {
assert(Class && TU && "Invalid arguments!");
void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding());
CXCursor C = { CXCursor_ObjCClassRef, { Class, RawLoc, TU } };
return C;
}
示例13: MakeCursorMemberRef
CXCursor cxcursor::MakeCursorMemberRef(FieldDecl *Field, SourceLocation Loc,
CXTranslationUnit TU) {
assert(Field && TU && "Invalid arguments!");
void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding());
CXCursor C = { CXCursor_MemberRef, { Field, RawLoc, TU } };
return C;
}
示例14: MakeCursorNamespaceRef
CXCursor cxcursor::MakeCursorNamespaceRef(NamedDecl *NS, SourceLocation Loc,
CXTranslationUnit TU) {
assert(NS && (isa<NamespaceDecl>(NS) || isa<NamespaceAliasDecl>(NS)) && TU &&
"Invalid arguments!");
void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding());
CXCursor C = { CXCursor_NamespaceRef, { NS, RawLoc, TU } };
return C;
}
示例15: getIndexLoc
CXIdxLoc CXIndexDataConsumer::getIndexLoc(SourceLocation Loc) const {
CXIdxLoc idxLoc = { {nullptr, nullptr}, 0 };
if (Loc.isInvalid())
return idxLoc;
idxLoc.ptr_data[0] = const_cast<CXIndexDataConsumer *>(this);
idxLoc.int_data = Loc.getRawEncoding();
return idxLoc;
}