diff options
| author | Brad King <brad.king@kitware.com> | 2020-02-13 19:02:34 (GMT) |
|---|---|---|
| committer | Brad King <brad.king@kitware.com> | 2020-02-13 19:02:34 (GMT) |
| commit | 4db44f1e26222ae9ad2aa0d41ee5ccd5a46c1d91 (patch) | |
| tree | 4086c01ffd7c1e54f79d9550ebe8eb18bf9194be /src | |
| parent | 626588b829e79f1eca72f9898c735b6bdc6cbd29 (diff) | |
| download | CastXML-4db44f1e26222ae9ad2aa0d41ee5ccd5a46c1d91.zip CastXML-4db44f1e26222ae9ad2aa0d41ee5ccd5a46c1d91.tar.gz CastXML-4db44f1e26222ae9ad2aa0d41ee5ccd5a46c1d91.tar.bz2 | |
Port to LLVM/Clang Git master as of 2020-02-13 (6c73246179)
The `llvm::StringRef` type now requires explicit conversion to
`std::string`. Such explicit conversions still work with older
versions of LLVM/Clang too.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Detect.cxx | 2 | ||||
| -rw-r--r-- | src/Output.cxx | 11 | ||||
| -rw-r--r-- | src/Utils.cxx | 3 |
3 files changed, 12 insertions, 4 deletions
diff --git a/src/Detect.cxx b/src/Detect.cxx index d1ad8ec..60ecb58 100644 --- a/src/Detect.cxx +++ b/src/Detect.cxx @@ -186,7 +186,7 @@ static bool detectCC_MSVC(const char* const* argBeg, const char* const* argEnd, includes_ref.split(includes, ";", -1, false); for (llvm::StringRef i : includes) { if (!i.empty()) { - std::string inc = i; + std::string inc(i); std::replace(inc.begin(), inc.end(), '\\', '/'); opts.Includes.push_back(inc); } diff --git a/src/Output.cxx b/src/Output.cxx index 430ab1c..061be43 100644 --- a/src/Output.cxx +++ b/src/Output.cxx @@ -19,6 +19,7 @@ #include "Utils.h" #include "clang/AST/ASTContext.h" +#include "clang/AST/Attr.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclFriend.h" @@ -397,6 +398,7 @@ class ASTVisitor : public ASTVisitorBase /** Print a name="..." attribute. */ void PrintNameAttribute(std::string const& name); + void PrintNameAttribute(llvm::StringRef name); /** Print a mangled="..." attribute. */ void PrintMangledAttribute(clang::NamedDecl const* d); @@ -1078,7 +1080,7 @@ void ASTVisitor::ProcessFileQueue() this->OS << " <File" " id=\"f" << this->FileNodes[f] << "\"" - " name=\"" << encodeXML(f->getName()) << "\"" + " name=\"" << encodeXML(std::string(f->getName())) << "\"" "/>\n" ; /* clang-format on */ @@ -1190,6 +1192,11 @@ void ASTVisitor::PrintNameAttribute(std::string const& name) this->OS << " name=\"" << encodeXML(n) << "\""; } +void ASTVisitor::PrintNameAttribute(llvm::StringRef name) +{ + this->PrintNameAttribute(std::string(name)); +} + void ASTVisitor::PrintMangledAttribute(clang::NamedDecl const* d) { // Compute the mangled name. @@ -1714,7 +1721,7 @@ void ASTVisitor::OutputTranslationUnitDecl(clang::TranslationUnitDecl const* d, { this->OS << " <Namespace"; this->PrintIdAttribute(dn); - this->PrintNameAttribute("::"); + this->PrintNameAttribute(std::string("::")); if (dn->Complete) { this->PrintMembersAttribute(d); } diff --git a/src/Utils.cxx b/src/Utils.cxx index 27e99e5..7b41195 100644 --- a/src/Utils.cxx +++ b/src/Utils.cxx @@ -78,7 +78,8 @@ bool findResourceDir(const char* argv0, std::ostream& error) llvm::sys::path::remove_filename(dir2); // Build tree has // <build>/bin[/<config>]/castxml - if (!tryBuildDir(dir.str()) && !tryBuildDir(dir2.str())) { + if (!tryBuildDir(std::string(dir.str())) && + !tryBuildDir(std::string(dir2.str()))) { error << "Unable to locate resources for " << exe << "\n"; return false; } |
