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/Support/CommandLine.h b/linux-x64/clang/include/llvm/Support/CommandLine.h
index a78020f..3cc2c3c 100644
--- a/linux-x64/clang/include/llvm/Support/CommandLine.h
+++ b/linux-x64/clang/include/llvm/Support/CommandLine.h
@@ -66,7 +66,8 @@
bool ParseCommandLineOptions(int argc, const char *const *argv,
StringRef Overview = "",
raw_ostream *Errs = nullptr,
- const char *EnvVar = nullptr);
+ const char *EnvVar = nullptr,
+ bool LongOptionsUseDoubleDash = false);
//===----------------------------------------------------------------------===//
// ParseEnvironmentOptions - Environment variable option processing alternate
@@ -158,23 +159,27 @@
// AlwaysPrefix - Only allow the behavior enabled by the Prefix flag and reject
// the Option=Value form.
//
-// Grouping - With this option enabled, multiple letter options are allowed to
-// bunch together with only a single hyphen for the whole group. This allows
-// emulation of the behavior that ls uses for example: ls -la === ls -l -a
-//
enum FormattingFlags {
NormalFormatting = 0x00, // Nothing special
Positional = 0x01, // Is a positional argument, no '-' required
Prefix = 0x02, // Can this option directly prefix its value?
- AlwaysPrefix = 0x03, // Can this option only directly prefix its value?
- Grouping = 0x04 // Can this option group with other options?
+ AlwaysPrefix = 0x03 // Can this option only directly prefix its value?
};
enum MiscFlags { // Miscellaneous flags to adjust argument
CommaSeparated = 0x01, // Should this cl::list split between commas?
PositionalEatsArgs = 0x02, // Should this positional cl::list eat -args?
- Sink = 0x04 // Should this cl::list eat all unknown options?
+ Sink = 0x04, // Should this cl::list eat all unknown options?
+
+ // Grouping - Can this option group with other options?
+ // If this is enabled, multiple letter options are allowed to bunch together
+ // with only a single hyphen for the whole group. This allows emulation
+ // of the behavior that ls uses for example: ls -la === ls -l -a
+ Grouping = 0x08,
+
+ // Default option
+ DefaultOption = 0x10
};
//===----------------------------------------------------------------------===//
@@ -260,26 +265,27 @@
// Out of line virtual function to provide home for the class.
virtual void anchor();
- int NumOccurrences = 0; // The number of times specified
+ uint16_t NumOccurrences; // The number of times specified
// Occurrences, HiddenFlag, and Formatting are all enum types but to avoid
// problems with signed enums in bitfields.
- unsigned Occurrences : 3; // enum NumOccurrencesFlag
+ uint16_t Occurrences : 3; // enum NumOccurrencesFlag
// not using the enum type for 'Value' because zero is an implementation
// detail representing the non-value
- unsigned Value : 2;
- unsigned HiddenFlag : 2; // enum OptionHidden
- unsigned Formatting : 3; // enum FormattingFlags
- unsigned Misc : 3;
- unsigned Position = 0; // Position of last occurrence of the option
- unsigned AdditionalVals = 0; // Greater than 0 for multi-valued option.
+ uint16_t Value : 2;
+ uint16_t HiddenFlag : 2; // enum OptionHidden
+ uint16_t Formatting : 2; // enum FormattingFlags
+ uint16_t Misc : 5;
+ uint16_t FullyInitialized : 1; // Has addArgument been called?
+ uint16_t Position; // Position of last occurrence of the option
+ uint16_t AdditionalVals; // Greater than 0 for multi-valued option.
public:
StringRef ArgStr; // The argument string itself (ex: "help", "o")
StringRef HelpStr; // The descriptive text message for -help
StringRef ValueStr; // String describing what the value of this option is
- OptionCategory *Category; // The Category this option belongs to
- SmallPtrSet<SubCommand *, 4> Subs; // The subcommands this option belongs to.
- bool FullyInitialized = false; // Has addArgument been called?
+ SmallVector<OptionCategory *, 1>
+ Categories; // The Categories this option belongs to
+ SmallPtrSet<SubCommand *, 1> Subs; // The subcommands this option belongs to.
inline enum NumOccurrencesFlag getNumOccurrencesFlag() const {
return (enum NumOccurrencesFlag)Occurrences;
@@ -305,6 +311,7 @@
bool hasArgStr() const { return !ArgStr.empty(); }
bool isPositional() const { return getFormattingFlag() == cl::Positional; }
bool isSink() const { return getMiscFlags() & cl::Sink; }
+ bool isDefaultOption() const { return getMiscFlags() & cl::DefaultOption; }
bool isConsumeAfter() const {
return getNumOccurrencesFlag() == cl::ConsumeAfter;
@@ -328,14 +335,17 @@
void setFormattingFlag(enum FormattingFlags V) { Formatting = V; }
void setMiscFlag(enum MiscFlags M) { Misc |= M; }
void setPosition(unsigned pos) { Position = pos; }
- void setCategory(OptionCategory &C) { Category = &C; }
+ void addCategory(OptionCategory &C);
void addSubCommand(SubCommand &S) { Subs.insert(&S); }
protected:
explicit Option(enum NumOccurrencesFlag OccurrencesFlag,
enum OptionHidden Hidden)
- : Occurrences(OccurrencesFlag), Value(0), HiddenFlag(Hidden),
- Formatting(NormalFormatting), Misc(0), Category(&GeneralCategory) {}
+ : NumOccurrences(0), Occurrences(OccurrencesFlag), Value(0),
+ HiddenFlag(Hidden), Formatting(NormalFormatting), Misc(0),
+ FullyInitialized(false), Position(0), AdditionalVals(0) {
+ Categories.push_back(&GeneralCategory);
+ }
inline void setNumAdditionalVals(unsigned n) { AdditionalVals = n; }
@@ -381,7 +391,7 @@
}
inline int getNumOccurrences() const { return NumOccurrences; }
- inline void reset() { NumOccurrences = 0; }
+ void reset();
};
//===----------------------------------------------------------------------===//
@@ -446,7 +456,7 @@
cat(OptionCategory &c) : Category(c) {}
- template <class Opt> void apply(Opt &O) const { O.setCategory(Category); }
+ template <class Opt> void apply(Opt &O) const { O.addCategory(Category); }
};
// sub - Specify the subcommand that this option belongs to.
@@ -822,6 +832,8 @@
public:
basic_parser_impl(Option &) {}
+ virtual ~basic_parser_impl() {}
+
enum ValueExpected getValueExpectedFlagDefault() const {
return ValueRequired;
}
@@ -849,8 +861,6 @@
virtual void anchor();
protected:
- ~basic_parser_impl() = default;
-
// A helper for basic_parser::printOptionDiff.
void printOptionName(const Option &O, size_t GlobalWidth) const;
};
@@ -864,15 +874,12 @@
using OptVal = OptionValue<DataType>;
basic_parser(Option &O) : basic_parser_impl(O) {}
-
-protected:
- ~basic_parser() = default;
};
//--------------------------------------------------
// parser<bool>
//
-template <> class parser<bool> final : public basic_parser<bool> {
+template <> class parser<bool> : public basic_parser<bool> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -899,8 +906,7 @@
//--------------------------------------------------
// parser<boolOrDefault>
-template <>
-class parser<boolOrDefault> final : public basic_parser<boolOrDefault> {
+template <> class parser<boolOrDefault> : public basic_parser<boolOrDefault> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -926,7 +932,7 @@
//--------------------------------------------------
// parser<int>
//
-template <> class parser<int> final : public basic_parser<int> {
+template <> class parser<int> : public basic_parser<int> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -948,7 +954,7 @@
//--------------------------------------------------
// parser<unsigned>
//
-template <> class parser<unsigned> final : public basic_parser<unsigned> {
+template <> class parser<unsigned> : public basic_parser<unsigned> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -968,11 +974,33 @@
extern template class basic_parser<unsigned>;
//--------------------------------------------------
+// parser<unsigned long>
+//
+template <>
+class parser<unsigned long> final : public basic_parser<unsigned long> {
+public:
+ parser(Option &O) : basic_parser(O) {}
+
+ // parse - Return true on error.
+ bool parse(Option &O, StringRef ArgName, StringRef Arg, unsigned long &Val);
+
+ // getValueName - Overload in subclass to provide a better default value.
+ StringRef getValueName() const override { return "ulong"; }
+
+ void printOptionDiff(const Option &O, unsigned long V, OptVal Default,
+ size_t GlobalWidth) const;
+
+ // An out-of-line virtual method to provide a 'home' for this class.
+ void anchor() override;
+};
+
+extern template class basic_parser<unsigned long>;
+
+//--------------------------------------------------
// parser<unsigned long long>
//
template <>
-class parser<unsigned long long> final
- : public basic_parser<unsigned long long> {
+class parser<unsigned long long> : public basic_parser<unsigned long long> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -981,7 +1009,7 @@
unsigned long long &Val);
// getValueName - Overload in subclass to provide a better default value.
- StringRef getValueName() const override { return "uint"; }
+ StringRef getValueName() const override { return "ulong"; }
void printOptionDiff(const Option &O, unsigned long long V, OptVal Default,
size_t GlobalWidth) const;
@@ -995,7 +1023,7 @@
//--------------------------------------------------
// parser<double>
//
-template <> class parser<double> final : public basic_parser<double> {
+template <> class parser<double> : public basic_parser<double> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1017,7 +1045,7 @@
//--------------------------------------------------
// parser<float>
//
-template <> class parser<float> final : public basic_parser<float> {
+template <> class parser<float> : public basic_parser<float> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1039,7 +1067,7 @@
//--------------------------------------------------
// parser<std::string>
//
-template <> class parser<std::string> final : public basic_parser<std::string> {
+template <> class parser<std::string> : public basic_parser<std::string> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1064,7 +1092,7 @@
//--------------------------------------------------
// parser<char>
//
-template <> class parser<char> final : public basic_parser<char> {
+template <> class parser<char> : public basic_parser<char> {
public:
parser(Option &O) : basic_parser(O) {}
@@ -1177,7 +1205,11 @@
};
template <> struct applicator<MiscFlags> {
- static void opt(MiscFlags MF, Option &O) { O.setMiscFlag(MF); }
+ static void opt(MiscFlags MF, Option &O) {
+ assert((MF != Grouping || O.ArgStr.size() == 1) &&
+ "cl::Grouping can only apply to single charater Options.");
+ O.setMiscFlag(MF);
+ }
};
// apply method - Apply modifiers to an option in a type safe way.
@@ -1397,6 +1429,8 @@
public:
list_storage() = default;
+ void clear() {}
+
bool setLocation(Option &O, StorageClass &L) {
if (Location)
return O.error("cl::location(x) specified more than once!");
@@ -1448,6 +1482,10 @@
reference operator[](size_type pos) { return Storage[pos]; }
const_reference operator[](size_type pos) const { return Storage[pos]; }
+ void clear() {
+ Storage.clear();
+ }
+
iterator erase(const_iterator pos) { return Storage.erase(pos); }
iterator erase(const_iterator first, const_iterator last) {
return Storage.erase(first, last);
@@ -1525,7 +1563,10 @@
void printOptionValue(size_t /*GlobalWidth*/, bool /*Force*/) const override {
}
- void setDefault() override {}
+ void setDefault() override {
+ Positions.clear();
+ list_storage<DataType, StorageClass>::clear();
+ }
void done() {
addArgument();
@@ -1731,7 +1772,10 @@
error("cl::alias must have argument name specified!");
if (!AliasFor)
error("cl::alias must have an cl::aliasopt(option) specified!");
+ if (!Subs.empty())
+ error("cl::alias must not have cl::sub(), aliased option's cl::sub() will be used!");
Subs = AliasFor->Subs;
+ Categories = AliasFor->Categories;
addArgument();
}