[llvm] r187843 - Move somewhat messy conditional out of line.

Eric Christopher echristo at gmail.com
Tue Aug 6 18:18:24 PDT 2013


Author: echristo
Date: Tue Aug  6 20:18:24 2013
New Revision: 187843

URL: http://llvm.org/viewvc/llvm-project?rev=187843&view=rev
Log:
Move somewhat messy conditional out of line.
No functional change.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=187843&r1=187842&r2=187843&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Aug  6 20:18:24 2013
@@ -1092,6 +1092,14 @@ static bool isContainedInAnonNamespace(D
   return false;
 }
 
+/// Test if the current CU language is C++ and that we have
+/// a named type that is not contained in an anonymous namespace.
+static bool shouldAddODRHash(CompileUnit *CU, DIE *Die) {
+  return (CU->getLanguage() == dwarf::DW_LANG_C_plus_plus &&
+          getDIEStringAttr(Die, dwarf::DW_AT_name) != "" &&
+          !isContainedInAnonNamespace(Die));
+}
+
 void DwarfDebug::finalizeModuleInfo() {
   // Collect info for variables that were optimized out.
   collectDeadVariables();
@@ -1113,13 +1121,9 @@ void DwarfDebug::finalizeModuleInfo() {
   for (unsigned i = 0, e = TypeUnits.size(); i != e; ++i) {
     MD5 Hash;
     DIE *Die = TypeUnits[i];
-    // If we've requested ODR hashes, the current language is C++, the type is
-    // named, and the type isn't located inside a C++ anonymous namespace then
-    // add the ODR signature attribute now.
-    if (GenerateODRHash &&
-        CUMap.begin()->second->getLanguage() == dwarf::DW_LANG_C_plus_plus &&
-        (getDIEStringAttr(Die, dwarf::DW_AT_name) != "") &&
-        !isContainedInAnonNamespace(Die))
+    // If we've requested ODR hashes and it's applicable for an ODR hash then
+    // add the ODR signature now.
+    if (GenerateODRHash && shouldAddODRHash(CUMap.begin()->second, Die))
       addDIEODRSignature(Hash, CUMap.begin()->second, Die);
   }
 





More information about the llvm-commits mailing list