Can you add a -E test that verifies that these pragmas roundtrip through the 
pre-processor?


================
Comment at: lib/Lex/Pragma.cpp:1075
@@ +1074,3 @@
+        bool SpecifierValid;
+        StringRef Specifier;
+        if (II) {
----------------
Make sure the SmallString has the same lifetime as Specifier.

================
Comment at: lib/Lex/Pragma.cpp:1091
@@ +1090,3 @@
+            SpecifierValid = (Value >= 1) && (Value <= 4);
+            Specifier = llvm::utostr(Value);
+          } else
----------------
utostr returns a std::string, so this would be a use-after-free. Use 
getSpelling() to get a StringRef that points into the original source code so 
we don't need memory allocation. You'll need to supply a SmallString, but 99% 
of the time it'll be unused.

http://reviews.llvm.org/D9856

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to