]> granicus.if.org Git - clang/commitdiff
PlistSupport.h: avoid gcc 'defined but not used' warning
authorAlp Toker <alp@nuanti.com>
Sun, 6 Jul 2014 07:59:14 +0000 (07:59 +0000)
committerAlp Toker <alp@nuanti.com>
Sun, 6 Jul 2014 07:59:14 +0000 (07:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212396 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/PlistSupport.h
lib/ARCMigrate/PlistReporter.cpp
lib/StaticAnalyzer/Core/PlistDiagnostics.cpp

index d5a347b33f9dea20ff3ec52c4a5bf10e6792c5df..be1304ef7973fab5597a36574d8196cd05bb5b92 100644 (file)
@@ -19,12 +19,6 @@ namespace clang {
 namespace markup {
 typedef llvm::DenseMap<FileID, unsigned> FIDMap;
 
-static const char *PlistHeader =
-    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
-    "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" "
-    "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
-    "<plist version=\"1.0\">\n";
-
 static inline void AddFID(FIDMap &FIDs, SmallVectorImpl<FileID> &V,
                           const SourceManager &SM, SourceLocation L) {
   FileID FID = SM.getFileID(SM.getExpansionLoc(L));
@@ -49,6 +43,15 @@ static inline raw_ostream &Indent(raw_ostream &o, const unsigned indent) {
   return o;
 }
 
+static inline raw_ostream &EmitPlistHeader(raw_ostream &o) {
+  static const char *PlistHeader =
+      "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+      "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" "
+      "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
+      "<plist version=\"1.0\">\n";
+  return o << PlistHeader;
+}
+
 static inline raw_ostream &EmitInteger(raw_ostream &o, int64_t value) {
   o << "<integer>";
   o << value;
index 09cb50512c2ff4d6959635ab66a53d268fbab0e3..6b34ef0c2b9e3e6dcd8060aca3b62dd4c91a973a 100644 (file)
@@ -63,8 +63,7 @@ void arcmt::writeARCDiagsToPlist(const std::string &outPath,
     return;
   }
 
-  // Write the plist header.
-  o << PlistHeader;
+  EmitPlistHeader(o);
 
   // Write the root object: a <dict> containing...
   //  - "files", an <array> mapping from FIDs to file names
index ff2735db26d2b1c007db144270bacca7e864f0b7..ba3ad2ef16c5e522bd4f2ac4c8aca363cbd93001 100644 (file)
@@ -345,8 +345,7 @@ void PlistDiagnostics::FlushDiagnosticsImpl(
     return;
   }
 
-  // Write the plist header.
-  o << PlistHeader;
+  EmitPlistHeader(o);
 
   // Write the root object: a <dict> containing...
   //  - "clang_version", the string representation of clang version