[cfe-commits] r81234 - /cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Chris Lattner sabre at nondot.org
Tue Sep 8 11:10:11 PDT 2009


Author: lattner
Date: Tue Sep  8 13:10:11 2009
New Revision: 81234

URL: http://llvm.org/viewvc/llvm-project?rev=81234&view=rev
Log:
reduce indentation.

Modified:
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=81234&r1=81233&r2=81234&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Sep  8 13:10:11 2009
@@ -1887,23 +1887,22 @@
 /// DeclApplyPragmaWeak - A declaration (maybe definition) needs #pragma weak
 /// applied to it, possibly with an alias.
 void Sema::DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, WeakInfo &W) {
-  if (!W.getUsed()) { // only do this once
-    W.setUsed(true);
-    if (W.getAlias()) { // clone decl, impersonate __attribute(weak,alias(...))
-      IdentifierInfo *NDId = ND->getIdentifier();
-      NamedDecl *NewD = DeclClonePragmaWeak(ND, W.getAlias());
-      NewD->addAttr(::new (Context) AliasAttr(NDId->getName()));
-      NewD->addAttr(::new (Context) WeakAttr());
-      WeakTopLevelDecl.push_back(NewD);
-      // FIXME: "hideous" code from Sema::LazilyCreateBuiltin
-      // to insert Decl at TU scope, sorry.
-      DeclContext *SavedContext = CurContext;
-      CurContext = Context.getTranslationUnitDecl();
-      PushOnScopeChains(NewD, S);
-      CurContext = SavedContext;
-    } else { // just add weak to existing
-      ND->addAttr(::new (Context) WeakAttr());
-    }
+  if (W.getUsed()) return; // only do this once
+  W.setUsed(true);
+  if (W.getAlias()) { // clone decl, impersonate __attribute(weak,alias(...))
+    IdentifierInfo *NDId = ND->getIdentifier();
+    NamedDecl *NewD = DeclClonePragmaWeak(ND, W.getAlias());
+    NewD->addAttr(::new (Context) AliasAttr(NDId->getName()));
+    NewD->addAttr(::new (Context) WeakAttr());
+    WeakTopLevelDecl.push_back(NewD);
+    // FIXME: "hideous" code from Sema::LazilyCreateBuiltin
+    // to insert Decl at TU scope, sorry.
+    DeclContext *SavedContext = CurContext;
+    CurContext = Context.getTranslationUnitDecl();
+    PushOnScopeChains(NewD, S);
+    CurContext = SavedContext;
+  } else { // just add weak to existing
+    ND->addAttr(::new (Context) WeakAttr());
   }
 }
 





More information about the cfe-commits mailing list