Update prebuilt Clang to r365631c1 from Android.
The version we had was segfaulting.
Bug: 132420445
Change-Id: Icb45a6fe0b4e2166f7895e669df1157cec9fb4e0
diff --git a/linux-x64/clang/include/llvm/Option/Arg.h b/linux-x64/clang/include/llvm/Option/Arg.h
index d3623a0..22e2bcf 100644
--- a/linux-x64/clang/include/llvm/Option/Arg.h
+++ b/linux-x64/clang/include/llvm/Option/Arg.h
@@ -58,6 +58,11 @@
/// The argument values, as C strings.
SmallVector<const char *, 2> Values;
+ /// If this arg was created through an alias, this is the original alias arg.
+ /// For example, *this might be "-finput-charset=utf-8" and Alias might
+ /// point to an arg representing "/source-charset:utf-8".
+ std::unique_ptr<Arg> Alias;
+
public:
Arg(const Option Opt, StringRef Spelling, unsigned Index,
const Arg *BaseArg = nullptr);
@@ -70,7 +75,15 @@
~Arg();
const Option &getOption() const { return Opt; }
+
+ /// Returns the used prefix and name of the option:
+ /// For `--foo=bar`, returns `--foo=`.
+ /// This is often the wrong function to call:
+ /// * Use `getValue()` to get `bar`.
+ /// * Use `getAsString()` to get a string suitable for printing an Arg in
+ /// a diagnostic.
StringRef getSpelling() const { return Spelling; }
+
unsigned getIndex() const { return Index; }
/// Return the base argument which generated this arg.
@@ -82,6 +95,11 @@
}
void setBaseArg(const Arg *BaseArg) { this->BaseArg = BaseArg; }
+ /// Args are converted to their unaliased form. For args that originally
+ /// came from an alias, this returns the alias the arg was produced from.
+ const Arg* getAlias() const { return Alias.get(); }
+ void setAlias(std::unique_ptr<Arg> Alias) { this->Alias = std::move(Alias); }
+
bool getOwnsValues() const { return OwnsValues; }
void setOwnsValues(bool Value) const { OwnsValues = Value; }
@@ -119,8 +137,10 @@
void print(raw_ostream &O) const;
void dump() const;
- /// Return a formatted version of the argument and
- /// its values, for debugging and diagnostics.
+ /// Return a formatted version of the argument and its values, for
+ /// diagnostics. Since this is for diagnostics, if this Arg was produced
+ /// through an alias, this returns the string representation of the alias
+ /// that the user wrote.
std::string getAsString(const ArgList &Args) const;
};