r248678 - Use llvm::makeArrayRef. NFC.

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 28 08:09:02 PDT 2015


On Sat, Sep 26, 2015 at 8:44 PM, Craig Topper via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: ctopper
> Date: Sat Sep 26 22:44:08 2015
> New Revision: 248678
>
> URL: http://llvm.org/viewvc/llvm-project?rev=248678&view=rev
> Log:
> Use llvm::makeArrayRef. NFC.
>
> Modified:
>     cfe/trunk/include/clang/AST/Type.h
>     cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
>     cfe/trunk/lib/AST/ASTImporter.cpp
>     cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>     cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
>
> Modified: cfe/trunk/include/clang/AST/Type.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=248678&r1=248677&r2=248678&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/AST/Type.h (original)
> +++ cfe/trunk/include/clang/AST/Type.h Sat Sep 26 22:44:08 2015
> @@ -4635,7 +4635,7 @@ public:
>    /// Retrieve the type arguments of this object type as they were
>    /// written.
>    ArrayRef<QualType> getTypeArgsAsWritten() const {
> -    return ArrayRef<QualType>(getTypeArgStorage(),
> +    return llvm::makeArrayRef(getTypeArgStorage(),
>                                ObjCObjectTypeBits.NumTypeArgs);
>    }
>
>
> Modified: cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h?rev=248678&r1=248677&r2=248678&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h (original)
> +++ cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h Sat Sep 26
> 22:44:08 2015
> @@ -1395,7 +1395,7 @@ public:
>
>    /// Return the list of basic blocks that this terminator can branch to.
>    ArrayRef<BasicBlock*> successors() {
> -    return ArrayRef<BasicBlock*>(&TargetBlock, 1);
> +    return llvm::makeArrayRef(TargetBlock);
>

I think this one might work even without makeArrayRef? (there's an implicit
ctor in ArrayRef<T> from T)


>    }
>
>    template <class V>
> @@ -1445,7 +1445,7 @@ public:
>
>    /// Return the list of basic blocks that this terminator can branch to.
>    ArrayRef<BasicBlock*> successors() {
> -    return ArrayRef<BasicBlock*>(Branches, 2);
> +    return llvm::makeArrayRef(Branches);
>    }
>
>    template <class V>
>
> Modified: cfe/trunk/lib/AST/ASTImporter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=248678&r1=248677&r2=248678&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/AST/ASTImporter.cpp (original)
> +++ cfe/trunk/lib/AST/ASTImporter.cpp Sat Sep 26 22:44:08 2015
> @@ -5329,7 +5329,7 @@ Expr *ASTNodeImporter::VisitCallExpr(Cal
>
>    return new (Importer.getToContext())
>      CallExpr(Importer.getToContext(), ToCallee,
> -             ArrayRef<Expr*>(ToArgs_Copied, NumArgs), T,
> E->getValueKind(),
> +             llvm::makeArrayRef(ToArgs_Copied, NumArgs), T,
> E->getValueKind(),
>               Importer.Import(E->getRParenLoc()));
>  }
>
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=248678&r1=248677&r2=248678&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sat Sep 26 22:44:08 2015
> @@ -2825,7 +2825,7 @@ CodeGenModule::GetAddrOfConstantCFString
>    // String pointer.
>    llvm::Constant *C = nullptr;
>    if (isUTF16) {
> -    ArrayRef<uint16_t> Arr = llvm::makeArrayRef<uint16_t>(
> +    auto Arr = llvm::makeArrayRef(
>          reinterpret_cast<uint16_t *>(const_cast<char
> *>(Entry.first().data())),
>          Entry.first().size() / 2);
>      C = llvm::ConstantDataArray::get(VMContext, Arr);
>
> Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=248678&r1=248677&r2=248678&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
> +++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Sat Sep 26 22:44:08 2015
> @@ -208,7 +208,7 @@ namespace clang {
>        auto &&PartialSpecializations = getPartialSpecializations(Common);
>        ArrayRef<DeclID> LazySpecializations;
>        if (auto *LS = Common->LazySpecializations)
> -        LazySpecializations = ArrayRef<DeclID>(LS + 1, LS + 1 + LS[0]);
> +        LazySpecializations = llvm::makeArrayRef(LS + 1, LS + 1 + LS[0]);
>

Maybe you could use LS[0] as the second arg (for a ptr+length rather than
begin+end construction)?


>
>        // Add a slot to the record for the number of specializations.
>        unsigned I = Record.size();
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150928/9c9be8f1/attachment.html>


More information about the cfe-commits mailing list