r262691 - [MIPS] initFeatureMap() to handle empty string argument

Bhushan D. Attarde via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 3 22:56:30 PST 2016

Author: bhushan.attarde
Date: Fri Mar  4 00:56:29 2016
New Revision: 262691

URL: http://llvm.org/viewvc/llvm-project?rev=262691&view=rev
[MIPS] initFeatureMap() to handle empty string argument
    This patch sets CPU string to its default value when it is not supplied by caller.
    Reviewers: vkalintiris, dsanders
    Subscribers: mohit.bhakkad, sagar, jaydeep, cfe-commits
    Differential Revision: http://reviews.llvm.org/D16139


Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=262691&r1=262690&r2=262691&view=diff
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Mar  4 00:56:29 2016
@@ -6689,6 +6689,8 @@ public:
   initFeatureMap(llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags,
                  StringRef CPU,
                  const std::vector<std::string> &FeaturesVec) const override {
+    if (CPU.empty())
+      CPU = getCPU();
     if (CPU == "octeon")
       Features["mips64r2"] = Features["cnmips"] = true;

More information about the cfe-commits mailing list