[PATCH] D24954: [Driver] Disable OpenSUSE rules for OpenSUSE/SLES 10 and older

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 24 10:53:44 PDT 2016


bruno added inline comments.


================
Comment at: lib/Driver/ToolChains.cpp:3937
+    StringRef Data = File.get()->getBuffer();
+    SmallVector<StringRef, 16> Lines;
+    Data.split(Lines, "\n");
----------------
This file usually has 5-6 lines, can you use 8 instead?


================
Comment at: lib/Driver/ToolChains.cpp:3940
+    for (const StringRef& Line : Lines) {
+      std::pair<StringRef, StringRef> SplitLine = Line.split('=');
+      int Version;
----------------
You probably want to explicitly skip the lines you're not interested to make it a bit more clear. AFAIU, the VERSION is usually on the second line. How about:

  if (Line.first.trim() != "VERSION")
    continue;
  <... then split and parse the value>


https://reviews.llvm.org/D24954





More information about the cfe-commits mailing list