Given Decl::isUsed() a flag indicating when to consider the "used"
attribute as part of the calculation. Sema::MarkDeclReferenced(), and
a few other places, want only to consider the "used" bit to determine,
e.g, whether to perform template instantiation. Fixes a linkage issue
with Boost.Serialization.

llvm-svn: 106252
diff --git a/clang/test/SemaTemplate/instantiate-function-2.cpp b/clang/test/SemaTemplate/instantiate-function-2.cpp
index afca358..ebc0ef3 100644
--- a/clang/test/SemaTemplate/instantiate-function-2.cpp
+++ b/clang/test/SemaTemplate/instantiate-function-2.cpp
@@ -20,3 +20,14 @@
 
   template void f<int>();
 }
+
+namespace UsedAttr {
+  template<typename T>
+  void __attribute__((used)) foo() {
+    T *x = 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}}
+  }
+
+  void bar() {
+    foo<int>(); // expected-note{{instantiation of}}
+  }
+}