document some invariants.
authorChris Lattner <sabre@nondot.org>
Sat, 25 Jul 2009 18:11:58 +0000 (18:11 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 25 Jul 2009 18:11:58 +0000 (18:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77084 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetAsmInfo.h
lib/Target/TargetAsmInfo.cpp

index fc044b8ab9fbf6997f555b8f15247d39f5d99a52..24d54cc00cd575291669bf27c92ce1e486840416 100644 (file)
@@ -592,9 +592,10 @@ namespace llvm {
       return 0;
     }
     
-    /// SectionForGlobal - This hooks returns proper section name for given
-    /// global with all necessary flags and marks.
-    // FIXME: MOVE TO TARGETLOWERING.
+    /// SectionForGlobal - This method computes the appropriate section to emit
+    /// the specified global variable or function definition.  This should not
+    /// be passed external (or available externally) globals.
+    // FIXME: MOVE TO ASMPRINTER.
     const Section* SectionForGlobal(const GlobalValue *GV) const;
     
     /// getSpecialCasedSectionGlobals - Allow the target to completely override
index 727c584e3a827d437039748e348b8e59e56bb220..dfb274f60845bdc4dd70a5546392a80fcb35152f 100644 (file)
@@ -293,8 +293,13 @@ static SectionKind::Kind SectionKindForGlobal(const GlobalValue *GV,
   }
 }
 
-
+/// SectionForGlobal - This method computes the appropriate section to emit
+/// the specified global variable or function definition.  This should not
+/// be passed external (or available externally) globals.
 const Section *TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
+  assert(!GV->isDeclaration() && !GV->hasAvailableExternallyLinkage() &&
+         "Can only be used for global definitions");
+  
   SectionKind::Kind Kind = SectionKindForGlobal(GV, TM.getRelocationModel());
 
   // Select section name.