[clang] 6890f30 - [AST][Introspection] Fix args not being set.

Nathan James via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 14 16:19:51 PDT 2021


Author: Nathan James
Date: 2021-04-15T00:19:40+01:00
New Revision: 6890f302f587ca4f6712be728bd9302da597fe0c

URL: https://github.com/llvm/llvm-project/commit/6890f302f587ca4f6712be728bd9302da597fe0c
DIFF: https://github.com/llvm/llvm-project/commit/6890f302f587ca4f6712be728bd9302da597fe0c.diff

LOG: [AST][Introspection] Fix args not being set.

This field isn't set in the constructor.
Tweak its accessor to return an ArrayRef.

Added: 
    

Modified: 
    clang/include/clang/Tooling/NodeIntrospection.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Tooling/NodeIntrospection.h b/clang/include/clang/Tooling/NodeIntrospection.h
index 70bfeba8c4f9..406e17f1351a 100644
--- a/clang/include/clang/Tooling/NodeIntrospection.h
+++ b/clang/include/clang/Tooling/NodeIntrospection.h
@@ -37,15 +37,15 @@ class LocationCall : public llvm::ThreadSafeRefCountedBase<LocationCall> {
   enum LocationCallFlags { NoFlags, ReturnsPointer, IsCast };
   LocationCall(SharedLocationCall on, std::string name,
                LocationCallFlags flags = NoFlags)
-      : m_flags(flags), m_on(std::move(on)), m_name(name) {}
+      : m_flags(flags), m_on(std::move(on)), m_name(std::move(name)) {}
   LocationCall(SharedLocationCall on, std::string name,
-               std::vector<std::string> const &args,
-               LocationCallFlags flags = NoFlags)
-      : m_flags(flags), m_on(std::move(on)), m_name(name) {}
+               std::vector<std::string> args, LocationCallFlags flags = NoFlags)
+      : m_flags(flags), m_on(std::move(on)), m_name(std::move(name)),
+        m_args(std::move(args)) {}
 
   LocationCall *on() const { return m_on.get(); }
   StringRef name() const { return m_name; }
-  std::vector<std::string> const &args() const { return m_args; }
+  ArrayRef<std::string> args() const { return m_args; }
   bool returnsPointer() const { return m_flags & ReturnsPointer; }
   bool isCast() const { return m_flags & IsCast; }
 


        


More information about the cfe-commits mailing list