From: Alp Toker Date: Wed, 9 Jul 2014 01:37:24 +0000 (+0000) Subject: Simplify warning flag value handling from r206826 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ea0d2389be998469758d929f651c29095d98641;p=platform%2Fupstream%2Fllvm.git Simplify warning flag value handling from r206826 Also give the field it a more appropriate name and improve the docs. llvm-svn: 212584 --- diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 71642a9..4dc8aeb 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -335,13 +335,12 @@ private: /// \brief Second string argument for the delayed diagnostic. std::string DelayedDiagArg2; - /// \brief Flag name value. + /// \brief Optional flag value. /// - /// Some flags accept values. For instance, -Wframe-larger-than or -Rpass. - /// When reporting a diagnostic with those flags, it is useful to also - /// report the value that actually triggered the flag. The content of this - /// string is a value to be emitted after the flag name. - std::string FlagNameValue; + /// Some flags accept values, for instance: -Wframe-larger-than= and + /// -Rpass=. The content of this string is emitted after the flag name + /// and '='. + std::string FlagValue; public: explicit DiagnosticsEngine( @@ -703,11 +702,8 @@ public: /// \brief Clear out the current diagnostic. void Clear() { CurDiagID = ~0U; } - /// \brief Return the value associated to this diagnostic flag. - StringRef getFlagNameValue() const { return StringRef(FlagNameValue); } - - /// \brief Set the value associated to this diagnostic flag. - void setFlagNameValue(StringRef V) { FlagNameValue = V; } + /// \brief Return the value associated with this diagnostic flag. + StringRef getFlagValue() const { return FlagValue; } private: /// \brief Report the delayed diagnostic. @@ -997,7 +993,7 @@ public: DiagObj->DiagFixItHints.push_back(Hint); } - void addFlagValue(StringRef V) const { DiagObj->setFlagNameValue(V); } + void addFlagValue(StringRef V) const { DiagObj->FlagValue = V; } }; struct AddFlagValue { @@ -1108,7 +1104,7 @@ inline DiagnosticBuilder DiagnosticsEngine::Report(SourceLocation Loc, assert(CurDiagID == ~0U && "Multiple diagnostics in flight at once!"); CurDiagLoc = Loc; CurDiagID = DiagID; - FlagNameValue.clear(); + FlagValue.clear(); return DiagnosticBuilder(this); } diff --git a/clang/lib/Frontend/TextDiagnosticPrinter.cpp b/clang/lib/Frontend/TextDiagnosticPrinter.cpp index 1d34abf..6271509 100644 --- a/clang/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/TextDiagnosticPrinter.cpp @@ -83,7 +83,7 @@ static void printDiagnosticOptions(raw_ostream &OS, if (!Opt.empty()) { OS << (Started ? "," : " [") << (Level == DiagnosticsEngine::Remark ? "-R" : "-W") << Opt; - StringRef OptValue = Info.getDiags()->getFlagNameValue(); + StringRef OptValue = Info.getDiags()->getFlagValue(); if (!OptValue.empty()) OS << "=" << OptValue; Started = true;